cfitsio  4.0.0
About: CFITSIO is a library of C and Fortran subroutines for reading and writing data files in the FITS (Flexible Image Transport System) data format.
  Fossies Dox: cfitsio-4.0.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

zuncompress.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
Include dependency graph for zuncompress.c:

Go to the source code of this file.

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)
  More...
 
#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)
  More...
 
static int fill_inbuf (int eof_ok)
  More...
 
static void write_buf (voidp buf, unsigned cnt)
  More...
 
static void error (char *m)
  More...
 
static int unlzw (FILE *in, FILE *out)
  More...
 
int zuncompress2mem (char *filename, FILE *diskfile, char **buffptr, size_t *buffsize, void *(*mem_realloc)(void *p, size_t newsize), size_t *filesize, int *status)
  More...
 

Variables

int(* work )(FILE *infile, FILE *outfile) = unlzw
  More...
 
static uch inbuf [0x8000+64]
  More...
 
static uch outbuf [16384+2048]
  More...
 
static ush d_buf [0x8000]
 
static uch window [2L *0x8000]
 
static ush prev [1L<< 16]
 
static int maxbits = 16
  More...
 
static int method = 8
  More...
 
static int exit_code = 0
  More...
 
static int last_member
  More...
 
static long bytes_in
  More...
 
static long bytes_out
  More...
 
static char ifname [128]
  More...
 
static FILE * ifd
  More...
 
static FILE * ofd
  More...
 
static void ** memptr
  More...
 
static size_t * memsize
  More...
 
void *(* realloc_fn )(void *p, size_t newsize)
  More...
 
static unsigned insize
  More...
 
static unsigned inptr
  More...
 
int block_mode = 0x80
  More...
 

Macro Definition Documentation

◆ input

#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

Definition at line 317 of file zuncompress.c.