home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ANews 1
/
AnewsCD01.iso
/
Indispensables
/
Compression
/
xad
/
Developer
/
Include
/
ASM
/
libraries
/
xadmaster.i
Wrap
Text File
|
1999-08-09
|
19KB
|
479 lines
IFND LIBRARIES_XADMASTER_I
LIBRARIES_XADMASTER_I SET 1
*
* $VER: xadmaster.i 2.2 (17.07.1999)
* xadmaster.library defines and structures
*
* Copyright © 1998-1999 by Dirk Stöcker
* All Rights Reserved.
*
IFND EXEC_LIBRARIES_I
INCLUDE "exec/libraries.i"
ENDC
IFND UTILITY_TAGITEM_I
INCLUDE "utility/tagitem.i"
ENDC
* NOTE: The structures do not have size labels, as they have no fixed
* size. You always need to call xadAllocObject to get them
*************************************************************************
* *
* library base structure *
* *
*************************************************************************
STRUCTURE xadMasterBase,LIB_SIZE
APTR xmb_SysBase
APTR xmb_DOSBase
APTR xmb_UtilityBase
ULONG xmb_RecogSize * read only
*************************************************************************
* *
* tag-function call flags *
* *
*************************************************************************
* input tags for xadGetInfo, only one can be specified per call
XAD_INSIZE EQU (TAG_USER+001) * input data size
XAD_INFILENAME EQU (TAG_USER+002)
XAD_INFILEHANDLE EQU (TAG_USER+003)
XAD_INMEMORY EQU (TAG_USER+004)
XAD_INHOOK EQU (TAG_USER+005)
XAD_INSPLITTED EQU (TAG_USER+006) * (V2)
* output tags, only one can be specified per call, xadXXXXUnArc
XAD_OUTSIZE EQU (TAG_USER+010) * output data size
XAD_OUTFILENAME EQU (TAG_USER+011)
XAD_OUTFILEHANDLE EQU (TAG_USER+012)
XAD_OUTMEMORY EQU (TAG_USER+013)
XAD_OUTHOOK EQU (TAG_USER+014)
XAD_OUTDEVICE EQU (TAG_USER+015) * for disk archives only
* object allocation tags for xadAllocObjectA
XAD_OBJNAMESIZE EQU (TAG_USER+020) * XADOBJ_FILEINFO, size of needed name space
XAD_OBJCOMMENTSIZE EQU (TAG_USER+021) * XADOBJ_FILEINFO, size of needed comment space
XAD_OBJPRIVINFOSIZE EQU (TAG_USER+022) * XADOBJ_FILEINFO & XADOBJ_DISKINFO, self use size
XAD_OBJBLOCKENTRIES EQU (TAG_USER+023) * XADOBJ_DISKINFO, number of needed entries
* tags for xadGetInfo, xadFileUnArc and xadDiskUnArc
XAD_NOEXTERN EQU (TAG_USER+050) * do not use extern clients
XAD_PASSWORD EQU (TAG_USER+051) * password when needed
XAD_ENTRYNUMBER EQU (TAG_USER+052) * number of wanted entry
XAD_PROGRESSHOOK EQU (TAG_USER+053) * the progress hook
XAD_OVERWRITE EQU (TAG_USER+054) * overwrite file ?
XAD_MAKEDIRECTORY EQU (TAG_USER+055) * create directory tree
XAD_IGNOREGEOMETRY EQU (TAG_USER+056) * ignore drive geometry ?
XAD_LOWCYLINDER EQU (TAG_USER+057) * lowest cylinder
XAD_HIGHCYLINDER EQU (TAG_USER+058) * highest cylinder
XAD_VERIFY EQU (TAG_USER+059) * verify for disk hook
* input tags for xadConvertDates, only one can be passed
XAD_DATEUNIX EQU (TAG_USER+070) * unix date variable
XAD_DATEAMIGA EQU (TAG_USER+071) * amiga date variable
XAD_DATEDATESTAMP EQU (TAG_USER+072) * struct DateStamp
XAD_DATEXADDATE EQU (TAG_USER+073) * struct xadDate
XAD_DATECLOCKDATA EQU (TAG_USER+074) * struct ClockData
XAD_DATECURRENTTIME EQU (TAG_USER+075) * input is system time
XAD_DATEMSDOS EQU (TAG_USER+076) * MS-DOS packed format (V2)
* output tags, there can be specified multiple tags for one call
XAD_GETDATEUNIX EQU (TAG_USER+080) * unix date variable
XAD_GETDATEAMIGA EQU (TAG_USER+081) * amiga date variable
XAD_GETDATEDATESTAMP EQU (TAG_USER+082) * struct DateStamp
XAD_GETDATEXADDATE EQU (TAG_USER+083) * struct xadDate
XAD_GETDATECLOCKDATA EQU (TAG_USER+084) * struct ClockData
XAD_GETDATEMSDOS EQU (TAG_USER+086) * MS-DOS packed format (V2)
* following tags need locale.library to be installed
XAD_MAKEGMTDATE EQU (TAG_USER+090) * make local to GMT time
XAD_MAKELOCALDATE EQU (TAG_USER+091) * make GMT to local time
*************************************************************************
* *
* objects for xadAllocObjectA *
* *
*************************************************************************
XADOBJ_ARCHIVEINFO EQU $0001 * struct xadArchiveInfo
XADOBJ_FILEINFO EQU $0002 * struct xadFileInfo
XADOBJ_DISKINFO EQU $0003 * struct xadDiskInfo
XADOBJ_HOOKPARAM EQU $0004 * struct HookParam
XADOBJ_DEVICEINFO EQU $0005 * struct xadDeviceInfo
XADOBJ_PROGRESSINFO EQU $0006 * struct xadProgressInfo
XADOBJ_TEXTINFO EQU $0007 * struct xadTextInfo
XADOBJ_SPLITFILE EQU $0008 * struct xadSplitFile
* result type of xadAllocVec
XADOBJ_MEMBLOCK EQu $0100 * memory of requested size and type
*************************************************************************
* *
* modes for xadCalcCRC126 and xadCalcCRC32 *
* *
*************************************************************************
XADCRC16_ID1 EQU $A001
XADCRC32_ID1 EQU $EDB88320
*************************************************************************
* *
* hook related stuff *
* *
*************************************************************************
XADHC_READ EQU 1 * read data into buffer
XADHC_WRITE EQU 2 * write buffer data to file/memory
XADHC_SEEK EQU 3 * seek in file
XADHC_INIT EQU 4 * initialize the hook
XADHC_FREE EQU 5 * end up hook work, free stuff
XADHC_ABORT EQU 6 * an error occured, delete partial stuff
XADHC_FULLSIZE EQU 7 * complete input size is needed
STRUCTURE xadHookParam,0
ULONG xhp_Command
ULONG xhp_CommandData
APTR xhp_BufferPtr
LONG xhp_BufferSize
LONG xhp_DataPos * current seek position
APTR xhp_PrivatePtr
* xadHookAccess commands
XADAC_READ EQU 10 * get data
XADAC_WRITE EQU 11 * write data
XADAC_COPY EQU 12 * copy input to ouput
XADAC_INPUTSEEK EQU 13 * seek in input file
XADAC_OUTPUTSEEK EQU 14 * seek in output file
*************************************************************************
* *
* 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.
STRUCTURE xadDate,0
ULONG xd_Micros * values 0 to 999999
LONG xd_Year * values 1 to 2147483648
UBYTE xd_Month * values 1 to 12
UBYTE xd_WeekDay * values 1 to 7
UBYTE xd_Day * values 1 to 31
UBYTE xd_Hour * values 0 to 23
UBYTE xd_Minute * values 0 to 60
UBYTE xd_Second * values 0 to 60
LABEL xadDate_SIZE
XADDAY_MONDAY EQU 1 * monday is the first day and
XADDAY_TUESDAY EQU 2
XADDAY_WEDNESDAY EQU 3
XADDAY_THURSDAY EQU 4
XADDAY_FRIDAY EQU 5
XADDAY_SATURDAY EQU 6
XADDAY_SUNDAY EQU 7 * sunday the last day of a week
STRUCTURE xadDeviceInfo,0 * for XAD_OUTDEVICE tag
APTR xdi_DeviceName * name of device
ULONG xdi_Unit * unit of device
APTR xdi_DOSName * instead of Device+Unit, dos name without ':'
STRUCTURE xadSplitFile,0 * for XAD_INSPLITTED
APTR xsf_Next
ULONG xsf_Type * XAD_INFILENAME, XAD_INFILEHANDLE, XAD_INMEMORY, XAD_INHOOK
ULONG xsf_Size * necessary for XAD_INMEMORY, useful for others
ULONG xsf_Data * FileName, Filehandle, Hookpointer or Memory
*************************************************************************
* *
* information structures *
* *
*************************************************************************
STRUCTURE xadArchiveInfo,0
APTR xai_Client * pointer to unarchiving client
APTR xai_PrivateClient * private client data
APTR xai_Password * password for crypted archives
ULONG xai_Flags * read only XADAIF_ flags
ULONG xai_LowCyl * lowest cylinder to unarchive
ULONG xai_HighCyl * highest cylinder to unarchive
ULONG xai_InPos * input position, read only
ULONG xai_InSize * input size, read only
ULONG xai_OutPos * output position, read only
ULONG xai_OutSize * output file size, read only
APTR xai_FileInfo * data pointer for file arcs
APTR xai_DiskInfo * data pointer for disk arcs
APTR xai_CurFile * data pointer for current file arc
APTR xai_CurDisk * data pointer for current disk arc
LONG xai_LastError * last error, when XADAIF_FILECORRUPT (V2)
APTR xai_MultiVolume * array of start offsets from parts (V2)
* 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
* is useful. All the other stuff is private and should not be accessed!
BITDEF XADAI,CRYPTED,0 * archive entries are encrypted
BITDEF XADAI,FILECORRUPT,1 * file is corrupt, but valid entries are in the list
BITDEF XADAI,FILEARCHIVE,2 * unarchive file entry
BITDEF XADAI,DISKARCHIVE,3 * unarchive disk entry
BITDEF XADAI,OVERWRITE,4 * overwrite the file
BITDEF XADAI,MAKEDIRECTORY,5 * create directory when missing
BITDEF XADAI,IGNOREGEOMETRY,6 * ignore drive geometry
BITDEF XADAI,VERIFY,7 * verify is turned on for disk hook
STRUCTURE xadFileInfo,0
APTR xfi_Next
ULONG xfi_EntryNumber * number of entry, starts with 1
APTR xfi_EntryInfo * additional archiver text
APTR xfi_PrivateInfo * client private, see XAD_OBJPRIVINFOSIZE
ULONG xfi_Flags * see XADFIF_xxx defines
APTR xfi_FileName * see XAD_OBJNAMESIZE tag
APTR xfi_Comment * see XAD_OBJCOMMENTSIZE tag
ULONG xfi_Protection * OS 3 bits (including multiuser)
ULONG xfi_OwnerUID * user ID
ULONG xfi_OwnerGID * group ID
APTR xfi_UserName * user name
APTR xfi_GroupName * group name
ULONG xfi_Size * size of this file
ULONG xfi_GroupCrSize * crunched size of group
ULONG xfi_CrunchSize * crunched size
APTR xfi_LinkName * name and path of link
STRUCT xfi_Date,xadDate_SIZE
BITDEF XADFI,CRYPTED,0 * entry is crypted
BITDEF XADFI,DIRECTORY,1 * entry is a directory
BITDEF XADFI,LINK,2 * entry is a link
BITDEF XADFI,INFOTEXT,3 * file is an information text
BITDEF XADFI,GROUPED,4 * file is in a crunch group
BITDEF XADFI,ENDOFGROUP,5 * crunch group ends here
BITDEF XADFI,NODATE,6 * no date supported, current date is set
* 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.
STRUCT xadTextInfo,0
APTR xti_Next
ULONG xti_Size * maybe zero - no text - e.g. when crypted
APTR xti_Text * and there is no password in xadGetInfo()
ULONG xti_Flags * see XADTIF_xxx defines
BITDEF XADTI,CRYPTED,0 * entry is empty, as data was crypted
BITDEF XADTI,BANNER,1 * text is a banner
BITDEF XADTI,FILEDIZ,2 * text is a file description
STRUCT xadDiskInfo,0
APTR xdi_Next
ULONG xdi_EntryNumber * number of entry, starts with 1
APTR xdi_EntryInfo * additional archiver text
APTR xdi_PrivateInfo * client private, see XAD_OBJPRIVINFOSIZE
ULONG xdi_Flags * see XADDIF_xxx defines
ULONG xdi_SectorSize
ULONG xdi_TotalSectors * see devices/trackdisk.h
ULONG xdi_Cylinders * to find out what these
ULONG xdi_CylSectors * fields mean, they are equal
ULONG xdi_Heads * to struct DriveGeometry
ULONG xdi_TrackSectors
ULONG xdi_LowCyl * lowest cylinder stored
ULONG xdi_HighCyl * highest cylinder stored
ULONG xdi_BlockInfoSize * number of BlockInfo entries
APTR xdi_BlockInfo * see XADBIF_xxx defines and XAD_OBJBLOCKENTRIES tag
APTR xdi_TextInfo * linked list with info texts
* 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.
BITDEF XADDI,CRYPTED,0 * entry is crypted
* 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.
BITDEF XADDI,GUESSCYLINDERS,7 * cylinder number is guessed
BITDEF XADDI,GUESSCYLSECTORS,8 * cylsectors is guessed
BITDEF XADDI,GUESSHEADS,9 * number of heads is guessed
BITDEF XADDI,GUESSTRACKSECTORS,10 * tracksectors is guessed
BITDEF XADDI,GUESSLOWCYL,11 * lowcyl is guessed
BITDEF XADDI,GUESSHIGHCYL,12 * highcyl is guessed
* If it is impossible to set some of the fields, you not 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.
BITDEF XADDI,NOCYLINDERS,15 * cylinder number is not set
BITDEF XADDI,NOCYLSECTORS,16 * cylsectors is not set
BITDEF XADDI,NOHEADS,17 * number of heads is not set
BITDEF XADDI,NOTRACKSECTORS,18 * tracksectors is not set
BITDEF XADDI,NOLOWCYL,19 * lowcyl is not set
BITDEF XADDI,NOHIGHCYL,20 * highcyl is not set
* defines for BlockInfo
BITDEF XADBI,CLEARED,0 * this block was cleared for archiving
BITDEF XADBI,UNUSED,1 * this block was not archived
*************************************************************************
* *
* progress report stuff *
* *
*************************************************************************
STRUCTURE xadProgressInfo,0
ULONG xpi_Mode * work modus
APTR xpi_Client * the client doing the work
APTR xpi_DiskInfo * current diskinfo, for disks
APTR xpi_FileInfo * current info for files
ULONG xpi_CurrentSize * current filesize
ULONG xpi_LowCyl * for disks only
ULONG xpi_HighCyl * for disks only
ULONG xpi_Status * see XADPIF flags
LONG xpi_Error * any of the error codes
APTR xpi_FileName * name of file to overwrite (V2)
APTR xpi_NewName * new name buffer, passed by hook (V2)
* 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
XADPMODE_ASK EQU 1
XADPMODE_PROGRESS EQU 2
XADPMODE_END EQU 3
XADPMODE_ERROR EQU 4
* flags for progress hook and ProgressInfo status field
BITDEF XADPI,OVERWRITE,0 * overwrite the file
BITDEF XADPI,MAKEDIRECTORY,1 * create the directory
BITDEF XADPI,IGNOREGEOMETRY,2 * ignore drive geometry
BITDEF XADPI,RENAME,10 * rename the file (V2)
BITDEF XADPI,OK,16 * all ok, proceed
BITDEF XADPI,SKIP,17 * skip file
*************************************************************************
* *
* errors *
* *
*************************************************************************
XADERR_OK EQU $0000 * no error
XADERR_UNKNOWN EQU $0001 * unknown error
XADERR_INPUT EQU $0002 * input data buffers border exceeded
XADERR_OUTPUT EQU $0003 * output data buffers border exceeded
XADERR_BADPARAMS EQU $0004 * function called with illegal parameters
XADERR_NOMEMORY EQU $0005 * not enough memory available
XADERR_ILLEGALDATA EQU $0006 * data is corrupted
XADERR_NOTSUPPORTED EQU $0007 * command is not supported
XADERR_RESOURCE EQU $0008 * required resource missing
XADERR_DECRUNCH EQU $0009 * error on decrunching
XADERR_FILETYPE EQU $000A * unknown file type
XADERR_OPENFILE EQU $000B * opening file failed
XADERR_SKIP EQU $000C * file, disk has been skipped
XADERR_BREAK EQU $000D * user break in progress hook
XADERR_FILEEXISTS EQU $000E * file already exists
XADERR_PASSWORD EQU $000F * missing or wrong password
XADERR_MAKEDIR EQU $0010 * could not create directory
XADERR_CHECKSUM EQU $0011 * wrong checksum
XADERR_VERIFY EQU $0012 * verify failed (disk hook)
XADERR_GEOMETRY EQU $0013 * wrong drive geometry
XADERR_DATAFORMAT EQU $0014 * unknown data format
*************************************************************************
* *
* client related stuff *
* *
*************************************************************************
STRUCTURE xadForeman,0
ULONG xfm_Security * should be XADFOREMAN_SECURITY
ULONG xfm_ID * must be XADFOREMAN_ID
UWORD xfm_Version * set to XADFOREMAN_VERSION
UWORD xfm_Reserved
APTR xfm_VersString * pointer to $VER: string
APTR xfm_FirstClient * pointer to first client
LABEL xadForman_SIZE
XADFOREMAN_SECURITY EQU $70FF4E75 * MOVEQ #-1,D0 and RTS
XADFOREMAN_ID EQU $58414446 * 'XADF' identification ID
XADFOREMAN_VERSION EQU 1
STRUCTURE xadClient,0
APTR xc_Next
UWORD xc_Version * set to XADCLIENT_VERSION
UWORD xc_MasterVersion
UWORD xc_ClientVersion
UWORD xc_ClientRevision
ULONG xc_RecogSize * needed size to recog the type
ULONG xc_Flags * see XADCF_xxx defines
ULONG xc_Identifier * ID of internal clients
APTR xc_ArchiverName
APTR xc_RecogData
APTR xc_GetInfo
APTR xc_UnArchive
APTR xc_Free
LABEL xadClient_SIZE
* xc_RecogData returns 1 when recognized and 0 when not, all the others
* return 0 when ok and XADERR values on error. xc_FinishUnArc has no
* return value.
* 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))
XADCLIENT_VERSION EQU 1
BITDEF XADC,FILEARCHIVER,0 * archiver is a file archiver
BITDEF XADC,DISKARCHIVER,1 * archiver is a disk archiver
BITDEF XADC,EXTERN,2 * external client, set by xadmaster
BITDEF XADC,FREETEXTINFO,28 * master frees xadTextInfo structures (V2)
BITDEF XADC,FREETEXTINFOTEXT,29 * master frees xadTExtInfo text block (V2)
BITDEF XADC,FREEFILEINFO,30 * master frees xadFileInfo structures (V2)
BITDEF XADC,FREEDISKINFO,31 * master frees xadDiskInfo structures (V2)
*************************************************************************
* *
* 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 EQU 1000
XADCID_SUPERDUPER3 EQU 1001
XADCID_XDISK EQU 1002
XADCID_PACKDEV EQU 1003
XADCID_ZOOM EQU 1004
XADCID_ZOOM5 EQU 1005
* file archivers start with 5000
XADCID_TAR EQU 5000
XADCID_SDSSFX EQU 5001
XADCID_LZX EQU 5002
XADCID_MXMSIMPLEARC EQU 5003
XADCID_LHPAK EQU 5004
XADCID_AMIGAPLUSUNPACK EQU 5005
XADCID_AMIPACK EQU 5006
XADCID_LHA EQU 5007
XADCID_LHASFX EQU 5008
* mixed archivers start with 9000
XADCID_DMS EQU 9000
XADCID_DMSSFX EQU 9001
ENDC ; LIBRARIES_XADMASTER_I