tioga 1.6 → 1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Tioga_README +35 -10
- data/split/Dvector/dvector.c +264 -22
- data/split/Dvector/lib/Dvector_extras.rb +30 -2
- data/split/Flate/extconf.rb +1 -1
- data/split/Function/function.c +112 -2
- data/split/Tioga/figures.c +76 -77
- data/split/Tioga/figures.h +375 -490
- data/split/Tioga/generic.c +254 -0
- data/split/Tioga/generic.h +236 -0
- data/split/Tioga/init.c +434 -320
- data/split/Tioga/lib/Creating_Paths.rb +11 -1
- data/split/Tioga/lib/FigMkr.rb +263 -65
- data/split/Tioga/lib/Legends.rb +4 -2
- data/split/Tioga/lib/Markers.rb +3 -2
- data/split/Tioga/lib/Special_Paths.rb +22 -23
- data/split/Tioga/lib/TeX_Text.rb +79 -1
- data/split/Tioga/lib/TexPreamble.rb +14 -0
- data/split/Tioga/lib/Utils.rb +5 -1
- data/split/Tioga/pdfs.h +7 -45
- data/split/Tioga/{axes.c → shared/axes.c} +210 -197
- data/split/Tioga/{makers.c → shared/makers.c} +442 -211
- data/split/Tioga/{pdf_font_dicts.c → shared/pdf_font_dicts.c} +0 -0
- data/split/Tioga/shared/pdfcolor.c +628 -0
- data/split/Tioga/shared/pdfcoords.c +443 -0
- data/split/Tioga/{pdffile.c → shared/pdffile.c} +56 -52
- data/split/Tioga/{pdfimage.c → shared/pdfimage.c} +103 -211
- data/split/Tioga/shared/pdfpath.c +766 -0
- data/split/Tioga/{pdftext.c → shared/pdftext.c} +121 -99
- data/split/Tioga/shared/texout.c +524 -0
- data/split/Tioga/wrappers.c +489 -0
- data/split/Tioga/wrappers.h +259 -0
- data/split/extconf.rb +4 -0
- data/split/mkmf2.rb +12 -1
- data/tests/benchmark_dvector_reads.rb +112 -0
- data/tests/tc_Dvector.rb +35 -3
- data/tests/tc_Function.rb +32 -0
- metadata +65 -52
- data/split/Tioga/pdfcolor.c +0 -486
- data/split/Tioga/pdfcoords.c +0 -523
- data/split/Tioga/pdfpath.c +0 -913
- data/split/Tioga/texout.c +0 -380
data/split/Tioga/init.c
CHANGED
@@ -19,58 +19,379 @@
|
|
19
19
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20
20
|
*/
|
21
21
|
|
22
|
+
#include "generic.h"
|
22
23
|
#include "figures.h"
|
23
24
|
#include "pdfs.h"
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
long trace_cnt; // counter for debugging traces
|
27
|
+
long trace_lvl; // set to 0 to turn tracing off. higher values turn on more tracing.
|
28
|
+
#define TRACE(fn) if (trace_lvl > 0) printf("%i %s\n",++trace_cnt,fn)
|
29
|
+
|
30
|
+
static ID_PTR fm_data_ID;
|
31
|
+
static ID_PTR save_dir_ID;
|
32
|
+
static ID_PTR quiet_mode_ID;
|
33
|
+
static ID_PTR tex_preview_documentclass_ID;
|
34
|
+
static ID_PTR tex_preamble_ID;
|
35
|
+
static ID_PTR xaxis_numeric_label_tex_ID;
|
36
|
+
static ID_PTR yaxis_numeric_label_tex_ID;
|
37
|
+
static ID_PTR tex_preview_pagestyle_ID;
|
38
|
+
static ID_PTR tex_preview_paper_width_ID;
|
39
|
+
static ID_PTR tex_preview_paper_height_ID;
|
40
|
+
static ID_PTR tex_preview_hoffset_ID;
|
41
|
+
static ID_PTR tex_preview_voffset_ID;
|
42
|
+
static ID_PTR tex_preview_figure_width_ID;
|
43
|
+
static ID_PTR tex_preview_figure_height_ID;
|
44
|
+
static ID_PTR tex_preview_tiogafigure_command_ID;
|
45
|
+
static ID_PTR tex_preview_fullpage_ID;
|
46
|
+
static ID_PTR tex_preview_minwhitespace_ID;
|
47
|
+
static ID_PTR do_cmd_ID;
|
48
|
+
static ID_PTR make_page_ID;
|
49
|
+
static ID_PTR initialized_ID;
|
50
|
+
static ID_PTR tex_xoffset_ID;
|
51
|
+
static ID_PTR tex_yoffset_ID;
|
52
|
+
static ID_PTR tex_fontsize_ID;
|
53
|
+
static ID_PTR tex_fontfamily_ID;
|
54
|
+
static ID_PTR tex_fontseries_ID;
|
55
|
+
static ID_PTR tex_fontshape_ID;
|
56
|
+
static ID_PTR line_type_ID;
|
57
|
+
static ID_PTR title_ID;
|
58
|
+
static ID_PTR xlabel_ID;
|
59
|
+
static ID_PTR ylabel_ID;
|
60
|
+
static ID_PTR xaxis_locations_for_major_ticks_ID;
|
61
|
+
static ID_PTR xaxis_locations_for_minor_ticks_ID;
|
62
|
+
static ID_PTR xaxis_tick_labels_ID;
|
63
|
+
static ID_PTR yaxis_locations_for_major_ticks_ID;
|
64
|
+
static ID_PTR yaxis_locations_for_minor_ticks_ID;
|
65
|
+
static ID_PTR yaxis_tick_labels_ID;
|
66
|
+
ID_PTR measures_info_ID;
|
67
|
+
|
34
68
|
|
35
69
|
void Init_IDs(void)
|
36
70
|
{
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
do_cmd_ID =
|
41
|
-
make_page_ID =
|
71
|
+
|
72
|
+
Init_generic();
|
73
|
+
|
74
|
+
do_cmd_ID = ID_Get("do_cmd");
|
75
|
+
make_page_ID = ID_Get("make_page");
|
42
76
|
// class variables
|
43
|
-
initialized_ID =
|
77
|
+
initialized_ID = ID_Get("@@initialized");
|
44
78
|
// instance variables
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
79
|
+
fm_data_ID = ID_Get("@fm_data");
|
80
|
+
save_dir_ID = ID_Get("@save_dir");
|
81
|
+
quiet_mode_ID = ID_Get("@quiet_mode");
|
82
|
+
tex_xoffset_ID = ID_Get("@tex_xoffset");
|
83
|
+
tex_yoffset_ID = ID_Get("@tex_yoffset");
|
84
|
+
tex_preview_documentclass_ID = ID_Get("@tex_preview_documentclass");
|
85
|
+
tex_preamble_ID = ID_Get("@tex_preamble");
|
86
|
+
xaxis_numeric_label_tex_ID = ID_Get("@xaxis_numeric_label_tex");
|
87
|
+
yaxis_numeric_label_tex_ID = ID_Get("@yaxis_numeric_label_tex");
|
88
|
+
tex_preview_pagestyle_ID = ID_Get("@tex_preview_pagestyle");
|
54
89
|
|
55
|
-
tex_preview_paper_width_ID =
|
56
|
-
tex_preview_paper_height_ID =
|
57
|
-
tex_preview_hoffset_ID =
|
58
|
-
tex_preview_voffset_ID =
|
59
|
-
tex_preview_figure_width_ID =
|
60
|
-
tex_preview_figure_height_ID =
|
90
|
+
tex_preview_paper_width_ID = ID_Get("@tex_preview_paper_width");
|
91
|
+
tex_preview_paper_height_ID = ID_Get("@tex_preview_paper_height");
|
92
|
+
tex_preview_hoffset_ID = ID_Get("@tex_preview_hoffset");
|
93
|
+
tex_preview_voffset_ID = ID_Get("@tex_preview_voffset");
|
94
|
+
tex_preview_figure_width_ID = ID_Get("@tex_preview_figure_width");
|
95
|
+
tex_preview_figure_height_ID = ID_Get("@tex_preview_figure_height");
|
61
96
|
|
62
|
-
tex_preview_fullpage_ID =
|
63
|
-
tex_preview_minwhitespace_ID =
|
97
|
+
tex_preview_fullpage_ID = ID_Get("@tex_preview_fullpage");
|
98
|
+
tex_preview_minwhitespace_ID = ID_Get("@tex_preview_minwhitespace");
|
64
99
|
|
65
|
-
tex_preview_tiogafigure_command_ID =
|
100
|
+
tex_preview_tiogafigure_command_ID = ID_Get("@tex_preview_tiogafigure_command");
|
66
101
|
|
67
|
-
tex_fontsize_ID =
|
68
|
-
tex_fontfamily_ID =
|
69
|
-
tex_fontseries_ID =
|
70
|
-
tex_fontshape_ID =
|
102
|
+
tex_fontsize_ID = ID_Get("@tex_fontsize");
|
103
|
+
tex_fontfamily_ID = ID_Get("@tex_fontfamily");
|
104
|
+
tex_fontseries_ID = ID_Get("@tex_fontseries");
|
105
|
+
tex_fontshape_ID = ID_Get("@tex_fontshape");
|
106
|
+
|
107
|
+
line_type_ID = ID_Get("@line_type");
|
108
|
+
xaxis_locations_for_major_ticks_ID = ID_Get("@xaxis_locations_for_major_ticks");
|
109
|
+
xaxis_locations_for_minor_ticks_ID = ID_Get("@xaxis_locations_for_minor_ticks");
|
110
|
+
xaxis_tick_labels_ID = ID_Get("@xaxis_tick_labels");
|
111
|
+
yaxis_locations_for_major_ticks_ID = ID_Get("@yaxis_locations_for_major_ticks");
|
112
|
+
yaxis_locations_for_minor_ticks_ID = ID_Get("@yaxis_locations_for_minor_ticks");
|
113
|
+
yaxis_tick_labels_ID = ID_Get("@yaxis_tick_labels");
|
114
|
+
measures_info_ID = ID_Get("@measures_info");
|
115
|
+
}
|
116
|
+
|
117
|
+
void do_cmd(OBJ_PTR fmkr, OBJ_PTR cmd, int *ierr) {
|
118
|
+
Call_Function(fmkr, do_cmd_ID, cmd, ierr); }
|
119
|
+
|
120
|
+
static void Type_Error(OBJ_PTR obj, ID_PTR name_ID, char *expected, int *ierr)
|
121
|
+
{
|
122
|
+
char *name = ID_Name(name_ID, ierr);
|
123
|
+
if (*ierr != 0) return;
|
124
|
+
while (name[0] == '@') name++;
|
125
|
+
RAISE_ERROR_ss("Require %s OBJ_PTR for '%s'", expected, name, ierr);
|
126
|
+
}
|
127
|
+
|
128
|
+
bool Get_bool(OBJ_PTR obj, ID_PTR name_ID, int *ierr) {
|
129
|
+
OBJ_PTR v = Obj_Attr_Get(obj, name_ID, ierr);
|
130
|
+
if (*ierr != 0) return false;
|
131
|
+
if (v != OBJ_FALSE && v != OBJ_TRUE && v != OBJ_NIL) {
|
132
|
+
Type_Error(v, name_ID, "true or false", ierr);
|
133
|
+
return false;
|
134
|
+
}
|
135
|
+
return v == OBJ_TRUE;
|
136
|
+
}
|
137
|
+
|
138
|
+
int Get_int(OBJ_PTR obj, ID_PTR name_ID, int *ierr) {
|
139
|
+
OBJ_PTR v = Obj_Attr_Get(obj, name_ID, ierr);
|
140
|
+
if (*ierr != 0) return 0;
|
141
|
+
if (!Is_Kind_of_Integer(v)) {
|
142
|
+
Type_Error(v, name_ID, "Integer", ierr);
|
143
|
+
return 0;
|
144
|
+
}
|
145
|
+
return Number_to_int(v, ierr);
|
146
|
+
}
|
147
|
+
|
148
|
+
double Get_double(OBJ_PTR obj, ID_PTR name_ID, int *ierr) {
|
149
|
+
OBJ_PTR v = Obj_Attr_Get(obj, name_ID, ierr);
|
150
|
+
if (*ierr != 0) return 0.0;
|
151
|
+
if (!Is_Kind_of_Number(v)) {
|
152
|
+
Type_Error(v, name_ID, "Numeric", ierr);
|
153
|
+
return 0.0;
|
154
|
+
}
|
155
|
+
return Number_to_double(v, ierr);
|
156
|
+
}
|
157
|
+
|
158
|
+
char *Get_tex_preview_paper_width(OBJ_PTR fmkr, int *ierr) {
|
159
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preview_paper_width_ID, ierr);
|
160
|
+
if (*ierr != 0) return NULL;
|
161
|
+
if (v == OBJ_NIL) return NULL;
|
162
|
+
return String_Ptr(v, ierr);
|
163
|
+
}
|
164
|
+
|
165
|
+
char *Get_tex_preview_paper_height(OBJ_PTR fmkr, int *ierr) {
|
166
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preview_paper_height_ID, ierr);
|
167
|
+
if (*ierr != 0) return NULL;
|
168
|
+
if (v == OBJ_NIL) return NULL;
|
169
|
+
return String_Ptr(v, ierr);
|
170
|
+
}
|
171
|
+
|
172
|
+
char *Get_tex_preview_hoffset(OBJ_PTR fmkr, int *ierr) {
|
173
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preview_hoffset_ID, ierr);
|
174
|
+
if (*ierr != 0) return NULL;
|
175
|
+
if (v == OBJ_NIL) return NULL;
|
176
|
+
return String_Ptr(v, ierr);
|
177
|
+
}
|
178
|
+
|
179
|
+
char *Get_tex_preview_voffset(OBJ_PTR fmkr, int *ierr) {
|
180
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preview_voffset_ID, ierr);
|
181
|
+
if (*ierr != 0) return NULL;
|
182
|
+
if (v == OBJ_NIL) return NULL;
|
183
|
+
return String_Ptr(v, ierr);
|
184
|
+
}
|
185
|
+
|
186
|
+
char *Get_tex_preview_figure_width(OBJ_PTR fmkr, int *ierr) {
|
187
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preview_figure_width_ID, ierr);
|
188
|
+
if (*ierr != 0) return NULL;
|
189
|
+
if (v == OBJ_NIL) return NULL;
|
190
|
+
return String_Ptr(v, ierr);
|
191
|
+
}
|
192
|
+
|
193
|
+
char *Get_tex_preview_figure_height(OBJ_PTR fmkr, int *ierr) {
|
194
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preview_figure_height_ID, ierr);
|
195
|
+
if (*ierr != 0) return NULL;
|
196
|
+
if (v == OBJ_NIL) return NULL;
|
197
|
+
return String_Ptr(v, ierr);
|
198
|
+
}
|
199
|
+
|
200
|
+
|
201
|
+
char *Get_tex_fontsize(OBJ_PTR fmkr, int *ierr) {
|
202
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_fontsize_ID, ierr);
|
203
|
+
if (*ierr != 0) return NULL;
|
204
|
+
if (v == OBJ_NIL) return NULL;
|
205
|
+
return String_Ptr(v, ierr);
|
206
|
+
}
|
207
|
+
|
208
|
+
char *Get_tex_fontfamily(OBJ_PTR fmkr, int *ierr) {
|
209
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_fontfamily_ID, ierr);
|
210
|
+
if (*ierr != 0) return NULL;
|
211
|
+
if (v == OBJ_NIL) return NULL;
|
212
|
+
return String_Ptr(v, ierr);
|
213
|
+
}
|
214
|
+
|
215
|
+
char *Get_tex_fontseries(OBJ_PTR fmkr, int *ierr) {
|
216
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_fontseries_ID, ierr);
|
217
|
+
if (*ierr != 0) return NULL;
|
218
|
+
if (v == OBJ_NIL) return NULL;
|
219
|
+
return String_Ptr(v, ierr);
|
220
|
+
}
|
221
|
+
|
222
|
+
char *Get_tex_fontshape(OBJ_PTR fmkr, int *ierr) {
|
223
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_fontshape_ID, ierr);
|
224
|
+
if (*ierr != 0) return NULL;
|
225
|
+
if (v == OBJ_NIL) return NULL;
|
226
|
+
return String_Ptr(v, ierr);
|
227
|
+
}
|
228
|
+
|
229
|
+
char *Get_tex_preview_minwhitespace(OBJ_PTR fmkr, int *ierr) {
|
230
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preview_minwhitespace_ID, ierr);
|
231
|
+
if (*ierr != 0) return NULL;
|
232
|
+
if (v == OBJ_NIL) return NULL;
|
233
|
+
return String_Ptr(v, ierr);
|
234
|
+
}
|
235
|
+
|
236
|
+
bool Get_tex_preview_fullpage(OBJ_PTR fmkr, int *ierr) {
|
237
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preview_fullpage_ID, ierr);
|
238
|
+
if (*ierr != 0) return false;
|
239
|
+
return v != OBJ_FALSE && v != OBJ_NIL;
|
240
|
+
}
|
241
|
+
|
242
|
+
/* gets the generated preamble */
|
243
|
+
char *Get_tex_preview_generated_preamble(OBJ_PTR fmkr, int *ierr) {
|
244
|
+
/* it is a class constant... */
|
245
|
+
OBJ_PTR v = TEX_PREAMBLE(fmkr, ierr);
|
246
|
+
if (*ierr != 0) return NULL;
|
247
|
+
if (v == OBJ_NIL) return NULL;
|
248
|
+
return CString_Ptr(v, ierr);
|
249
|
+
}
|
250
|
+
|
251
|
+
double Get_tex_xoffset(OBJ_PTR fmkr, int *ierr) { return Get_double(fmkr, tex_xoffset_ID, ierr); }
|
252
|
+
double Get_tex_yoffset(OBJ_PTR fmkr, int *ierr) { return Get_double(fmkr, tex_yoffset_ID, ierr); }
|
253
|
+
|
254
|
+
|
255
|
+
OBJ_PTR Get_fm_data_attr(OBJ_PTR fmkr, int *ierr) { return Obj_Attr_Get(fmkr, fm_data_ID, ierr); }
|
256
|
+
|
257
|
+
|
258
|
+
static char *Get_save_dir(OBJ_PTR fmkr, int *ierr) {
|
259
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, save_dir_ID, ierr);
|
260
|
+
if (*ierr != 0) return NULL;
|
261
|
+
if (v == OBJ_NIL) return NULL;
|
262
|
+
return String_Ptr(v, ierr);
|
263
|
+
}
|
264
|
+
|
265
|
+
char *Get_tex_preview_documentclass(OBJ_PTR fmkr, int *ierr) {
|
266
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preview_documentclass_ID, ierr);
|
267
|
+
if (*ierr != 0) return NULL;
|
268
|
+
if (v == OBJ_NIL) return NULL;
|
269
|
+
return String_Ptr(v, ierr);
|
270
|
+
}
|
271
|
+
|
272
|
+
char *Get_tex_preamble(OBJ_PTR fmkr, int *ierr) {
|
273
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preamble_ID, ierr);
|
274
|
+
if (*ierr != 0) return NULL;
|
275
|
+
if (v == OBJ_NIL) return NULL;
|
276
|
+
return String_Ptr(v, ierr);
|
277
|
+
}
|
278
|
+
|
279
|
+
char *Get_xaxis_numeric_label_tex(OBJ_PTR fmkr, int *ierr) {
|
280
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, xaxis_numeric_label_tex_ID, ierr);
|
281
|
+
if (*ierr != 0) return NULL;
|
282
|
+
if (v == OBJ_NIL) return NULL;
|
283
|
+
return String_Ptr(v, ierr);
|
284
|
+
}
|
285
|
+
|
286
|
+
char *Get_yaxis_numeric_label_tex(OBJ_PTR fmkr, int *ierr) {
|
287
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, yaxis_numeric_label_tex_ID, ierr);
|
288
|
+
if (*ierr != 0) return NULL;
|
289
|
+
if (v == OBJ_NIL) return NULL;
|
290
|
+
return String_Ptr(v, ierr);
|
291
|
+
}
|
292
|
+
|
293
|
+
char *Get_tex_preview_pagestyle(OBJ_PTR fmkr, int *ierr) {
|
294
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preview_pagestyle_ID, ierr);
|
295
|
+
if (*ierr != 0) return NULL;
|
296
|
+
if (v == OBJ_NIL) return NULL;
|
297
|
+
return String_Ptr(v, ierr);
|
298
|
+
}
|
299
|
+
|
300
|
+
char *Get_tex_preview_tiogafigure_command(OBJ_PTR fmkr, int *ierr) {
|
301
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, tex_preview_tiogafigure_command_ID, ierr);
|
302
|
+
if (*ierr != 0) return NULL;
|
303
|
+
if (v == OBJ_NIL) return NULL;
|
304
|
+
return String_Ptr(v, ierr);
|
305
|
+
}
|
306
|
+
|
307
|
+
static bool Get_quiet_mode(OBJ_PTR fmkr, int *ierr) {
|
308
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, quiet_mode_ID, ierr);
|
309
|
+
if (*ierr != 0) return false;
|
310
|
+
return v != OBJ_FALSE && v != OBJ_NIL;
|
311
|
+
}
|
312
|
+
|
313
|
+
|
314
|
+
static void Make_Save_Fname(OBJ_PTR fmkr, char *full_name, char *f_name,
|
315
|
+
bool with_save_dir, bool with_pdf_extension, int *ierr) {
|
316
|
+
int i, j, k, len, mod_len, mod_num, did_mod_num = false;
|
317
|
+
char c, *fmt, model[STRLEN], *save=NULL;
|
318
|
+
if (with_save_dir) { save = Get_save_dir(fmkr,ierr); if (*ierr != 0) return; }
|
319
|
+
if (with_save_dir && save != NULL && strlen(save) > 0) {
|
320
|
+
sprintf(full_name, "%s/", save); j = strlen(full_name); }
|
321
|
+
else j = 0;
|
322
|
+
if (f_name == NULL) f_name = "plot";
|
323
|
+
len = strlen(f_name);
|
324
|
+
for (i=0; i < len; i++) {
|
325
|
+
c = f_name[i];
|
326
|
+
full_name[j++] = c;
|
327
|
+
}
|
328
|
+
full_name[j] = '\0';
|
329
|
+
char *dot = strrchr(full_name,'.');
|
330
|
+
if (dot == NULL || strcmp(dot+1,"pdf") != 0) { /* add pdf extension */
|
331
|
+
full_name[j] = '\0';
|
332
|
+
if (!with_pdf_extension) return;
|
333
|
+
strcpy(full_name+j, ".pdf");
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
|
338
|
+
OBJ_PTR c_get_save_filename(OBJ_PTR fmkr, FM *p, OBJ_PTR name, int *ierr) {
|
339
|
+
char full_name[STRLEN];
|
340
|
+
char *fname = (name == OBJ_NIL)? NULL : String_Ptr(name, ierr);
|
341
|
+
if (*ierr != 0) RETURN_NIL;
|
342
|
+
Make_Save_Fname(fmkr, full_name, fname, false, false, ierr);
|
343
|
+
if (*ierr != 0) RETURN_NIL;
|
344
|
+
return String_From_Cstring(full_name);
|
345
|
+
}
|
346
|
+
|
347
|
+
|
348
|
+
void c_private_make(OBJ_PTR fmkr, FM *p, OBJ_PTR name, OBJ_PTR cmd, int *ierr) {
|
349
|
+
char full_name[STRLEN], mod_num_name[STRLEN];
|
350
|
+
OBJ_PTR result;
|
351
|
+
bool quiet = Get_quiet_mode(fmkr, ierr);
|
352
|
+
if (*ierr != 0) return;
|
353
|
+
if (!Get_initialized()) {
|
354
|
+
Init_pdf(ierr); if (*ierr != 0) return;
|
355
|
+
Init_tex(ierr); if (*ierr != 0) return;
|
356
|
+
Set_initialized();
|
357
|
+
}
|
358
|
+
char *fn = (name == OBJ_NIL)? NULL : String_Ptr(name,ierr);
|
359
|
+
if (*ierr != 0) return;
|
360
|
+
Make_Save_Fname(fmkr, full_name, fn, true, true, ierr);
|
361
|
+
if (*ierr != 0) return;
|
362
|
+
Open_pdf(fmkr, p, full_name, quiet, ierr);
|
363
|
+
if (*ierr != 0) return;
|
364
|
+
Open_tex(fmkr, full_name, quiet, ierr);
|
365
|
+
if (*ierr != 0) return;
|
366
|
+
Write_gsave();
|
367
|
+
p->root_figure = true;
|
368
|
+
p->in_subplot = false;
|
369
|
+
Call_Function(fmkr, make_page_ID, cmd, ierr);
|
370
|
+
if (*ierr != 0) return;
|
371
|
+
Write_grestore();
|
372
|
+
if (result == OBJ_FALSE) quiet = true;
|
373
|
+
Close_pdf(fmkr, p, quiet, ierr);
|
374
|
+
if (*ierr != 0) return;
|
375
|
+
Close_tex(fmkr, quiet, ierr);
|
376
|
+
if (*ierr != 0) return;
|
377
|
+
Create_wrapper(fmkr, full_name, quiet, ierr);
|
378
|
+
}
|
379
|
+
|
380
|
+
|
381
|
+
OBJ_PTR c_private_make_portfolio(OBJ_PTR fmkr, FM *p, OBJ_PTR name, OBJ_PTR fignums, OBJ_PTR fignames, int *ierr) {
|
382
|
+
char full_name[STRLEN];
|
383
|
+
char *fn = (name == OBJ_NIL)? NULL : String_Ptr(name,ierr);
|
384
|
+
if (*ierr != 0) RETURN_NIL;
|
385
|
+
Make_Save_Fname(fmkr, full_name, fn, true, false, ierr);
|
386
|
+
if (*ierr != 0) RETURN_NIL;
|
387
|
+
private_make_portfolio(full_name, fignums, fignames, ierr);
|
388
|
+
if (*ierr != 0) RETURN_NIL;
|
389
|
+
return String_From_Cstring(full_name);
|
71
390
|
}
|
72
391
|
|
73
|
-
|
392
|
+
|
393
|
+
void c_set_device_pagesize(OBJ_PTR fmkr, FM *p, double width, double height, int *ierr) {
|
394
|
+
// sizes in units of 1/720 inch
|
74
395
|
p->page_left = 0;
|
75
396
|
p->page_right = width;
|
76
397
|
p->page_bottom = 0;
|
@@ -84,23 +405,14 @@ void c_set_device_pagesize(FM *p, double width, double height) { // sizes in uni
|
|
84
405
|
}
|
85
406
|
|
86
407
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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");
|
408
|
+
void c_set_frame_sides(OBJ_PTR fmkr, FM *p, double left, double right, double top, double bottom, int *ierr) { // sizes in page coords [0..1]
|
409
|
+
if (left > 1.0 || left < 0.0) RAISE_ERROR("Sorry: OBJ_PTR of left must be between 0 and 1 for set_frame_sides", ierr);
|
410
|
+
if (right > 1.0 || right < 0.0) RAISE_ERROR("Sorry: OBJ_PTR of right must be between 0 and 1 for set_frame_sides", ierr);
|
411
|
+
if (top > 1.0 || top < 0.0) RAISE_ERROR("Sorry: OBJ_PTR of top must be between 0 and 1 for set_frame_sides", ierr);
|
412
|
+
if (bottom > 1.0 || bottom < 0.0) RAISE_ERROR("Sorry: OBJ_PTR of bottom must be between 0 and 1 for set_frame_sides", ierr);
|
413
|
+
if (left >= right) RAISE_ERROR("Sorry: OBJ_PTR of left must be smaller than OBJ_PTR of right for set_frame_sides", ierr);
|
414
|
+
if (bottom >= top) RAISE_ERROR("Sorry: OBJ_PTR of bottom must be smaller than OBJ_PTR of top for set_frame_sides", ierr);
|
415
|
+
if (*ierr != 0) return;
|
104
416
|
p->frame_left = left;
|
105
417
|
p->frame_right = right;
|
106
418
|
p->frame_bottom = bottom;
|
@@ -109,27 +421,18 @@ void c_set_frame_sides(FM *p, double left, double right, double top, double bott
|
|
109
421
|
p->frame_height = top - bottom;
|
110
422
|
}
|
111
423
|
|
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
424
|
|
124
|
-
void
|
125
|
-
FM *p = Get_FM(fmkr);
|
425
|
+
void c_private_init_fm_data(OBJ_PTR fmkr, FM *p, int *ierr) {
|
126
426
|
/* Page */
|
127
427
|
p->root_figure = true;
|
128
428
|
p->in_subplot = false;
|
129
|
-
c_private_set_default_font_size(p, 12.0);
|
130
|
-
|
429
|
+
c_private_set_default_font_size(fmkr, p, 12.0, ierr);
|
430
|
+
if (*ierr != 0) return;
|
431
|
+
c_set_device_pagesize(fmkr, p, 5 * 72.0 * ENLARGE, 5 * 72.0 * ENLARGE, ierr);
|
432
|
+
if (*ierr != 0) return;
|
131
433
|
/* default frame */
|
132
|
-
c_set_frame_sides(p, 0.15, 0.85, 0.85, 0.15);
|
434
|
+
c_set_frame_sides(fmkr, p, 0.15, 0.85, 0.85, 0.15, ierr);
|
435
|
+
if (*ierr != 0) return;
|
133
436
|
/* default bounds */
|
134
437
|
p->bounds_left = p->bounds_bottom = p->bounds_xmin = p->bounds_ymin = 0;
|
135
438
|
p->bounds_right = p->bounds_top = p->bounds_xmax = p->bounds_ymax = 1;
|
@@ -150,13 +453,16 @@ void Initialize_Figure(VALUE fmkr) {
|
|
150
453
|
p->text_shift_from_y_origin = 2.0;
|
151
454
|
p->default_text_scale = 1.0; Recalc_Font_Hts(p);
|
152
455
|
/* graphics attributes */
|
153
|
-
p->
|
154
|
-
p->
|
456
|
+
p->stroke_color_R = 0.0;
|
457
|
+
p->stroke_color_G = 0.0;
|
458
|
+
p->stroke_color_B = 0.0;
|
459
|
+
p->fill_color_R = 0.0;
|
460
|
+
p->fill_color_G = 0.0;
|
461
|
+
p->fill_color_B = 0.0;
|
155
462
|
p->default_line_scale = 1.0;
|
156
463
|
p->line_width = 1.2;
|
157
464
|
p->line_cap = LINE_CAP_ROUND;
|
158
465
|
p->line_join = LINE_JOIN_ROUND;
|
159
|
-
p->line_type = Qnil; // means solid line
|
160
466
|
p->miter_limit = 2.0;
|
161
467
|
|
162
468
|
p->stroke_opacity = 1.0;
|
@@ -164,39 +470,42 @@ void Initialize_Figure(VALUE fmkr) {
|
|
164
470
|
|
165
471
|
/* Title */
|
166
472
|
p->title_visible = true;
|
167
|
-
p->title = Qnil;
|
168
473
|
p->title_side = TOP;
|
169
474
|
p->title_position = 0.5;
|
170
475
|
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
|
476
|
+
p->title_shift = 0.7; // in char heights, positive for out from edge (or toward larger x or y OBJ_PTR)
|
172
477
|
p->title_angle = 0.0;
|
173
478
|
p->title_alignment = ALIGNED_AT_BASELINE;
|
174
479
|
p->title_justification = CENTERED;
|
175
|
-
p->
|
480
|
+
p->title_color_R = 0.0;
|
481
|
+
p->title_color_G = 0.0;
|
482
|
+
p->title_color_B = 0.0;
|
176
483
|
|
177
484
|
/* X label */
|
178
485
|
p->xlabel_visible = true;
|
179
|
-
p->xlabel = Qnil;
|
180
486
|
p->xlabel_side = BOTTOM;
|
181
487
|
p->xlabel_position = 0.5;
|
182
488
|
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
|
489
|
+
p->xlabel_shift = 2.0; // in char heights, positive for out from edge (or toward larger x or y OBJ_PTR)
|
184
490
|
p->xlabel_angle = 0.0;
|
185
491
|
p->xlabel_alignment = ALIGNED_AT_BASELINE;
|
186
492
|
p->xlabel_justification = CENTERED;
|
187
|
-
p->
|
493
|
+
p->xlabel_color_R = 0.0;
|
494
|
+
p->xlabel_color_G = 0.0;
|
495
|
+
p->xlabel_color_B = 0.0;
|
188
496
|
|
189
497
|
/* Y label */
|
190
498
|
p->ylabel_visible = true;
|
191
|
-
p->ylabel = Qnil;
|
192
499
|
p->ylabel_side = LEFT;
|
193
500
|
p->ylabel_position = 0.5;
|
194
501
|
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
|
502
|
+
p->ylabel_shift = 1.8; // in char heights, positive for out from edge (or toward larger x or y OBJ_PTR)
|
196
503
|
p->ylabel_angle = 0.0;
|
197
504
|
p->ylabel_alignment = ALIGNED_AT_BASELINE;
|
198
505
|
p->ylabel_justification = CENTERED;
|
199
|
-
p->
|
506
|
+
p->ylabel_color_R = 0.0;
|
507
|
+
p->ylabel_color_G = 0.0;
|
508
|
+
p->ylabel_color_B = 0.0;
|
200
509
|
|
201
510
|
/* X axis */
|
202
511
|
p->xaxis_visible = true;
|
@@ -204,27 +513,26 @@ void Initialize_Figure(VALUE fmkr) {
|
|
204
513
|
p->xaxis_loc = BOTTOM;
|
205
514
|
// line
|
206
515
|
p->xaxis_line_width = 1.0; // for axis line
|
207
|
-
p->
|
516
|
+
p->xaxis_stroke_color_R = 0.0; // for axis line and tick marks
|
517
|
+
p->xaxis_stroke_color_G = 0.0;
|
518
|
+
p->xaxis_stroke_color_B = 0.0;
|
208
519
|
// tick marks
|
209
520
|
p->xaxis_major_tick_width = 0.9; // same units as line_width
|
210
521
|
p->xaxis_minor_tick_width = 0.7; // same units as line_width
|
211
522
|
p->xaxis_major_tick_length = 0.6; // in units of numeric label char heights
|
212
523
|
p->xaxis_minor_tick_length = 0.3; // in units of numeric label char heights
|
213
524
|
p->xaxis_log_values = false;
|
214
|
-
p->xaxis_ticks_inside = true; // inside frame or toward larger x or y
|
215
|
-
p->xaxis_ticks_outside = false; // inside frame or toward smaller x or y
|
525
|
+
p->xaxis_ticks_inside = true; // inside frame or toward larger x or y OBJ_PTR for specific location
|
526
|
+
p->xaxis_ticks_outside = false; // inside frame or toward smaller x or y OBJ_PTR for specific location
|
216
527
|
p->xaxis_tick_interval = 0.0; // set to 0 to use default
|
217
528
|
p->xaxis_min_between_major_ticks = 2; // in units of numeric label char heights
|
218
529
|
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
530
|
// numeric labels on major ticks
|
222
531
|
p->xaxis_use_fixed_pt = false;
|
223
532
|
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
533
|
p->xaxis_numeric_label_decimal_digits = -1; // set to negative to use default
|
226
534
|
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
|
535
|
+
p->xaxis_numeric_label_shift = 0.3; // in char heights, positive for out from edge (or toward larger x or y OBJ_PTR)
|
228
536
|
p->xaxis_numeric_label_angle = 0.0;
|
229
537
|
p->xaxis_numeric_label_alignment = ALIGNED_AT_MIDHEIGHT;
|
230
538
|
p->xaxis_numeric_label_justification = CENTERED;
|
@@ -241,27 +549,26 @@ void Initialize_Figure(VALUE fmkr) {
|
|
241
549
|
p->yaxis_loc = LEFT;
|
242
550
|
// line
|
243
551
|
p->yaxis_line_width = 1.0; // for axis line
|
244
|
-
p->
|
552
|
+
p->yaxis_stroke_color_R = 0.0; // for axis line and tick marks
|
553
|
+
p->yaxis_stroke_color_G = 0.0;
|
554
|
+
p->yaxis_stroke_color_B = 0.0;
|
245
555
|
// tick marks
|
246
556
|
p->yaxis_major_tick_width = 0.9; // same units as line_width
|
247
557
|
p->yaxis_minor_tick_width = 0.7; // same units as line_width
|
248
558
|
p->yaxis_major_tick_length = 0.6; // in units of numeric label char heights
|
249
559
|
p->yaxis_minor_tick_length = 0.3; // in units of numeric label char heights
|
250
560
|
p->yaxis_log_values = false;
|
251
|
-
p->yaxis_ticks_inside = true; // inside frame or toward larger x or y
|
252
|
-
p->yaxis_ticks_outside = false; // inside frame or toward smaller x or y
|
561
|
+
p->yaxis_ticks_inside = true; // inside frame or toward larger x or y OBJ_PTR for specific location
|
562
|
+
p->yaxis_ticks_outside = false; // inside frame or toward smaller x or y OBJ_PTR for specific location
|
253
563
|
p->yaxis_tick_interval = 0.0; // set to 0 to use default
|
254
564
|
p->yaxis_min_between_major_ticks = 2; // in units of numeric label char heights
|
255
565
|
p->yaxis_number_of_minor_intervals = 0; // set to 0 to use default
|
256
|
-
p->yaxis_locations_for_major_ticks = Qnil; // set to nil to use defaults
|
257
|
-
p->yaxis_locations_for_minor_ticks = Qnil; // set to nil to use defaults
|
258
566
|
// numeric labels on major ticks
|
259
567
|
p->yaxis_use_fixed_pt = false;
|
260
568
|
p->yaxis_digits_max = 0;
|
261
|
-
p->yaxis_tick_labels = Qnil; // set to nil to use defaults. else must have a label for each major tick
|
262
569
|
p->yaxis_numeric_label_decimal_digits = -1; // set to negative to use default
|
263
570
|
p->yaxis_numeric_label_scale = 0.7;
|
264
|
-
p->yaxis_numeric_label_shift = 0.5; // in char heights, positive for out from edge (or toward larger x or y
|
571
|
+
p->yaxis_numeric_label_shift = 0.5; // in char heights, positive for out from edge (or toward larger x or y OBJ_PTR)
|
265
572
|
p->yaxis_numeric_label_angle = 0.0;
|
266
573
|
p->yaxis_numeric_label_alignment = ALIGNED_AT_MIDHEIGHT;
|
267
574
|
p->yaxis_numeric_label_justification = CENTERED;
|
@@ -284,245 +591,52 @@ void Initialize_Figure(VALUE fmkr) {
|
|
284
591
|
p->legend_alignment = ALIGNED_AT_BASELINE;
|
285
592
|
p->legend_justification = LEFT_JUSTIFIED;
|
286
593
|
p->debug_verbosity_level = 0;
|
287
|
-
|
288
594
|
/* emit a warning by default */
|
289
595
|
p->croak_on_nonok_numbers = 1;
|
290
596
|
}
|
291
597
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
char *name = rb_id2name(name_ID);
|
297
|
-
while (name[0] == '@') name++;
|
298
|
-
rb_raise(rb_eArgError, "Require %s value for '%s'", expected, name);
|
299
|
-
}
|
300
|
-
|
301
|
-
bool Get_bool(VALUE obj, ID name_ID) {
|
302
|
-
VALUE v = rb_ivar_get(obj, name_ID);
|
303
|
-
if (v != Qfalse && v != Qtrue && v != Qnil)
|
304
|
-
Type_Error(v, name_ID, "true or false");
|
305
|
-
return v == Qtrue;
|
306
|
-
}
|
307
|
-
|
308
|
-
int Get_int(VALUE obj, ID name_ID) {
|
309
|
-
VALUE v = rb_ivar_get(obj, name_ID);
|
310
|
-
if (!rb_obj_is_kind_of(v,rb_Integer_class))
|
311
|
-
Type_Error(v, name_ID, "Integer");
|
312
|
-
v = rb_Integer(v);
|
313
|
-
return NUM2INT(v);
|
314
|
-
}
|
315
|
-
|
316
|
-
double Get_double(VALUE obj, ID name_ID) {
|
317
|
-
VALUE v = rb_ivar_get(obj, name_ID);
|
318
|
-
if (!rb_obj_is_kind_of(v,rb_Numeric_class))
|
319
|
-
Type_Error(v, name_ID, "Numeric");
|
320
|
-
v = rb_Float(v);
|
321
|
-
return NUM2DBL(v);
|
598
|
+
OBJ_PTR Get_line_type(OBJ_PTR fmkr, int *ierr) {
|
599
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, line_type_ID, ierr);
|
600
|
+
if (*ierr != 0) RETURN_NIL;
|
601
|
+
return v;
|
322
602
|
}
|
323
603
|
|
324
|
-
|
325
|
-
|
326
|
-
VALUE v = rb_ivar_get(fmkr, tex_preview_paper_width_ID);
|
327
|
-
if (v == Qnil) return NULL;
|
328
|
-
return StringValuePtr(v);
|
329
|
-
}
|
330
|
-
|
331
|
-
char *Get_tex_preview_paper_height(VALUE fmkr) {
|
332
|
-
VALUE v = rb_ivar_get(fmkr, tex_preview_paper_height_ID);
|
333
|
-
if (v == Qnil) return NULL;
|
334
|
-
return StringValuePtr(v);
|
604
|
+
void Set_line_type(OBJ_PTR fmkr, OBJ_PTR v, int *ierr) {
|
605
|
+
Obj_Attr_Set(fmkr, line_type_ID, v, ierr);
|
335
606
|
}
|
336
607
|
|
337
|
-
|
338
|
-
|
339
|
-
if (
|
340
|
-
return
|
608
|
+
OBJ_PTR Get_xaxis_locations_for_major_ticks(OBJ_PTR fmkr, int *ierr) {
|
609
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, xaxis_locations_for_major_ticks_ID, ierr);
|
610
|
+
if (*ierr != 0) RETURN_NIL;
|
611
|
+
return v;
|
341
612
|
}
|
342
613
|
|
343
|
-
|
344
|
-
|
345
|
-
if (
|
346
|
-
return
|
614
|
+
OBJ_PTR Get_xaxis_locations_for_minor_ticks(OBJ_PTR fmkr, int *ierr) {
|
615
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, xaxis_locations_for_minor_ticks_ID, ierr);
|
616
|
+
if (*ierr != 0) RETURN_NIL;
|
617
|
+
return v;
|
347
618
|
}
|
348
619
|
|
349
|
-
|
350
|
-
|
351
|
-
if (
|
352
|
-
return
|
620
|
+
OBJ_PTR Get_xaxis_tick_labels(OBJ_PTR fmkr, int *ierr) {
|
621
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, xaxis_tick_labels_ID, ierr);
|
622
|
+
if (*ierr != 0) RETURN_NIL;
|
623
|
+
return v;
|
353
624
|
}
|
354
625
|
|
355
|
-
|
356
|
-
|
357
|
-
if (
|
358
|
-
return
|
626
|
+
OBJ_PTR Get_yaxis_locations_for_major_ticks(OBJ_PTR fmkr, int *ierr) {
|
627
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, yaxis_locations_for_major_ticks_ID, ierr);
|
628
|
+
if (*ierr != 0) RETURN_NIL;
|
629
|
+
return v;
|
359
630
|
}
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
if (v == Qnil) return NULL;
|
365
|
-
return StringValuePtr(v);
|
366
|
-
}
|
367
|
-
|
368
|
-
char *Get_tex_fontfamily(VALUE fmkr) {
|
369
|
-
VALUE v = rb_ivar_get(fmkr, tex_fontfamily_ID);
|
370
|
-
if (v == Qnil) return NULL;
|
371
|
-
return StringValuePtr(v);
|
372
|
-
}
|
373
|
-
|
374
|
-
char *Get_tex_fontseries(VALUE fmkr) {
|
375
|
-
VALUE v = rb_ivar_get(fmkr, tex_fontseries_ID);
|
376
|
-
if (v == Qnil) return NULL;
|
377
|
-
return StringValuePtr(v);
|
378
|
-
}
|
379
|
-
|
380
|
-
char *Get_tex_fontshape(VALUE fmkr) {
|
381
|
-
VALUE v = rb_ivar_get(fmkr, tex_fontshape_ID);
|
382
|
-
if (v == Qnil) return NULL;
|
383
|
-
return StringValuePtr(v);
|
384
|
-
}
|
385
|
-
|
386
|
-
char *Get_tex_preview_minwhitespace(VALUE fmkr) {
|
387
|
-
VALUE v = rb_ivar_get(fmkr, tex_preview_minwhitespace_ID);
|
388
|
-
if (v == Qnil) return NULL;
|
389
|
-
return StringValuePtr(v);
|
631
|
+
OBJ_PTR Get_yaxis_locations_for_minor_ticks(OBJ_PTR fmkr, int *ierr) {
|
632
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, yaxis_locations_for_minor_ticks_ID, ierr);
|
633
|
+
if (*ierr != 0) RETURN_NIL;
|
634
|
+
return v;
|
390
635
|
}
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
return v
|
395
|
-
}
|
396
|
-
|
397
|
-
/* gets the generated preamble */
|
398
|
-
char *Get_tex_preview_generated_preamble(VALUE fmkr) {
|
399
|
-
/* it is a class constant... */
|
400
|
-
VALUE v = rb_const_get(CLASS_OF(fmkr),
|
401
|
-
rb_intern("TEX_PREAMBLE"));
|
402
|
-
if (v == Qnil) return NULL;
|
403
|
-
return StringValueCStr(v);
|
404
|
-
}
|
405
|
-
|
406
|
-
|
407
|
-
double Get_tex_xoffset(VALUE fmkr) { return Get_double(fmkr, tex_xoffset_ID); }
|
408
|
-
double Get_tex_yoffset(VALUE fmkr) { return Get_double(fmkr, tex_yoffset_ID); }
|
409
|
-
|
410
|
-
static char *Get_save_dir(VALUE fmkr) {
|
411
|
-
VALUE v = rb_ivar_get(fmkr, save_dir_ID);
|
412
|
-
if (v == Qnil) return NULL;
|
413
|
-
return StringValuePtr(v);
|
414
|
-
}
|
415
|
-
|
416
|
-
char *Get_tex_preview_documentclass(VALUE fmkr) {
|
417
|
-
VALUE v = rb_ivar_get(fmkr, tex_preview_documentclass_ID);
|
418
|
-
if (v == Qnil) return NULL;
|
419
|
-
return StringValuePtr(v);
|
420
|
-
}
|
421
|
-
|
422
|
-
char *Get_tex_preamble(VALUE fmkr) {
|
423
|
-
VALUE v = rb_ivar_get(fmkr, tex_preamble_ID);
|
424
|
-
if (v == Qnil) return NULL;
|
425
|
-
return StringValuePtr(v);
|
636
|
+
OBJ_PTR Get_yaxis_tick_labels(OBJ_PTR fmkr, int *ierr) {
|
637
|
+
OBJ_PTR v = Obj_Attr_Get(fmkr, yaxis_tick_labels_ID, ierr);
|
638
|
+
if (*ierr != 0) RETURN_NIL;
|
639
|
+
return v;
|
426
640
|
}
|
427
641
|
|
428
|
-
char *Get_xaxis_numeric_label_tex(VALUE fmkr) {
|
429
|
-
VALUE v = rb_ivar_get(fmkr, xaxis_numeric_label_tex_ID);
|
430
|
-
if (v == Qnil) return NULL;
|
431
|
-
return StringValuePtr(v);
|
432
|
-
}
|
433
|
-
|
434
|
-
char *Get_yaxis_numeric_label_tex(VALUE fmkr) {
|
435
|
-
VALUE v = rb_ivar_get(fmkr, yaxis_numeric_label_tex_ID);
|
436
|
-
if (v == Qnil) return NULL;
|
437
|
-
return StringValuePtr(v);
|
438
|
-
}
|
439
|
-
|
440
|
-
char *Get_tex_preview_pagestyle(VALUE fmkr) {
|
441
|
-
VALUE v = rb_ivar_get(fmkr, tex_preview_pagestyle_ID);
|
442
|
-
if (v == Qnil) return NULL;
|
443
|
-
return StringValuePtr(v);
|
444
|
-
}
|
445
|
-
|
446
|
-
char *Get_tex_preview_tiogafigure_command(VALUE fmkr) {
|
447
|
-
VALUE v = rb_ivar_get(fmkr, tex_preview_tiogafigure_command_ID);
|
448
|
-
if (v == Qnil) return NULL;
|
449
|
-
return StringValuePtr(v);
|
450
|
-
}
|
451
|
-
|
452
|
-
static bool Get_quiet_mode(VALUE fmkr) {
|
453
|
-
VALUE v = rb_ivar_get(fmkr, quiet_mode_ID);
|
454
|
-
return v != Qfalse && v != Qnil;
|
455
|
-
}
|
456
|
-
|
457
|
-
static bool Get_initialized() {
|
458
|
-
VALUE v = rb_cvar_get(cFM, initialized_ID);
|
459
|
-
return v != Qfalse && v != Qnil;
|
460
|
-
}
|
461
|
-
|
462
|
-
static void Set_initialized() {
|
463
|
-
rb_cv_set(cFM, "@@initialized", Qtrue);
|
464
|
-
}
|
465
|
-
|
466
|
-
static void Make_Save_Fname(VALUE fmkr, char *full_name, char *f_name,
|
467
|
-
bool with_save_dir, bool with_pdf_extension) {
|
468
|
-
int i, j, k, len, mod_len, mod_num, did_mod_num = false;
|
469
|
-
char c, *fmt, model[STRLEN], *save=NULL;
|
470
|
-
if (with_save_dir) save = Get_save_dir(fmkr);
|
471
|
-
if (with_save_dir && save != NULL && strlen(save) > 0) {
|
472
|
-
sprintf(full_name, "%s/", save); j = strlen(full_name); }
|
473
|
-
else j = 0;
|
474
|
-
if (f_name == NULL) f_name = "plot";
|
475
|
-
len = strlen(f_name);
|
476
|
-
for (i=0; i < len; i++) {
|
477
|
-
c = f_name[i];
|
478
|
-
full_name[j++] = c;
|
479
|
-
}
|
480
|
-
full_name[j] = '\0';
|
481
|
-
char *dot = strrchr(full_name,'.');
|
482
|
-
if (dot == NULL || strcmp(dot+1,"pdf") != 0) { /* add pdf extension */
|
483
|
-
full_name[j] = '\0';
|
484
|
-
if (!with_pdf_extension) return;
|
485
|
-
strcpy(full_name+j, ".pdf");
|
486
|
-
}
|
487
|
-
}
|
488
|
-
|
489
|
-
VALUE FM_get_save_filename(VALUE fmkr, VALUE name) {
|
490
|
-
char full_name[STRLEN];
|
491
|
-
Make_Save_Fname(fmkr, full_name, (name == Qnil)? NULL : StringValuePtr(name), false, false);
|
492
|
-
return rb_str_new2(full_name);
|
493
|
-
}
|
494
|
-
|
495
|
-
VALUE FM_private_make(VALUE fmkr, VALUE name, VALUE cmd) {
|
496
|
-
char full_name[STRLEN], mod_num_name[STRLEN];
|
497
|
-
FM *p = Get_FM(fmkr);
|
498
|
-
FM saved = *p;
|
499
|
-
VALUE result;
|
500
|
-
bool quiet = Get_quiet_mode(fmkr);
|
501
|
-
if (!Get_initialized()) {
|
502
|
-
Init_pdf();
|
503
|
-
Init_tex();
|
504
|
-
Set_initialized();
|
505
|
-
}
|
506
|
-
Make_Save_Fname(fmkr, full_name, (name == Qnil)? NULL : StringValuePtr(name), true, true);
|
507
|
-
Open_pdf(fmkr, full_name, quiet);
|
508
|
-
Open_tex(fmkr, full_name, quiet);
|
509
|
-
Write_gsave();
|
510
|
-
p->root_figure = true;
|
511
|
-
p->in_subplot = false;
|
512
|
-
result = rb_funcall(fmkr, make_page_ID, 1, cmd);
|
513
|
-
Write_grestore();
|
514
|
-
if (result == Qfalse) quiet = true;
|
515
|
-
Close_pdf(fmkr, quiet);
|
516
|
-
Close_tex(fmkr, quiet);
|
517
|
-
Create_wrapper(fmkr, full_name, quiet);
|
518
|
-
*p = saved;
|
519
|
-
return result;
|
520
|
-
}
|
521
|
-
|
522
|
-
VALUE FM_private_make_portfolio(VALUE fmkr, VALUE name, VALUE fignums, VALUE fignames) {
|
523
|
-
char full_name[STRLEN];
|
524
|
-
Make_Save_Fname(fmkr, full_name, (name == Qnil)? NULL : StringValuePtr(name), true, false);
|
525
|
-
private_make_portfolio(full_name, fignums, fignames);
|
526
|
-
return rb_str_new2(full_name);
|
527
|
-
}
|
528
642
|
|