home *** CD-ROM | disk | FTP | other *** search
- Some remarks for sublib writers
- -------------------------------
-
- Most important: Talk to me. I'll check your libs and help you where needed.
- My address: umueller@amiga.physik.unizh.ch
-
- How XpkPackChunk works:
- - Check xpar->Sub[0]. If it's 0, this is the first call. Allocate your tables
- and store pointers to them in Sub[0] .. Sub[3].
- - Read xpar->InLen bytes from xpar->InBuf and pack them to xpar->OutBuf.
- Don't exceed xpar->OutBufLen. Store packed len in xpar->OutLen.
-
- How XpkUnpackChunk works:
- - Check xpar->Sub[0]. If it's 0, this is the first call. Allocate your tables
- and store pointers to them in Sub[0] .. Sub[3].
- - Read xpar->InLen bytes from xpar->InBuf and unpack them to xpar->OutBuf.
- Don't exceed xpar->OutBufLen. Maybe compare uncompressed len with
- xpar->OutLen.
-
- Other notes:
- - Your library should, of course, be re-entrant. This means no PC-relative
- addressing of writeable data. Whatever you have, store a pointer to it
- somewhere in the XpkSubMessage. You can detect the first chunk of a file
- by the fact that this pointer is still NULL. In case your lib is
- not re-entrant, return XPKERR_LIBINUSE when required.
-
- - There will be no larger chunks on (de)compression than the first one.
-
- - On compression, you may expand the data by XPK_MARGIN bytes maximum. This
- means the output buffer is as large as the input buffer plus XPK_MARGIN.
- Compression libs would, of course, already return XPKERR_EXPANSION if
- they exceed the input buffer.
-
- - You must supply a function XpkPackReset, which clears all tables so
- that the next chunk will be able to be unpacked independently. You also
- have to call it before returning XPKERR_EXPANSION!
-
- - On decompression, you will also have a XPK_MARGIN byte saftey margin for
- runaway unpacking.
-
- - Fill in one XINFO structure. See libraries/xpksub.h for the meanings of
- the fields therein.
-
- - If your packer has only one packing mode, fill in one XMINFO structure
- (see xpk.h). Set the 'Upto' field to 100, this means this struct handles
- all modes up to (and including) 100, which is the max packing mode. Place
- a pointer to this struct in the XINFO structure.
-
- - There must be at least one XMINFO structure, and the last XMINFO
- structure must have the Upto set to 100. It must!
-
- - If your packer has several modes, create several XMINFO structures and
- sort them by efficiency in ascending order. Place a pointer to them
- in XINFO. Set the XPKIF_MODES flag in the Flag field of XINFO.
-
- - Your packer will get the 0..100 number and is responsible of mapping
- it to its own packing modes.
-
- - Set the DefMde field to some 0...100 number.
-
- - If XSF_STEPDOWN is set in the Flags field of the SubParams structure,
- you are allowed to reduce packing efficiency in order to save mem.
-