home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / tools / packer / xpk_develop / include / asm / xpk / xpk.i next >
Encoding:
Text File  |  1998-02-08  |  14.2 KB  |  359 lines

  1.     IFND    XPK_XPK_I
  2. XPK_XPK_I    SET    1
  3.  
  4. **
  5. **    $VER: xpk/xpk.i 4.15 (24.01.1998) by SDI
  6. **
  7. **    (C) Copyright 1991-1998 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 tags for Pack/Unpack *
  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. * tags added for xfdmaster support (version 4 revision 25) *
  82. XPK_Key16     EQU    (XPK_TagBase+$37) ; 16 bit key (unpack only)
  83. XPK_Key32     EQU    (XPK_TagBase+$38) ; 32 bit key (unpack only)
  84.  
  85. * preference depending tags added for version 4 - their default value
  86. * may depend on preferences, see <xpk/xpkprefs.i> for more info
  87.  
  88. XPK_UseXfdMaster EQU    (XPK_TagBase+$40) ; Use xfdmaster.library (FALSE)
  89. XPK_UseExternals EQU    (XPK_TagBase+$41) ; Use packers in extern dir (TRUE)
  90. XPK_PassRequest  EQU    (XPK_TagBase+$42) ; automatic password req. ? (FALSE)
  91. XPK_Preferences  EQU    (XPK_TagBase+$43) ; use prefs semaphore ? (TRUE)
  92. XPK_ChunkReport  EQU    (XPK_TagBase+$44) ; automatic chunk report ? (FALSE)
  93.  
  94. * tags XTAG(0x50) to XTAG(0x6F) are for XpkPassRequest -- see below
  95.  
  96. XPK_MARGIN    EQU    256    * Safety margin for output buffer
  97.  
  98. **************************************************************************
  99. *
  100. *     Message passed to InHook and OutHook
  101. *
  102. *
  103.  
  104.  STRUCTURE    XpkIOMsg,0
  105.     ULONG    xiom_Type        ; Read/Write/Alloc/Free/Abort
  106.     APTR    xiom_Ptr        ; The mem area to read from/write to
  107.     LONG    xiom_Size        ; The size of the read/write
  108.     LONG    xiom_IOError        ; The IoErr() that occurred
  109.     LONG    xiom_Reserved        ; Reserved for future use
  110.     LONG    xiom_Private1        ; Hook specific, will be set to 0 by
  111.     LONG    xiom_Private2        ; master library before first use
  112.     LONG    xiom_Private3        ;
  113.     LONG    xiom_Private4        ;
  114.     LABEL    xiom_SIZEOF
  115.  
  116. * The values for XpkIoMsg->Type *
  117. XIO_READ    EQU    1
  118. XIO_WRITE    EQU    2
  119. XIO_FREE    EQU    3
  120. XIO_ABORT    EQU    4
  121. XIO_GETBUF    EQU    5
  122. XIO_SEEK    EQU    6
  123. XIO_TOTSIZE    EQU    7
  124.  
  125. ******************************************************************************
  126. *
  127. *
  128. *   The progress report interface
  129. *
  130. *
  131.  STRUCTURE    XpkProgress,0
  132.     LONG    xp_Type        ; Type of report: start/cont/end/abort
  133.     APTR    xp_PackerName    ; Brief name of packer being used
  134.     APTR    xp_PackerLongName ; Descriptive name of packer being used
  135.     APTR    xp_Activity    ; Packing/unpacking message
  136.     APTR    xp_FileName    ; Name of file being processed, if available
  137.     LONG    xp_CCur        ; Amount of packed data already processed
  138.     LONG    xp_UCur        ; Amount of unpacked data already processed
  139.     LONG    xp_ULen        ; Amount of unpacked data in file
  140.     LONG    xp_CF        ; Compression factor so far
  141.     LONG    xp_Done        ; Percentage done already
  142.     LONG    xp_Speed    ; Bytes per second, from beginning of stream
  143.     STRUCT    xp_Reserved,8*4    ; For future use
  144.     LABEL    xp_SIZEOF
  145.  
  146. XPKPROG_START    EQU    1
  147. XPKPROG_MID    EQU    2
  148. XPKPROG_END    EQU    3
  149.  
  150. *****************************************************************************
  151. *
  152. *
  153. *       The file info block
  154. *
  155. *
  156.  STRUCTURE    XpkFib,0
  157.     LONG    xf_Type        ; Unpacked, packed, archive?
  158.     LONG    xf_ULen        ; Uncompressed length
  159.     LONG    xf_CLen        ; Compressed length
  160.     LONG    xf_NLen        ; Next chunk len
  161.     LONG    xf_UCur        ; Uncompressed bytes so far
  162.     LONG    xf_CCur        ; Compressed bytes so far
  163.     LONG    xf_ID        ; 4 letter ID of packer
  164.     STRUCT    xf_Packer,6    ; 4 letter name of packer
  165.     WORD    xf_SubVersion    ; Required sublib version
  166.     WORD    xf_MasVersion    ; Required masterlib version
  167.     LONG    xf_Flags    ; Password?
  168.     STRUCT    xf_Head,16    ; First 16 bytes of orig. file
  169.     LONG    xf_Ratio    ; Compression ratio
  170.     STRUCT    xf_Reserved,8*4    ; For future use
  171.     LABEL    xf_SIZEOF
  172.  
  173. XPKTYPE_UNPACKED  EQU    0       ; Not packed
  174. XPKTYPE_PACKED      EQU    1       ; Packed file
  175. XPKTYPE_ARCHIVE   EQU    2       ; Archive
  176.  
  177. XPKFLAGS_PASSWORD EQU    $00000001    ; Password needed
  178. XPKFLAGS_SEEK      EQU    $00000002    ; Chunks are independent
  179. XPKFLAGS_NONSTD   EQU    $00000004       ; Nonstandard file format
  180. * defines added for xfdmaster support (version 4 revision 25) *
  181. XPKFLAGS_KEY16      EQU    $00000008    ; 16 bit key - for decrunching
  182. XPKFLAGS_KEY32      EQU    $00000010    ; 32 bit key - for decrunching
  183.  
  184. ******************************************************************************
  185. *
  186. *       The error messages
  187. *
  188. *
  189.  
  190. XPKERR_OK        EQU    0
  191. XPKERR_NOFUNC        EQU    -1    ; This function not implemented        
  192. XPKERR_NOFILES        EQU    -2    ; No files allowed for this function        
  193. XPKERR_IOERRIN        EQU    -3    ; Input error happened, look at Result2    
  194. XPKERR_IOERROUT        EQU    -4    ; Output error happened, look at Result2    
  195. XPKERR_CHECKSUM        EQU    -5    ; Check sum test failed            
  196. XPKERR_VERSION        EQU    -6    ; Packed file's version newer than lib's    
  197. XPKERR_NOMEM        EQU    -7    ; Out of memory                
  198. XPKERR_LIBINUSE        EQU    -8    ; For not-reentrant libraries        
  199. XPKERR_WRONGFORM    EQU    -9    ; Was not packed with this library        
  200. XPKERR_SMALLBUF        EQU    -10    ; Output buffer too small            
  201. XPKERR_LARGEBUF        EQU    -11    ; Input buffer too large            
  202. XPKERR_WRONGMODE    EQU    -12    ; This packing mode not supported        
  203. XPKERR_NEEDPASSWD    EQU    -13    ; Password needed for decoding this file    
  204. XPKERR_CORRUPTPKD     EQU    -14    ; Packed file is corrupt            
  205. XPKERR_MISSINGLIB     EQU    -15    ; Required library is missing        
  206. XPKERR_BADPARAMS     EQU    -16    ; Caller's TagList was screwed up          
  207. XPKERR_EXPANSION    EQU    -17    ; Would have caused data expansion         
  208. XPKERR_NOMETHOD       EQU    -18    ; Can't find requested method              
  209. XPKERR_ABORTED        EQU    -19    ; Operation aborted by user                
  210. XPKERR_TRUNCATED    EQU    -20    ; Input file is truncated            
  211. XPKERR_WRONGCPU       EQU    -21    ; Better CPU required for this library    
  212. XPKERR_PACKED         EQU    -22    ; Data are already XPacked            
  213. XPKERR_NOTPACKED      EQU    -23    ; Data not packed                
  214. XPKERR_FILEEXISTS     EQU    -24    ; File already exists            
  215. XPKERR_OLDMASTLIB     EQU    -25    ; Master library too old            
  216. XPKERR_OLDSUBLIB      EQU    -26    ; Sub library too old            
  217. XPKERR_NOCRYPT        EQU    -27    ; Cannot encrypt                
  218. XPKERR_NOINFO         EQU    -28    ; Can't get info on that packer        
  219. XPKERR_LOSSY        EQU    -29    ; This compression method is lossy        
  220. XPKERR_NOHARDWARE    EQU    -30    ; Compression hardware required        
  221. XPKERR_BADHARDWARE    EQU    -31    ; Compression hardware failed        
  222. XPKERR_WRONGPW        EQU    -32    ; Password was wrong                
  223. XPKERR_UNKNOWN        EQU    -33    ; unknown error cause
  224. XPKERR_REQTIMEOUT    EQU    -34    ; password request reached time out    */
  225.  
  226. XPKERRMSGSIZE        EQU    80    ; Maximum size of an error message        
  227.  
  228. *****************************************************************************
  229. *
  230. *
  231. *     The XpkQuery() call
  232. *
  233. *
  234.  
  235.  STRUCTURE XpkPackerInfo,0
  236.     STRUCT  xpi_Name,24         ; Brief name of the packer
  237.     STRUCT  xpi_LongName,32     ; Full name of the packer
  238.     STRUCT  xpi_Description,80  ; One line description of packer
  239.     LONG    xpi_Flags           ; Defined below
  240.     LONG    xpi_MaxChunk        ; Max input chunk size for packing
  241.     LONG    xpi_DefChunk        ; Default packing chunk size
  242.     UWORD   xpi_DefMode         ; Default mode on 0..100 scale
  243.     LABEL   xpi_SIZEOF
  244.  
  245. XPKIF_PK_CHUNK   EQU    $00000001   ; Library supplies chunk packing
  246. XPKIF_PK_STREAM  EQU    $00000002   ; Library supplies stream packing
  247. XPKIF_PK_ARCHIVE EQU    $00000004   ; Library supplies archive packing
  248. XPKIF_UP_CHUNK   EQU    $00000008   ; Library supplies chunk unpacking
  249. XPKIF_UP_STREAM  EQU    $00000010   ; Library supplies stream unpacking
  250. XPKIF_UP_ARCHIVE EQU    $00000020   ; Library supplies archive unpacking
  251. XPKIF_HOOKIO     EQU    $00000080   ; Uses full Hook I/O
  252. XPKIF_CHECKING   EQU    $00000400   ; Does its own data checking
  253. XPKIF_PREREADHDR EQU    $00000800   ; Unpacker pre-reads the next chunkhdr
  254. XPKIF_ENCRYPTION EQU    $00002000   ; Sub library supports encryption
  255. XPKIF_NEEDPASSWD EQU    $00004000   ; Sub library requires encryption
  256. XPKIF_MODES      EQU    $00008000   ; Sub library has different XpkMode's
  257. XPKIF_LOSSY      EQU    $00010000   ; Sub library does lossy compression
  258.  
  259.  STRUCTURE XpkMode,0
  260.     APTR    xm_Next          ; Chain to next descriptor for ModeDesc list
  261.     ULONG   xm_Upto          ; Maximum efficiency handled by this mode
  262.     ULONG   xm_Flags         ; Defined below
  263.     ULONG   xm_PackMemory    ; Extra memory required during packing
  264.     ULONG   xm_UnpackMemory  ; Extra memory during unpacking
  265.     ULONG   xm_PackSpeed     ; Approx packing speed in K per second
  266.     ULONG   xm_UnpackSpeed   ; Approx unpacking speed in K per second
  267.     UWORD   xm_Ratio         ; CF in 0.1% for AmigaVision executable
  268.     UWORD   xm_ChunkSize     ; Desired chunk size in K (!!) for this mode
  269.     STRUCT  xm_Description,10; 8 character mode description
  270.     LABEL   xm_SIZEOF
  271.  
  272. XPKMF_A3000SPEED EQU $00000001    ; Timings on A3000/25
  273. XPKMF_PK_NOCPU   EQU $00000002    ; Packing not heavily CPU dependent
  274. XPKMF_UP_NOCPU   EQU $00000004    ; Unpacking... (i.e. hardware modes)
  275.  
  276.  
  277. MAXPACKERS    EQU    100
  278.  
  279.  STRUCTURE XpkPackerList,0
  280.     ULONG    xpl_NumPackers
  281.     STRUCT    xpl_Packer,MAXPACKERS*6
  282.     LABEL    xpl_SIZEOF
  283.  
  284. *****************************************************************************
  285. *
  286. *
  287. *     The XpkPassRequest() call (library version 4)
  288. *
  289. *
  290.  
  291. XPK_PassChars      EQU    (XPK_TagBase+$50) ; which chars should be used
  292. XPK_PasswordBuf      EQU    (XPK_TagBase+$51) ; buffer to write password to
  293. XPK_PassBufSize      EQU    (XPK_TagBase+$52) ; size of password buffer
  294. XPK_Key16BitPtr      EQU    (XPK_TagBase+$53) ; pointer to UWORD var for key data
  295. XPK_Key32BitPtr      EQU    (XPK_TagBase+$54) ; pointer to ULONG var for key data
  296. XPK_PubScreen      EQU    (XPK_TagBase+$55) ; pointer to struct Screen
  297. XPK_PassTitle      EQU    (XPK_TagBase+$56) ; Text shown in Screen title
  298. XPK_TimeOut      EQU    (XPK_TagBase+$57) ; Timeout time of requester in seconds
  299. * request position and verify tags (version 4 revision 25) *
  300. XPK_PassWinLeft      EQU    (XPK_TagBase+$58) ; distance from left screen border
  301. XPK_PassWinTop      EQU    (XPK_TagBase+$59) ; distance form top screen border
  302. XPK_PassWinWidth  EQU    (XPK_TagBase+$5A) ; width of requester window
  303. XPK_PassWinHeight EQU    (XPK_TagBase+$5B) ; height of requester window
  304. XPK_PassCenter    EQU    (XPK_TagBase+$5C) ; Left and Top are used as center coords
  305. XPK_PassVerify      EQU   (XPK_TagBase+$5D) ; force user to verify password
  306.  
  307. * XPKPASSFF defines for XPK_PassChars. Do not use. Use XPKPASSFLG defines *
  308.  
  309. XPKPASSFF_30x39     EQU    $0001 ; all numbers
  310. XPKPASSFF_41x46        EQU    $0002 ; chars 'A' to 'F'
  311. XPKPASSFF_61x66     EQU    $0004 ; chars 'a' to 'f'
  312. XPKPASSFF_47x5A        EQU    $0008 ; chars 'G' to 'Z'
  313. XPKPASSFF_67x7A        EQU    $0010 ; chars 'g' to 'z'
  314. XPKPASSFF_20        EQU    $0020 ; space character
  315. XPKPASSFF_SPECIAL7BIT    EQU    $0040 ; special 7 bit chars
  316.             ; all chars 0x20 to 0x7E without above defined
  317.  
  318. XPKPASSFF_C0xDE        EQU    $0080 ; upper special chars
  319. XPKPASSFF_DFxFF        EQU    $0100 ; lower special chars
  320. XPKPASSFF_SPECIAL8BIT    EQU    $0200 ; special 8 bit chars
  321.             ; all chars 0xA0 to 0xBF
  322.  
  323. * Control characters (0x00 to 0x1F, 0x7F and 0x80 to 0x9F) are not
  324. * useable. This also means carriage return, linefeed, tab stop and
  325. * other controls are not usable.
  326.  
  327. * flags for XPK_PassChars, XPKPASSFLG_PRINTABLE is default
  328. *
  329. * NUMERIC    : numbers
  330. * HEXADECIMAL    : hex numbers
  331. * ALPHANUMERIC    : numbers and letters
  332. * INTALPHANUM    : numbers and international letters
  333. * ASCII7    : 7 Bit ASCII
  334. * PRINTABLE    : all characters
  335.  
  336. XPKPASSFLG_NUMERIC    EQU    XPKPASSFF_30x39
  337. XPKPASSFLG_HEXADECIMAL    EQU    (XPKPASSFF_30x39|XPKPASSFF_41x46|XPKPASSFF_61x66)
  338. XPKPASSFLG_ALPHANUMERIC    EQU    (XPKPASSFLG_HEXADECIMAL|XPKPASSFF_47x5A|XPKPASSFF_67x7A)
  339. XPKPASSFLG_INTALPHANUM    EQU    (XPKPASSFLG_ALPHANUMERIC|XPKPASSFF_C0xDE|XPKPASSFF_DFxFF)
  340. XPKPASSFLG_ASCII7    EQU    (XPKPASSFLG_ALPHANUMERIC|XPKPASSFF_SPECIAL7BIT)
  341. XPKPASSFLG_PRINTABLE    EQU    (XPKPASSFLG_INTALPHANUM|XPKPASSFF_SPECIAL7BIT|XPKPASSFF_SPECIAL8BIT|XPKPASSFF_20)
  342.  
  343. *****************************************************************************
  344. *
  345. *
  346. *     The XpkAllocObject() call (library version 4)
  347. *
  348. * use this always with library version >= 4, do NO longer allocate the
  349. * structures yourself
  350. *
  351. *
  352.  
  353. XPKOBJ_FIB        EQU    0 ; XpkFib structure
  354. XPKOBJ_PACKERINFO    EQU    1 ; XpkPackerInfo structure
  355. XPKOBJ_MODE        EQU    2 ; XpkMode structure
  356. XPKOBJ_PACKERLIST    EQU    3 ; XpkPackerList structure
  357.  
  358.     ENDC
  359.