home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Cruncher / XPK_D310.LZX / xpk_Develop / Include / ASM / xpk / xpk.i next >
Encoding:
Text File  |  1996-10-19  |  10.0 KB  |  264 lines

  1.     IFND    XPK_XPK_I
  2. XPK_XPK_I    SET    1
  3.  
  4. **
  5. **    $VER: xpk/xpk.i 3.10 (26.09.96) by SDI
  6. **
  7. **    (C) Copyright 1991, 1992, 1993, 1994, 1995 by 
  8. **          Urban Dominik Mueller, Bryan Ford,
  9. **          Christian Schneider, Christian von Roques
  10. **        All Rights Reserved
  11. **
  12.  
  13.     INCLUDE    "exec/types.i"
  14.     INCLUDE    "exec/libraries.i"
  15.     INCLUDE "utility/tagitem.i"
  16.     INCLUDE    "utility/hooks.i"
  17.     
  18. XPKNAME        MACRO
  19.         DC.B  'xpkmaster.library',0
  20.         ENDM
  21.  
  22. ******************************************************************************
  23. *
  24. *      The packing/unpacking tags
  25. *
  26. *
  27.  
  28. XPK_TagBase    equ    (TAG_USER+'XP')
  29.  
  30. * Caller must supply ONE of these to tell Xpk#?ackFile where to get data from *
  31. XPK_InName    equ    (XPK_TagBase+$01)    ; Name of a single data file
  32. XPK_InFH    equ    (XPK_TagBase+$02)    ; File handle - read from current position
  33. XPK_InBuf    equ    (XPK_TagBase+$03)    ; Unblocked buffer - must also supply InLen
  34. XPK_InHook    equ    (XPK_TagBase+$04)    ; Callback Hook to get input data
  35.  
  36. * Caller must supply ONE of these to tell Xpk#?ackFile where to send data to *
  37. XPK_OutName    equ    (XPK_TagBase+$10)    ; Write (or overwrite) this data file
  38. XPK_OutFH    equ    (XPK_TagBase+$11)    ; File handle - write from current position on
  39. XPK_OutBuf    equ    (XPK_TagBase+$12)    ; Unblocked buffer - must also supply OutBufLen
  40. XPK_GetOutBuf    equ    (XPK_TagBase+$13)    ; Master allocates OutBuf - ti_Data points to buffer pointer
  41. XPK_OutHook    equ    (XPK_TagBase+$14)    ; Callback Hook to get output buffers
  42.  
  43. * Other junk *
  44. XPK_InLen    equ    (XPK_TagBase+$20)    ; len of data in input buffer
  45. XPK_OutBufLen    equ    (XPK_TagBase+$21)    ; len of output buffer
  46. XPK_GetOutLen    equ    (XPK_TagBase+$22)    ; ti_Data points to long to receive OutLen
  47. XPK_GetOutBufLen equ    (XPK_TagBase+$23)    ; ti_Data points to long to receive OutBufLen
  48. XPK_Password    equ    (XPK_TagBase+$24)    ; password for de/encoding
  49. XPK_GetError    equ    (XPK_TagBase+$25)    ; ti_Data points to buffer for error message
  50. XPK_OutMemType    equ    (XPK_TagBase+$26)    ; Memory type for output buffer
  51. XPK_PassThru    equ    (XPK_TagBase+$27)    ; Bool: Pass through unrecognized formats
  52. XPK_StepDown    equ    (XPK_TagBase+$28)    ; Bool: Step down pack method if necessary
  53. XPK_ChunkHook    equ    (XPK_TagBase+$29)    ; Call this Hook between chunks
  54. XPK_PackMethod    equ    (XPK_TagBase+$2a)    ; Do a FindMethod before packing
  55. XPK_ChunkSize    equ    (XPK_TagBase+$2b)    ; Chunk size to try to pack with
  56. XPK_PackMode    equ    (XPK_TagBase+$2c)    ; Packing mode for sublib to use
  57. XPK_NoClobber    equ    (XPK_TagBase+$2d)    ; Don't overwrite existing files
  58. XPK_Ignore    equ    (XPK_TagBase+$2e)    ; Skip this tag
  59. XPK_TaskPri    equ    (XPK_TagBase+$2f)    ; Change priority for (un)packing
  60. XPK_FileName    equ    (XPK_TagBase+$30)    ; File name in progress report
  61. XPK_ShortError    equ    (XPK_TagBase+$31)    ; Output short error messages
  62. XPK_PackersQuery equ    (XPK_TagBase+$32)    ; Query available packers
  63. XPK_PackerQuery    equ    (XPK_TagBase+$33)    ; Query properties of a packer
  64. XPK_ModeQuery    equ    (XPK_TagBase+$34)    ; Query properties of packmode
  65. XPK_LossyOK    equ    (XPK_TagBase+$35)    ; Lossy packing permitted? def.=no
  66. XPK_NoCRC    equ    (XPK_TagBase+$36)    ; Ignore checksum
  67.  
  68. XPK_FindMethod    equ    XPK_PackMethod
  69.  
  70. XPK_MARGIN    equ    256
  71.  
  72.  
  73. **************************************************************************
  74. *
  75. *     Message passed to InHook and OutHook
  76. *
  77. *
  78.  
  79.  STRUCTURE    XpkIOMsg,0
  80.     ULONG    xiom_Type        ; Read/Write/Alloc/Free/Abort
  81.     APTR    xiom_Ptr        ; The mem area to read from/write to
  82.     LONG    xiom_Size        ; The size of the read/write
  83.     LONG    xiom_IOError        ; The IoErr() that occurred
  84.     LONG    xiom_Reserved        ; Reserved for future use
  85.     LONG    xiom_Private1        ; Hook specific, will be set to 0 by
  86.     LONG    xiom_Private2        ; master library before first use
  87.     LONG    xiom_Private3        ;
  88.     LONG    xiom_Private4        ;
  89.     LABEL    xiom_SIZEOF
  90.  
  91. * The values for XpkIoMsg->Type *
  92. XIO_READ    EQU    1
  93. XIO_WRITE    EQU    2
  94. XIO_FREE    EQU    3
  95. XIO_ABORT    EQU    4
  96. XIO_GETBUF    EQU    5
  97. XIO_SEEK    EQU    6
  98. XIO_TOTSIZE    EQU    7
  99.  
  100. ******************************************************************************
  101. *
  102. *
  103. *   The progress report interface
  104. *
  105. *
  106.  STRUCTURE    XpkProgress,0
  107.     LONG    xp_Type        ; Type of report: start/cont/end/abort
  108.     APTR    xp_PackerName    ; Brief name of packer being used
  109.     APTR    xp_PackerLongName ; Descriptive name of packer being used
  110.     APTR    xp_Activity    ; Packing/unpacking message
  111.     APTR    xp_FileName    ; Name of file being processed, if available
  112.     LONG    xp_CCur        ; Amount of packed data already processed
  113.     LONG    xp_UCur        ; Amount of unpacked data already processed
  114.     LONG    xp_ULen        ; Amount of unpacked data in file
  115.     LONG    xp_CF        ; Compression factor so far
  116.     LONG    xp_Done        ; Percentage done already
  117.     LONG    xp_Speed    ; Bytes per second, from beginning of stream
  118.     STRUCT    xp_Reserved,8*4    ; For future use
  119.     LABEL    xp_SIZEOF
  120.  
  121. XPKPROG_START    EQU    1
  122. XPKPROG_MID    EQU    2
  123. XPKPROG_END    EQU    3
  124.  
  125. *****************************************************************************
  126. *
  127. *
  128. *       The file info block
  129. *
  130. *
  131.  STRUCTURE    XpkFib,0
  132.     LONG    xf_Type        ; Unpacked, packed, archive?
  133.     LONG    xf_ULen        ; Uncompressed length
  134.     LONG    xf_CLen        ; Compressed length
  135.     LONG    xf_NLen        ; Next chunk len
  136.     LONG    xf_UCur        ; Uncompressed bytes so far
  137.     LONG    xf_CCur        ; Compressed bytes so far
  138.     LONG    xf_ID        ; 4 letter ID of packer
  139.     STRUCT    xf_Packer,6    ; 4 letter name of packer
  140.     WORD    xf_SubVersion    ; Required sublib version
  141.     WORD    xf_MasVersion    ; Required masterlib version
  142.     LONG    xf_Flags    ; Password?
  143.     STRUCT    xf_Head,16    ; First 16 bytes of orig. file
  144.     LONG    xf_Ratio    ; Compression ratio
  145.     STRUCT    xf_Reserved,8*4    ; For future use
  146.     LABEL    xf_SIZEOF
  147.  
  148. XPKTYPE_UNPACKED  EQU    0       ; Not packed
  149. XPKTYPE_PACKED      EQU    1       ; Packed file
  150. XPKTYPE_ARCHIVE   EQU    2       ; Archive
  151.  
  152. XPKFLAGS_PASSWORD EQU    1       ; Password needed
  153. XPKFLAGS_SEEK      EQU    2       ; Chunks are independent
  154. XPKFLAGS_NONSTD   EQU    4       ; Nonstandard file format
  155.  
  156. ******************************************************************************
  157. *
  158. *       The error messages
  159. *
  160. *
  161.  
  162. XPKERR_OK        EQU    0
  163. XPKERR_NOFUNC        EQU    -1    ; This function not implemented        
  164. XPKERR_NOFILES        EQU    -2    ; No files allowed for this function        
  165. XPKERR_IOERRIN        EQU    -3    ; Input error happened, look at Result2    
  166. XPKERR_IOERROUT        EQU    -4    ; Output error happened, look at Result2    
  167. XPKERR_CHECKSUM        EQU    -5    ; Check sum test failed            
  168. XPKERR_VERSION        EQU    -6    ; Packed file's version newer than lib's    
  169. XPKERR_NOMEM        EQU    -7    ; Out of memory                
  170. XPKERR_LIBINUSE        EQU    -8    ; For not-reentrant libraries        
  171. XPKERR_WRONGFORM    EQU    -9    ; Was not packed with this library        
  172. XPKERR_SMALLBUF        EQU    -10    ; Output buffer too small            
  173. XPKERR_LARGEBUF        EQU    -11    ; Input buffer too large            
  174. XPKERR_WRONGMODE    EQU    -12    ; This packing mode not supported        
  175. XPKERR_NEEDPASSWD    EQU    -13    ; Password needed for decoding this file    
  176. XPKERR_CORRUPTPKD     EQU    -14    ; Packed file is corrupt            
  177. XPKERR_MISSINGLIB     EQU    -15    ; Required library is missing        
  178. XPKERR_BADPARAMS     EQU    -16    ; Caller's TagList was screwed up          
  179. XPKERR_EXPANSION    EQU    -17    ; Would have caused data expansion         
  180. XPKERR_NOMETHOD       EQU    -18    ; Can't find requested method              
  181. XPKERR_ABORTED        EQU    -19    ; Operation aborted by user                
  182. XPKERR_TRUNCATED    EQU    -20    ; Input file is truncated            
  183. XPKERR_WRONGCPU       EQU    -21    ; Better CPU required for this library    
  184. XPKERR_PACKED         EQU    -22    ; Data are already XPacked            
  185. XPKERR_NOTPACKED      EQU    -23    ; Data not packed                
  186. XPKERR_FILEEXISTS     EQU    -24    ; File already exists            
  187. XPKERR_OLDMASTLIB     EQU    -25    ; Master library too old            
  188. XPKERR_OLDSUBLIB      EQU    -26    ; Sub library too old            
  189. XPKERR_NOCRYPT        EQU    -27    ; Cannot encrypt                
  190. XPKERR_NOINFO         EQU    -28    ; Can't get info on that packer        
  191. XPKERR_LOSSY        EQU    -29    ; This compression method is lossy        
  192. XPKERR_NOHARDWARE    EQU    -30    ; Compression hardware required        
  193. XPKERR_BADHARDWARE    EQU    -31    ; Compression hardware failed        
  194. XPKERR_WRONGPW        EQU    -32    ; Password was wrong                
  195.  
  196.  
  197. XPKERRMSGSIZE        EQU    80    ; Maximum size of an error message        
  198.  
  199. *****************************************************************************
  200. *
  201. *
  202. *     The XpkQuery() call
  203. *
  204. *
  205.  
  206.  STRUCTURE XpkPackerInfo,0
  207.     STRUCT  xpi_Name,24         ; Brief name of the packer
  208.     STRUCT  xpi_LongName,32     ; Full name of the packer
  209.     STRUCT  xpi_Description,80  ; One line description of packer
  210.     LONG    xpi_Flags           ; Defined below
  211.     LONG    xpi_MaxChunk        ; Max input chunk size for packing
  212.     LONG    xpi_DefChunk        ; Default packing chunk size
  213.     UWORD   xpi_DefMode         ; Default mode on 0..100 scale
  214.     LABEL   xpi_SIZEOF
  215.  
  216. XPKIF_PK_CHUNK   EQU    $00000001   ; Library supplies chunk packing
  217. XPKIF_PK_STREAM  EQU    $00000002   ; Library supplies stream packing
  218. XPKIF_PK_ARCHIVE EQU    $00000004   ; Library supplies archive packing
  219. XPKIF_UP_CHUNK   EQU    $00000008   ; Library supplies chunk unpacking
  220. XPKIF_UP_STREAM  EQU    $00000010   ; Library supplies stream unpacking
  221. XPKIF_UP_ARCHIVE EQU    $00000020   ; Library supplies archive unpacking
  222. XPKIF_HOOKIO     EQU    $00000080   ; Uses full Hook I/O
  223. XPKIF_CHECKING   EQU    $00000400   ; Does its own data checking
  224. XPKIF_PREREADHDR EQU    $00000800   ; Unpacker pre-reads the next chunkhdr
  225. XPKIF_ENCRYPTION EQU    $00002000   ; Sub library supports encryption
  226. XPKIF_NEEDPASSWD EQU    $00004000   ; Sub library requires encryption
  227. XPKIF_MODES      EQU    $00008000   ; Sub library has different modes
  228. XPKIF_LOSSY      EQU    $00010000   ; Sub library does lossy compression
  229.  
  230.  STRUCTURE XpkMode,0
  231.     APTR    xm_Next          ; Chain to next descriptor for ModeDesc list
  232.     ULONG   xm_Upto          ; Maximum efficiency handled by this mode
  233.     ULONG   xm_Flags         ; Defined below
  234.     ULONG   xm_PackMemory    ; Extra memory required during packing
  235.     ULONG   xm_UnpackMemory  ; Extra memory during unpacking
  236.     ULONG   xm_PackSpeed     ; Approx packing speed in K per second
  237.     ULONG   xm_UnpackSpeed   ; Approx unpacking speed in K per second
  238.     UWORD   xm_Ratio         ; CF in 0.1% for AmigaVision executable
  239.     UWORD   xm_ChunkSize     ; Desired chunk size in K (!!) for this mode
  240.     STRUCT  xm_Description,10; 8 character mode description
  241.     LABEL   xm_SIZEOF
  242.  
  243. XPKMF_A3000SPEED EQU $00000001    ; Timings on A3000/25
  244. XPKMF_PK_NOCPU   EQU $00000002    ; Packing not heavily CPU dependent
  245. XPKMF_UP_NOCPU   EQU $00000004    ; Unpacking... (i.e. hardware modes)
  246.  
  247.  
  248. MAXPACKERS    EQU    100
  249.  
  250.  STRUCTURE XpkPackerList,0
  251.     ULONG    xpl_NumPackers
  252.     STRUCT    xpl_Packer,MAXPACKERS*6
  253.     LABEL    xpl_SIZEOF
  254.  
  255. *****************************************************************************
  256. *
  257. *
  258. *     The XpkOpen() type calls
  259. *
  260.  
  261.  
  262. XPKLEN_ONECHUNK EQU $7fffffff
  263.     ENDC
  264.