ruby-gdchart 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,145 @@
1
+ CC=gcc
2
+ # gcc 2.7.1 or better is required
3
+ # CFLAGS=
4
+ # CFLAGS=-g -ansi -pedantic
5
+
6
+ # ----- build path -----
7
+ GDC_INCL=./
8
+ GDC_LD=./
9
+ GDC_LIB=libgdc.a
10
+
11
+ # ----- install locations -----
12
+ PREFIX_INC = /usr/local/include
13
+ PREFIX_LIB = /usr/local/lib
14
+
15
+ # INCLUDEDIRS=-I. -I/usr/include/freetype2 -I/usr/include/X11 -I/usr/X11R6/include/X11 -I/usr/local/include
16
+
17
+ # ----- lib gd -----
18
+ # GDChart requires the gd library - www.boutell.com/gd/
19
+ # gd 2.0.28 or better is required (GIF support has returned to libgd)
20
+ # if it's not installed in a standard location edit these lines for your installation
21
+ GD_INCL=/usr/local/include/
22
+ GD_LD=/usr/local/lib/
23
+ #GD_LIB=libgd.so
24
+ # a static libgd is also available
25
+ GD_LIB=libgd.a
26
+
27
+ # ----- lib png -----
28
+ # libgd requires libpng
29
+ # if it's not installed in a standard location edit these lines for your installation
30
+ # PNG_INCL = ../libpng-1.0.8
31
+ # PNG_LD = ../libpng-1.0.8
32
+
33
+ # ----- lib z -----
34
+ # libgd requires zlib
35
+ # if it's not installed in a standard location edit these lines for your installation
36
+ # ZLIB_INCL = ../zlib-1.1.3
37
+ # ZLIB_LD = ../zlib-1.1.3
38
+
39
+ # ----- lib jpeg -----
40
+ # libgd optionally uses libjpeg to produce JPEG images
41
+ # JPEG_INCL = ../libjpeg
42
+ # JPEG_LD = ../libjpeg
43
+ JPEG_DEF = -DHAVE_JPEG
44
+ JPEG_LK = -ljpeg
45
+
46
+ # libgd optionally uses libfreetype to use TTFs
47
+ # FT_LD = /usr/local/lib
48
+ FT_DEF = -DHAVE_LIBFREETYPE
49
+ FT_LK = -lfreetype
50
+
51
+ DEFS = $(FT_DEF) $(JPEG_DEF)
52
+ LIBS = $(FT_LK) $(JPEG_LK)
53
+
54
+ LIB_PATHS = -L$(GD_LD) -L$(GDC_LD)
55
+ # if not installed in standard paths (/lib, /usr/lib), or LD_LIBRARY_PATH
56
+ # LIB_PATHS = -L$(GD_LD) -L$(PNG_LD) -L$(ZLIB_LD) -L$(JPEG_LD)
57
+
58
+ # NOTE:
59
+ # libpng, libz, etc. are usually linked in as dynamic libs
60
+ # either use a link line similar to one of these, or set environment LD_LIBRARY_PATH
61
+ # these should likely be absolute paths, as resolved at runtime
62
+ # LIB_PATHS = $(LIB_PATHS) -R$(PNG_LD) -R$(ZLIB_LD)
63
+ # LIB_PATHS = $(LIB_PATHS) -Xlinker -rpath -Xlinker $(PNG_LD) -Xlinker -rpath -Xlinker $(ZLIB_LD)
64
+
65
+
66
+ all: libgdc.a gdc_samp1 gdc_samp2 gdc_pie_samp ft_samp
67
+
68
+ # --- compile the samples ---
69
+ gdc_pie_samp.o: $(GDC_INCL)gdc.h $(GDC_INCL)gdcpie.h gdc_pie_samp.c
70
+ $(CC) $(CFLAGS) -I$(GDC_INCL) $(DEFS) -c gdc_pie_samp.c
71
+
72
+ gdc_samp1.o: $(GDC_INCL)gdc.h $(GDC_INCL)gdchart.h gdc_samp1.c
73
+ $(CC) $(CFLAGS) -I$(GDC_INCL) $(DEFS) -c gdc_samp1.c
74
+
75
+ gdc_samp2.o: $(GDC_INCL)gdc.h $(GDC_INCL)gdchart.h gdc_samp2.c
76
+ $(CC) $(CFLAGS) -I$(GDC_INCL) $(DEFS) -c gdc_samp2.c
77
+
78
+ ft_samp.o: $(GDC_INCL)gdc.h $(GDC_INCL)gdchart.h ft_samp.c
79
+ $(CC) $(CFLAGS) -I$(GDC_INCL) $(DEFS) -c ft_samp.c
80
+
81
+ # --- link the samples ---
82
+ gdc_samp1: $(GDC_LD)libgdc.a gdc_samp1.o $(GD_LD)/$(GD_LIB) $(GDC_LD)/$(GDC_LIB)
83
+ $(CC) -o gdc_samp1 \
84
+ gdc_samp1.o \
85
+ $(LIB_PATHS) \
86
+ -lgdc -lgd -lz -lpng $(LIBS) -lm
87
+
88
+ gdc_samp2: $(GDC_LD)libgdc.a gdc_samp2.o $(GD_LD)/$(GD_LIB) $(GDC_LD)/$(GDC_LIB)
89
+ $(CC) -o gdc_samp2 \
90
+ gdc.o gdchart.o price_conv.o \
91
+ gdc_samp2.o \
92
+ $(LIB_PATHS) \
93
+ -lgdc -lgd -lz -lpng $(LIBS) -lm
94
+
95
+ gdc_pie_samp: $(GDC_LD)libgdc.a gdc_pie_samp.o $(GD_LD)/$(GD_LIB) $(GDC_LD)/$(GDC_LIB)
96
+ $(CC) -o gdc_pie_samp \
97
+ gdc.o gdc_pie.o price_conv.o \
98
+ gdc_pie_samp.o \
99
+ $(LIB_PATHS) \
100
+ -lgdc -lgd -lz -lpng $(LIBS) -lm
101
+
102
+ ft_samp: $(GDC_LD)libgdc.a ft_samp.o $(GD_LD)/$(GD_LIB) $(GDC_LD)/$(GDC_LIB)
103
+ $(CC) -o ft_samp \
104
+ gdc.o gdchart.o price_conv.o \
105
+ ft_samp.o \
106
+ $(LIB_PATHS) \
107
+ -lgdc -lgd -lz -lpng $(LIBS) -lm
108
+
109
+ # --- compile the lib ---
110
+ #gdc.h: $(GD_INCL)gd.h $(GD_INCL)gdfonts.h $(GD_INCL)gdfontt.h $(GD_INCL)gdfontmb.h $(GD_INCL)gdfontg.h $(GD_INCL)gdfontl.h $(GDC_INCL)array_alloc.h
111
+ gdc.h: array_alloc.h
112
+
113
+ price_conv.o: price_conv.c
114
+ $(CC) $(CFLAGS) -c price_conv.c
115
+
116
+ gdc.o: gdc.c $(GDC_INCL)gdc.h
117
+ $(CC) $(CFLAGS) -I$(GD_INCL) -I$(GDC_INCL) $(DEFS) -c gdc.c
118
+
119
+ gdc_pie.o: $(GDC_INCL)gdc.h $(GDC_INCL)gdcpie.h gdc_pie.c
120
+ $(CC) $(CFLAGS) -I$(GD_INCL) -I$(GDC_INCL) $(DEFS) -c gdc_pie.c
121
+
122
+ gdchart.o: $(GDC_INCL)gdc.h $(GDC_INCL)gdchart.h gdchart.c
123
+ $(CC) $(CFLAGS) -I$(GD_INCL) -I$(GDC_INCL) $(DEFS) -c gdchart.c
124
+
125
+ array_alloc.o: array_alloc.c array_alloc.h
126
+ $(CC) $(CFLAGS) -c array_alloc.c
127
+
128
+ libgdc.a: price_conv.o gdc.o gdc_pie.o gdchart.o array_alloc.o
129
+ ar cr libgdc.a gdc.o gdchart.o gdc_pie.o price_conv.o array_alloc.o
130
+ ranlib libgdc.a
131
+
132
+ # --- supporting libraries ---
133
+ # should be compile & installed separately
134
+ # $(GD_LD)/$(GD_LIB):
135
+ # cd $(GD_LD) ; make -f Makefile $(GD_LIB)
136
+
137
+ # ----- install -----
138
+ install: gdc.h gdchart.h gdcpie.h libgdc.a
139
+ cp gdc.h gdchart.h gdcpie.h $(PREFIX_INC)/
140
+ cp libgdc.a $(PREFIX_LIB)/
141
+
142
+ # --- clean ---
143
+ clean:
144
+ rm -f *.o *.a gdc_samp1 gdc_samp2 gdc_pie_samp ft_samp
145
+
@@ -0,0 +1,87 @@
1
+ /* GDCHART 0.11.5dev 17 Dec 2004 */
2
+ /* Copyright Bruce Verderaime 1998-2004 */
3
+
4
+ GDChart 0.11.5 relies on the latest version of libgd ( gd 2.0.28 or higher available: www.boutell.com/gd/ ).
5
+ gd 2.0.28 in turn relies on libpng and zlib (and optionally libjpeg, and libfreetype).
6
+
7
+ If libgd 2.0.28 or higher isn't installed, do that first.
8
+
9
+ There's no configure script.
10
+ Makefile may need to be edited to change paths to libgd (It's set to libgd's defualt install path).
11
+ The makefile defaults to include jpeg and freetype, and assumes they are installed,
12
+ and libgd was built with those options as well.
13
+
14
+ Though dev, it is a stable release.
15
+
16
+ --
17
+ brv@fred.net
18
+
19
+
20
+ Note: GDChart is copyrighted code:
21
+ Permission has been granted to copy, distribute and modify GDChart in any context without fee, including a commercial
22
+ application, provided that this notice is present in user-accessible supporting documentation.
23
+
24
+ This does not affect your ownership of the derived work itself, and the intent is to assure proper credit for the authors of
25
+ GDChart, not to interfere with your productive use of GDChart. If you have questions, ask. "Derived works" includes all programs that
26
+ utilize the library. Credit must be given in user-accessible documentation.
27
+
28
+ This software is provided "AS IS." The copyright holders disclaim all warranties, either express or implied, including but
29
+ not limited to implied warranties of merchantability and fitness for a particular purpose, with respect to this code and
30
+ accompanying documentation.
31
+
32
+
33
+ Note: gd is copyrighted code:
34
+ COPYRIGHT STATEMENT FOLLOWS THIS LINE
35
+
36
+ Portions copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
37
+ 2002 by Cold Spring Harbor Laboratory. Funded under Grant
38
+ P41-RR02188 by the National Institutes of Health.
39
+
40
+ Portions copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 by
41
+ Boutell.Com, Inc.
42
+
43
+ Portions relating to GD2 format copyright 1999, 2000, 2001, 2002
44
+ Philip Warner.
45
+
46
+ Portions relating to PNG copyright 1999, 2000, 2001, 2002 Greg
47
+ Roelofs.
48
+
49
+ Portions relating to gdttf.c copyright 1999, 2000, 2001, 2002 John
50
+ Ellson (ellson@lucent.com).
51
+
52
+ Portions relating to gdft.c copyright 2001, 2002 John Ellson
53
+ (ellson@lucent.com).
54
+
55
+ Portions relating to JPEG and to color quantization copyright 2000,
56
+ 2001, 2002, Doug Becker and copyright (C) 1994, 1995, 1996, 1997,
57
+ 1998, 1999, 2000, 2001, 2002, Thomas G. Lane. This software is
58
+ based in part on the work of the Independent JPEG Group. See the
59
+ file README-JPEG.TXT for more information.
60
+
61
+ Portions relating to WBMP copyright 2000, 2001, 2002 Maurice
62
+ Szmurlo and Johan Van den Brande.
63
+
64
+ Permission has been granted to copy, distribute and modify gd in
65
+ any context without fee, including a commercial application,
66
+ provided that this notice is present in user-accessible supporting
67
+ documentation.
68
+
69
+ This does not affect your ownership of the derived work itself, and
70
+ the intent is to assure proper credit for the authors of gd, not to
71
+ interfere with your productive use of gd. If you have questions,
72
+ ask. "Derived works" includes all programs that utilize the
73
+ library. Credit must be given in user-accessible documentation.
74
+
75
+ This software is provided "AS IS." The copyright holders disclaim
76
+ all warranties, either express or implied, including but not
77
+ limited to implied warranties of merchantability and fitness for a
78
+ particular purpose, with respect to this code and accompanying
79
+ documentation.
80
+
81
+ Although their code does not appear in gd, the authors wish to thank
82
+ David Koblas, David Rowley, and Hutchison Avenue Software Corporation
83
+ for their prior contributions.
84
+
85
+ END OF GD COPYRIGHT STATEMENT
86
+
87
+
@@ -0,0 +1,183 @@
1
+ /* GDCHART 0.11.2dev ARRAY_ALLOC.C Mar 2002 */
2
+ /* Copyright Bruce Verderaime 2002-2004 */
3
+ /* Contributed in part or whole by Don Fasen and Darren Kent */
4
+
5
+ #if !defined (__GNUC__) || defined (__STRICT_ANSI__)
6
+
7
+ #include <stdio.h>
8
+
9
+ #include "array_alloc.h"
10
+
11
+ /*F***************************************************************************
12
+ *
13
+ * Function Name: allocate_array_float
14
+ *
15
+ * Function Prototype: float ** allocate_array_float (int nr, int nc)
16
+ *
17
+ * Allocates memory for a two-dimensional array of floats
18
+ * referenced as arr[r][c]
19
+ *
20
+ ***************************************************************************
21
+ *
22
+ * access array as arr[i1=0-nr][i2=0-nc] = *(&arr[0][0]+nr*i1+i2)
23
+ * row col makes fewest pointer array elements
24
+ * assuming Ncol>>Nrow
25
+ * Ex: NC=2
26
+ * _______ __________
27
+ * **arr |arr[0] |------>arr[0]-->|arr[0][0] |
28
+ * |_______| |__________|
29
+ * |arr[1] |----- |arr[0][1] |
30
+ * |_______| | |__________|
31
+ * | . | --------->|arr[1][0] |
32
+ * | . | |__________|
33
+ * |_______| |arr[1][1] |
34
+ * |arr[NR-1]
35
+ * | |
36
+ * pointer array data array
37
+ *
38
+ ******************************************************************************
39
+ *
40
+ * Parameters :
41
+ *
42
+ * Name Type Use Description
43
+ * ---- ---- --- -----------
44
+ * nr int Input Number of rows
45
+ * nc int Input Number of columns
46
+ *
47
+ ******************************************************************************
48
+ *
49
+ * Function Return: float** with allocated memory all set up as float[][].
50
+ *
51
+ ******************************************************************************
52
+ *
53
+ * Author: Don Fasen
54
+ * Date : 12/18/98
55
+ * Modified: Darren Kent 20/03/2002
56
+ *
57
+ ****************************************************************************F*/
58
+ float **
59
+ allocate_array_float( int nr, /* number of pointer array elements */
60
+ int nc ) /* larger number for min memory usage */
61
+ {
62
+ int i;
63
+ float **arr;
64
+
65
+ /* Try to allocate memory for the pointer array, 'nr' pointers-to-float: */
66
+ arr = (float**)malloc( nr * sizeof(float*) );
67
+ /* no test for success ala glib, i.e., if you're outa memory, ... */
68
+ #ifdef DBUG
69
+ if( arr == NULL )
70
+ {
71
+ perror( "Unable to malloc pointer array in allocate_array_float()\n" );
72
+ exit( 2 );
73
+ }
74
+ #endif
75
+
76
+ /* Now allocate memory for the data array, 'nr * nc' floats: */
77
+ arr[0] = (float*)malloc( nr * nc * sizeof(float) );
78
+ #ifdef DBUG
79
+ if( arr == NULL )
80
+ {
81
+ perror( "Unable to malloc data array in allocate_array_float()\n" );
82
+ exit( 2 );
83
+ }
84
+ #endif
85
+ /* fill in the array pointers to point to successive columns. */
86
+ /* Don't need to do the first (zeroth) one, because it was set up by the data malloc. */
87
+ /* Note that adding 1 to (float*)a.arr[0] adds sizeof(float*) automatically. */
88
+
89
+ for (i = 1; i < nr; i++)
90
+ arr[i] = arr[0] + i*nc;
91
+
92
+ return arr;
93
+
94
+ } /* End of FUNCTION allocate_array_float */
95
+
96
+ /***********************************************************************************
97
+ *
98
+ * Same Implementation for a Char array.
99
+ *
100
+ ************************************************************************************/
101
+ char **
102
+ allocate_array_char( int nr,
103
+ int nc )
104
+ {
105
+ int i;
106
+ char **arr;
107
+
108
+ /* Try to allocate memory for the pointer array, 'nr' pointers-to-chars: */
109
+ arr = (char**)malloc( nr * sizeof(char*) );
110
+ /* no test for success ala glib, i.e., if you're outa memory, ... */
111
+ #ifdef DBUG
112
+ if( arr == NULL )
113
+ {
114
+ perror( "Unable to malloc pointer array in allocate_array_char()\n" );
115
+ exit( 2 );
116
+ }
117
+ #endif
118
+
119
+ /* Now allocate memory for the data array, 'nr * nc' char: */
120
+ arr[0] = (char*)malloc( nr * nc * sizeof(char) );
121
+ #ifdef DBUG
122
+ if( arr == NULL )
123
+ {
124
+ perror( "Unable to malloc data array in allocate_array_char()\n" );
125
+ exit( 2 );
126
+ }
127
+ #endif
128
+ /* fill in the array pointers to point to successive columns. */
129
+ /* Don't need to do the first (zeroth) one, because it was set up by the data malloc. */
130
+ /* Note that adding 1 to (char*)a.arr[0] adds sizeof(char*) automatically. */
131
+
132
+ for (i = 1; i < nr; i++)
133
+ arr[i] = arr[0] + i*nc;
134
+
135
+ return arr;
136
+
137
+ } /* End of FUNCTION allocate_array_char */
138
+
139
+ /***********************************************************************************
140
+ *
141
+ * Same Implementation for a Int array.
142
+ *
143
+ ************************************************************************************/
144
+ int **
145
+ allocate_array_int( int nr,
146
+ int nc )
147
+
148
+ {
149
+ int i;
150
+ int **arr;
151
+
152
+ /* Try to allocate memory for the pointer array, 'nr' pointers-to-ints: */
153
+ arr = (int**)malloc( nr * sizeof(int*) );
154
+ /* no test for success ala glib, i.e., if you're outa memory, ... */
155
+ #ifdef DBUG
156
+ if( arr == NULL )
157
+ {
158
+ perror( "Unable to malloc pointer array in allocate_array_int()\n" );
159
+ exit( 2 );
160
+ }
161
+ #endif
162
+
163
+ /* Now allocate memory for the data array, 'nr * nc' int: */
164
+ arr[0] = (int*)malloc( nr * nc * sizeof(int) );
165
+ #ifdef DBUG
166
+ if( arr == NULL )
167
+ {
168
+ perror( "Unable to malloc data array in allocate_array_int()\n" );
169
+ exit( 2 );
170
+ }
171
+ #endif
172
+ /* fill in the array pointers to point to successive columns. */
173
+ /* Don't need to do the first (zeroth) one, because it was set up by the data malloc. */
174
+ /* Note that adding 1 to (int*)a.arr[0] adds sizeof(int*) automatically. */
175
+
176
+ for (i = 1; i < nr; i++)
177
+ arr[i] = arr[0] + i*nc;
178
+
179
+ return arr;
180
+
181
+ } /* End of FUNCTION allocate_array_int */
182
+
183
+ #endif /* !defined (__GNUC__) || defined (__STRICT_ANSI__) */
@@ -0,0 +1,41 @@
1
+ /* GDCHART 0.11.2dev ARRAY_ALLOC.H Mar 2002 */
2
+ /* Copyright Bruce Verderaime 2002-2004 */
3
+ /* Contributed in part or whole by Don Fasen and Darren Kent */
4
+
5
+ #ifndef _ARRAY_ALLOC_H
6
+ #define _ARRAY_ALLOC_H
7
+
8
+ /* ----- no dynamic auto array, need to mallocate space ----- */
9
+ #if !defined (__GNUC__) || defined (__STRICT_ANSI__)
10
+
11
+ #include <stdlib.h>
12
+
13
+ float **allocate_array_float( int nrs, int ncs );
14
+ char **allocate_array_char( int nrs, int ncs );
15
+ int **allocate_array_int( int nrs, int ncs );
16
+
17
+ #define CREATE_ARRAY1( arr, type, nels ) type *arr = (type*)malloc( (nels) * sizeof(type) )
18
+ /* array2 can't do ptr (*) types */
19
+ #define CREATE_ARRAY2( arr, type, nrs, ncs ) type **arr = allocate_array_##type( nrs, ncs )
20
+
21
+ #define FREE_ARRAY1( arr ) if( arr ) { free( (void*)arr ); arr = NULL; } else
22
+ #define FREE_ARRAY2( arr ) if( arr ) \
23
+ { \
24
+ if( arr[0] ) \
25
+ free( (void*)arr[0] ); \
26
+ free( (void*)arr ); \
27
+ arr = NULL; \
28
+ } \
29
+ else
30
+
31
+ /* ----- avoid alloc, let the stack do the work ----- */
32
+ #else
33
+
34
+ #define CREATE_ARRAY1( arr, type, nels ) type arr[ nels ]
35
+ #define CREATE_ARRAY2( arr, type, nrs, ncs ) type arr[ nrs ][ ncs ]
36
+ #define FREE_ARRAY1( arr )
37
+ #define FREE_ARRAY2( arr )
38
+
39
+ #endif
40
+
41
+ #endif /*_ARRAY_ALLOC_H */