cfitsio  3390
Data Structures | Macros | Typedefs | Functions | Variables
zuncompress.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
Include dependency graph for zuncompress.c:

Data Structures

union  bytes
 

Macros

#define get_char()   get_byte()
 
#define OF(args)   args
 
#define memzero(s, n)    memset ((voidp)(s), 0, (n))
 
#define MINZIP(a, b)   ((a) <= (b) ? (a) : (b))
 
#define OK   0
 
#define ERROR   1
 
#define COMPRESSED   1
 
#define DEFLATED   8
 
#define INBUFSIZ   0x8000 /* input buffer size */
 
#define INBUF_EXTRA   64 /* required by unlzw() */
 
#define OUTBUFSIZ   16384 /* output buffer size */
 
#define OUTBUF_EXTRA   2048 /* required by unlzw() */
 
#define DIST_BUFSIZE   0x8000 /* buffer for distances, see trees.c */
 
#define WSIZE   0x8000 /* window size--must be a power of two, and */
 
#define DECLARE(type, array, size)   type array[size]
 
#define tab_suffix   window
 
#define tab_prefix   prev /* hash link (see deflate.c) */
 
#define head   (prev+WSIZE) /* hash head (see deflate.c) */
 
#define LZW_MAGIC   "\037\235" /* Magic header for lzw files, 1F 9D */
 
#define get_byte()   (inptr < insize ? inbuf[inptr++] : fill_inbuf(0))
 
#define Assert(cond, msg)
 
#define Trace(x)
 
#define Tracev(x)
 
#define Tracevv(x)
 
#define Tracec(c, x)
 
#define Tracecv(c, x)
 
#define BITS   16
 
#define INIT_BITS   9 /* Initial number of bits per code */
 
#define BIT_MASK   0x1f /* Mask for 'number of compression bits' */
 
#define BLOCK_MODE   0x80
 
#define LZW_RESERVED   0x60 /* reserved bits */
 
#define CLEAR   256 /* flush the dictionary */
 
#define FIRST   (CLEAR+1) /* first free entry */
 
#define local   static
 
#define MAXCODE(n)   (1L << (n))
 
#define REGISTERS   2
 
#define REG1
 
#define REG2
 
#define REG3
 
#define REG4
 
#define REG5
 
#define REG6
 
#define REG7
 
#define REG8
 
#define REG9
 
#define REG10
 
#define REG11
 
#define REG12
 
#define REG13
 
#define REG14
 
#define REG15
 
#define REG16
 
#define REG1   register
 
#define REG2   register
 
#define BYTEORDER   0000
 
#define NOALLIGN   0
 
#define input(b, o, c, n, m)
 
#define tab_prefixof(i)   tab_prefix[i]
 
#define clear_tab_prefixof()   memzero(tab_prefix, 256);
 
#define de_stack   ((char_type *)(&d_buf[DIST_BUFSIZE-1]))
 
#define tab_suffixof(i)   tab_suffix[i]
 

Typedefs

typedef void * voidp
 
typedef unsigned char uch
 
typedef unsigned short ush
 
typedef unsigned long ulg
 
typedef int file_t
 
typedef unsigned char char_type
 
typedef long code_int
 
typedef unsigned long count_int
 
typedef unsigned short count_short
 
typedef unsigned long cmp_code_int
 

Functions

void ffpmsg (const char *err_message)
 
local int fill_inbuf OF ((int eof_ok))
 
local void write_buf OF ((voidp buf, unsigned cnt))
 
local void error OF ((char *m))
 
local int unlzw OF ((FILE *in, FILE *out))
 
int work OF ((FILE *infile, FILE *outfile))
 
int zuncompress2mem (char *filename, FILE *diskfile, char **buffptr, size_t *buffsize, void *(*mem_realloc)(void *p, size_t newsize), size_t *filesize, int *status)
 
local int unlzw (FILE *in, FILE *out)
 
local int fill_inbuf (int eof_ok)
 
local void write_buf (voidp buf, unsigned cnt)
 
local void error (char *m)
 

Variables

void *(* realloc_fn )(void *p, size_t newsize)
 
int block_mode = BLOCK_MODE
 

Macro Definition Documentation

#define Assert (   cond,
  msg 
)
#define BIT_MASK   0x1f /* Mask for 'number of compression bits' */
#define BITS   16
#define BLOCK_MODE   0x80
#define BYTEORDER   0000
#define CLEAR   256 /* flush the dictionary */
#define clear_tab_prefixof ( )    memzero(tab_prefix, 256);
#define COMPRESSED   1
#define de_stack   ((char_type *)(&d_buf[DIST_BUFSIZE-1]))
#define DECLARE (   type,
  array,
  size 
)    type array[size]
#define DEFLATED   8
#define DIST_BUFSIZE   0x8000 /* buffer for distances, see trees.c */
#define ERROR   1
#define FIRST   (CLEAR+1) /* first free entry */
#define get_byte ( )    (inptr < insize ? inbuf[inptr++] : fill_inbuf(0))
#define get_char ( )    get_byte()
#define head   (prev+WSIZE) /* hash head (see deflate.c) */
#define INBUF_EXTRA   64 /* required by unlzw() */
#define INBUFSIZ   0x8000 /* input buffer size */
#define INIT_BITS   9 /* Initial number of bits per code */
#define input (   b,
  o,
  c,
  n,
 
)
Value:
{ \
REG1 char_type *p = &(b)[(o)>>3]; \
(c) = ((((long)(p[0]))|((long)(p[1])<<8)| \
((long)(p[2])<<16))>>((o)&0x7))&(m); \
(o) += (n); \
}
unsigned char char_type
Definition: zuncompress.c:188
#define local   static
#define LZW_MAGIC   "\037\235" /* Magic header for lzw files, 1F 9D */
#define LZW_RESERVED   0x60 /* reserved bits */
#define MAXCODE (   n)    (1L << (n))
#define memzero (   s,
 
)    memset ((voidp)(s), 0, (n))
#define MINZIP (   a,
 
)    ((a) <= (b) ? (a) : (b))
#define NOALLIGN   0
#define OF (   args)    args
#define OK   0
#define OUTBUF_EXTRA   2048 /* required by unlzw() */
#define OUTBUFSIZ   16384 /* output buffer size */
#define REG1
#define REG1   register
#define REG10
#define REG11
#define REG12
#define REG13
#define REG14
#define REG15
#define REG16
#define REG2
#define REG2   register
#define REG3
#define REG4
#define REG5
#define REG6
#define REG7
#define REG8
#define REG9
#define REGISTERS   2
#define tab_prefix   prev /* hash link (see deflate.c) */
#define tab_prefixof (   i)    tab_prefix[i]
#define tab_suffix   window
#define tab_suffixof (   i)    tab_suffix[i]
#define Trace (   x)
#define Tracec (   c,
 
)
#define Tracecv (   c,
 
)
#define Tracev (   x)
#define Tracevv (   x)
#define WSIZE   0x8000 /* window size--must be a power of two, and */

Typedef Documentation

typedef unsigned char char_type
typedef unsigned long cmp_code_int
typedef long code_int
typedef unsigned long count_int
typedef unsigned short count_short
typedef int file_t
typedef unsigned char uch
typedef unsigned long ulg
typedef unsigned short ush
typedef void* voidp

Function Documentation

local void error ( char *  m)

Here is the call graph for this function:

Here is the caller graph for this function:

void ffpmsg ( const char *  err_message)

put message on to error stack

Here is the call graph for this function:

local int fill_inbuf ( int  eof_ok)

Here is the call graph for this function:

local int fill_inbuf OF ( (int eof_ok)  )
local void write_buf OF ( (voidp buf, unsigned cnt)  )
local void error OF ( (char *m)  )
local int unlzw OF ( (FILE *in, FILE *out)  )
int work OF ( (FILE *infile, FILE *outfile)  )
local int unlzw ( FILE *  in,
FILE *  out 
)

Here is the call graph for this function:

Here is the caller graph for this function:

local void write_buf ( voidp  buf,
unsigned  cnt 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int zuncompress2mem ( char *  filename,
FILE *  diskfile,
char **  buffptr,
size_t *  buffsize,
void *(*)(void *p, size_t newsize)  mem_realloc,
size_t *  filesize,
int *  status 
)

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int block_mode = BLOCK_MODE
void*(* realloc_fn) (void *p, size_t newsize)