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
data/split/Tioga/flate.h
ADDED
@@ -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__ */
|
data/split/Tioga/init.c
ADDED
@@ -0,0 +1,524 @@
|
|
1
|
+
/* init.c */
|
2
|
+
/*
|
3
|
+
Copyright (C) 2005 Bill Paxton
|
4
|
+
|
5
|
+
This file is part of Tioga.
|
6
|
+
|
7
|
+
Tioga 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
|
+
Tioga 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 Tioga; if not, write to the Free Software
|
19
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "figures.h"
|
23
|
+
#include "pdfs.h"
|
24
|
+
|
25
|
+
VALUE rb_Integer_class, rb_Numeric_class;
|
26
|
+
ID save_dir_ID, quiet_mode_ID;
|
27
|
+
ID tex_preview_documentclass_ID, tex_preamble_ID, xaxis_numeric_label_tex_ID, yaxis_numeric_label_tex_ID, tex_preview_pagestyle_ID;
|
28
|
+
ID tex_preview_paper_width_ID, tex_preview_paper_height_ID;
|
29
|
+
ID tex_preview_hoffset_ID, tex_preview_voffset_ID;
|
30
|
+
ID tex_preview_figure_width_ID, tex_preview_figure_height_ID, tex_preview_tiogafigure_command_ID;
|
31
|
+
ID tex_preview_fullpage_ID, tex_preview_minwhitespace_ID;
|
32
|
+
ID do_cmd_ID, make_page_ID, initialized_ID, tex_xoffset_ID, tex_yoffset_ID;
|
33
|
+
ID tex_fontsize_ID, tex_fontfamily_ID, tex_fontseries_ID, tex_fontshape_ID;
|
34
|
+
|
35
|
+
void Init_IDs(void)
|
36
|
+
{
|
37
|
+
|
38
|
+
rb_Numeric_class = rb_define_class("Numeric", rb_cObject);
|
39
|
+
rb_Integer_class = rb_define_class("Integer", rb_Numeric_class);
|
40
|
+
do_cmd_ID = rb_intern("do_cmd");
|
41
|
+
make_page_ID = rb_intern("make_page");
|
42
|
+
// class variables
|
43
|
+
initialized_ID = rb_intern("@@initialized");
|
44
|
+
// instance variables
|
45
|
+
save_dir_ID = rb_intern("@save_dir");
|
46
|
+
quiet_mode_ID = rb_intern("@quiet_mode");
|
47
|
+
tex_xoffset_ID = rb_intern("@tex_xoffset");
|
48
|
+
tex_yoffset_ID = rb_intern("@tex_yoffset");
|
49
|
+
tex_preview_documentclass_ID = rb_intern("@tex_preview_documentclass");
|
50
|
+
tex_preamble_ID = rb_intern("@tex_preamble");
|
51
|
+
xaxis_numeric_label_tex_ID = rb_intern("@xaxis_numeric_label_tex");
|
52
|
+
yaxis_numeric_label_tex_ID = rb_intern("@yaxis_numeric_label_tex");
|
53
|
+
tex_preview_pagestyle_ID = rb_intern("@tex_preview_pagestyle");
|
54
|
+
|
55
|
+
tex_preview_paper_width_ID = rb_intern("@tex_preview_paper_width");
|
56
|
+
tex_preview_paper_height_ID = rb_intern("@tex_preview_paper_height");
|
57
|
+
tex_preview_hoffset_ID = rb_intern("@tex_preview_hoffset");
|
58
|
+
tex_preview_voffset_ID = rb_intern("@tex_preview_voffset");
|
59
|
+
tex_preview_figure_width_ID = rb_intern("@tex_preview_figure_width");
|
60
|
+
tex_preview_figure_height_ID = rb_intern("@tex_preview_figure_height");
|
61
|
+
|
62
|
+
tex_preview_fullpage_ID = rb_intern("@tex_preview_fullpage");
|
63
|
+
tex_preview_minwhitespace_ID = rb_intern("@tex_preview_minwhitespace");
|
64
|
+
|
65
|
+
tex_preview_tiogafigure_command_ID = rb_intern("@tex_preview_tiogafigure_command");
|
66
|
+
|
67
|
+
tex_fontsize_ID = rb_intern("@tex_fontsize");
|
68
|
+
tex_fontfamily_ID = rb_intern("@tex_fontfamily");
|
69
|
+
tex_fontseries_ID = rb_intern("@tex_fontseries");
|
70
|
+
tex_fontshape_ID = rb_intern("@tex_fontshape");
|
71
|
+
}
|
72
|
+
|
73
|
+
void c_set_device_pagesize(FM *p, double width, double height) { // sizes in units of 1/720 inch
|
74
|
+
p->page_left = 0;
|
75
|
+
p->page_right = width;
|
76
|
+
p->page_bottom = 0;
|
77
|
+
p->page_top = height;
|
78
|
+
p->page_width = p->page_right - p->page_left;
|
79
|
+
p->page_height = p->page_top - p->page_bottom;
|
80
|
+
p->clip_left = p->page_left;
|
81
|
+
p->clip_right = p->page_right;
|
82
|
+
p->clip_top = p->page_top;
|
83
|
+
p->clip_bottom = p->page_bottom;
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
VALUE FM_set_device_pagesize(VALUE fmkr, VALUE width, VALUE height)
|
88
|
+
{
|
89
|
+
FM *p = Get_FM(fmkr);
|
90
|
+
width = rb_Float(width);
|
91
|
+
height = rb_Float(height);
|
92
|
+
c_set_device_pagesize(p, NUM2DBL(width), NUM2DBL(height));
|
93
|
+
return fmkr;
|
94
|
+
}
|
95
|
+
|
96
|
+
|
97
|
+
void c_set_frame_sides(FM *p, double left, double right, double top, double bottom) { // sizes in page coords [0..1]
|
98
|
+
if (left > 1.0 || left < 0.0) rb_raise(rb_eArgError, "Sorry: value of left must be between 0 and 1 for set_frame_sides");
|
99
|
+
if (right > 1.0 || right < 0.0) rb_raise(rb_eArgError, "Sorry: value of right must be between 0 and 1 for set_frame_sides");
|
100
|
+
if (top > 1.0 || top < 0.0) rb_raise(rb_eArgError, "Sorry: value of top must be between 0 and 1 for set_frame_sides");
|
101
|
+
if (bottom > 1.0 || bottom < 0.0) rb_raise(rb_eArgError, "Sorry: value of bottom must be between 0 and 1 for set_frame_sides");
|
102
|
+
if (left >= right) rb_raise(rb_eArgError, "Sorry: value of left must be smaller than value of right for set_frame_sides");
|
103
|
+
if (bottom >= top) rb_raise(rb_eArgError, "Sorry: value of bottom must be smaller than value of top for set_frame_sides");
|
104
|
+
p->frame_left = left;
|
105
|
+
p->frame_right = right;
|
106
|
+
p->frame_bottom = bottom;
|
107
|
+
p->frame_top = top;
|
108
|
+
p->frame_width = right - left;
|
109
|
+
p->frame_height = top - bottom;
|
110
|
+
}
|
111
|
+
|
112
|
+
VALUE FM_set_frame_sides(VALUE fmkr, VALUE left, VALUE right, VALUE top, VALUE bottom)
|
113
|
+
{
|
114
|
+
FM *p = Get_FM(fmkr);
|
115
|
+
left = rb_Float(left);
|
116
|
+
right = rb_Float(right);
|
117
|
+
top = rb_Float(top);
|
118
|
+
bottom = rb_Float(bottom);
|
119
|
+
c_set_frame_sides(p, NUM2DBL(left), NUM2DBL(right), NUM2DBL(top), NUM2DBL(bottom));
|
120
|
+
return fmkr;
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
void Initialize_Figure(VALUE fmkr) {
|
125
|
+
FM *p = Get_FM(fmkr);
|
126
|
+
/* Page */
|
127
|
+
p->root_figure = true;
|
128
|
+
p->in_subplot = false;
|
129
|
+
c_private_set_default_font_size(p, 12.0);
|
130
|
+
c_set_device_pagesize(p, 5 * 72.0 * ENLARGE, 5 * 72.0 * ENLARGE);
|
131
|
+
/* default frame */
|
132
|
+
c_set_frame_sides(p, 0.15, 0.85, 0.85, 0.15);
|
133
|
+
/* default bounds */
|
134
|
+
p->bounds_left = p->bounds_bottom = p->bounds_xmin = p->bounds_ymin = 0;
|
135
|
+
p->bounds_right = p->bounds_top = p->bounds_xmax = p->bounds_ymax = 1;
|
136
|
+
p->bounds_width = p->bounds_right - p->bounds_left;
|
137
|
+
p->bounds_height = p->bounds_top - p->bounds_bottom;
|
138
|
+
/* text attributes */
|
139
|
+
p->justification = CENTERED;
|
140
|
+
p->alignment = ALIGNED_AT_BASELINE;
|
141
|
+
p->label_left_margin = 0; // as fraction of frame width
|
142
|
+
p->label_right_margin = 0; // as fraction of frame width
|
143
|
+
p->label_top_margin = 0; // as fraction of frame height
|
144
|
+
p->label_bottom_margin = 0; // as fraction of frame height
|
145
|
+
p->text_shift_on_left = 1.8;
|
146
|
+
p->text_shift_on_right = 2.5;
|
147
|
+
p->text_shift_on_top = 0.7;
|
148
|
+
p->text_shift_on_bottom = 2.0;
|
149
|
+
p->text_shift_from_x_origin = 1.8;
|
150
|
+
p->text_shift_from_y_origin = 2.0;
|
151
|
+
p->default_text_scale = 1.0; Recalc_Font_Hts(p);
|
152
|
+
/* graphics attributes */
|
153
|
+
p->stroke_color = Qnil;
|
154
|
+
p->fill_color = Qnil;
|
155
|
+
p->default_line_scale = 1.0;
|
156
|
+
p->line_width = 1.2;
|
157
|
+
p->line_cap = LINE_CAP_ROUND;
|
158
|
+
p->line_join = LINE_JOIN_ROUND;
|
159
|
+
p->line_type = Qnil; // means solid line
|
160
|
+
p->miter_limit = 2.0;
|
161
|
+
|
162
|
+
p->stroke_opacity = 1.0;
|
163
|
+
p->fill_opacity = 1.0;
|
164
|
+
|
165
|
+
/* Title */
|
166
|
+
p->title_visible = true;
|
167
|
+
p->title = Qnil;
|
168
|
+
p->title_side = TOP;
|
169
|
+
p->title_position = 0.5;
|
170
|
+
p->title_scale = 1.1;
|
171
|
+
p->title_shift = 0.7; // in char heights, positive for out from edge (or toward larger x or y value)
|
172
|
+
p->title_angle = 0.0;
|
173
|
+
p->title_alignment = ALIGNED_AT_BASELINE;
|
174
|
+
p->title_justification = CENTERED;
|
175
|
+
p->title_color = Qnil;
|
176
|
+
|
177
|
+
/* X label */
|
178
|
+
p->xlabel_visible = true;
|
179
|
+
p->xlabel = Qnil;
|
180
|
+
p->xlabel_side = BOTTOM;
|
181
|
+
p->xlabel_position = 0.5;
|
182
|
+
p->xlabel_scale = 1.0;
|
183
|
+
p->xlabel_shift = 2.0; // in char heights, positive for out from edge (or toward larger x or y value)
|
184
|
+
p->xlabel_angle = 0.0;
|
185
|
+
p->xlabel_alignment = ALIGNED_AT_BASELINE;
|
186
|
+
p->xlabel_justification = CENTERED;
|
187
|
+
p->xlabel_color = Qnil;
|
188
|
+
|
189
|
+
/* Y label */
|
190
|
+
p->ylabel_visible = true;
|
191
|
+
p->ylabel = Qnil;
|
192
|
+
p->ylabel_side = LEFT;
|
193
|
+
p->ylabel_position = 0.5;
|
194
|
+
p->ylabel_scale = 1.0;
|
195
|
+
p->ylabel_shift = 1.8; // in char heights, positive for out from edge (or toward larger x or y value)
|
196
|
+
p->ylabel_angle = 0.0;
|
197
|
+
p->ylabel_alignment = ALIGNED_AT_BASELINE;
|
198
|
+
p->ylabel_justification = CENTERED;
|
199
|
+
p->ylabel_color = Qnil;
|
200
|
+
|
201
|
+
/* X axis */
|
202
|
+
p->xaxis_visible = true;
|
203
|
+
p->xaxis_type = AXIS_WITH_TICKS_AND_NUMERIC_LABELS;
|
204
|
+
p->xaxis_loc = BOTTOM;
|
205
|
+
// line
|
206
|
+
p->xaxis_line_width = 1.0; // for axis line
|
207
|
+
p->xaxis_stroke_color = Qnil; // for axis line and tick marks
|
208
|
+
// tick marks
|
209
|
+
p->xaxis_major_tick_width = 0.9; // same units as line_width
|
210
|
+
p->xaxis_minor_tick_width = 0.7; // same units as line_width
|
211
|
+
p->xaxis_major_tick_length = 0.6; // in units of numeric label char heights
|
212
|
+
p->xaxis_minor_tick_length = 0.3; // in units of numeric label char heights
|
213
|
+
p->xaxis_log_values = false;
|
214
|
+
p->xaxis_ticks_inside = true; // inside frame or toward larger x or y value for specific location
|
215
|
+
p->xaxis_ticks_outside = false; // inside frame or toward smaller x or y value for specific location
|
216
|
+
p->xaxis_tick_interval = 0.0; // set to 0 to use default
|
217
|
+
p->xaxis_min_between_major_ticks = 2; // in units of numeric label char heights
|
218
|
+
p->xaxis_number_of_minor_intervals = 0; // set to 0 to use default
|
219
|
+
p->xaxis_locations_for_major_ticks = Qnil; // set to nil to use defaults
|
220
|
+
p->xaxis_locations_for_minor_ticks = Qnil; // set to nil to use defaults
|
221
|
+
// numeric labels on major ticks
|
222
|
+
p->xaxis_use_fixed_pt = false;
|
223
|
+
p->xaxis_digits_max = 0;
|
224
|
+
p->xaxis_tick_labels = Qnil; // set to nil to use defaults. else must have a label for each major tick
|
225
|
+
p->xaxis_numeric_label_decimal_digits = -1; // set to negative to use default
|
226
|
+
p->xaxis_numeric_label_scale = 0.7;
|
227
|
+
p->xaxis_numeric_label_shift = 0.3; // in char heights, positive for out from edge (or toward larger x or y value)
|
228
|
+
p->xaxis_numeric_label_angle = 0.0;
|
229
|
+
p->xaxis_numeric_label_alignment = ALIGNED_AT_MIDHEIGHT;
|
230
|
+
p->xaxis_numeric_label_justification = CENTERED;
|
231
|
+
p->top_edge_type = EDGE_WITH_TICKS;
|
232
|
+
p->top_edge_visible = true;
|
233
|
+
p->bottom_edge_type = EDGE_WITH_TICKS;
|
234
|
+
p->bottom_edge_visible = true;
|
235
|
+
|
236
|
+
/* Y axis */
|
237
|
+
p->yaxis_visible = true;
|
238
|
+
p->yaxis_type = AXIS_WITH_TICKS_AND_NUMERIC_LABELS;
|
239
|
+
p->yaxis_loc = LEFT;
|
240
|
+
// line
|
241
|
+
p->yaxis_line_width = 1.0; // for axis line
|
242
|
+
p->yaxis_stroke_color = Qnil; // for axis line and tick marks
|
243
|
+
// tick marks
|
244
|
+
p->yaxis_major_tick_width = 0.9; // same units as line_width
|
245
|
+
p->yaxis_minor_tick_width = 0.7; // same units as line_width
|
246
|
+
p->yaxis_major_tick_length = 0.6; // in units of numeric label char heights
|
247
|
+
p->yaxis_minor_tick_length = 0.3; // in units of numeric label char heights
|
248
|
+
p->yaxis_log_values = false;
|
249
|
+
p->yaxis_ticks_inside = true; // inside frame or toward larger x or y value for specific location
|
250
|
+
p->yaxis_ticks_outside = false; // inside frame or toward smaller x or y value for specific location
|
251
|
+
p->yaxis_tick_interval = 0.0; // set to 0 to use default
|
252
|
+
p->yaxis_min_between_major_ticks = 2; // in units of numeric label char heights
|
253
|
+
p->yaxis_number_of_minor_intervals = 0; // set to 0 to use default
|
254
|
+
p->yaxis_locations_for_major_ticks = Qnil; // set to nil to use defaults
|
255
|
+
p->yaxis_locations_for_minor_ticks = Qnil; // set to nil to use defaults
|
256
|
+
// numeric labels on major ticks
|
257
|
+
p->yaxis_use_fixed_pt = false;
|
258
|
+
p->yaxis_digits_max = 0;
|
259
|
+
p->yaxis_tick_labels = Qnil; // set to nil to use defaults. else must have a label for each major tick
|
260
|
+
p->yaxis_numeric_label_decimal_digits = -1; // set to negative to use default
|
261
|
+
p->yaxis_numeric_label_scale = 0.7;
|
262
|
+
p->yaxis_numeric_label_shift = 0.5; // in char heights, positive for out from edge (or toward larger x or y value)
|
263
|
+
p->yaxis_numeric_label_angle = 0.0;
|
264
|
+
p->yaxis_numeric_label_alignment = ALIGNED_AT_MIDHEIGHT;
|
265
|
+
p->yaxis_numeric_label_justification = CENTERED;
|
266
|
+
p->left_edge_type = EDGE_WITH_TICKS;
|
267
|
+
p->left_edge_visible = true;
|
268
|
+
p->right_edge_type = EDGE_WITH_TICKS;
|
269
|
+
p->right_edge_visible = true;
|
270
|
+
/* Legend */
|
271
|
+
p->legend_line_x0 = 0.5;
|
272
|
+
p->legend_line_x1 = 2.0;
|
273
|
+
p->legend_line_dy = 0.4;
|
274
|
+
p->legend_text_width = -1;
|
275
|
+
p->legend_text_xstart = 2.8;
|
276
|
+
p->legend_text_ystart = 2.0;
|
277
|
+
p->legend_text_dy = 1.9;
|
278
|
+
p->legend_line_width = -1;
|
279
|
+
p->legend_scale = 0.6;
|
280
|
+
p->legend_alignment = ALIGNED_AT_BASELINE;
|
281
|
+
p->legend_justification = LEFT_JUSTIFIED;
|
282
|
+
p->debug_verbosity_level = 0;
|
283
|
+
|
284
|
+
/* emit a warning by default */
|
285
|
+
p->croak_on_nonok_numbers = 1;
|
286
|
+
}
|
287
|
+
|
288
|
+
VALUE do_cmd(VALUE fmkr, VALUE cmd) { return rb_funcall(fmkr, do_cmd_ID, 1, cmd); }
|
289
|
+
|
290
|
+
static void Type_Error(VALUE obj, ID name_ID, char *expected)
|
291
|
+
{
|
292
|
+
char *name = rb_id2name(name_ID);
|
293
|
+
while (name[0] == '@') name++;
|
294
|
+
rb_raise(rb_eArgError, "Require %s value for '%s'", expected, name);
|
295
|
+
}
|
296
|
+
|
297
|
+
bool Get_bool(VALUE obj, ID name_ID) {
|
298
|
+
VALUE v = rb_ivar_get(obj, name_ID);
|
299
|
+
if (v != Qfalse && v != Qtrue && v != Qnil)
|
300
|
+
Type_Error(v, name_ID, "true or false");
|
301
|
+
return v == Qtrue;
|
302
|
+
}
|
303
|
+
|
304
|
+
int Get_int(VALUE obj, ID name_ID) {
|
305
|
+
VALUE v = rb_ivar_get(obj, name_ID);
|
306
|
+
if (!rb_obj_is_kind_of(v,rb_Integer_class))
|
307
|
+
Type_Error(v, name_ID, "Integer");
|
308
|
+
v = rb_Integer(v);
|
309
|
+
return NUM2INT(v);
|
310
|
+
}
|
311
|
+
|
312
|
+
double Get_double(VALUE obj, ID name_ID) {
|
313
|
+
VALUE v = rb_ivar_get(obj, name_ID);
|
314
|
+
if (!rb_obj_is_kind_of(v,rb_Numeric_class))
|
315
|
+
Type_Error(v, name_ID, "Numeric");
|
316
|
+
v = rb_Float(v);
|
317
|
+
return NUM2DBL(v);
|
318
|
+
}
|
319
|
+
|
320
|
+
|
321
|
+
char *Get_tex_preview_paper_width(VALUE fmkr) {
|
322
|
+
VALUE v = rb_ivar_get(fmkr, tex_preview_paper_width_ID);
|
323
|
+
if (v == Qnil) return NULL;
|
324
|
+
return StringValuePtr(v);
|
325
|
+
}
|
326
|
+
|
327
|
+
char *Get_tex_preview_paper_height(VALUE fmkr) {
|
328
|
+
VALUE v = rb_ivar_get(fmkr, tex_preview_paper_height_ID);
|
329
|
+
if (v == Qnil) return NULL;
|
330
|
+
return StringValuePtr(v);
|
331
|
+
}
|
332
|
+
|
333
|
+
char *Get_tex_preview_hoffset(VALUE fmkr) {
|
334
|
+
VALUE v = rb_ivar_get(fmkr, tex_preview_hoffset_ID);
|
335
|
+
if (v == Qnil) return NULL;
|
336
|
+
return StringValuePtr(v);
|
337
|
+
}
|
338
|
+
|
339
|
+
char *Get_tex_preview_voffset(VALUE fmkr) {
|
340
|
+
VALUE v = rb_ivar_get(fmkr, tex_preview_voffset_ID);
|
341
|
+
if (v == Qnil) return NULL;
|
342
|
+
return StringValuePtr(v);
|
343
|
+
}
|
344
|
+
|
345
|
+
char *Get_tex_preview_figure_width(VALUE fmkr) {
|
346
|
+
VALUE v = rb_ivar_get(fmkr, tex_preview_figure_width_ID);
|
347
|
+
if (v == Qnil) return NULL;
|
348
|
+
return StringValuePtr(v);
|
349
|
+
}
|
350
|
+
|
351
|
+
char *Get_tex_preview_figure_height(VALUE fmkr) {
|
352
|
+
VALUE v = rb_ivar_get(fmkr, tex_preview_figure_height_ID);
|
353
|
+
if (v == Qnil) return NULL;
|
354
|
+
return StringValuePtr(v);
|
355
|
+
}
|
356
|
+
|
357
|
+
|
358
|
+
char *Get_tex_fontsize(VALUE fmkr) {
|
359
|
+
VALUE v = rb_ivar_get(fmkr, tex_fontsize_ID);
|
360
|
+
if (v == Qnil) return NULL;
|
361
|
+
return StringValuePtr(v);
|
362
|
+
}
|
363
|
+
|
364
|
+
char *Get_tex_fontfamily(VALUE fmkr) {
|
365
|
+
VALUE v = rb_ivar_get(fmkr, tex_fontfamily_ID);
|
366
|
+
if (v == Qnil) return NULL;
|
367
|
+
return StringValuePtr(v);
|
368
|
+
}
|
369
|
+
|
370
|
+
char *Get_tex_fontseries(VALUE fmkr) {
|
371
|
+
VALUE v = rb_ivar_get(fmkr, tex_fontseries_ID);
|
372
|
+
if (v == Qnil) return NULL;
|
373
|
+
return StringValuePtr(v);
|
374
|
+
}
|
375
|
+
|
376
|
+
char *Get_tex_fontshape(VALUE fmkr) {
|
377
|
+
VALUE v = rb_ivar_get(fmkr, tex_fontshape_ID);
|
378
|
+
if (v == Qnil) return NULL;
|
379
|
+
return StringValuePtr(v);
|
380
|
+
}
|
381
|
+
|
382
|
+
char *Get_tex_preview_minwhitespace(VALUE fmkr) {
|
383
|
+
VALUE v = rb_ivar_get(fmkr, tex_preview_minwhitespace_ID);
|
384
|
+
if (v == Qnil) return NULL;
|
385
|
+
return StringValuePtr(v);
|
386
|
+
}
|
387
|
+
|
388
|
+
bool Get_tex_preview_fullpage(VALUE fmkr) {
|
389
|
+
VALUE v = rb_ivar_get(fmkr, tex_preview_fullpage_ID);
|
390
|
+
return v != Qfalse && v != Qnil;
|
391
|
+
}
|
392
|
+
|
393
|
+
/* gets the generated preamble */
|
394
|
+
char *Get_tex_preview_generated_preamble(VALUE fmkr) {
|
395
|
+
/* it is a class constant... */
|
396
|
+
VALUE v = rb_const_get(CLASS_OF(fmkr),
|
397
|
+
rb_intern("TEX_PREAMBLE"));
|
398
|
+
if (v == Qnil) return NULL;
|
399
|
+
return StringValueCStr(v);
|
400
|
+
}
|
401
|
+
|
402
|
+
|
403
|
+
double Get_tex_xoffset(VALUE fmkr) { return Get_double(fmkr, tex_xoffset_ID); }
|
404
|
+
double Get_tex_yoffset(VALUE fmkr) { return Get_double(fmkr, tex_yoffset_ID); }
|
405
|
+
|
406
|
+
static char *Get_save_dir(VALUE fmkr) {
|
407
|
+
VALUE v = rb_ivar_get(fmkr, save_dir_ID);
|
408
|
+
if (v == Qnil) return NULL;
|
409
|
+
return StringValuePtr(v);
|
410
|
+
}
|
411
|
+
|
412
|
+
char *Get_tex_preview_documentclass(VALUE fmkr) {
|
413
|
+
VALUE v = rb_ivar_get(fmkr, tex_preview_documentclass_ID);
|
414
|
+
if (v == Qnil) return NULL;
|
415
|
+
return StringValuePtr(v);
|
416
|
+
}
|
417
|
+
|
418
|
+
char *Get_tex_preamble(VALUE fmkr) {
|
419
|
+
VALUE v = rb_ivar_get(fmkr, tex_preamble_ID);
|
420
|
+
if (v == Qnil) return NULL;
|
421
|
+
return StringValuePtr(v);
|
422
|
+
}
|
423
|
+
|
424
|
+
char *Get_xaxis_numeric_label_tex(VALUE fmkr) {
|
425
|
+
VALUE v = rb_ivar_get(fmkr, xaxis_numeric_label_tex_ID);
|
426
|
+
if (v == Qnil) return NULL;
|
427
|
+
return StringValuePtr(v);
|
428
|
+
}
|
429
|
+
|
430
|
+
char *Get_yaxis_numeric_label_tex(VALUE fmkr) {
|
431
|
+
VALUE v = rb_ivar_get(fmkr, yaxis_numeric_label_tex_ID);
|
432
|
+
if (v == Qnil) return NULL;
|
433
|
+
return StringValuePtr(v);
|
434
|
+
}
|
435
|
+
|
436
|
+
char *Get_tex_preview_pagestyle(VALUE fmkr) {
|
437
|
+
VALUE v = rb_ivar_get(fmkr, tex_preview_pagestyle_ID);
|
438
|
+
if (v == Qnil) return NULL;
|
439
|
+
return StringValuePtr(v);
|
440
|
+
}
|
441
|
+
|
442
|
+
char *Get_tex_preview_tiogafigure_command(VALUE fmkr) {
|
443
|
+
VALUE v = rb_ivar_get(fmkr, tex_preview_tiogafigure_command_ID);
|
444
|
+
if (v == Qnil) return NULL;
|
445
|
+
return StringValuePtr(v);
|
446
|
+
}
|
447
|
+
|
448
|
+
static bool Get_quiet_mode(VALUE fmkr) {
|
449
|
+
VALUE v = rb_ivar_get(fmkr, quiet_mode_ID);
|
450
|
+
return v != Qfalse && v != Qnil;
|
451
|
+
}
|
452
|
+
|
453
|
+
static bool Get_initialized() {
|
454
|
+
VALUE v = rb_cvar_get(cFM, initialized_ID);
|
455
|
+
return v != Qfalse && v != Qnil;
|
456
|
+
}
|
457
|
+
|
458
|
+
static void Set_initialized() {
|
459
|
+
rb_cv_set(cFM, "@@initialized", Qtrue);
|
460
|
+
}
|
461
|
+
|
462
|
+
static void Make_Save_Fname(VALUE fmkr, char *full_name, char *f_name,
|
463
|
+
bool with_save_dir, bool with_pdf_extension) {
|
464
|
+
int i, j, k, len, mod_len, mod_num, did_mod_num = false;
|
465
|
+
char c, *fmt, model[STRLEN], *save=NULL;
|
466
|
+
if (with_save_dir) save = Get_save_dir(fmkr);
|
467
|
+
if (with_save_dir && save != NULL && strlen(save) > 0) {
|
468
|
+
sprintf(full_name, "%s/", save); j = strlen(full_name); }
|
469
|
+
else j = 0;
|
470
|
+
if (f_name == NULL) f_name = "plot";
|
471
|
+
len = strlen(f_name);
|
472
|
+
for (i=0; i < len; i++) {
|
473
|
+
c = f_name[i];
|
474
|
+
full_name[j++] = c;
|
475
|
+
}
|
476
|
+
full_name[j] = '\0';
|
477
|
+
char *dot = strrchr(full_name,'.');
|
478
|
+
if (dot == NULL || strcmp(dot+1,"pdf") != 0) { /* add pdf extension */
|
479
|
+
full_name[j] = '\0';
|
480
|
+
if (!with_pdf_extension) return;
|
481
|
+
strcpy(full_name+j, ".pdf");
|
482
|
+
}
|
483
|
+
}
|
484
|
+
|
485
|
+
VALUE FM_get_save_filename(VALUE fmkr, VALUE name) {
|
486
|
+
char full_name[STRLEN];
|
487
|
+
Make_Save_Fname(fmkr, full_name, (name == Qnil)? NULL : StringValuePtr(name), false, false);
|
488
|
+
return rb_str_new2(full_name);
|
489
|
+
}
|
490
|
+
|
491
|
+
VALUE FM_private_make(VALUE fmkr, VALUE name, VALUE cmd) {
|
492
|
+
char full_name[STRLEN], mod_num_name[STRLEN];
|
493
|
+
FM *p = Get_FM(fmkr);
|
494
|
+
FM saved = *p;
|
495
|
+
VALUE result;
|
496
|
+
bool quiet = Get_quiet_mode(fmkr);
|
497
|
+
if (!Get_initialized()) {
|
498
|
+
Init_pdf();
|
499
|
+
Init_tex();
|
500
|
+
Set_initialized();
|
501
|
+
}
|
502
|
+
Make_Save_Fname(fmkr, full_name, (name == Qnil)? NULL : StringValuePtr(name), true, true);
|
503
|
+
Open_pdf(fmkr, full_name, quiet);
|
504
|
+
Open_tex(fmkr, full_name, quiet);
|
505
|
+
Write_gsave();
|
506
|
+
p->root_figure = true;
|
507
|
+
p->in_subplot = false;
|
508
|
+
result = rb_funcall(fmkr, make_page_ID, 1, cmd);
|
509
|
+
Write_grestore();
|
510
|
+
if (result == Qfalse) quiet = true;
|
511
|
+
Close_pdf(fmkr, quiet);
|
512
|
+
Close_tex(fmkr, quiet);
|
513
|
+
Create_wrapper(fmkr, full_name, quiet);
|
514
|
+
*p = saved;
|
515
|
+
return result;
|
516
|
+
}
|
517
|
+
|
518
|
+
VALUE FM_private_make_portfolio(VALUE fmkr, VALUE name, VALUE fignums, VALUE fignames) {
|
519
|
+
char full_name[STRLEN];
|
520
|
+
Make_Save_Fname(fmkr, full_name, (name == Qnil)? NULL : StringValuePtr(name), true, false);
|
521
|
+
private_make_portfolio(full_name, fignums, fignames);
|
522
|
+
return rb_str_new2(full_name);
|
523
|
+
}
|
524
|
+
|