(*#-- BEGIN AutoRevision header, please do NOT edit! * * $VER: XpkMasterD.def 1.1 (27.01.1998) * Auth: T.B. (tonyiommi@geocities.com) * * Desc: XPKMaster Defs for xpk 4.25 (27.01.1998) by SDI * Reqs: AMIGA OS 2.0 * Lang: MODULA-2 * Comp: Cyclone © by M. Timmermans * *-- END AutoRevision header --*) DEFINITION MODULE XpkMasterD; (*$ Implementation- *) FROM SYSTEM IMPORT ADDRESS; FROM UtilityD IMPORT tagUser; TYPE StrPtr = ADDRESS; (* --- The packing/unpacking tags --- *) (* (TRUE) or (FALSE) mean the default value given by xpkmaster.library *) CONST tagBase=tagUser + ORD('X')*256 + ORD('P'); (* Caller must supply ONE of these to tell Xpk#?ack where to get data from *) inName =tagBase+1; (* Process an entire named file *) inFH =tagBase+2; (* File handle - start from current position. If packing partial file, must also supply InLen *) inBuf =tagBase+3; (* Single unblocked memory buffer. Must also supply InLen *) inHook =tagBase+4; (* Call custom Hook to read data. Must also supply InLen, when hook cannot do! (not for XPK unpacking) *) (* Caller must supply ONE of these to tell Xpk#?ackFile where to send data to *) outName =tagBase+10H; (* Write (or overwrite) this data file *) outFH =tagBase+11H; (* File handle - write from current position on *) outBuf =tagBase+12H; (* Unblocked buffer - must also supply OutBufLen *) getOutBuf =tagBase+13H; (* Master allocates OutBuf - ti_Data points to buf ptr *) outHook =tagBase+14H; (* Callback Hook to get output buffers *) (* --- Other tags for Pack/Unpack --- *) inLen =tagBase+20H; (* Length of data in input buffer *) outBufLen =tagBase+21H; (* Length of output buffer *) getOutLen =tagBase+22H; (* ti_Data points to long to receive OutLen *) getOutBufLen =tagBase+23H; (* ti_Data points to long to receive OutBufLen *) password =tagBase+24H; (* Password for de/encoding *) getError =tagBase+25H; (* ti_Data points to buffer for error message *) outMemType =tagBase+26H; (* Memory type for output buffer *) passThru =tagBase+27H; (* Bool: Pass through unrecognized formats on unpack *) stepDown =tagBase+28H; (* Bool: Step down pack method if necessary *) chunkHook =tagBase+29H; (* Call this Hook between chunks *) packMethod =tagBase+2AH; (* Do a FindMethod before packing *) chunkSize =tagBase+2BH; (* Chunk size to try to pack with *) packMode =tagBase+2CH; (* Packing mode for sublib to use *) noClobber =tagBase+2DH; (* Don't overwrite existing files *) ignore =tagBase+2EH; (* Skip this tag *) taskPri =tagBase+2FH; (* Change priority for (un)packing *) fileName =tagBase+30H; (* File name for progress report *) shortError =tagBase+31H; (* !!! obsolete !!! *) packersQuery =tagBase+32H; (* Query available packers *) packerQuery =tagBase+33H; (* Query properties of a packer *) modeQuery =tagBase+34H; (* Query properties of packmode *) lossyOK =tagBase+35H; (* Lossy packing permitted? (FALSE) *) noCRC =tagBase+36H; (* Ignore checksum *) (* tags added for xfdmaster support (version 4 revision 25) *) key16 =tagBase+37H; (* 16 bit key (unpack only) *) key32 =tagBase+38H; (* 32 bit key (unpack only) *) (* preference depending tags added for version 4 - their default value may depend on preferences, see xpk/xpkprefs.h for more info *) useXfdMaster =tagBase+40H; (* Use xfdmaster.library (FALSE) *) useExternals =tagBase+41H; (* Use packers in extern dir (TRUE) *) passRequest =tagBase+42H; (* automatic password req.? (FALSE) *) preferences =tagBase+43H; (* use prefs semaphore ? (TRUE) *) chunkReport =tagBase+44H; (* automatic chunk report ? (FALSE) *) (* tags tagBase+0x50) to tagBase+0x69) are for XpkPassRequest -- see below *) margin =256; (* Safety margin for output buffer *) (* --- The hook function interface --- *) (* Message passed to InHook and OutHook as the ParamPacket *) TYPE IOMsgPtr=POINTER TO IOMsg; IOMsg=RECORD type :LONGINT; (* Read/Write/Alloc/Free/Abort*) ptr :ADDRESS; (* The mem area to read from/write to *) size :LONGINT; (* The size of the read/write *) ioError, (* The IoErr() that occurred *) reserved, (* Reserved for future use *) private1, (* Hook specific, will be set to 0 by *) private2, (* master library before first use *) private3, private4 :LONGINT; END; (* The values for XpkIoMsg->Type *) CONST ioRead =1; ioWrite =2; ioFree =3; ioAbort =4; ioGetbuf =5; ioSeek =6; ioTotSize=7; (* --- The progress report interface --- *) (* Passed to ChunkHook as the ParamPacket *) TYPE ProgressPtr=POINTER TO Progress; Progress=RECORD type :LONGINT; (* Type of report: start/cont/end/abort *) packerName, (* Brief name of packer being used *) packerLongName, (* Descriptive name of packer being used *) activity, (* Packing/unpacking message *) fileName :StrPtr; (* Name of file being processed, if available *) cCur, (* Amount of packed data already processed *) uCur, (* Amount of unpacked data already processed *) uLen, (* Amount of unpacked data in file *) cf, (* Compression factor so far *) done, (* Percentage done already *) speed :LONGINT; (* Bytes per second, from beginning of stream *) reserved :ARRAY[1..8] OF LONGINT; (* For future use *) END; CONST progStart =1; progMID =2; progEnd =3; (* --- The file info block --- *) TYPE FibPtr = POINTER TO Fib; Fib=RECORD type, (* Unpacked, packed, archive? *) uLen, (* Uncompressed length *) cLen, (* Compressed length *) nLen, (* Next chunk len *) uCur, (* Uncompressed bytes so far *) cCur, (* Compressed bytes so far *) id :LONGINT; (* 4 letter ID of packer *) packer :ARRAY[0..4] OF CHAR; (* 4 letter name of packer *) subVersion, (* Required sublib version *) masVersion :INTEGER; (* Required masterlib version *) flags :LONGINT; (* Password *) head :ARRAY[0..15] OF SHORTCARD; (* First 16 bytes of orig. file *) ratio :LONGINT; (* Compression ratio *) reserved :ARRAY[0..7] OF LONGINT; (* For future use *) END; CONST typeUnpacked =0; (* Not packed *) typePacked =1; (* Packed file *) typeArchive =2; (* Archive *) flagsPassword = 1; (* Password needed *) flagsNoSeek = 2; (* Chunks are dependent *) flagsNonSTD = 4; (* Nonstandard file format *) (* defines added for xfdmaster support (version 4 revision 25) *) flagsKey16 = 8; (* 16 bit key - for decrunching *) flagsKey32 =16; (* 32 bit key - for decrunching *) (* --- The error messages --- *) errOK =0; errNoFunc =-1; (* This function not implemented *) errNoFiles =-2; (* No files allowed for this function *) errIoErrIn =-3; (* Input error happened *) errIoErrOut =-4; (* Output error happened *) errChecksum =-5; (* Check sum test failed *) errVersion =-6; (* Packed file's version newer than lib *) errNoMem =-7; (* Out of memory *) errLibInUse =-8; (* For not-reentrant libraries *) errWrongForm =-9; (* Was not packed with this library *) errSmallBuf =-10; (* Output buffer too small *) errLargeBuf =-11; (* Input buffer too large *) errWrongMode =-12; (* This packing mode not supported *) errNeedPassWD =-13; (* Password needed for decoding *) errCorruptPKD =-14; (* Packed file is corrupt *) errMissingLib =-15; (* Required library is missing *) errBadParams =-16; (* Caller's TagList was screwed up *) errExpansion =-17; (* Would have caused data expansion *) errNoMethod =-18; (* Cannot find requested method *) errAborted =-19; (* Operation aborted by user *) errTruncated =-20; (* Input file is truncated *) errWrongCPU =-21; (* Better CPU required for this library *) errPacked =-22; (* Data are already XPacked *) errNotPacked =-23; (* Data not packed *) errFileExists =-24; (* File already exists *) errOldMastlib =-25; (* Master library too old *) errOldSUBLIB =-26; (* Sub library too old *) errNoCrypt =-27; (* Cannot encrypt *) errNoInfo =-28; (* Can't get info on that packer *) errLossy =-29; (* This compression method is lossy *) errNoHardware =-30; (* Compression hardware required *) errBadHardware=-31; (* Compression hardware failed *) errWrongPW =-32; (* Password was wrong *) errUnknown =-33; (* unknown error cause *) errReqTimeOut =-34; (* password request reached time out *) errMsgSize =80; (* Maximum size of an error message *) (* --- The XpkQuery() call --- *) TYPE PackerInfoPtr=POINTER TO PackerInfo; PackerInfo=RECORD name :ARRAY[0..23] OF CHAR; (* Brief name of the packer *) longName :ARRAY[0..31] OF CHAR; (* Full name of the packer *) description :ARRAY[0..79] OF CHAR; (* One line description of packer *) flags :LONGINT; (* Defined below *) maxChunk :LONGINT; (* Max input chunk size for packing *) defChunk :LONGINT; (* Default packing chunk size *) defMode :INTEGER; (* Default mode on 0..100 scale *) END; (* --- Defines for Flags --- *) CONST pkChunk =00001H; (* Library supplies chunk packing *) pkStream =00002H; (* Library supplies stream packing *) pkArchive =00004H; (* Library supplies archive packing *) upChunk =00008H; (* Library supplies chunk unpacking *) upStream =00010H; (* Library supplies stream unpacking *) upArchive =00020H; (* Library supplies archive unpacking *) hookio =00080H; (* Uses full Hook I/O *) checking =00400H; (* Does its own data checking *) prereadhdr=00800H; (* Unpacker pre-reads the next chunkhdr *) encryption=02000H; (* Sub library supports encryption *) needpasswd=04000H; (* Sub library requires encryption *) modes =08000H; (* Sub library has different modes *) lossy =10000H; (* Sub library does lossy compression *) TYPE ModePtr=POINTER TO Mode; Mode=RECORD next :ModePtr; (* Chain to next descriptor for ModeDesc list *) upto, (* Maximum efficiency handled by this mode *) flags, (* Defined below *) packMemory, (* Extra memory required during packing *) unpackMemory, (* Extra memory during unpacking *) packSpeed, (* Approx packing speed in K per second *) unpackSpeed :LONGINT; (* Approx unpacking speed in K per second *) ratio, (* CF in 0.1% for AmigaVision executable *) chunkSize :INTEGER; (* Desired chunk size in K (!!) for this mode *) description :ARRAY[0..9] OF CHAR; (* 7 character mode description *) END; (* --- Defines for XpkMode.Flags --- *) CONST a3000Speed =1; (* Timings on A3000/25 *) noCPU =2; (* Packing not heavily CPU dependent *) upNoCPU =4; (* Unpacking... (i.e. hardware modes) *) MaxPackers =100; TYPE PackerListPtr=POINTER TO PackerList; PackerList=RECORD numPackers:LONGINT; packer :ARRAY[0..MaxPackers-1],[0..5] OF CHAR; END; CONST (* --- The XpkPassRequest() call (library version 4) --- *) passChars =tagBase+50H; (* which chars should be used *) passwordBuf =tagBase+51H; (* buffer to write password to *) passBufSize =tagBase+52H; (* size of password buffer *) key16BitPtr =tagBase+53H; (* pointer to UWORD var for key data *) key32BitPtr =tagBase+54H; (* pointer to ULONG var for key data *) pubScreen =tagBase+55H; (* pointer to struct Screen *) passTitle =tagBase+56H; (* Text shown in Screen title *) timeOut =tagBase+57H; (* Timeout time of requester in seconds *) (* request position and verify tags (version 4 revision 25) *) passWinLeft =tagBase+58H; (* distance from left screen border *) passWinTop =tagBase+59H; (* distance form top screen border *) passWinWidth =tagBase+5AH; (* width of requester window *) passWinHeight=tagBase+5BH; (* height of requester window *) passCenter =tagBase+5CH; (* Left and Top are used as center coords *) passVerify =tagBase+5DH; (* force user to verify password *) (* XPKPASSFF defines for PassChars. Do not use. Use XPKPASSFLG defines *) passFF30x39 =0; (* all numbers *) passFF41x46 =1; (* chars 'A' to 'F' *) passFF61x66 =2; (* chars 'a' to 'f' *) passFF47x5A =4; (* chars 'G' to 'Z' *) passFF67x7A =8; (* chars 'g' to 'z' *) passFF20 =16; (* space character *) passFFSpecial7Bit =32; (* all chars 0x20 to 0x7E without above defined *) passFFC0xDE =64; (* upper special chars *) passFFDFxFF =128; (* lower special chars *) passFFSpecial8Bit =256; (* special 8Bit chars *) (* all chars 0xA0 to 0xBF *) (* flags for PassChars, XPKPASSFLG_PRINTABLE is default *) (* NUMERIC :numbers HEXADECIMAL :hex numbers ALPHANUMERIC:numbers and letters INTALPHANUM :numbers and international letters ASCII7 :7 Bit ASCII PRINTABLE :all characters *) passFlgNumeric =passFF30x39; passFlgHexadecimal =passFF30x39+passFF41x46+passFF61x66; passFlgAlphanumeric =passFlgHexadecimal+passFF47x5A+passFF67x7A; passFlgIntAlphanum =passFlgAlphanumeric+passFFC0xDE+passFFDFxFF; passFlgASCII7 =passFlgAlphanumeric+passFFSpecial7Bit; passsFLGPrintable =passFlgIntAlphanum+passFFSpecial7Bit+passFFSpecial8Bit+passFF20; (* The XpkAllocObject() call (library version 4) *) (* use this always with library version >= 4, do NO longer allocate the structures yourself *) objFIB =0; (* XpkFib structure *) objPackerinfo =1; (* XpkPackerInfo structure *) objMode =2; (* XpkMode structure *) objPackerlist =3; (* XpkPackerList structure *) END XpkMasterD.