home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Cruncher / XPK416DV.LHA / xpk_Develop / Include / ASM / xpk / xpk.i next >
Encoding:
Text File  |  1997-09-06  |  13.1 KB  |  346 lines

  1.     IFND    XPK_XPK_I
  2. XPK_XPK_I    SET    1
  3.  
  4. **
  5. **    $VER: xpk/xpk.i 4.10 (05.04.97) by SDI
  6. **
  7. **    (C) Copyright 1991-1997 by 
  8. **          Urban Dominik Mueller, Bryan Ford,
  9. **          Christian Schneider, Christian von Roques
  10. **        Dirk Stöcker
  11. **        All Rights Reserved
  12. **
  13.  
  14.     IFND    EXEC_TYPES_I
  15.     INCLUDE    "exec/types.i"
  16.     ENDC
  17.  
  18.     IFND    EXEC_LIBRARIES_I
  19.     INCLUDE    "exec/libraries.i"
  20.     ENDC
  21.  
  22.     IFND    UTILITY_TAGITEMS_I
  23.     INCLUDE "utility/tagitem.i"
  24.     ENDC
  25.  
  26.     IFND    UTILITY_HOOKS_I
  27.     INCLUDE    "utility/hooks.i"
  28.     ENDC
  29.  
  30. XPKNAME        MACRO
  31.         DC.B  'xpkmaster.library',0
  32.         ENDM
  33.  
  34. ******************************************************************************
  35. *
  36. *      The packing/unpacking tags
  37. *
  38. *
  39.  
  40. XPK_TagBase     EQU    (TAG_USER+'XP')
  41.  
  42. * Caller must supply ONE of these to tell Xpk#?ackFile where to get data from *
  43. XPK_InName     EQU    (XPK_TagBase+$01) ; Name of a single data file
  44. XPK_InFH     EQU    (XPK_TagBase+$02) ; File handle - read from current position
  45. XPK_InBuf     EQU    (XPK_TagBase+$03) ; Unblocked buffer - must also supply InLen
  46. XPK_InHook     EQU    (XPK_TagBase+$04) ; Callback Hook to get input data
  47.                            ; Must also supply InLen, when hook
  48.                           ; cannot do! (not for XPK unpacking)
  49.  
  50. * Caller must supply ONE of these to tell Xpk#?ack where to send data to *
  51. XPK_OutName     EQU    (XPK_TagBase+$10) ; Write (or overwrite) this data file
  52. XPK_OutFH     EQU    (XPK_TagBase+$11) ; File handle - write from current position on
  53. XPK_OutBuf     EQU    (XPK_TagBase+$12) ; Unblocked buffer - must also supply OutBufLen
  54. XPK_GetOutBuf     EQU    (XPK_TagBase+$13) ; Master allocates OutBuf - ti_Data points to buffer pointer
  55. XPK_OutHook     EQU    (XPK_TagBase+$14) ; Callback Hook to get output buffers
  56.  
  57. * Other junk *
  58. XPK_InLen     EQU    (XPK_TagBase+$20) ; len of data in input buffer
  59. XPK_OutBufLen     EQU    (XPK_TagBase+$21) ; len of output buffer
  60. XPK_GetOutLen     EQU    (XPK_TagBase+$22) ; ti_Data points to long to receive OutLen
  61. XPK_GetOutBufLen EQU    (XPK_TagBase+$23) ; ti_Data points to long to receive OutBufLen
  62. XPK_Password     EQU    (XPK_TagBase+$24) ; password for de/encoding
  63. XPK_GetError     EQU    (XPK_TagBase+$25) ; !!! obsolete !!!
  64. XPK_OutMemType     EQU    (XPK_TagBase+$26) ; Memory type for output buffer
  65. XPK_PassThru     EQU    (XPK_TagBase+$27) ; Bool: Pass through unrecognized formats
  66. XPK_StepDown     EQU    (XPK_TagBase+$28) ; Bool: Step down pack method if necessary
  67. XPK_ChunkHook     EQU    (XPK_TagBase+$29) ; Call this Hook between chunks
  68. XPK_PackMethod     EQU    (XPK_TagBase+$2a) ; Do a FindMethod before packing
  69. XPK_ChunkSize     EQU    (XPK_TagBase+$2b) ; Chunk size to try to pack with
  70. XPK_PackMode     EQU    (XPK_TagBase+$2c) ; Packing mode for sublib to use
  71. XPK_NoClobber     EQU    (XPK_TagBase+$2d) ; Don't overwrite existing files
  72. XPK_Ignore     EQU    (XPK_TagBase+$2e) ; Skip this tag
  73. XPK_TaskPri     EQU    (XPK_TagBase+$2f) ; Change priority for (un)packing
  74. XPK_FileName     EQU    (XPK_TagBase+$30) ; File name in progress report
  75. XPK_ShortError     EQU    (XPK_TagBase+$31) ; Output short error messages
  76. XPK_PackersQuery EQU    (XPK_TagBase+$32) ; Query available packers
  77. XPK_PackerQuery     EQU    (XPK_TagBase+$33) ; Query properties of a packer
  78. XPK_ModeQuery     EQU    (XPK_TagBase+$34) ; Query properties of packmode
  79. XPK_LossyOK     EQU    (XPK_TagBase+$35) ; Lossy packing permitted? (FALSE)
  80. XPK_NoCRC     EQU    (XPK_TagBase+$36) ; Ignore checksum
  81.  
  82. * preference depending tags added for version 4 - their default value
  83. * may depend on preferences, see <xpk/xpkprefs.i> for more info
  84.  
  85. XPK_UseXfdMaster EQU    (XPK_TagBase+$40) ; Use xfdmaster.library (FALSE)
  86. XPK_UseExternals EQU    (XPK_TagBase+$41) ; Use packers in extern dir (TRUE)
  87. XPK_PassRequest  EQU    (XPK_TagBase+$42) ; automatic password req. ? (FALSE)
  88. XPK_Preferences  EQU    (XPK_TagBase+$43) ; use prefs semaphore ? (TRUE)
  89. XPK_ChunkReport  EQU    (XPK_TagBase+$44) ; automatic chunk report ? (FALSE)
  90.  
  91. * tags XTAG(0x50) to XTAG(0x69) are for XpkPassRequest -- see below
  92.  
  93. XPK_MARGIN    EQU    256
  94.  
  95. **************************************************************************
  96. *
  97. *     Message passed to InHook and OutHook
  98. *
  99. *
  100.  
  101.  STRUCTURE    XpkIOMsg,0
  102.     ULONG    xiom_Type        ; Read/Write/Alloc/Free/Abort
  103.     APTR    xiom_Ptr        ; The mem area to read from/write to
  104.     LONG    xiom_Size        ; The size of the read/write
  105.     LONG    xiom_IOError        ; The IoErr() that occurred
  106.     LONG    xiom_Reserved        ; Reserved for future use
  107.     LONG    xiom_Private1        ; Hook specific, will be set to 0 by
  108.     LONG    xiom_Private2        ; master library before first use
  109.     LONG    xiom_Private3        ;
  110.     LONG    xiom_Private4        ;
  111.     LABEL    xiom_SIZEOF
  112.  
  113. * The values for XpkIoMsg->Type *
  114. XIO_READ    EQU    1
  115. XIO_WRITE    EQU    2
  116. XIO_FREE    EQU    3
  117. XIO_ABORT    EQU    4
  118. XIO_GETBUF    EQU    5
  119. XIO_SEEK    EQU    6
  120. XIO_TOTSIZE    EQU    7
  121.  
  122. ******************************************************************************
  123. *
  124. *
  125. *   The progress report interface
  126. *
  127. *
  128.  STRUCTURE    XpkProgress,0
  129.     LONG    xp_Type        ; Type of report: start/cont/end/abort
  130.     APTR    xp_PackerName    ; Brief name of packer being used
  131.     APTR    xp_PackerLongName ; Descriptive name of packer being used
  132.     APTR    xp_Activity    ; Packing/unpacking message
  133.     APTR    xp_FileName    ; Name of file being processed, if available
  134.     LONG    xp_CCur        ; Amount of packed data already processed
  135.     LONG    xp_UCur        ; Amount of unpacked data already processed
  136.     LONG    xp_ULen        ; Amount of unpacked data in file
  137.     LONG    xp_CF        ; Compression factor so far
  138.     LONG    xp_Done        ; Percentage done already
  139.     LONG    xp_Speed    ; Bytes per second, from beginning of stream
  140.     STRUCT    xp_Reserved,8*4    ; For future use
  141.     LABEL    xp_SIZEOF
  142.  
  143. XPKPROG_START    EQU    1
  144. XPKPROG_MID    EQU    2
  145. XPKPROG_END    EQU    3
  146.  
  147. *****************************************************************************
  148. *
  149. *
  150. *       The file info block
  151. *
  152. *
  153.  STRUCTURE    XpkFib,0
  154.     LONG    xf_Type        ; Unpacked, packed, archive?
  155.     LONG    xf_ULen        ; Uncompressed length
  156.     LONG    xf_CLen        ; Compressed length
  157.     LONG    xf_NLen        ; Next chunk len
  158.     LONG    xf_UCur        ; Uncompressed bytes so far
  159.     LONG    xf_CCur        ; Compressed bytes so far
  160.     LONG    xf_ID        ; 4 letter ID of packer
  161.     STRUCT    xf_Packer,6    ; 4 letter name of packer
  162.     WORD    xf_SubVersion    ; Required sublib version
  163.     WORD    xf_MasVersion    ; Required masterlib version
  164.     LONG    xf_Flags    ; Password?
  165.     STRUCT    xf_Head,16    ; First 16 bytes of orig. file
  166.     LONG    xf_Ratio    ; Compression ratio
  167.     STRUCT    xf_Reserved,8*4    ; For future use
  168.     LABEL    xf_SIZEOF
  169.  
  170. XPKTYPE_UNPACKED  EQU    0       ; Not packed
  171. XPKTYPE_PACKED      EQU    1       ; Packed file
  172. XPKTYPE_ARCHIVE   EQU    2       ; Archive
  173.  
  174. XPKFLAGS_PASSWORD EQU    1       ; Password needed
  175. XPKFLAGS_SEEK      EQU    2       ; Chunks are independent
  176. XPKFLAGS_NONSTD   EQU    4       ; Nonstandard file format
  177.  
  178. ******************************************************************************
  179. *
  180. *       The error messages
  181. *
  182. *
  183.  
  184. XPKERR_OK        EQU    0
  185. XPKERR_NOFUNC        EQU    -1    ; This function not implemented        
  186. XPKERR_NOFILES        EQU    -2    ; No files allowed for this function        
  187. XPKERR_IOERRIN        EQU    -3    ; Input error happened, look at Result2    
  188. XPKERR_IOERROUT        EQU    -4    ; Output error happened, look at Result2    
  189. XPKERR_CHECKSUM        EQU    -5    ; Check sum test failed            
  190. XPKERR_VERSION        EQU    -6    ; Packed file's version newer than lib's    
  191. XPKERR_NOMEM        EQU    -7    ; Out of memory                
  192. XPKERR_LIBINUSE        EQU    -8    ; For not-reentrant libraries        
  193. XPKERR_WRONGFORM    EQU    -9    ; Was not packed with this library        
  194. XPKERR_SMALLBUF        EQU    -10    ; Output buffer too small            
  195. XPKERR_LARGEBUF        EQU    -11    ; Input buffer too large            
  196. XPKERR_WRONGMODE    EQU    -12    ; This packing mode not supported        
  197. XPKERR_NEEDPASSWD    EQU    -13    ; Password needed for decoding this file    
  198. XPKERR_CORRUPTPKD     EQU    -14    ; Packed file is corrupt            
  199. XPKERR_MISSINGLIB     EQU    -15    ; Required library is missing        
  200. XPKERR_BADPARAMS     EQU    -16    ; Caller's TagList was screwed up          
  201. XPKERR_EXPANSION    EQU    -17    ; Would have caused data expansion         
  202. XPKERR_NOMETHOD       EQU    -18    ; Can't find requested method              
  203. XPKERR_ABORTED        EQU    -19    ; Operation aborted by user                
  204. XPKERR_TRUNCATED    EQU    -20    ; Input file is truncated            
  205. XPKERR_WRONGCPU       EQU    -21    ; Better CPU required for this library    
  206. XPKERR_PACKED         EQU    -22    ; Data are already XPacked            
  207. XPKERR_NOTPACKED      EQU    -23    ; Data not packed                
  208. XPKERR_FILEEXISTS     EQU    -24    ; File already exists            
  209. XPKERR_OLDMASTLIB     EQU    -25    ; Master library too old            
  210. XPKERR_OLDSUBLIB      EQU    -26    ; Sub library too old            
  211. XPKERR_NOCRYPT        EQU    -27    ; Cannot encrypt                
  212. XPKERR_NOINFO         EQU    -28    ; Can't get info on that packer        
  213. XPKERR_LOSSY        EQU    -29    ; This compression method is lossy        
  214. XPKERR_NOHARDWARE    EQU    -30    ; Compression hardware required        
  215. XPKERR_BADHARDWARE    EQU    -31    ; Compression hardware failed        
  216. XPKERR_WRONGPW        EQU    -32    ; Password was wrong                
  217. XPKERR_UNKNOWN        EQU    -33    ; unknown error cause
  218.  
  219. XPKERRMSGSIZE        EQU    80    ; Maximum size of an error message        
  220.  
  221. *****************************************************************************
  222. *
  223. *
  224. *     The XpkQuery() call
  225. *
  226. *
  227.  
  228.  STRUCTURE XpkPackerInfo,0
  229.     STRUCT  xpi_Name,24         ; Brief name of the packer
  230.     STRUCT  xpi_LongName,32     ; Full name of the packer
  231.     STRUCT  xpi_Description,80  ; One line description of packer
  232.     LONG    xpi_Flags           ; Defined below
  233.     LONG    xpi_MaxChunk        ; Max input chunk size for packing
  234.     LONG    xpi_DefChunk        ; Default packing chunk size
  235.     UWORD   xpi_DefMode         ; Default mode on 0..100 scale
  236.     LABEL   xpi_SIZEOF
  237.  
  238. XPKIF_PK_CHUNK   EQU    $00000001   ; Library supplies chunk packing
  239. XPKIF_PK_STREAM  EQU    $00000002   ; Library supplies stream packing
  240. XPKIF_PK_ARCHIVE EQU    $00000004   ; Library supplies archive packing
  241. XPKIF_UP_CHUNK   EQU    $00000008   ; Library supplies chunk unpacking
  242. XPKIF_UP_STREAM  EQU    $00000010   ; Library supplies stream unpacking
  243. XPKIF_UP_ARCHIVE EQU    $00000020   ; Library supplies archive unpacking
  244. XPKIF_HOOKIO     EQU    $00000080   ; Uses full Hook I/O
  245. XPKIF_CHECKING   EQU    $00000400   ; Does its own data checking
  246. XPKIF_PREREADHDR EQU    $00000800   ; Unpacker pre-reads the next chunkhdr
  247. XPKIF_ENCRYPTION EQU    $00002000   ; Sub library supports encryption
  248. XPKIF_NEEDPASSWD EQU    $00004000   ; Sub library requires encryption
  249. XPKIF_MODES      EQU    $00008000   ; Sub library has different modes
  250. XPKIF_LOSSY      EQU    $00010000   ; Sub library does lossy compression
  251.  
  252.  STRUCTURE XpkMode,0
  253.     APTR    xm_Next          ; Chain to next descriptor for ModeDesc list
  254.     ULONG   xm_Upto          ; Maximum efficiency handled by this mode
  255.     ULONG   xm_Flags         ; Defined below
  256.     ULONG   xm_PackMemory    ; Extra memory required during packing
  257.     ULONG   xm_UnpackMemory  ; Extra memory during unpacking
  258.     ULONG   xm_PackSpeed     ; Approx packing speed in K per second
  259.     ULONG   xm_UnpackSpeed   ; Approx unpacking speed in K per second
  260.     UWORD   xm_Ratio         ; CF in 0.1% for AmigaVision executable
  261.     UWORD   xm_ChunkSize     ; Desired chunk size in K (!!) for this mode
  262.     STRUCT  xm_Description,10; 8 character mode description
  263.     LABEL   xm_SIZEOF
  264.  
  265. XPKMF_A3000SPEED EQU $00000001    ; Timings on A3000/25
  266. XPKMF_PK_NOCPU   EQU $00000002    ; Packing not heavily CPU dependent
  267. XPKMF_UP_NOCPU   EQU $00000004    ; Unpacking... (i.e. hardware modes)
  268.  
  269.  
  270. MAXPACKERS    EQU    100
  271.  
  272.  STRUCTURE XpkPackerList,0
  273.     ULONG    xpl_NumPackers
  274.     STRUCT    xpl_Packer,MAXPACKERS*6
  275.     LABEL    xpl_SIZEOF
  276.  
  277. *****************************************************************************
  278. *
  279. *
  280. *     The XpkOpen() type calls
  281. *
  282.  
  283. XPKLEN_ONECHUNK  EQU    $7FFFFFFF
  284.  
  285. *****************************************************************************
  286. *
  287. *
  288. *     The XpkPassRequest() call (library version 4)
  289. *
  290. *
  291.  
  292. XPK_PassChars     EQU    (XPK_TagBase+$50) ; which chars should be used
  293. XPK_PasswordBuf     EQU    (XPK_TagBase+$51) ; buffer to write password to
  294. XPK_PassBufSize     EQU    (XPK_TagBase+$52) ; size of password buffer
  295. XPK_Key16BitPtr     EQU    (XPK_TagBase+$53) ; pointer to UWORD var for key data
  296. XPK_Key32BitPtr     EQU    (XPK_TagBase+$54) ; pointer to ULONG var for key data
  297. XPK_PubScreen     EQU    (XPK_TagBase+$55) ; pointer to struct Screen
  298. XPK_PassTitle     EQU    (XPK_TagBase+$56) ; Text shown in Screen title
  299. XPK_TimeOut     EQU    (XPK_TagBase+$57) ; Timeout time of requester in seconds
  300.  
  301. * XPKPASSFF defines for XPK_PassChars. Do not use. Use XPKPASSFLG defines
  302.  
  303. XPKPASSFF_30x39     EQU    $0001 ; all numbers
  304. XPKPASSFF_41x46        EQU    $0002 ; chars 'A' to 'F'
  305. XPKPASSFF_61x66     EQU    $0004 ; chars 'a' to 'f'
  306. XPKPASSFF_47x5A        EQU    $0008 ; chars 'G' to 'Z'
  307. XPKPASSFF_67x7A        EQU    $0010 ; chars 'g' to 'z'
  308. XPKPASSFF_20        EQU    $0020 ; space character
  309. XPKPASSFF_SPECIAL7BIT    EQU    $0040 ; all chars 0x20 to 0x7F without above defined
  310. XPKPASSFF_C0xDE        EQU    $0080 ; upper special chars
  311. XPKPASSFF_DFxFF        EQU    $0100 ; lower special chars
  312. XPKPASSFF_SPECIAL8BIT    EQU    $0200 ; special 8Bit chars
  313.  
  314. * flags for XPK_PassChars, XPKPASSFLG_PRINTABLE is default
  315. *
  316. * NUMERIC    : numbers
  317. * HEXADECIMAL    : hex numbers
  318. * ALPHANUMERIC    : numbers and letters
  319. * INTALPHANUM    : numbers and international letters
  320. * ASCII7    : 7 Bit ASCII
  321. * PRINTABLE    : all characters
  322.  
  323. XPKPASSFLG_NUMERIC    EQU    XPKPASSFF_30x39
  324. XPKPASSFLG_HEXADECIMAL    EQU    (XPKPASSFF_30x39|XPKPASSFF_41x46|XPKPASSFF_61x66)
  325. XPKPASSFLG_ALPHANUMERIC    EQU    (XPKPASSFLG_HEXADECIMAL|XPKPASSFF_47x5A|XPKPASSFF_67x7A)
  326. XPKPASSFLG_INTALPHANUM    EQU    (XPKPASSFLG_ALPHANUMERIC|XPKPASSFF_C0xDE|XPKPASSFF_DFxFF)
  327. XPKPASSFLG_ASCII7    EQU    (XPKPASSFLG_ALPHANUMERIC|XPKPASSFF_SPECIAL7BIT)
  328. XPKPASSFLG_PRINTABLE    EQU    (XPKPASSFLG_INTALPHANUM|XPKPASSFF_SPECIAL7BIT|XPKPASSFF_SPECIAL8BIT|XPKPASSFF_20)
  329.  
  330. *****************************************************************************
  331. *
  332. *
  333. *     The XpkAllocObject() call (library version 4)
  334. *
  335. * use this always with library version >= 4, do NO longer allocate the
  336. * structures yourself
  337. *
  338. *
  339.  
  340. XPKOBJ_FIB        EQU    0 ; XpkFib structure
  341. XPKOBJ_PACKERINFO    EQU    1 ; XpkPackerInfo structure
  342. XPKOBJ_MODE        EQU    2 ; XpkMode structure
  343. XPKOBJ_PACKERLIST    EQU    3 ; XpkPackerList structure
  344.  
  345.     ENDC
  346.