home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / tools / packer / xpk_develop / include / modula2 / xpkmasterd.def next >
Encoding:
Modula Definition  |  1998-02-08  |  13.9 KB  |  317 lines

  1. (*#-- BEGIN AutoRevision header, please do NOT edit!
  2. *
  3. * $VER: XpkMasterD.def 1.1 (27.01.1998)
  4. * Auth: T.B. (tonyiommi@geocities.com)
  5. *
  6. * Desc: XPKMaster Defs for xpk 4.25 (27.01.1998) by SDI
  7. * Reqs: AMIGA OS 2.0
  8. * Lang: MODULA-2
  9. * Comp: Cyclone © by M. Timmermans
  10. *-- END AutoRevision header --*)
  11.  
  12. DEFINITION MODULE XpkMasterD; (*$ Implementation- *)
  13.  
  14. FROM SYSTEM IMPORT ADDRESS;
  15. FROM UtilityD IMPORT tagUser;
  16.  
  17. TYPE  StrPtr = ADDRESS;
  18.  
  19. (* --- The packing/unpacking tags --- *)
  20. (* (TRUE) or (FALSE) mean the default value given by xpkmaster.library *)
  21.  
  22. CONST
  23.  tagBase=tagUser + ORD('X')*256 + ORD('P');
  24.  
  25. (* Caller must supply ONE of these to tell Xpk#?ack where to get data from *)
  26.  inName =tagBase+1; (* Process an entire named file *)
  27.  inFH   =tagBase+2; (* File handle - start from current position. If packing partial file, must also supply InLen *)
  28.  inBuf  =tagBase+3; (* Single unblocked memory buffer. Must also supply InLen *)
  29.  inHook =tagBase+4; (* Call custom Hook to read data. Must also supply InLen, when hook cannot do! (not for XPK unpacking) *)
  30.  
  31. (* Caller must supply ONE of these to tell Xpk#?ackFile where to send data to *)
  32.  outName    =tagBase+10H; (* Write (or overwrite) this data file *)
  33.  outFH      =tagBase+11H; (* File handle - write from current position on *)
  34.  outBuf     =tagBase+12H; (* Unblocked buffer - must also supply OutBufLen *)
  35.  getOutBuf  =tagBase+13H; (* Master allocates OutBuf - ti_Data points to buf ptr *)
  36.  outHook    =tagBase+14H; (* Callback Hook to get output buffers *)
  37.  
  38. (* --- Other tags for Pack/Unpack --- *)
  39.  inLen          =tagBase+20H; (* Length of data in input buffer *)
  40.  outBufLen      =tagBase+21H; (* Length of output buffer *)
  41.  getOutLen      =tagBase+22H; (* ti_Data points to long to receive OutLen *)
  42.  getOutBufLen   =tagBase+23H; (* ti_Data points to long to receive OutBufLen *)
  43.  password       =tagBase+24H; (* Password for de/encoding *)
  44.  getError       =tagBase+25H; (* ti_Data points to buffer for error message *)
  45.  outMemType     =tagBase+26H; (* Memory type for output buffer *)
  46.  passThru       =tagBase+27H; (* Bool: Pass through unrecognized formats on unpack *)
  47.  stepDown       =tagBase+28H; (* Bool: Step down pack method if necessary *)
  48.  chunkHook      =tagBase+29H; (* Call this Hook between chunks *)
  49.  packMethod     =tagBase+2AH; (* Do a FindMethod before packing *)
  50.  chunkSize      =tagBase+2BH; (* Chunk size to try to pack with *)
  51.  packMode       =tagBase+2CH; (* Packing mode for sublib to use *)
  52.  noClobber      =tagBase+2DH; (* Don't overwrite existing files *)
  53.  ignore         =tagBase+2EH; (* Skip this tag *)
  54.  taskPri        =tagBase+2FH; (* Change priority for (un)packing *)
  55.  fileName       =tagBase+30H; (* File name for progress report *)
  56.  shortError     =tagBase+31H; (* !!! obsolete !!! *)
  57.  packersQuery   =tagBase+32H; (* Query available packers *)
  58.  packerQuery    =tagBase+33H; (* Query properties of a packer *)
  59.  modeQuery      =tagBase+34H; (* Query properties of packmode *)
  60.  lossyOK        =tagBase+35H; (* Lossy packing permitted? (FALSE) *)
  61.  noCRC          =tagBase+36H; (* Ignore checksum *)
  62.  
  63. (* tags added for xfdmaster support (version 4 revision 25) *)
  64.  key16        =tagBase+37H; (* 16 bit key (unpack only) *)
  65.  key32        =tagBase+38H; (* 32 bit key (unpack only) *)
  66.  
  67. (* preference depending tags added for version 4 - their default value may depend on preferences, see xpk/xpkprefs.h for more info *)
  68.  useXfdMaster  =tagBase+40H; (* Use xfdmaster.library (FALSE) *)
  69.  useExternals  =tagBase+41H; (* Use packers in extern dir (TRUE) *)
  70.  passRequest   =tagBase+42H; (* automatic password req.? (FALSE) *)
  71.  preferences   =tagBase+43H; (* use prefs semaphore ? (TRUE) *)
  72.  chunkReport   =tagBase+44H; (* automatic chunk report ? (FALSE) *)
  73.  
  74. (* tags tagBase+0x50) to tagBase+0x69) are for XpkPassRequest -- see below *)
  75.  
  76.  margin =256;   (* Safety margin for output buffer  *)
  77.  
  78. (* --- The hook function interface --- *)
  79. (* Message passed to InHook and OutHook as the ParamPacket *)
  80. TYPE
  81.  IOMsgPtr=POINTER TO IOMsg;
  82.  IOMsg=RECORD
  83.   type      :LONGINT;   (* Read/Write/Alloc/Free/Abort*)
  84.   ptr       :ADDRESS;   (* The mem area to read from/write to *)
  85.   size      :LONGINT;   (* The size of the read/write *)
  86.   ioError,  (* The IoErr() that occurred *)
  87.   reserved, (* Reserved for future use *)
  88.   private1, (* Hook specific, will be set to 0 by *)
  89.   private2, (* master library before first use *)
  90.   private3,
  91.   private4  :LONGINT;
  92.  END;
  93.  
  94. (* The values for XpkIoMsg->Type *)
  95. CONST
  96.  ioRead   =1;
  97.  ioWrite  =2;
  98.  ioFree   =3;
  99.  ioAbort  =4;
  100.  ioGetbuf =5;
  101.  ioSeek   =6;
  102.  ioTotSize=7;
  103.  
  104. (* --- The progress report interface --- *)
  105.  
  106. (* Passed to ChunkHook as the ParamPacket *)
  107. TYPE
  108.  ProgressPtr=POINTER TO Progress;
  109.  Progress=RECORD
  110.   type          :LONGINT;   (* Type of report: start/cont/end/abort *)
  111.   packerName,               (* Brief name of packer being used *)
  112.   packerLongName,           (* Descriptive name of packer being used *)
  113.   activity,                 (* Packing/unpacking message *)
  114.   fileName      :StrPtr;    (* Name of file being processed, if available *)
  115.   cCur,                     (* Amount of packed data already processed *)
  116.   uCur,                     (* Amount of unpacked data already processed *)
  117.   uLen,                     (* Amount of unpacked data in file *)
  118.   cf,                       (* Compression factor so far *)
  119.   done,                     (* Percentage done already *)
  120.   speed         :LONGINT;   (* Bytes per second, from beginning of stream *)
  121.   reserved      :ARRAY[1..8] OF LONGINT;    (* For future use *)
  122.  END;
  123.  
  124. CONST
  125.   progStart =1;
  126.   progMID   =2;
  127.   progEnd   =3;
  128.  
  129. (* --- The file info block --- *)
  130. TYPE
  131.  FibPtr = POINTER TO Fib;
  132.  Fib=RECORD
  133.   type,         (* Unpacked, packed, archive? *)
  134.   uLen,         (* Uncompressed length *)
  135.   cLen,         (* Compressed length *)
  136.   nLen,         (* Next chunk len *)
  137.   uCur,         (* Uncompressed bytes so far *)
  138.   cCur,         (* Compressed bytes so far *)
  139.   id            :LONGINT;                   (* 4 letter ID of packer *)
  140.   packer        :ARRAY[0..4] OF CHAR;       (* 4 letter name of packer *)
  141.   subVersion,                               (* Required sublib version *)
  142.   masVersion    :INTEGER;                   (* Required masterlib version *)
  143.   flags         :LONGINT;                   (* Password *)
  144.   head          :ARRAY[0..15] OF SHORTCARD; (* First 16 bytes of orig. file *)
  145.   ratio         :LONGINT;                   (* Compression ratio *)
  146.   reserved      :ARRAY[0..7] OF LONGINT;    (* For future use *)
  147.  END;
  148.  
  149. CONST
  150.  typeUnpacked =0; (* Not packed *)
  151.  typePacked   =1; (* Packed file *)
  152.  typeArchive  =2; (* Archive *)
  153.  
  154.  flagsPassword  = 1; (* Password needed *)
  155.  flagsNoSeek    = 2; (* Chunks are dependent *)
  156.  flagsNonSTD    = 4; (* Nonstandard file format *)
  157.  
  158.  (* defines added for xfdmaster support (version 4 revision 25) *)
  159.  flagsKey16    = 8; (* 16 bit key - for decrunching *)
  160.  flagsKey32    =16; (* 32 bit key - for decrunching *)
  161.  
  162. (* --- The error messages --- *)
  163.   errOK         =0;
  164.   errNoFunc     =-1;    (* This function not implemented *)
  165.   errNoFiles    =-2;    (* No files allowed for this function *)
  166.   errIoErrIn    =-3;    (* Input error happened *)
  167.   errIoErrOut   =-4;    (* Output error happened *)
  168.   errChecksum   =-5;    (* Check sum test failed *)
  169.   errVersion    =-6;    (* Packed file's version newer than lib *)
  170.   errNoMem      =-7;    (* Out of memory *)
  171.   errLibInUse   =-8;    (* For not-reentrant libraries *)
  172.   errWrongForm  =-9;    (* Was not packed with this library *)
  173.   errSmallBuf   =-10;   (* Output buffer too small *)
  174.   errLargeBuf   =-11;   (* Input buffer too large *)
  175.   errWrongMode  =-12;   (* This packing mode not supported *)
  176.   errNeedPassWD =-13;   (* Password needed for decoding *)
  177.   errCorruptPKD =-14;   (* Packed file is corrupt *)
  178.   errMissingLib =-15;   (* Required library is missing *)
  179.   errBadParams  =-16;   (* Caller's TagList was screwed up *)
  180.   errExpansion  =-17;   (* Would have caused data expansion *)
  181.   errNoMethod   =-18;   (* Cannot find requested method *)
  182.   errAborted    =-19;   (* Operation aborted by user *)
  183.   errTruncated  =-20;   (* Input file is truncated *)
  184.   errWrongCPU   =-21;   (* Better CPU required for this library *)
  185.   errPacked     =-22;   (* Data are already XPacked *)
  186.   errNotPacked  =-23;   (* Data not packed *)
  187.   errFileExists =-24;   (* File already exists *)
  188.   errOldMastlib =-25;   (* Master library too old *)
  189.   errOldSUBLIB  =-26;   (* Sub library too old *)
  190.   errNoCrypt    =-27;   (* Cannot encrypt *)
  191.   errNoInfo     =-28;   (* Can't get info on that packer *)
  192.   errLossy      =-29;   (* This compression method is lossy *)
  193.   errNoHardware =-30;   (* Compression hardware required *)
  194.   errBadHardware=-31;   (* Compression hardware failed *)
  195.   errWrongPW    =-32;   (* Password was wrong *)
  196.   errUnknown    =-33;   (* unknown error cause *)
  197.   errReqTimeOut =-34;        (* password request reached time out *)
  198.  
  199.   errMsgSize    =80;    (* Maximum size of an error message *)
  200.  
  201. (* --- The XpkQuery() call --- *)
  202. TYPE
  203.  PackerInfoPtr=POINTER TO PackerInfo;
  204.  PackerInfo=RECORD
  205.   name          :ARRAY[0..23] OF CHAR;  (* Brief name of the packer *)
  206.   longName      :ARRAY[0..31] OF CHAR;  (* Full name of the packer *)
  207.   description   :ARRAY[0..79] OF CHAR;  (* One line description of packer *)
  208.   flags         :LONGINT;               (* Defined below *)
  209.   maxChunk      :LONGINT;               (* Max input chunk size for packing *)
  210.   defChunk      :LONGINT;               (* Default packing chunk size *)
  211.   defMode       :INTEGER;               (* Default mode on 0..100 scale *)
  212.  END;
  213.  
  214. (* --- Defines for Flags --- *)
  215. CONST
  216.   pkChunk   =00001H; (* Library supplies chunk packing *)
  217.   pkStream  =00002H; (* Library supplies stream packing *)
  218.   pkArchive =00004H; (* Library supplies archive packing *)
  219.   upChunk   =00008H; (* Library supplies chunk unpacking *)
  220.   upStream  =00010H; (* Library supplies stream unpacking *)
  221.   upArchive =00020H; (* Library supplies archive unpacking *)
  222.   hookio    =00080H; (* Uses full Hook I/O *)
  223.   checking  =00400H; (* Does its own data checking *)
  224.   prereadhdr=00800H; (* Unpacker pre-reads the next chunkhdr *)
  225.   encryption=02000H; (* Sub library supports encryption *)
  226.   needpasswd=04000H; (* Sub library requires encryption *)
  227.   modes     =08000H; (* Sub library has different modes *)
  228.   lossy     =10000H; (* Sub library does lossy compression *)
  229.  
  230. TYPE
  231.  ModePtr=POINTER TO Mode;
  232.  Mode=RECORD
  233.   next          :ModePtr;   (* Chain to next descriptor for ModeDesc list *)
  234.   upto,                     (* Maximum efficiency handled by this mode *)
  235.   flags,                    (* Defined below *)
  236.   packMemory,               (* Extra memory required during packing *)
  237.   unpackMemory,             (* Extra memory during unpacking *)
  238.   packSpeed,                (* Approx packing speed in K per second *)
  239.   unpackSpeed   :LONGINT;   (* Approx unpacking speed in K per second *)
  240.   ratio,                    (* CF in 0.1% for AmigaVision executable *)
  241.   chunkSize     :INTEGER;   (* Desired chunk size in K (!!) for this mode *)
  242.   description   :ARRAY[0..9] OF CHAR;   (* 7 character mode description *)
  243.  END;
  244.  
  245. (* --- Defines for XpkMode.Flags --- *)
  246. CONST
  247.  a3000Speed =1; (* Timings on A3000/25 *)
  248.  noCPU      =2; (* Packing not heavily CPU dependent *)
  249.  upNoCPU    =4; (* Unpacking... (i.e. hardware modes) *)
  250.  
  251.  MaxPackers =100;
  252.  
  253. TYPE
  254.  PackerListPtr=POINTER TO PackerList;
  255.  PackerList=RECORD
  256.   numPackers:LONGINT;
  257.   packer    :ARRAY[0..MaxPackers-1],[0..5] OF CHAR;
  258.  END;
  259.  
  260. CONST
  261. (* --- The XpkPassRequest() call (library version 4) --- *)
  262.    passChars    =tagBase+50H; (* which chars should be used *)
  263.    passwordBuf  =tagBase+51H; (* buffer to write password to *)
  264.    passBufSize  =tagBase+52H; (* size of password buffer *)
  265.    key16BitPtr  =tagBase+53H; (* pointer to UWORD var for key data *)
  266.    key32BitPtr  =tagBase+54H; (* pointer to ULONG var for key data *)
  267.    pubScreen    =tagBase+55H; (* pointer to struct Screen *)
  268.    passTitle    =tagBase+56H; (* Text shown in Screen title *)
  269.    timeOut      =tagBase+57H; (* Timeout time of requester in seconds *)
  270.  
  271.    (* request position and verify tags (version 4 revision 25) *)
  272.    passWinLeft    =tagBase+58H; (* distance from left screen border *)
  273.    passWinTop    =tagBase+59H; (* distance form top screen border *)
  274.    passWinWidth =tagBase+5AH; (* width of requester window *)
  275.    passWinHeight=tagBase+5BH; (* height of requester window *)
  276.    passCenter   =tagBase+5CH; (* Left and Top are used as center coords *)
  277.    passVerify    =tagBase+5DH; (* force user to verify password *)
  278.  
  279. (* XPKPASSFF defines for  PassChars. Do not use. Use XPKPASSFLG defines *)
  280.   passFF30x39       =0;   (* all numbers      *)
  281.   passFF41x46       =1;   (* chars 'A' to 'F' *)
  282.   passFF61x66       =2;   (* chars 'a' to 'f' *)
  283.   passFF47x5A       =4;   (* chars 'G' to 'Z' *)
  284.   passFF67x7A       =8;   (* chars 'g' to 'z' *)
  285.   passFF20          =16;  (* space character  *)
  286.   passFFSpecial7Bit =32;  (* all chars 0x20 to 0x7E without above defined *)
  287.   passFFC0xDE       =64;  (* upper special chars  *)
  288.   passFFDFxFF       =128; (* lower special chars  *)
  289.   passFFSpecial8Bit =256; (* special 8Bit chars   *) (* all chars 0xA0 to 0xBF *)
  290.  
  291. (* flags for  PassChars, XPKPASSFLG_PRINTABLE is default *)
  292. (*
  293. NUMERIC     :numbers
  294. HEXADECIMAL :hex numbers
  295. ALPHANUMERIC:numbers and letters
  296. INTALPHANUM :numbers and international letters
  297. ASCII7      :7 Bit ASCII
  298. PRINTABLE   :all characters
  299. *)
  300.   passFlgNumeric        =passFF30x39;
  301.   passFlgHexadecimal    =passFF30x39+passFF41x46+passFF61x66;
  302.   passFlgAlphanumeric   =passFlgHexadecimal+passFF47x5A+passFF67x7A;
  303.   passFlgIntAlphanum    =passFlgAlphanumeric+passFFC0xDE+passFFDFxFF;
  304.   passFlgASCII7         =passFlgAlphanumeric+passFFSpecial7Bit;
  305.   passsFLGPrintable     =passFlgIntAlphanum+passFFSpecial7Bit+passFFSpecial8Bit+passFF20;
  306.  
  307. (* The XpkAllocObject() call (library version 4) *)
  308.  
  309. (* use this always with library version >= 4, do NO longer allocate the structures yourself *)
  310.   objFIB        =0; (* XpkFib structure *)
  311.   objPackerinfo =1; (* XpkPackerInfo structure *)
  312.   objMode       =2; (* XpkMode structure *)
  313.   objPackerlist =3; (* XpkPackerList structure *)
  314.  
  315. END XpkMasterD.
  316.