home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 10 / Sonderheft_12.iso / best-of-tools / packer / xpk3.11 / xpk_source / modula2 / interfaces / xpkmasterd.def < prev    next >
Text File  |  1996-11-26  |  13KB  |  309 lines

  1. (*************************************************************************
  2.  
  3. :Program.    XpkMasterD.def
  4. :Contents.   Interface-Module for xpkmaster.library
  5. :Author.     Oliver Knorr
  6. :Remark.     Derived from Hartmut Goebel's Oberon Interface
  7. :Copyright.  Copyright © 1992 by Oliver Knorr
  8. :Copyright.  May be freely distributed with the Xpk-Package
  9. :Copyright.  permission is given to be included with M2Amiga
  10. :Language.   Modula-2
  11. :Translator. M2Amiga V4.0
  12. :History.    V1.0, 29 Jul 1992 Oliver Knorr
  13. :History     V2.0, 30 Jul 1992 Oliver Knorr
  14. :Date.       29 Jul 1992 01:41:25
  15.  
  16. *************************************************************************)
  17.  
  18. DEFINITION MODULE XpkMasterD;
  19. (*$ Implementation:=FALSE *)
  20.  
  21. FROM UtilityD IMPORT tagUser ;
  22. FROM SYSTEM   IMPORT ADDRESS, BYTE, LONGSET ;
  23.  
  24. CONST
  25.   xpkName = "xpkmaster.library";
  26.  
  27. TYPE
  28.   StrPtr = POINTER TO ARRAY [0..255] OF CHAR;
  29.  
  30.  
  31. (*****************************************************************************
  32.  *
  33.  *
  34.  *      The packing/unpacking tags
  35.  *
  36.  *)
  37.  
  38. (* Tags we support *)
  39. TYPE
  40.   XpkTags=(xpkTagBase:=tagUser + ORD("X")*256 + ORD("P"),
  41.  
  42. (* Caller must supply ONE of these to tell Xpk#?ackFile where to get data from *)
  43.   xpkInName,        (* an entire named file *)
  44.   xpkInFH,          (* File handle - start from current position *)
  45.                       (* If packing partial file, must also supply InLen *)
  46.   xpkInBuf,         (* Single unblocked memory buffer *)
  47.                       (* Must also supply InLen *)
  48.   xpkInHook,        (* Call custom Hook to read data *)
  49.                       (* If packing, must also supply InLen *)
  50.                       (* If unpacking, InLen required only for PPDecrunch *)
  51.  
  52. (* TagBase+5 through TagBase+15 are reserved *)
  53.   xpk05, xpk06, xpk07, xpk08, xpk09, xpk10, xpk11, xpk12, xpk13, xpk14, xpk15,
  54.  
  55. (* Caller must supply ONE of these to tell Xpk#?ackFile where to send data to *)
  56.   xpkOutName,       (* Write (or overwrite) this data file *)
  57.   xpkOutFH,         (* File handle - write from current position on *)
  58.   xpkOutBuf,        (* Unblocked buffer - must also supply OutBufLen *)
  59.   xpkGetOutBuf,     (* Master allocates OutBuf - ti_Data points to buf ptr *)
  60.   xpkOutHook,       (* Callback Hook to get output buffers *)
  61.  
  62. (* TagBase+21 through TagBase+31 are reserved *)
  63.   xpk21, xpk22, xpk23, xpk24, xpk25, xpk26, xpk27, xpk28, xpk29, xpk30, xpk31,
  64.  
  65. (* Other tags for Pack/Unpack *)
  66.   xpkInLen,         (* Length of data in input buffer *)
  67.   xpkOutBufLen,     (* Length of output buffer *)
  68.   xpkGetOutLen,     (* ti_Data points to long to receive OutLen *)
  69.   xpkGetOutBufLen,  (* ti_Data points to long to receive OutBufLen *)
  70.   xpkPassword,      (* Password for de/encoding *)
  71.   xpkGetError,      (* ti_Data points to buffer for error message *)
  72.   xpkOutMemType,    (* Memory type for output buffer *)
  73.   xpkPassThru,      (* Bool: Pass through unrecognized formats on unpack *)
  74.   xpkStepDown,      (* Bool: Step down pack method if necessary *)
  75.   xpkChunkHook,     (* Call this Hook between chunks *)
  76.   xpkPackMethod,    (* Do a FindMethod before packing *)
  77.   xpkChunkSize,     (* Chunk size to try to pack with *)
  78.   xpkPackMode,      (* Packing mode for sublib to use *)
  79.   xpkNoClobber,     (* Don't overwrite existing files  *)
  80.   xpkIgnore,        (* Skip this tag                   *)
  81.   xpkTaskPri,       (* Change priority for (un)packing *)
  82.   xpkFileName,      (* File name for progress report   *)
  83.   xpkShortError,    (* Output short error messages     *)
  84.   xpkPackerQuery,   (* Query properties of a packer    *)
  85.   xpkModeQuery      (* Query properties of packmode    *)
  86. );
  87.  
  88. CONST
  89.   xpkFindMethod=xpkPackMethod;  (* Compatibility *)
  90.  
  91.  
  92. (*****************************************************************************
  93.  *
  94.  *
  95.  *     The hook function interface
  96.  *
  97.  *)
  98.  
  99. TYPE
  100.  
  101. (* The values for XpkIOMsg.type *)
  102.   XpkIOMsgType = (xiomt0, ioRead, ioWrite, ioFree, ioAbort, ioGetBuf,
  103.                      ioSeek, ioTotSize) ;
  104.  
  105. (* Message passed to InHook and OutHook as the ParamPacket *)
  106.   XpkIOMsgPtr = POINTER TO XpkIOMsg;
  107.   XpkIOMsg = RECORD
  108.     type     : LONGINT; (* Read/Write/Alloc/Free/Abort        *)
  109.     ptr      : ADDRESS; (* The mem area to read from/write to *)
  110.     size     : LONGINT; (* The size of the read/write         *)
  111.     ioError  : LONGINT; (* The IoErr() that occurred          *)
  112.     reserved : ADDRESS; (* Reserved for future use            *)
  113.     private1 : ADDRESS; (* Hook specific, will be set to 0 by *)
  114.     private2 : ADDRESS; (* master library before first use    *)
  115.     private3 : ADDRESS;
  116.     private4 : ADDRESS;
  117.   END;
  118.  
  119.  
  120. (*****************************************************************************
  121.  *
  122.  *
  123.  *      The progress report interface
  124.  *
  125.  *)
  126.  
  127. TYPE
  128. (* The values for XpkProgress.type *)
  129.   XpkProgressType = (xpt0, progStart, progMid, progEnd) ;
  130.  
  131. (* Passed to ChunkHook as the ParamPacket *)
  132.   XpkProgressPtr = POINTER TO XpkProgress;
  133.   XpkProgress = RECORD
  134.     type           : LONGINT;  (* Type of report: start/cont/end/abort       *)
  135.     packerName     : StrPtr;   (* Brief name of packer being used            *)
  136.     packerLongName : StrPtr;   (* Descriptive name of packer being used      *)
  137.     activity : StrPtr;         (* Packing/unpacking message                  *)
  138.     fileName : StrPtr;         (* Name of file being processed, if available *)
  139.     cCur  : LONGINT;           (* Amount of packed data already processed    *)
  140.     uCur  : LONGINT;           (* Amount of unpacked data already processed  *)
  141.     uLen  : LONGINT;           (* Amount of unpacked data already processed  *)
  142.     cf    : LONGINT;           (* Compression factor so far                  *)
  143.     done  : LONGINT;           (* Percentage done already                    *)
  144.     speed : LONGINT;           (* Bytes per second, from beginning of stream *)
  145.     reserved : ARRAY [0..7] OF ADDRESS;      (* For future use               *)
  146.   END;
  147.  
  148.  
  149. (*****************************************************************************
  150.  *
  151.  *
  152.  *       The file info block
  153.  *
  154.  *)
  155.  
  156. TYPE
  157.  
  158. (* Defines for XpkFib.type *)
  159.   XpkFibType = (unpacked, packed, archive) ;
  160.  
  161. (* Defines for XpkFib.flags *)
  162.   XpkFibFlags = (password, seek, nonStd, xff3, xff4, xff5, xff6, xff7,
  163.                  xff8, xff9, xff10, xff11, xff12, xff13, xff14, xff15,
  164.                  xff16, xff17, xff18, xff19, xff20, xff21, xff22, xff23,
  165.                  xff24, xff25, xff26, xff27, xff28, xff29, xff30, xff31) ;
  166.   XpkFibFlagSet = SET OF XpkFibFlags ;
  167.  
  168.   XpkFibPtr = POINTER TO XpkFib;
  169.   XpkFib = RECORD
  170.     type : LONGINT                    ; (* Unpacked, packed, archive?   *)
  171.     uLen : LONGINT                    ; (* Uncompressed length          *)
  172.     cLen : LONGINT                    ; (* Compressed length            *)
  173.     nLen : LONGINT                    ; (* Next chunk len               *)
  174.     uCur : LONGINT                    ; (* Uncompressed bytes so far    *)
  175.     cCur : LONGINT                    ; (* Compressed bytes so far      *)
  176.     id     : ARRAY [0..3] OF BYTE     ; (* 4 letter ID of packer        *)
  177.     packer : ARRAY [0..5] OF BYTE     ; (* 4 letter name of packer      *)
  178.     subVersion : INTEGER              ; (* Required sublib version      *)
  179.     masVersion : INTEGER              ; (* Required masterlib version   *)
  180.     flags : XpkFibFlagSet             ; (* Password?                    *)
  181.     head : ARRAY [0..15] OF BYTE      ; (* First 16 bytes of orig. file *)
  182.     ratio : LONGINT                   ; (* Compression ratio            *)
  183.     reserved : ARRAY [0..7] OF ADDRESS; (* For future use               *)
  184.   END;
  185.  
  186.   XpkFH = POINTER TO RECORD
  187.     fib: XpkFib
  188.     (* private data follows *)
  189.   END;
  190.  
  191.  
  192. (*****************************************************************************
  193.  *
  194.  *
  195.  *       The error messages
  196.  *
  197.  *)
  198.  
  199. CONST
  200.   errOk         =  0;
  201.   errNoFunc     = -1;   (* This function not implemented         *)
  202.   errNoFiles    = -2;   (* No files allowed for this function    *)
  203.   errIOErrIn    = -3;   (* Input error happened, look at Result2 *)
  204.   errIOErrOut   = -4;   (* Output error happened,look at Result2 *)
  205.   errCheckSum   = -5;   (* Check sum test failed                 *)
  206.   errVersion    = -6;   (* Packed file's version newer than lib  *)
  207.   errNoMem      = -7;   (* Out of memory                         *)
  208.   errLibInUse   = -8;   (* For not-reentrant libraries           *)
  209.   errWrongForm  = -9;   (* Was not packed with this library      *)
  210.   errSmallBuf   = -10;  (* Output buffer too small               *)
  211.   errLargeBuf   = -11;  (* Input buffer too large                *)
  212.   errWrongMode  = -12;  (* This packing mode not supported       *)
  213.   errNeedPasswd = -13;  (* Password needed for decoding          *)
  214.   errCorruptPkd = -14;  (* Packed file is corrupt                *)
  215.   errMissingLib = -15;  (* Required library is missing           *)
  216.   errBadParams  = -16;  (* Caller's TagList was screwed up       *)
  217.   errExpansion  = -17;  (* Would have caused data expansion      *)
  218.   errNoMethod   = -18;  (* Can't find requested method           *)
  219.   errAborted    = -19;  (* Operation aborted by user             *)
  220.   errTruncated  = -20;  (* Input file is truncated               *)
  221.   errWrongCPU   = -21;  (* Better CPU required for this library  *)
  222.   errPacked     = -22;  (* Data are already XPacked              *)
  223.   errNotPacked  = -23;  (* Data not packed                       *)
  224.   errFileExists = -24;  (* File already exists                   *)
  225.   errOldMastLib = -25;  (* Master library too old                *)
  226.   errOldSubLib  = -26;  (* Sub library too old                   *)
  227.   errNoCrypt    = -27;  (* Cannot encrypt                        *)
  228.   errNoInfo     = -28;  (* Can't get info in that packer         *)
  229.  
  230.   errMsgSize    =  80;  (* Maximum size of an error message      *)
  231.  
  232. (*****************************************************************************
  233.  *
  234.  *
  235.  *     The XpkQuery() call
  236.  *
  237.  *)
  238.  
  239. TYPE
  240.  
  241.   XpkInfoFlags = (pkChunk,    (* Library supplies chunk packing       *)
  242.                   pkStream,   (* Library supplies stream packing      *)
  243.                   pkArchive,  (* Library supplies archive packing     *)
  244.                   upChunk,    (* Library supplies chunk unpacking     *)
  245.                   upStream,   (* Library supplies stream unpacking    *)
  246.                   upArchive,  (* Library supplies archive unpacking   *)
  247.                   xpif6,
  248.                   hookio,     (* Uses full Hook I/O                   *)
  249.                   xpif8, xpif9,
  250.                   checking,   (* Does its own data checking           *)
  251.                   prereadhdr, (* Unpacker pre-reads the next chunkhdr *)
  252.                   xpif12,
  253.                   encryption, (* Sub library supports encryption      *)
  254.                   needPasswd, (* Sub library requires encryption      *)
  255.                   modes,      (* Sub library has different modes      *)
  256.                   lossy,      (* Sub library does lossy compression   *)
  257.                   xpif17, xpif18, xpif19, xpif20, xpif21, xpif22,
  258.                   xpif23, xpif24, xpif25, xpif26, xpif27, xpif28,
  259.                   xpif29, xpif30, xpif31) ;
  260.   XpkInfoFlagSet = SET OF XpkInfoFlags ;
  261.  
  262.   XpkPackerInfoPtr = POINTER TO XpkPackerInfo;
  263.   XpkPackerInfo = RECORD
  264.     name : ARRAY [0..23] OF CHAR;        (* Brief name of the packer          *)
  265.     longName : ARRAY [0..31] OF CHAR;    (* Full name of the packer           *)
  266.     description : ARRAY [0..79] OF CHAR; (* One line description of packer    *)
  267.     flags    : XpkInfoFlagSet;           (* Defined above                     *)
  268.     maxChunk : LONGINT;                  (* Max input chunk size for packing  *)
  269.     defChunk : LONGINT;                  (* Default packing chunk size        *)
  270.     defMode  : INTEGER;                  (* Default mode on 0..100 scale      *)
  271.   END;
  272.  
  273.   XpkModeFlags = (a3000Speed, (* Timings on A3000/25                *)
  274.                   pkNoCPU,    (* Packing not heavily CPU dependent  *)
  275.                   upNoCPU,    (* Unpacking... (i.e. hardware modes) *)
  276.                   xmf3, xmf4, xmf5, xmf6, xmf7, xmf8, xmf9, xmf10,
  277.                   xmf11, xmf12, xmf13, xmf14, xmf15, xmf16, xmf17, xmf18,
  278.                   xmf19, xmf20, xmf21, xmf22, xmf23, xmf24, xmf25, xmf26,
  279.                   xmf27, xmf28, xmf29, xmf30, xmf31) ;
  280.   XpkModeFlagSet = SET OF XpkModeFlags ;
  281.  
  282.   XpkModePtr = POINTER TO XpkMode;
  283.   XpkMode = RECORD
  284.     next : XpkModePtr;           (* Chain to next descriptor for ModeDesc list*)
  285.     upto : LONGINT;              (* Maximum efficiency handled by this mode   *)
  286.     flags : XpkModeFlagSet;      (* Defined above                             *)
  287.     packMemory   : LONGINT;      (* Extra memory required during packing      *)
  288.     unpackMemory : LONGINT;      (* Extra memory during unpacking             *)
  289.     packSpeed    : LONGINT;      (* Approx packing speed in K per second      *)
  290.     unpackSpeed  : LONGINT;      (* Approx unpacking speed in K per second    *)
  291.     ratio    : INTEGER;          (* CF in 0.1% for AmigaVision executable     *)
  292.     reserved : INTEGER;
  293.     description : ARRAY [0..7] OF CHAR; (* 8 character mode description       *)
  294.   END;
  295.  
  296.  
  297. (*****************************************************************************
  298.  *
  299.  *
  300.  *     The XpkOpen() type calls
  301.  *
  302.  *)
  303.  
  304. CONST
  305.  
  306.   lenOneChunk = 7FFFFFFFH;
  307.  
  308. END XpkMasterD.noimp
  309.