PackIt bsp.h

/*		Bit-stream Pipe Definitions

	These definitions are used in conjunction with the BSP (bit-stream pipe) module.

	Initial coding 4/9/86 by Harry R. Chesley.

	© Copyright 1986 by Harry R. Chesley.
	All rights reserved.
*/

struct Bsp {				/* A bit-stream pipe. */
	char *block;			/* Pointer to bit-stream block. */
	char *endBlock;			/* Pointer to the last byte of the bit-stream. */
	char *margin;			/* Byte at which to start applying the breaks. */
	char *inPtr;			/* Current ingoing bit-stream byte. */
	int inCnt;				/* Number of bits left in current ingoing byte. */
	char *outPtr;			/* Current outgoing bit-stream byte. */
	int outCnt;				/* Number of bits left in current outgoing byte. */
	int eos;				/* TRUE if at end-of-stream. */
	int (*getFunc)();		/* Function to call when bit-stream empties. */
	struct Bsp *fromBsp;	/* Bit-stream to pass to bspFunc(). */
	long refVal;			/* User-settable reference number. */
	int storAllo;			/* TRUE if we allocated the BSP storage. */
	int blockAllo;			/* TRUE if we allocated the block storage. */
};

typedef struct Bsp Bsp;
typedef Bsp * BspPtr;

/* Stream-stuffing function messages: */

#define INITBSP 0		/* Initialize and return the margin. */
#define STUFFBSP 1		/* Fill up the bit-stream. */
#define REWINDBSP 2		/* Rewind the stream. */

BspPtr NewBsp();
long BlkDecode();