Go to the documentation of this file.
00001 /* Copyright (C) 2001-2007 Peter Selinger.
00002    This file is part of Potrace. It is free software and it is covered
00003    by the GNU General Public License. See the file COPYING for details. */
00005 /* $Id: lzw.h 147 2007-04-09 00:44:09Z selinger $ */
00007 #define LZW_NORMAL 0
00008 #define LZW_EOD 1
00010 /* user visible state */
00012 struct lzw_stream_s {
00013   char *next_in;     /* pointer to next input character */
00014   int avail_in;      /* number of input chars available */
00015   char *next_out;    /* pointer to next free byte in output buffer */
00016   int avail_out;     /* remaining size of output buffer */
00018   void *internal;    /* internal state, not user accessible */
00019 };
00020 typedef struct lzw_stream_s lzw_stream_t;
00022 /* user visible functions */
00024 /* The interface for compression and decompression is the same.  The
00025    application must first call lzw_init to create and initialize a
00026    compression object.  Then it calls lzw_compress on this object
00027    repeatedly, as follows: next_in and next_out must point to valid,
00028    non-overlapping regions of memory of size at least avail_in and
00029    avail_out, respectively.  The lzw_compress function will read and
00030    process as many input bytes as possible as long as there is room in
00031    the output buffer. It will update next_in, avail_in, next_out, and
00032    avail_out accordingly. Some input may be consumed without producing
00033    any output, or some output may be produced without consuming any
00034    input. However, the lzw_compress function makes progress in the
00035    sense that, after calling this function, at least one of avail_in
00036    or avail_out is guaranteed to be 0. The mode flag is normally set
00037    to LZW_NORMAL. It can be set to LZW_EOD (end of data) to indicate
00038    that the current input buffer represents the entire remaining input
00039    data stream.  When called with mode=LZW_EOD, and avail_out is
00040    non-zero after the call, then the application may conclude that the
00041    end of output has been reached. (However, if avail_out==0 after the
00042    call, then lzw_compress should be called again with the remaining
00043    input, if any). Finally, lzw_free should be called to deallocate
00044    the lzw_stream. Lzw_init returns NULL on error, with errno
00045    set. Lzw_compress returns 0 on success, and 1 on error with errno
00046    set. EINVAL is used to indicate an internal error, which should not
00047    happen. */
00049 lzw_stream_t *lzw_init(void);
00050 int lzw_compress(lzw_stream_t *s, int mode);
00051 void lzw_free(lzw_stream_t *s);
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Author(s): Niklas Meinzer, Ina Baumgarten
autogenerated on Wed Dec 26 2012 16:00:43