File: flate.h

package info (click to toggle)
libtioga-ruby 1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 10,460 kB
  • ctags: 3,986
  • sloc: ansic: 38,451; ruby: 16,774; sh: 172; makefile: 111
file content (98 lines) | stat: -rw-r--r-- 3,955 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* flate.h -- c interface for the Ruby Flate extension
*/

/*
   Copyright (C) 2005  Bill Paxton

   Flate is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Library Public License as published
   by the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   Flate is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with Flate; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/


/* This file has been heavily modified by Vincent Fourmond for the 'RCR330'
   symbol export scheme 
*/
#ifndef __flate_H__
#define __flate_H__

#include <symbols.h>

DECLARE_SYMBOL(int, flate_compress, 
	       (unsigned char *new_ptr, unsigned long *new_len_ptr, 
		unsigned char *ptr, long len));
// source is given by ptr and is len bytes in length.
// new_ptr is destination buffer of size *new_len_ptr.  
// NOTE: the destination buffer for flate_compress should be LARGER than the source buffer to be safe.
// The minimal extra is 0.1% larger than the source plus 12 bytes.
// My rule is to use (len * 11)/10 + 100 just to be sure.
DECLARE_SYMBOL(int, flate_expand,
	       (unsigned char **new_ptr_ptr, unsigned long *new_len_ptr, 
		unsigned char *ptr, long len));
// source is given by ptr and is len bytes in length.
// *new_ptr_ptr is destination buffer of size *new_len_ptr.  
// NOTE: the destination buffer for flate_expand will be reallocated if it isn't large enough.
// So you MUST allocate a buffer rather than using a static one.
// And you MUST be prepared for the buffer to change location and size.

// Here are the return codes for the compression/expansion functions. Negative
// values are errors, positive values are used for special but normal events.

#define FLATE_OK              0
#define FLATE_STREAM_END      1
#define FLATE_NEED_DICT       2
#define FLATE_ERRNO         (-1)
#define FLATE_STREAM_ERROR  (-2)
#define FLATE_DATA_ERROR    (-3)
#define FLATE_MEM_ERROR     (-4)
#define FLATE_BUF_ERROR     (-5)
#define FLATE_VERSION_ERROR (-6)

// If this simple interface isn't enough for your needs, the next stop is zlib.h
// for the full interface.

// The internals of this package come from the 'zlib' compression library which
// carries the following copyright:

/* 'zlib' general purpose compression library
  version 1.2.2, October 3rd, 2004

  Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

  Jean-loup Gailly        Mark Adler
  jloup@gzip.org          madler@alumni.caltech.edu


  The data format used by the zlib library is described by RFCs (Request for
  Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
*/


#endif   /* __flate_H__ */