home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 106 / EnigmaAmiga106CD.iso / software / utilities / xpk_develop / include / asm / xpk / xpk.i next >
Encoding:
Text File  |  1998-11-09  |  14.5 KB  |  372 lines

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