lzw.h

Go to the documentation of this file.
00001 
00006 /*
00007  * Copyright (C) 2005 Mike Frysinger <vapier@gmail.com>
00008  * Released into the public domain
00009  *
00010  * $Header: /cvsroot/freestdf/liblzw/lzw.h,v 1.3 2006/01/08 05:58:12 vapier Exp $
00011  */
00012 
00013 #ifndef _LZW_H
00014 #define _LZW_H
00015 
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019 
00020 #define LZW_MAGIC_1 0x1F
00021 #define LZW_MAGIC_2 0x9D
00022 #define LZW_MAGIC   "\037\235"
00023 
00024 #ifdef __IN_LIBLZW
00025 # define HBITS   17         /* 50% occupancy */
00026 # define HSIZE   (1<<HBITS)
00027 # define HMASK   (HSIZE-1)
00028 # define HPRIME  9941
00029 
00030 typedef struct {
00031     int fd;
00032     int eof;
00033 
00034     unsigned char *inbuf, *outbuf, *stackp;
00035     unsigned char *unreadbuf;
00036     size_t stackp_diff;
00037     size_t insize, outpos;
00038     ssize_t rsize;
00039 
00040     unsigned char flags;
00041     int maxbits, block_mode;
00042 
00043     unsigned long int htab[HSIZE];
00044     unsigned short codetab[HSIZE];
00045 
00046     int n_bits, posbits, inbits, bitmask, finchar;
00047     long int maxcode, oldcode, incode, code, free_ent;
00048 } lzwFile;
00049 
00050 #else
00051 typedef void lzwFile;
00052 #endif
00053 
00054 extern lzwFile *lzw_open(const char*, int, ...);
00055 extern lzwFile* lzw_fdopen(int);
00056 extern int lzw_close(lzwFile*);
00057 extern ssize_t lzw_read(lzwFile*, void*, size_t);
00058 
00059 #ifdef __cplusplus
00060 }
00061 #endif
00062 
00063 #endif /* _LZW_H */

Generated on Thu Jun 8 14:05:35 2006 for libstdf by  doxygen 1.4.6