tioga 1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Tioga_README +372 -0
- data/lgpl.txt +504 -0
- data/split/Dtable/defs.h +33 -0
- data/split/Dtable/dtable.c +1928 -0
- data/split/Dtable/dtable_intern.h +144 -0
- data/split/Dtable/dvector.h +61 -0
- data/split/Dtable/extconf.rb +4 -0
- data/split/Dtable/include/dtable.h +35 -0
- data/split/Dtable/lib/Dtable_extras.rb +90 -0
- data/split/Dtable/namespace.h +47 -0
- data/split/Dtable/safe_double.h +104 -0
- data/split/Dtable/symbols.c +92 -0
- data/split/Dtable/symbols.h +52 -0
- data/split/Dvector/defs.h +33 -0
- data/split/Dvector/dvector.c +5486 -0
- data/split/Dvector/dvector_intern.h +142 -0
- data/split/Dvector/extconf.rb +4 -0
- data/split/Dvector/include/dvector.h +61 -0
- data/split/Dvector/lib/Dvector_extras.rb +328 -0
- data/split/Dvector/lib/Numeric_extras.rb +134 -0
- data/split/Dvector/namespace.h +47 -0
- data/split/Dvector/safe_double.h +104 -0
- data/split/Dvector/symbols.c +92 -0
- data/split/Dvector/symbols.h +52 -0
- data/split/Flate/defs.h +33 -0
- data/split/Flate/extconf.rb +19 -0
- data/split/Flate/flate.c +156 -0
- data/split/Flate/flate_intern.h +97 -0
- data/split/Flate/include/flate.h +98 -0
- data/split/Flate/namespace.h +47 -0
- data/split/Flate/safe_double.h +104 -0
- data/split/Flate/symbols.c +92 -0
- data/split/Flate/symbols.h +52 -0
- data/split/Function/defs.h +33 -0
- data/split/Function/dvector.h +61 -0
- data/split/Function/extconf.rb +4 -0
- data/split/Function/function.c +988 -0
- data/split/Function/joint_qsort.c +258 -0
- data/split/Function/lib/Function_extras.rb +44 -0
- data/split/Function/namespace.h +47 -0
- data/split/Function/safe_double.h +104 -0
- data/split/Function/symbols.c +92 -0
- data/split/Function/symbols.h +52 -0
- data/split/Tioga/axes.c +774 -0
- data/split/Tioga/defs.h +33 -0
- data/split/Tioga/dtable.h +35 -0
- data/split/Tioga/dvector.h +61 -0
- data/split/Tioga/extconf.rb +4 -0
- data/split/Tioga/figures.c +672 -0
- data/split/Tioga/figures.h +855 -0
- data/split/Tioga/flate.h +98 -0
- data/split/Tioga/init.c +524 -0
- data/split/Tioga/lib/Arcs_and_Circles.rb +64 -0
- data/split/Tioga/lib/ColorConstants.rb +274 -0
- data/split/Tioga/lib/Colorbars.rb +10 -0
- data/split/Tioga/lib/Colormaps.rb +105 -0
- data/split/Tioga/lib/Coordinate_Conversions.rb +194 -0
- data/split/Tioga/lib/Creating_Paths.rb +94 -0
- data/split/Tioga/lib/Doc.rb +91 -0
- data/split/Tioga/lib/Executive.rb +515 -0
- data/split/Tioga/lib/FigMkr.rb +2224 -0
- data/split/Tioga/lib/FigureConstants.rb +125 -0
- data/split/Tioga/lib/Figures_and_Plots.rb +268 -0
- data/split/Tioga/lib/Images.rb +278 -0
- data/split/Tioga/lib/Legends.rb +190 -0
- data/split/Tioga/lib/MarkerConstants.rb +122 -0
- data/split/Tioga/lib/Markers.rb +129 -0
- data/split/Tioga/lib/Page_Frame_Bounds.rb +567 -0
- data/split/Tioga/lib/Rectangles.rb +94 -0
- data/split/Tioga/lib/Shading.rb +100 -0
- data/split/Tioga/lib/Special_Paths.rb +307 -0
- data/split/Tioga/lib/Strokes.rb +129 -0
- data/split/Tioga/lib/TeX_Text.rb +454 -0
- data/split/Tioga/lib/TexPreamble.rb +358 -0
- data/split/Tioga/lib/Titles_and_Labels.rb +306 -0
- data/split/Tioga/lib/Transparency.rb +89 -0
- data/split/Tioga/lib/Using_Paths.rb +164 -0
- data/split/Tioga/lib/Utils.rb +74 -0
- data/split/Tioga/lib/X_and_Y_Axes.rb +749 -0
- data/split/Tioga/lib/irb_tioga.rb +122 -0
- data/split/Tioga/lib/tioga.rb +1 -0
- data/split/Tioga/lib/tioga_ui.rb +5 -0
- data/split/Tioga/lib/tioga_ui_cmds.rb +793 -0
- data/split/Tioga/makers.c +989 -0
- data/split/Tioga/mk_tioga_sty.rb +53 -0
- data/split/Tioga/namespace.h +47 -0
- data/split/Tioga/pdf_font_dicts.c +18253 -0
- data/split/Tioga/pdfcolor.c +486 -0
- data/split/Tioga/pdfcoords.c +505 -0
- data/split/Tioga/pdffile.c +342 -0
- data/split/Tioga/pdfimage.c +536 -0
- data/split/Tioga/pdfpath.c +914 -0
- data/split/Tioga/pdfs.h +229 -0
- data/split/Tioga/pdftext.c +443 -0
- data/split/Tioga/safe_double.h +104 -0
- data/split/Tioga/symbols.c +92 -0
- data/split/Tioga/symbols.h +52 -0
- data/split/Tioga/texout.c +380 -0
- data/split/defs.h +33 -0
- data/split/extconf.rb +107 -0
- data/split/mkmf2.rb +1612 -0
- data/split/namespace.h +47 -0
- data/split/safe_double.h +104 -0
- data/split/scripts/tioga +4 -0
- data/split/symbols.c +92 -0
- data/split/symbols.h +52 -0
- data/tests/dtable_test.data +6 -0
- data/tests/dvector_read_test.data +1 -0
- data/tests/dvector_test.data +101 -0
- data/tests/tc_Dtable.rb +221 -0
- data/tests/tc_Dvector.rb +791 -0
- data/tests/tc_FMkr.rb +162 -0
- data/tests/tc_Flate.rb +45 -0
- data/tests/tc_Function.rb +111 -0
- data/tests/ts_Tioga.rb +38 -0
- metadata +163 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
# Dtable installation file
|
2
|
+
require 'mkmf'
|
3
|
+
|
4
|
+
unless have_header("zlib.h") and have_library("z", "compress", "zlib.h")
|
5
|
+
puts <<"EON"
|
6
|
+
Error: you should have zlib (including development files) installed to
|
7
|
+
build and run Tioga. You can get it there:
|
8
|
+
|
9
|
+
http://www.zlib.net/
|
10
|
+
|
11
|
+
If that doesn't solve your problem, please report it on the Tioga tracker:
|
12
|
+
|
13
|
+
http://rubyforge.org/tracker/?group_id=701
|
14
|
+
|
15
|
+
EON
|
16
|
+
exit 1
|
17
|
+
end
|
18
|
+
|
19
|
+
create_makefile 'Flate'
|
data/split/Flate/flate.c
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
/* flate.c -- main file for Ruby extension
|
2
|
+
*/
|
3
|
+
|
4
|
+
#include <symbols.h>
|
5
|
+
#include "zlib.h"
|
6
|
+
#include "flate_intern.h"
|
7
|
+
/*
|
8
|
+
Copyright (C) 2005 Bill Paxton
|
9
|
+
|
10
|
+
Flate is free software; you can redistribute it and/or modify
|
11
|
+
it under the terms of the GNU General Library Public License as published
|
12
|
+
by the Free Software Foundation; either version 2 of the License, or
|
13
|
+
(at your option) any later version.
|
14
|
+
|
15
|
+
Flate is distributed in the hope that it will be useful,
|
16
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
+
GNU Library General Public License for more details.
|
19
|
+
|
20
|
+
You should have received a copy of the GNU Library General Public License
|
21
|
+
along with Flate; if not, write to the Free Software
|
22
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
+
*/
|
24
|
+
|
25
|
+
// The internals of this package come from the 'zlib' compression library which
|
26
|
+
// carries the following copyright:
|
27
|
+
|
28
|
+
/* 'zlib' general purpose compression library
|
29
|
+
version 1.2.2, October 3rd, 2004
|
30
|
+
|
31
|
+
Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
|
32
|
+
|
33
|
+
This software is provided 'as-is', without any express or implied
|
34
|
+
warranty. In no event will the authors be held liable for any damages
|
35
|
+
arising from the use of this software.
|
36
|
+
|
37
|
+
Permission is granted to anyone to use this software for any purpose,
|
38
|
+
including commercial applications, and to alter it and redistribute it
|
39
|
+
freely, subject to the following restrictions:
|
40
|
+
|
41
|
+
1. The origin of this software must not be misrepresented; you must not
|
42
|
+
claim that you wrote the original software. If you use this software
|
43
|
+
in a product, an acknowledgment in the product documentation would be
|
44
|
+
appreciated but is not required.
|
45
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
46
|
+
misrepresented as being the original software.
|
47
|
+
3. This notice may not be removed or altered from any source distribution.
|
48
|
+
|
49
|
+
Jean-loup Gailly Mark Adler
|
50
|
+
jloup@gzip.org madler@alumni.caltech.edu
|
51
|
+
|
52
|
+
|
53
|
+
The data format used by the zlib library is described by RFCs (Request for
|
54
|
+
Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
|
55
|
+
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
|
56
|
+
*/
|
57
|
+
|
58
|
+
PRIVATE
|
59
|
+
/*
|
60
|
+
* call-seq:
|
61
|
+
* Flate.compress(str) -> string
|
62
|
+
*
|
63
|
+
* Returns a compressed verion of _str_ in a new string.
|
64
|
+
*/
|
65
|
+
VALUE do_compress(VALUE klass, VALUE str) {
|
66
|
+
str = rb_String(str);
|
67
|
+
unsigned char *ptr = (unsigned char *)RSTRING(str)->ptr;
|
68
|
+
long len = RSTRING(str)->len;
|
69
|
+
unsigned long new_len = (len * 11) / 10 + 100;
|
70
|
+
unsigned char *new_ptr = ALLOC_N(unsigned char, new_len);
|
71
|
+
if (flate_compress(new_ptr, &new_len, ptr, len) != Z_OK) {
|
72
|
+
free(new_ptr);
|
73
|
+
rb_raise(rb_eArgError, "Error in Flate.compress");
|
74
|
+
}
|
75
|
+
VALUE new_str = rb_str_new((char *)new_ptr, new_len);
|
76
|
+
free(new_ptr);
|
77
|
+
return new_str;
|
78
|
+
}
|
79
|
+
|
80
|
+
PRIVATE int flate_compress(unsigned char *new_ptr, unsigned long *new_len_ptr, unsigned char *ptr, long len) {
|
81
|
+
return compress(new_ptr, new_len_ptr, ptr, len); // updates new_len to the actual length
|
82
|
+
}
|
83
|
+
|
84
|
+
PRIVATE
|
85
|
+
/*
|
86
|
+
* call-seq:
|
87
|
+
* Flate.expand(str) -> string
|
88
|
+
*
|
89
|
+
* Returns a decompressed verion of _str_ in a new string.
|
90
|
+
* Assumes that _str_ was compressed using <code>Flate.compress</code>.
|
91
|
+
*
|
92
|
+
*/
|
93
|
+
|
94
|
+
VALUE do_expand(VALUE klass, VALUE str) {
|
95
|
+
str = rb_String(str);
|
96
|
+
unsigned char *ptr = (unsigned char *)RSTRING(str)->ptr;
|
97
|
+
long len = RSTRING(str)->len;
|
98
|
+
unsigned long new_len = len * 4 + 100;
|
99
|
+
unsigned char *new_ptr = ALLOC_N(unsigned char, new_len);
|
100
|
+
if (flate_expand(&new_ptr, &new_len, ptr, len) != Z_OK) {
|
101
|
+
free(new_ptr);
|
102
|
+
rb_raise(rb_eArgError, "Error in Flate.expand");
|
103
|
+
}
|
104
|
+
VALUE new_str = rb_str_new((char *)new_ptr, new_len);
|
105
|
+
free(new_ptr);
|
106
|
+
return new_str;
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
// NOTE: the destination buffer will be reallocated if it isn't large enough.
|
111
|
+
// So you MUST allocate a buffer rather than using a static one.
|
112
|
+
// And you MUST be prepared for the buffer to change location and size.
|
113
|
+
PRIVATE int flate_expand(unsigned char **new_ptr_ptr, unsigned long *new_len_ptr, unsigned char *ptr, long len) {
|
114
|
+
unsigned char *new_ptr = *new_ptr_ptr;
|
115
|
+
int result = Z_MEM_ERROR;
|
116
|
+
while (*new_len_ptr < 9999999) {
|
117
|
+
result = uncompress(new_ptr, new_len_ptr, ptr, len); // updates new_len
|
118
|
+
if (result != Z_MEM_ERROR && result != Z_BUF_ERROR) break;
|
119
|
+
// new_len not big enough
|
120
|
+
*new_len_ptr *= 2;
|
121
|
+
if (*new_len_ptr >= 9999999) break;
|
122
|
+
free(new_ptr);
|
123
|
+
new_ptr = ALLOC_N(unsigned char, *new_len_ptr);
|
124
|
+
}
|
125
|
+
*new_ptr_ptr = new_ptr;
|
126
|
+
return result;
|
127
|
+
}
|
128
|
+
|
129
|
+
/*
|
130
|
+
* Document-module: Flate
|
131
|
+
*
|
132
|
+
* The Flate module implements an efficient lossless compression/decompression algorithm suitable for text and data.
|
133
|
+
* It is a Ruby-wrapper around code from the 'zlib' compression library, written by
|
134
|
+
* Jean-loup Gailly and Mark Adler, who kindly grant permission for free use of their work (visit {the zlib site}[http://www.gzip.org/zlib/]). The algorithm for flate
|
135
|
+
* is based on huffman encoding and LZ77 compression. For an introduction to the details, see the {description by
|
136
|
+
* Gailly and Adler}[link:algorithm.txt]. Compression to 1/3 original size
|
137
|
+
* is not unusual for text files, which explains the popularity of this algorithm and its use in
|
138
|
+
* applications such as 'Zip' and 'gzip', and in PDF files where it is used for lossless compression of text
|
139
|
+
* along with JPEG for lossy compression of images.
|
140
|
+
* Note that short strings, fewer than
|
141
|
+
* 100 bytes or so, may actually 'compress' to a larger string due to the overhead of compression tables.
|
142
|
+
*/
|
143
|
+
|
144
|
+
PUBLIC void Init_Flate() {
|
145
|
+
/* modified by Vincent Fourmond, for the splitting out */
|
146
|
+
/*VALUE mTioga = rb_define_module("Tioga");
|
147
|
+
VALUE mFlate = rb_define_module_under(mTioga, "Flate"); */
|
148
|
+
VALUE mFlate = rb_define_module("Flate");
|
149
|
+
rb_define_singleton_method(mFlate, "compress", do_compress, 1);
|
150
|
+
rb_define_singleton_method(mFlate, "expand", do_expand, 1);
|
151
|
+
|
152
|
+
/* exporting the symbols that might be needed by other modules */
|
153
|
+
RB_EXPORT_SYMBOL(mFlate, flate_expand);
|
154
|
+
RB_EXPORT_SYMBOL(mFlate, flate_compress);
|
155
|
+
}
|
156
|
+
|
@@ -0,0 +1,97 @@
|
|
1
|
+
/* flate.h -- c interface for the Ruby Flate extension
|
2
|
+
*/
|
3
|
+
|
4
|
+
/*
|
5
|
+
Copyright (C) 2005 Bill Paxton
|
6
|
+
|
7
|
+
Flate is free software; you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Library Public License as published
|
9
|
+
by the Free Software Foundation; either version 2 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
Flate is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU Library General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU Library General Public License
|
18
|
+
along with Flate; if not, write to the Free Software
|
19
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
|
23
|
+
#ifndef __flate_H__
|
24
|
+
#define __flate_H__
|
25
|
+
|
26
|
+
#include <namespace.h>
|
27
|
+
|
28
|
+
#include "ruby.h"
|
29
|
+
|
30
|
+
/* and once again, the dirty trick */
|
31
|
+
|
32
|
+
PRIVATE int flate_compress(unsigned char *new_ptr, unsigned long *new_len_ptr, unsigned char *ptr, long len);
|
33
|
+
// source is given by ptr and is len bytes in length.
|
34
|
+
// new_ptr is destination buffer of size *new_len_ptr.
|
35
|
+
// NOTE: the destination buffer for flate_compress should be LARGER than the source buffer to be safe.
|
36
|
+
// The minimal extra is 0.1% larger than the source plus 12 bytes.
|
37
|
+
// My rule is to use (len * 11)/10 + 100 just to be sure.
|
38
|
+
PRIVATE int flate_expand(unsigned char **new_ptr_ptr, unsigned long *new_len_ptr, unsigned char *ptr, long len);
|
39
|
+
// source is given by ptr and is len bytes in length.
|
40
|
+
// *new_ptr_ptr is destination buffer of size *new_len_ptr.
|
41
|
+
// NOTE: the destination buffer for flate_expand will be reallocated if it isn't large enough.
|
42
|
+
// So you MUST allocate a buffer rather than using a static one.
|
43
|
+
// And you MUST be prepared for the buffer to change location and size.
|
44
|
+
|
45
|
+
// Here are the return codes for the compression/expansion functions. Negative
|
46
|
+
// values are errors, positive values are used for special but normal events.
|
47
|
+
|
48
|
+
#define FLATE_OK 0
|
49
|
+
#define FLATE_STREAM_END 1
|
50
|
+
#define FLATE_NEED_DICT 2
|
51
|
+
#define FLATE_ERRNO (-1)
|
52
|
+
#define FLATE_STREAM_ERROR (-2)
|
53
|
+
#define FLATE_DATA_ERROR (-3)
|
54
|
+
#define FLATE_MEM_ERROR (-4)
|
55
|
+
#define FLATE_BUF_ERROR (-5)
|
56
|
+
#define FLATE_VERSION_ERROR (-6)
|
57
|
+
|
58
|
+
PUBLIC void Init_Flate(void);
|
59
|
+
|
60
|
+
// If this simple interface isn't enough for your needs, the next stop is zlib.h
|
61
|
+
// for the full interface.
|
62
|
+
|
63
|
+
// The internals of this package come from the 'zlib' compression library which
|
64
|
+
// carries the following copyright:
|
65
|
+
|
66
|
+
/* 'zlib' general purpose compression library
|
67
|
+
version 1.2.2, October 3rd, 2004
|
68
|
+
|
69
|
+
Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
|
70
|
+
|
71
|
+
This software is provided 'as-is', without any express or implied
|
72
|
+
warranty. In no event will the authors be held liable for any damages
|
73
|
+
arising from the use of this software.
|
74
|
+
|
75
|
+
Permission is granted to anyone to use this software for any purpose,
|
76
|
+
including commercial applications, and to alter it and redistribute it
|
77
|
+
freely, subject to the following restrictions:
|
78
|
+
|
79
|
+
1. The origin of this software must not be misrepresented; you must not
|
80
|
+
claim that you wrote the original software. If you use this software
|
81
|
+
in a product, an acknowledgment in the product documentation would be
|
82
|
+
appreciated but is not required.
|
83
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
84
|
+
misrepresented as being the original software.
|
85
|
+
3. This notice may not be removed or altered from any source distribution.
|
86
|
+
|
87
|
+
Jean-loup Gailly Mark Adler
|
88
|
+
jloup@gzip.org madler@alumni.caltech.edu
|
89
|
+
|
90
|
+
|
91
|
+
The data format used by the zlib library is described by RFCs (Request for
|
92
|
+
Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
|
93
|
+
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
|
94
|
+
*/
|
95
|
+
|
96
|
+
|
97
|
+
#endif /* __flate_H__ */
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/* flate.h -- c interface for the Ruby Flate extension
|
2
|
+
*/
|
3
|
+
|
4
|
+
/*
|
5
|
+
Copyright (C) 2005 Bill Paxton
|
6
|
+
|
7
|
+
Flate is free software; you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Library Public License as published
|
9
|
+
by the Free Software Foundation; either version 2 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
Flate is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU Library General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU Library General Public License
|
18
|
+
along with Flate; if not, write to the Free Software
|
19
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
|
23
|
+
/* This file has been heavily modified by Vincent Fourmond for the 'RCR330'
|
24
|
+
symbol export scheme
|
25
|
+
*/
|
26
|
+
#ifndef __flate_H__
|
27
|
+
#define __flate_H__
|
28
|
+
|
29
|
+
#include <symbols.h>
|
30
|
+
|
31
|
+
DECLARE_SYMBOL(int, flate_compress,
|
32
|
+
(unsigned char *new_ptr, unsigned long *new_len_ptr,
|
33
|
+
unsigned char *ptr, long len));
|
34
|
+
// source is given by ptr and is len bytes in length.
|
35
|
+
// new_ptr is destination buffer of size *new_len_ptr.
|
36
|
+
// NOTE: the destination buffer for flate_compress should be LARGER than the source buffer to be safe.
|
37
|
+
// The minimal extra is 0.1% larger than the source plus 12 bytes.
|
38
|
+
// My rule is to use (len * 11)/10 + 100 just to be sure.
|
39
|
+
DECLARE_SYMBOL(int, flate_expand,
|
40
|
+
(unsigned char **new_ptr_ptr, unsigned long *new_len_ptr,
|
41
|
+
unsigned char *ptr, long len));
|
42
|
+
// source is given by ptr and is len bytes in length.
|
43
|
+
// *new_ptr_ptr is destination buffer of size *new_len_ptr.
|
44
|
+
// NOTE: the destination buffer for flate_expand will be reallocated if it isn't large enough.
|
45
|
+
// So you MUST allocate a buffer rather than using a static one.
|
46
|
+
// And you MUST be prepared for the buffer to change location and size.
|
47
|
+
|
48
|
+
// Here are the return codes for the compression/expansion functions. Negative
|
49
|
+
// values are errors, positive values are used for special but normal events.
|
50
|
+
|
51
|
+
#define FLATE_OK 0
|
52
|
+
#define FLATE_STREAM_END 1
|
53
|
+
#define FLATE_NEED_DICT 2
|
54
|
+
#define FLATE_ERRNO (-1)
|
55
|
+
#define FLATE_STREAM_ERROR (-2)
|
56
|
+
#define FLATE_DATA_ERROR (-3)
|
57
|
+
#define FLATE_MEM_ERROR (-4)
|
58
|
+
#define FLATE_BUF_ERROR (-5)
|
59
|
+
#define FLATE_VERSION_ERROR (-6)
|
60
|
+
|
61
|
+
// If this simple interface isn't enough for your needs, the next stop is zlib.h
|
62
|
+
// for the full interface.
|
63
|
+
|
64
|
+
// The internals of this package come from the 'zlib' compression library which
|
65
|
+
// carries the following copyright:
|
66
|
+
|
67
|
+
/* 'zlib' general purpose compression library
|
68
|
+
version 1.2.2, October 3rd, 2004
|
69
|
+
|
70
|
+
Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
|
71
|
+
|
72
|
+
This software is provided 'as-is', without any express or implied
|
73
|
+
warranty. In no event will the authors be held liable for any damages
|
74
|
+
arising from the use of this software.
|
75
|
+
|
76
|
+
Permission is granted to anyone to use this software for any purpose,
|
77
|
+
including commercial applications, and to alter it and redistribute it
|
78
|
+
freely, subject to the following restrictions:
|
79
|
+
|
80
|
+
1. The origin of this software must not be misrepresented; you must not
|
81
|
+
claim that you wrote the original software. If you use this software
|
82
|
+
in a product, an acknowledgment in the product documentation would be
|
83
|
+
appreciated but is not required.
|
84
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
85
|
+
misrepresented as being the original software.
|
86
|
+
3. This notice may not be removed or altered from any source distribution.
|
87
|
+
|
88
|
+
Jean-loup Gailly Mark Adler
|
89
|
+
jloup@gzip.org madler@alumni.caltech.edu
|
90
|
+
|
91
|
+
|
92
|
+
The data format used by the zlib library is described by RFCs (Request for
|
93
|
+
Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
|
94
|
+
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
|
95
|
+
*/
|
96
|
+
|
97
|
+
|
98
|
+
#endif /* __flate_H__ */
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/* namespace.h: an attempt at rationalizing shared objects
|
2
|
+
namespace use.
|
3
|
+
|
4
|
+
Copyright (C) 2006 Vincent Fourmond
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Library Public License as published
|
8
|
+
by the Free Software Foundation; either version 2 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU Library General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Library General Public License
|
17
|
+
along with this program; if not, write to the Free Software
|
18
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#ifndef _NAMESPACE_H
|
22
|
+
#define _NAMESPACE_H
|
23
|
+
|
24
|
+
/* This header file provides two OS-specific macros for the definition of
|
25
|
+
extern symbols:
|
26
|
+
|
27
|
+
* PUBLIC, which has to be used to mark objects that will be used
|
28
|
+
outside the module
|
29
|
+
|
30
|
+
* PRIVATE, for symbols which are "extern" but intern to the module
|
31
|
+
|
32
|
+
Please don't add "extern" after the PRIVATE or PUBLIC declaration
|
33
|
+
as this would break compilation on Darwin.
|
34
|
+
*/
|
35
|
+
|
36
|
+
#ifdef __APPLE__
|
37
|
+
# define PRIVATE __private_extern__
|
38
|
+
# define PUBLIC
|
39
|
+
#elif __GNUC__ >= 4 /* we have the visibility attribute */
|
40
|
+
# define PRIVATE __attribute__ ((visibility ("hidden")))
|
41
|
+
# define PUBLIC __attribute__ ((visibility ("default")))
|
42
|
+
#else /* not really good */
|
43
|
+
# define PRIVATE
|
44
|
+
# define PUBLIC
|
45
|
+
#endif /* __APPLE__ and __GNU_C_ >= 4*/
|
46
|
+
|
47
|
+
#endif
|
@@ -0,0 +1,104 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
safe_double.h: small abstraction for storing double without endianess
|
4
|
+
problems
|
5
|
+
|
6
|
+
Copyright (C) 2006 Vincent Fourmond
|
7
|
+
|
8
|
+
This program is free software; you can redistribute it and/or modify
|
9
|
+
it under the terms of the GNU General Library Public License as published
|
10
|
+
by the Free Software Foundation; either version 2 of the License, or
|
11
|
+
(at your option) any later version.
|
12
|
+
|
13
|
+
This program is distributed in the hope that it will be useful,
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
GNU Library General Public License for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU Library General Public License
|
19
|
+
along with this program; if not, write to the Free Software
|
20
|
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
|
22
|
+
**********************************************************************/
|
23
|
+
|
24
|
+
/* This file provides two functions: store_double and get_double, which
|
25
|
+
can be used in a 'safe' way to store doubles and retrive them
|
26
|
+
in a hopefully platform-independent form. However, it just
|
27
|
+
stores it without regards to that if ieee754.h isn't found...
|
28
|
+
*/
|
29
|
+
|
30
|
+
#ifndef _DOUBLE_H
|
31
|
+
#define _DOUBLE_H
|
32
|
+
|
33
|
+
#define STORE_LOWER_BYTE(a,p) do {\
|
34
|
+
*(p++) = (a) & 0xFF; (a) >>= 8; }\
|
35
|
+
while(0)
|
36
|
+
#define STORE_UNSIGNED(a,p) for(i = 0; i < 4; i++) STORE_LOWER_BYTE(a,p);
|
37
|
+
#define GET_UNSIGNED(a,p) do { a = 0; for(i = 0; i < 4; i++) \
|
38
|
+
(a) |= *(p++) << (i * 8); } while (0)
|
39
|
+
|
40
|
+
#ifdef HAVE_IEEE754_H
|
41
|
+
#include <ieee754.h>
|
42
|
+
|
43
|
+
|
44
|
+
static inline void store_double(double a, unsigned char * p)
|
45
|
+
{
|
46
|
+
unsigned int tmp;
|
47
|
+
int i;
|
48
|
+
union ieee754_double d;
|
49
|
+
d.d = a;
|
50
|
+
/* we store it with lower bytes firts */
|
51
|
+
tmp = d.ieee.mantissa1;
|
52
|
+
STORE_UNSIGNED(tmp, p);
|
53
|
+
tmp = d.ieee.negative << 31 |
|
54
|
+
d.ieee.exponent << 20 |
|
55
|
+
d.ieee.mantissa0;
|
56
|
+
STORE_UNSIGNED(tmp, p);
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
static inline double get_double(const unsigned char * p)
|
61
|
+
{
|
62
|
+
unsigned int tmp;
|
63
|
+
int i;
|
64
|
+
union ieee754_double d;
|
65
|
+
GET_UNSIGNED(tmp, p);
|
66
|
+
d.ieee.mantissa1 = tmp;
|
67
|
+
GET_UNSIGNED(tmp, p);
|
68
|
+
d.ieee.mantissa0 = tmp & 0xFFFFF;
|
69
|
+
d.ieee.exponent = (tmp >> 20) & 0x7FF;
|
70
|
+
d.ieee.negative = (tmp >> 31) & 0x1;
|
71
|
+
return d.d;
|
72
|
+
}
|
73
|
+
|
74
|
+
#else
|
75
|
+
|
76
|
+
union basic_double{
|
77
|
+
double d;
|
78
|
+
struct {
|
79
|
+
unsigned int a:32;
|
80
|
+
unsigned int b:32;
|
81
|
+
} i;
|
82
|
+
};
|
83
|
+
|
84
|
+
static inline void store_double(double a, unsigned char * p)
|
85
|
+
{
|
86
|
+
union basic_double d;
|
87
|
+
int i;
|
88
|
+
d.d = a;
|
89
|
+
STORE_UNSIGNED(d.i.a, p);
|
90
|
+
STORE_UNSIGNED(d.i.b, p);
|
91
|
+
}
|
92
|
+
|
93
|
+
static inline double get_double(const unsigned char * p)
|
94
|
+
{
|
95
|
+
union basic_double d;
|
96
|
+
int i;
|
97
|
+
GET_UNSIGNED(d.i.a, p);
|
98
|
+
GET_UNSIGNED(d.i.b, p);
|
99
|
+
return d.d;
|
100
|
+
}
|
101
|
+
|
102
|
+
#endif /* HAVE_IEEE754_H */
|
103
|
+
|
104
|
+
#endif /* _DOUBLE_H */
|