|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Data Structures | |
| struct | imcode |
| struct | imwork |
| struct | crmbits |
| struct | ppbits |
Macros | |
| #define | RB(p) |
| #define | RW(p) |
| #define | RL(p) |
| #define | ID_IMP 0x494d5021UL /* "IMP!" */ |
| #define | ID_CRM 0x43724d21UL /* "CrM!" */ |
| #define | ID_CRM2 0x43724d32UL /* "CrM2" */ |
| #define | ID_PP20 0x50503230UL /* "PP20" */ |
| #define | WS sizeof(struct imwork) |
| #define | IMOFF(m) |
| #define | ST(m) |
| #define | IMELEM(m) |
| #define | STA(m, i) |
| #define | OCMPTAB (offsetof(typeof(tabbs), cmptab) - 2) |
| #define | OADDTAB (offsetof(typeof(tabbs), addtab) - 2) |
| #define | OREALTAB (offsetof(typeof(tabbs), realtab) - 2) |
| #define | OANZPERBITS (offsetof(typeof(tabbs), anzperbits) - 2) |
Typedefs | |
| typedef LONG | infofunc(ULONG gain) |
Functions | |
| ULONG | _startcrunch (UBYTE *buf, ULONG len) |
| Implode(Bufferadr,DataLen): crunches the data in place with the Imploder algorithm. | |
| BB_BOOL | _decrunch (UBYTE *buf) |
| Deplode(Startadr): decrunches Imploder data in place. | |
| void | _crm (void) |
| void | _crm2 (void) |
| void | _ppdecrunch (void) |
| static LONG | own (ULONG gain) |
| static int | im26 (UBYTE *st) |
| static ULONG | im37 (UBYTE *st, UBYTE nbits, ULONG value) |
| static int | im28 (UBYTE *st) |
| static int | im40 (UBYTE *st, ULONG len, ULONG offset) |
| static int | im55 (UBYTE *st) |
| static void | literal (UBYTE *st) |
| static ULONG | implode (UBYTE *buf, ULONG len, infofunc *info, ULONG mode, UBYTE *tabout) |
| static int | imbit (UBYTE *bitbuf, const UBYTE **src) |
| static BB_BOOL | deplode (UBYTE *buf) |
| static ULONG | ror32 (ULONG v, unsigned n) |
| static ULONG | rol32 (ULONG v, unsigned n) |
| static int | crmbit (struct crmbits *b) |
| static UWORD | crmgetbits (struct crmbits *b, UWORD n) |
| static void | crminit (struct crmbits *b, const UBYTE *end) |
| static void | fastdecruncher (UBYTE *dst, const UBYTE *src, ULONG dstlen, ULONG srclen) |
| static BOOL | readtab (struct crmbits *b, UWORD maxbits, UBYTE *counts, UBYTE *codes, UWORD room) |
| static void | calccmptab (const UBYTE *counts, UBYTE *cmp) |
| static UWORD | readit (struct crmbits *b, const UBYTE *cmp, const UBYTE *real) |
| static void | lzhdecruncher (UBYTE *dst, const UBYTE *src, ULONG dstlen, ULONG srclen) |
| static void | overlapdecrunch (const UBYTE *src, UBYTE *dst) |
| static void | crm_c (const UBYTE *src) |
| CrMDecrunch Bufferadr: decrunches Crunch-Mania data ("CrM!" or "CrM2") in place. | |
| BLITZ_ALIAS (_crm, crm_c) | |
| static void | crm2_c (const UBYTE *src, UBYTE *dst) |
| CrMDecrunch Bufferadr,Destinationadr: decrunches Crunch-Mania data ("CrM!" or "CrM2") to a destination. | |
| BLITZ_ALIAS (_crm2, crm2_c) | |
| static int | ppbit (struct ppbits *b) |
| static UWORD | ppread (struct ppbits *b, UWORD n) |
| static void | ppdecrunch (const UBYTE *file, const UBYTE *end, UBYTE *dest) |
| static void | ppdecrunch_c (const UBYTE *start, const UBYTE *end, UBYTE *dest) |
| PPDecrunch Bufferadr,Bufferend,Destinationadr: decrunches a PowerPacker file ("PP20"). | |
| BLITZ_ALIAS (_ppdecrunch, ppdecrunch_c) | |
Variables | |
| static const ULONG | imtab0 [12] |
| static const ULONG | imtab1 [36] |
| static const ULONG | imtab2 [2] = { 0x2060E, 0x1020304 } |
| static const ULONG | imtab3 [3] = { 0x1010101, 0x2030304, 0x405070E } |
| static const ULONG | imtab4 [6] |
| static const UBYTE | I1F8C [4] = { 0x06, 0x0a, 0x0a, 0x12 } |
| static const UBYTE | I1F90 [12] |
| struct { | |
| UWORD zero | |
| UWORD cmptab [32] | |
| UWORD addtab [32] | |
| UWORD realtab [527] | |
| UWORD anzperbits [32] | |
| } | tabbs |
| #define ID_CRM 0x43724d21UL /* "CrM!" */ |
| #define ID_CRM2 0x43724d32UL /* "CrM2" */ |
| #define ID_IMP 0x494d5021UL /* "IMP!" */ |
| #define ID_PP20 0x50503230UL /* "PP20" */ |
| #define IMOFF | ( | m | ) |
| #define OANZPERBITS (offsetof(typeof(tabbs), anzperbits) - 2) |
| #define RB | ( | p | ) |
| #define RL | ( | p | ) |
| #define RW | ( | p | ) |
| #define ST | ( | m | ) |
| #define STA | ( | m, | |
| i ) |
| #define WS sizeof(struct imwork) |
| typedef LONG infofunc(ULONG gain) |
| void _crm | ( | void | ) |
| void _crm2 | ( | void | ) |
| BB_BOOL _decrunch | ( | UBYTE * | buf | ) |
Deplode(Startadr): decrunches Imploder data in place.
BUG(orig) (#119), won't fix (see the head comment): the data are not checked: corrupt data write outside the buffer.
| buf | d0: the crunched data ("IMP!" header) |
| void _ppdecrunch | ( | void | ) |
| ULONG _startcrunch | ( | UBYTE * | buf, |
| ULONG | len ) |
Implode(Bufferadr,DataLen): crunches the data in place with the Imploder algorithm.
_startcrunch: Imploder "mode" 8, i.e. table 0 (window 128 bytes), no explode table. The first 12 bytes of the buffer become "IMP!", the length and the crunched length. The info routine (own) runs before every step: it writes the low word of (source - destination) to COLOR00 (the background flickers) and breaks on the left mouse button. BUG(orig) (#112), won't fix (see the head comment): the match search reads up to 254 bytes behind the data. BUG(orig) (#114), won't fix (see the head comment): a result of 0 after at least 64 bytes, or -1, leaves the buffer partly crunched. Not a bug (#113): after $4012 literal bytes in a row the rest is stored uncrunched.
| BLITZ_ALIAS | ( | _ppdecrunch | , |
| ppdecrunch_c | ) |
|
static |
|
static |
CrMDecrunch Bufferadr,Destinationadr: decrunches Crunch-Mania data ("CrM!" or "CrM2") to a destination.
_crm2: OverlapDecrunch; if the crunched data plus MinSecDist reach behind the start of the destination (signed comparison) they are first copied to MinSecDist bytes before the destination. All registers kept. BUG(orig) (#116), won't fix: that copy overwrites memory in front of the destination. Fixed (#115), (#117); BUG(orig) (#119), won't fix: see the one argument form.
| src | d0: the crunched data (with header) |
| dst | d1: the destination |
|
static |
CrMDecrunch Bufferadr: decrunches Crunch-Mania data ("CrM!" or "CrM2") in place.
_crm: OverlapDecrunch with destination = source: the crunched data are first copied to MinSecDist bytes before the buffer. Other data than "CrM!"/"CrM2" are left alone. All registers kept. BUG(orig) (#116), won't fix (see the head comment): up to MinSecDist bytes of memory in front of the buffer are overwritten. Fixed (#115): the copy of (CrLen>>2) longs ran 4 GB for a crunched length below 4. Fixed (#117): CrM2 tables with a count of 0 read 65536 entries (now the decrunch ends). BUG(orig) (#119), won't fix: no checks of the data.
| src | d0: the crunched data (with header), also the destination |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
PPDecrunch Bufferadr,Bufferend,Destinationadr: decrunches a PowerPacker file ("PP20").
_ppdecrunch: the last long of the packed file holds the original length and the number of empty bits; other files than "PP20" are left alone. All registers kept. Fixed (#118): an efficiency value outside 1-15 unpacks nothing (the original read 65536 bits for a value of 0 and unpacked garbage). BUG(orig) (#119), won't fix: no other checks of the data.
| start | d0: the packed file |
| end | d1: the end of the packed file |
| dest | d2: the destination |
|
static |
|
static |
|
static |
|
static |
|
static |
| UWORD addtab[32] |
| UWORD anzperbits[32] |
| UWORD cmptab[32] |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| UWORD realtab[527] |
| struct { ... } tabbs |
| UWORD zero |