tioga 1.6 → 1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -0,0 +1,259 @@
|
|
1
|
+
/* wrappers.h */
|
2
|
+
/*
|
3
|
+
Copyright (C) 2007 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
|
+
#ifndef __wrappers_H__
|
23
|
+
#define __wrappers_H__
|
24
|
+
|
25
|
+
#include "figures.h"
|
26
|
+
#include "generic.h"
|
27
|
+
|
28
|
+
|
29
|
+
// These are the Ruby wrappers
|
30
|
+
|
31
|
+
// They provide the transition from the Ruby interpreter
|
32
|
+
// to the c routines.
|
33
|
+
|
34
|
+
|
35
|
+
/*======================================================================*/
|
36
|
+
// axes.c
|
37
|
+
extern OBJ_PTR FM_show_axis(OBJ_PTR fmkr, OBJ_PTR loc);
|
38
|
+
extern OBJ_PTR FM_show_edge(OBJ_PTR fmkr, OBJ_PTR loc);
|
39
|
+
extern OBJ_PTR FM_no_title(OBJ_PTR fmkr);
|
40
|
+
extern OBJ_PTR FM_no_xlabel(OBJ_PTR fmkr);
|
41
|
+
extern OBJ_PTR FM_no_ylabel(OBJ_PTR fmkr);
|
42
|
+
extern OBJ_PTR FM_no_xaxis(OBJ_PTR fmkr);
|
43
|
+
extern OBJ_PTR FM_no_yaxis(OBJ_PTR fmkr);
|
44
|
+
extern OBJ_PTR FM_no_left_edge(OBJ_PTR fmkr);
|
45
|
+
extern OBJ_PTR FM_no_right_edge(OBJ_PTR fmkr);
|
46
|
+
extern OBJ_PTR FM_no_top_edge(OBJ_PTR fmkr);
|
47
|
+
extern OBJ_PTR FM_no_bottom_edge(OBJ_PTR fmkr);
|
48
|
+
|
49
|
+
/*======================================================================*/
|
50
|
+
// init.c
|
51
|
+
extern OBJ_PTR FM_private_init_fm_data(OBJ_PTR fmkr);
|
52
|
+
extern OBJ_PTR FM_set_frame_sides(OBJ_PTR fmkr, OBJ_PTR left, OBJ_PTR right, OBJ_PTR top, OBJ_PTR bottom); // in page coords [0..1]
|
53
|
+
extern OBJ_PTR FM_set_device_pagesize(OBJ_PTR fmkr, OBJ_PTR width, OBJ_PTR height); // size in output coords (decipoints)
|
54
|
+
extern OBJ_PTR FM_get_save_filename(OBJ_PTR fmkr, OBJ_PTR name);
|
55
|
+
extern OBJ_PTR FM_private_make(OBJ_PTR fmkr, OBJ_PTR name, OBJ_PTR cmd);
|
56
|
+
extern OBJ_PTR FM_private_make_portfolio(OBJ_PTR fmkr, OBJ_PTR name, OBJ_PTR fignums, OBJ_PTR fignames);
|
57
|
+
|
58
|
+
/*======================================================================*/
|
59
|
+
// makers.c
|
60
|
+
extern OBJ_PTR FM_private_make_contour(OBJ_PTR fmkr, OBJ_PTR gaps,
|
61
|
+
OBJ_PTR xs, OBJ_PTR ys, OBJ_PTR zs, OBJ_PTR z_level, OBJ_PTR legit, OBJ_PTR method);
|
62
|
+
extern OBJ_PTR FM_private_make_steps(OBJ_PTR fmkr, OBJ_PTR Xdata, OBJ_PTR Ydata,
|
63
|
+
OBJ_PTR xfirst, OBJ_PTR yfirst, OBJ_PTR xlast, OBJ_PTR ylast);
|
64
|
+
extern OBJ_PTR FM_private_make_spline_interpolated_points(OBJ_PTR fmkr, OBJ_PTR Xvec,
|
65
|
+
OBJ_PTR Xdata, OBJ_PTR Ydata, OBJ_PTR start_slope, OBJ_PTR end_slope);
|
66
|
+
|
67
|
+
/*======================================================================*/
|
68
|
+
// pdfcolor.c
|
69
|
+
extern OBJ_PTR FM_stroke_opacity_set(OBJ_PTR fmkr, OBJ_PTR val);
|
70
|
+
extern OBJ_PTR FM_fill_opacity_set(OBJ_PTR fmkr, OBJ_PTR val);
|
71
|
+
extern OBJ_PTR FM_private_axial_shading(OBJ_PTR fmkr, OBJ_PTR x0, OBJ_PTR y0,
|
72
|
+
OBJ_PTR x1, OBJ_PTR y1, OBJ_PTR colormap, OBJ_PTR extend_start, OBJ_PTR extend_end);
|
73
|
+
extern OBJ_PTR FM_private_radial_shading(OBJ_PTR fmkr, OBJ_PTR x0, OBJ_PTR y0, OBJ_PTR r0,
|
74
|
+
OBJ_PTR x1, OBJ_PTR y1, OBJ_PTR r1, OBJ_PTR colormap,
|
75
|
+
OBJ_PTR a, OBJ_PTR b, OBJ_PTR c, OBJ_PTR d,
|
76
|
+
OBJ_PTR extend_start, OBJ_PTR extend_end);
|
77
|
+
extern OBJ_PTR FM_private_create_colormap(OBJ_PTR fmkr, OBJ_PTR rgb_flag,
|
78
|
+
OBJ_PTR length, OBJ_PTR Ps, OBJ_PTR C1s, OBJ_PTR C2s, OBJ_PTR C3s);
|
79
|
+
extern OBJ_PTR FM_get_color_from_colormap(OBJ_PTR fmkr, OBJ_PTR color_map, OBJ_PTR color_position);
|
80
|
+
extern OBJ_PTR FM_convert_to_colormap(OBJ_PTR fmkr, OBJ_PTR Rs, OBJ_PTR Gs, OBJ_PTR Bs);
|
81
|
+
extern OBJ_PTR FM_hls_to_rgb(OBJ_PTR fmkr, OBJ_PTR hls_vec);
|
82
|
+
extern OBJ_PTR FM_rgb_to_hls(OBJ_PTR fmkr, OBJ_PTR rgb_vec);
|
83
|
+
extern OBJ_PTR FM_title_color_set(OBJ_PTR fmkr, OBJ_PTR val);
|
84
|
+
extern OBJ_PTR FM_title_color_get(OBJ_PTR fmkr);
|
85
|
+
extern OBJ_PTR FM_xlabel_color_get(OBJ_PTR fmkr);
|
86
|
+
extern OBJ_PTR FM_xlabel_color_set(OBJ_PTR fmkr, OBJ_PTR val);
|
87
|
+
extern OBJ_PTR FM_ylabel_color_get(OBJ_PTR fmkr);
|
88
|
+
extern OBJ_PTR FM_ylabel_color_set(OBJ_PTR fmkr, OBJ_PTR val);
|
89
|
+
extern OBJ_PTR FM_xaxis_stroke_color_get(OBJ_PTR fmkr);
|
90
|
+
extern OBJ_PTR FM_xaxis_stroke_color_set(OBJ_PTR fmkr, OBJ_PTR val);
|
91
|
+
extern OBJ_PTR FM_yaxis_stroke_color_get(OBJ_PTR fmkr);
|
92
|
+
extern OBJ_PTR FM_yaxis_stroke_color_set(OBJ_PTR fmkr, OBJ_PTR val);
|
93
|
+
|
94
|
+
/*======================================================================*/
|
95
|
+
// pdfcoords.c
|
96
|
+
extern OBJ_PTR FM_private_set_subframe(OBJ_PTR fmkr, OBJ_PTR left_margin, OBJ_PTR right_margin, OBJ_PTR top_margin, OBJ_PTR bottom_margin);
|
97
|
+
extern OBJ_PTR FM_private_set_default_font_size(OBJ_PTR fmkr, OBJ_PTR size); // size in points
|
98
|
+
extern OBJ_PTR FM_doing_subplot(OBJ_PTR fmkr);
|
99
|
+
extern OBJ_PTR FM_doing_subfigure(OBJ_PTR fmkr);
|
100
|
+
extern OBJ_PTR FM_private_set_bounds(OBJ_PTR fmkr, OBJ_PTR left, OBJ_PTR right, OBJ_PTR top, OBJ_PTR bottom); /* in figure coords */
|
101
|
+
extern OBJ_PTR FM_convert_to_degrees(OBJ_PTR fmkr, OBJ_PTR dx, OBJ_PTR dy);
|
102
|
+
extern OBJ_PTR FM_convert_inches_to_output(OBJ_PTR fmkr, OBJ_PTR val);
|
103
|
+
extern OBJ_PTR FM_convert_output_to_inches(OBJ_PTR fmkr, OBJ_PTR val);
|
104
|
+
extern OBJ_PTR FM_convert_mm_to_output(OBJ_PTR fmkr, OBJ_PTR val);
|
105
|
+
extern OBJ_PTR FM_convert_output_to_mm(OBJ_PTR fmkr, OBJ_PTR val);
|
106
|
+
extern OBJ_PTR FM_convert_page_to_output_x(OBJ_PTR fmkr, OBJ_PTR val);
|
107
|
+
extern OBJ_PTR FM_convert_page_to_output_y(OBJ_PTR fmkr, OBJ_PTR val);
|
108
|
+
extern OBJ_PTR FM_convert_page_to_output_dx(OBJ_PTR fmkr, OBJ_PTR val);
|
109
|
+
extern OBJ_PTR FM_convert_page_to_output_dy(OBJ_PTR fmkr, OBJ_PTR val);
|
110
|
+
extern OBJ_PTR FM_convert_output_to_page_x(OBJ_PTR fmkr, OBJ_PTR val);
|
111
|
+
extern OBJ_PTR FM_convert_output_to_page_y(OBJ_PTR fmkr, OBJ_PTR val);
|
112
|
+
extern OBJ_PTR FM_convert_output_to_page_dx(OBJ_PTR fmkr, OBJ_PTR val);
|
113
|
+
extern OBJ_PTR FM_convert_output_to_page_dy(OBJ_PTR fmkr, OBJ_PTR val);
|
114
|
+
extern OBJ_PTR FM_convert_frame_to_page_x(OBJ_PTR fmkr, OBJ_PTR val);
|
115
|
+
extern OBJ_PTR FM_convert_frame_to_page_y(OBJ_PTR fmkr, OBJ_PTR val);
|
116
|
+
extern OBJ_PTR FM_convert_frame_to_page_dx(OBJ_PTR fmkr, OBJ_PTR val);
|
117
|
+
extern OBJ_PTR FM_convert_frame_to_page_dy(OBJ_PTR fmkr, OBJ_PTR val);
|
118
|
+
extern OBJ_PTR FM_convert_page_to_frame_x(OBJ_PTR fmkr, OBJ_PTR val);
|
119
|
+
extern OBJ_PTR FM_convert_page_to_frame_y(OBJ_PTR fmkr, OBJ_PTR val);
|
120
|
+
extern OBJ_PTR FM_convert_page_to_frame_dx(OBJ_PTR fmkr, OBJ_PTR val);
|
121
|
+
extern OBJ_PTR FM_convert_page_to_frame_dy(OBJ_PTR fmkr, OBJ_PTR val);
|
122
|
+
extern OBJ_PTR FM_convert_figure_to_frame_x(OBJ_PTR fmkr, OBJ_PTR val);
|
123
|
+
extern OBJ_PTR FM_convert_figure_to_frame_y(OBJ_PTR fmkr, OBJ_PTR val);
|
124
|
+
extern OBJ_PTR FM_convert_figure_to_frame_dx(OBJ_PTR fmkr, OBJ_PTR val);
|
125
|
+
extern OBJ_PTR FM_convert_figure_to_frame_dy(OBJ_PTR fmkr, OBJ_PTR val);
|
126
|
+
extern OBJ_PTR FM_convert_frame_to_figure_x(OBJ_PTR fmkr, OBJ_PTR val);
|
127
|
+
extern OBJ_PTR FM_convert_frame_to_figure_y(OBJ_PTR fmkr, OBJ_PTR val);
|
128
|
+
extern OBJ_PTR FM_convert_frame_to_figure_dx(OBJ_PTR fmkr, OBJ_PTR val);
|
129
|
+
extern OBJ_PTR FM_convert_frame_to_figure_dy(OBJ_PTR fmkr, OBJ_PTR val);
|
130
|
+
extern OBJ_PTR FM_convert_figure_to_output_x(OBJ_PTR fmkr, OBJ_PTR val);
|
131
|
+
extern OBJ_PTR FM_convert_figure_to_output_y(OBJ_PTR fmkr, OBJ_PTR val);
|
132
|
+
extern OBJ_PTR FM_convert_figure_to_output_dx(OBJ_PTR fmkr, OBJ_PTR val);
|
133
|
+
extern OBJ_PTR FM_convert_figure_to_output_dy(OBJ_PTR fmkr, OBJ_PTR val);
|
134
|
+
extern OBJ_PTR FM_convert_output_to_figure_x(OBJ_PTR fmkr, OBJ_PTR val);
|
135
|
+
extern OBJ_PTR FM_convert_output_to_figure_y(OBJ_PTR fmkr, OBJ_PTR val);
|
136
|
+
extern OBJ_PTR FM_convert_output_to_figure_dx(OBJ_PTR fmkr, OBJ_PTR val);
|
137
|
+
extern OBJ_PTR FM_convert_output_to_figure_dy(OBJ_PTR fmkr, OBJ_PTR val);
|
138
|
+
|
139
|
+
/*======================================================================*/
|
140
|
+
// pdffile.c
|
141
|
+
extern OBJ_PTR FM_pdf_gsave(OBJ_PTR fmkr);
|
142
|
+
extern OBJ_PTR FM_pdf_grestore(OBJ_PTR fmkr);
|
143
|
+
|
144
|
+
/*======================================================================*/
|
145
|
+
// pdfimage.c
|
146
|
+
extern OBJ_PTR FM_private_show_jpg(OBJ_PTR fmkr, OBJ_PTR filename,
|
147
|
+
OBJ_PTR width, OBJ_PTR height, OBJ_PTR image_destination, OBJ_PTR mask_xo_num);
|
148
|
+
extern OBJ_PTR FM_private_create_image_data(OBJ_PTR fmkr, OBJ_PTR data,
|
149
|
+
OBJ_PTR first_row, OBJ_PTR last_row, OBJ_PTR first_column, OBJ_PTR last_column,
|
150
|
+
OBJ_PTR min_OBJ_PTR, OBJ_PTR max_OBJ_PTR, OBJ_PTR max_code, OBJ_PTR if_below_range, OBJ_PTR if_above_range);
|
151
|
+
extern OBJ_PTR FM_private_create_monochrome_image_data(OBJ_PTR fmkr, OBJ_PTR data,
|
152
|
+
OBJ_PTR first_row, OBJ_PTR last_row, OBJ_PTR first_column, OBJ_PTR last_column,
|
153
|
+
OBJ_PTR boundary, OBJ_PTR reverse);
|
154
|
+
extern OBJ_PTR FM_private_show_image(OBJ_PTR fmkr, OBJ_PTR llx, OBJ_PTR lly, OBJ_PTR lrx, OBJ_PTR lry, OBJ_PTR ulx, OBJ_PTR uly,
|
155
|
+
OBJ_PTR interpolate, OBJ_PTR w, OBJ_PTR h, OBJ_PTR data, OBJ_PTR OBJ_PTR_mask_min, OBJ_PTR OBJ_PTR_mask_max,
|
156
|
+
OBJ_PTR hival, OBJ_PTR lookup, OBJ_PTR mask_xo_num);
|
157
|
+
extern OBJ_PTR FM_private_show_rgb_image(OBJ_PTR fmkr,
|
158
|
+
OBJ_PTR llx, OBJ_PTR lly, OBJ_PTR lrx, OBJ_PTR lry, OBJ_PTR ulx, OBJ_PTR uly,
|
159
|
+
OBJ_PTR interpolate, OBJ_PTR w, OBJ_PTR h, OBJ_PTR data, OBJ_PTR mask_xo_num);
|
160
|
+
extern OBJ_PTR FM_private_show_cmyk_image(OBJ_PTR fmkr,
|
161
|
+
OBJ_PTR llx, OBJ_PTR lly, OBJ_PTR lrx, OBJ_PTR lry, OBJ_PTR ulx, OBJ_PTR uly,
|
162
|
+
OBJ_PTR interpolate, OBJ_PTR w, OBJ_PTR h, OBJ_PTR data, OBJ_PTR mask_xo_num);
|
163
|
+
extern OBJ_PTR FM_private_show_grayscale_image(OBJ_PTR fmkr,
|
164
|
+
OBJ_PTR llx, OBJ_PTR lly, OBJ_PTR lrx, OBJ_PTR lry, OBJ_PTR ulx, OBJ_PTR uly,
|
165
|
+
OBJ_PTR interpolate, OBJ_PTR w, OBJ_PTR h, OBJ_PTR data, OBJ_PTR mask_xo_num);
|
166
|
+
extern OBJ_PTR FM_private_show_monochrome_image(OBJ_PTR fmkr, OBJ_PTR llx, OBJ_PTR lly, OBJ_PTR lrx, OBJ_PTR lry, OBJ_PTR ulx, OBJ_PTR uly,
|
167
|
+
OBJ_PTR interpolate, OBJ_PTR reversed, OBJ_PTR w, OBJ_PTR h, OBJ_PTR data, OBJ_PTR mask_xo_num);
|
168
|
+
|
169
|
+
/*======================================================================*/
|
170
|
+
// pdfpath.c
|
171
|
+
extern OBJ_PTR FM_stroke_color_set(OBJ_PTR fmkr, OBJ_PTR val);
|
172
|
+
extern OBJ_PTR FM_stroke_color_get(OBJ_PTR fmkr);
|
173
|
+
extern OBJ_PTR FM_fill_color_set(OBJ_PTR fmkr, OBJ_PTR val);
|
174
|
+
extern OBJ_PTR FM_fill_color_get(OBJ_PTR fmkr);
|
175
|
+
extern OBJ_PTR FM_line_width_set(OBJ_PTR fmkr, OBJ_PTR val);
|
176
|
+
extern OBJ_PTR FM_rescale_lines(OBJ_PTR fmkr, OBJ_PTR scaling);
|
177
|
+
extern OBJ_PTR FM_line_cap_set(OBJ_PTR fmkr, OBJ_PTR val);
|
178
|
+
extern OBJ_PTR FM_line_join_set(OBJ_PTR fmkr, OBJ_PTR val);
|
179
|
+
extern OBJ_PTR FM_miter_limit_set(OBJ_PTR fmkr, OBJ_PTR val);
|
180
|
+
extern OBJ_PTR FM_line_type_set(OBJ_PTR fmkr, OBJ_PTR line_type);
|
181
|
+
extern OBJ_PTR FM_update_bbox(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y);
|
182
|
+
extern OBJ_PTR FM_bbox_left(OBJ_PTR fmkr);
|
183
|
+
extern OBJ_PTR FM_bbox_right(OBJ_PTR fmkr);
|
184
|
+
extern OBJ_PTR FM_bbox_top(OBJ_PTR fmkr);
|
185
|
+
extern OBJ_PTR FM_bbox_bottom(OBJ_PTR fmkr);
|
186
|
+
extern OBJ_PTR FM_move_to_point(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y); // x y m
|
187
|
+
extern OBJ_PTR FM_append_point_to_path(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y); // x y l
|
188
|
+
extern OBJ_PTR FM_bezier_control_points(OBJ_PTR fmkr, OBJ_PTR x0, OBJ_PTR y0, OBJ_PTR delta_x, OBJ_PTR a, OBJ_PTR b, OBJ_PTR c);
|
189
|
+
extern OBJ_PTR FM_append_curve_to_path(OBJ_PTR fmkr,
|
190
|
+
OBJ_PTR x1, OBJ_PTR y1, OBJ_PTR x2, OBJ_PTR y2, OBJ_PTR x3, OBJ_PTR y3);
|
191
|
+
extern OBJ_PTR FM_close_path(OBJ_PTR fmkr); // h
|
192
|
+
extern OBJ_PTR FM_append_arc_to_path(OBJ_PTR fmkr, OBJ_PTR x_start, OBJ_PTR y_start, OBJ_PTR x_corner, OBJ_PTR y_corner,
|
193
|
+
OBJ_PTR x_end, OBJ_PTR y_end, OBJ_PTR dx, OBJ_PTR dy);
|
194
|
+
extern OBJ_PTR FM_append_rect_to_path(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR width, OBJ_PTR height); // x y w h re
|
195
|
+
extern OBJ_PTR FM_append_rounded_rect_to_path(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR width, OBJ_PTR height, OBJ_PTR dx, OBJ_PTR dy);
|
196
|
+
extern OBJ_PTR FM_append_oval_to_path(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR dx, OBJ_PTR dy, OBJ_PTR angle);
|
197
|
+
extern OBJ_PTR FM_append_circle_to_path(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR dx);
|
198
|
+
extern OBJ_PTR FM_append_points_to_path(OBJ_PTR fmkr, OBJ_PTR x_vec, OBJ_PTR y_vec);
|
199
|
+
extern OBJ_PTR FM_private_append_points_with_gaps_to_path(OBJ_PTR fmkr, OBJ_PTR x_vec, OBJ_PTR y_vec, OBJ_PTR gaps, OBJ_PTR close_gaps);
|
200
|
+
extern OBJ_PTR FM_stroke(OBJ_PTR fmkr); // S
|
201
|
+
extern OBJ_PTR FM_close_and_stroke(OBJ_PTR fmkr); // s
|
202
|
+
extern OBJ_PTR FM_fill(OBJ_PTR fmkr); // f
|
203
|
+
extern OBJ_PTR FM_discard_path(OBJ_PTR fmkr); // n
|
204
|
+
extern OBJ_PTR FM_eofill(OBJ_PTR fmkr); // f*
|
205
|
+
extern OBJ_PTR FM_fill_and_stroke(OBJ_PTR fmkr); // B
|
206
|
+
extern OBJ_PTR FM_eofill_and_stroke(OBJ_PTR fmkr); // B*
|
207
|
+
extern OBJ_PTR FM_close_fill_and_stroke(OBJ_PTR fmkr); // b
|
208
|
+
extern OBJ_PTR FM_close_eofill_and_stroke(OBJ_PTR fmkr); // b*
|
209
|
+
extern OBJ_PTR FM_clip(OBJ_PTR fmkr); // W n
|
210
|
+
extern OBJ_PTR FM_eoclip(OBJ_PTR fmkr); // W* n
|
211
|
+
extern OBJ_PTR FM_stroke_line(OBJ_PTR fmkr, OBJ_PTR x1, OBJ_PTR y1, OBJ_PTR x2, OBJ_PTR y2);
|
212
|
+
extern OBJ_PTR FM_fill_rect(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR width, OBJ_PTR height);
|
213
|
+
extern OBJ_PTR FM_stroke_rect(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR width, OBJ_PTR height);
|
214
|
+
extern OBJ_PTR FM_fill_and_stroke_rect(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR width, OBJ_PTR height);
|
215
|
+
extern OBJ_PTR FM_clip_rect(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR width, OBJ_PTR height);
|
216
|
+
extern OBJ_PTR FM_fill_oval(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR dx, OBJ_PTR dy, OBJ_PTR angle);
|
217
|
+
extern OBJ_PTR FM_stroke_oval(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR dx, OBJ_PTR dy, OBJ_PTR angle);
|
218
|
+
extern OBJ_PTR FM_fill_and_stroke_oval(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR dx, OBJ_PTR dy, OBJ_PTR angle);
|
219
|
+
extern OBJ_PTR FM_clip_oval(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR dx, OBJ_PTR dy, OBJ_PTR angle);
|
220
|
+
extern OBJ_PTR FM_fill_rounded_rect(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR width, OBJ_PTR height, OBJ_PTR dx, OBJ_PTR dy);
|
221
|
+
extern OBJ_PTR FM_stroke_rounded_rect(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR width, OBJ_PTR height, OBJ_PTR dx, OBJ_PTR dy);
|
222
|
+
extern OBJ_PTR FM_fill_and_stroke_rounded_rect(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR width, OBJ_PTR height, OBJ_PTR dx, OBJ_PTR dy);
|
223
|
+
extern OBJ_PTR FM_clip_rounded_rect(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR width, OBJ_PTR height, OBJ_PTR dx, OBJ_PTR dy);
|
224
|
+
extern OBJ_PTR FM_fill_circle(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR dx);
|
225
|
+
extern OBJ_PTR FM_stroke_circle(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR dx);
|
226
|
+
extern OBJ_PTR FM_fill_and_stroke_circle(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR dx);
|
227
|
+
extern OBJ_PTR FM_clip_circle(OBJ_PTR fmkr, OBJ_PTR x, OBJ_PTR y, OBJ_PTR dx);
|
228
|
+
extern OBJ_PTR FM_append_frame_to_path(OBJ_PTR fmkr);
|
229
|
+
extern OBJ_PTR FM_fill_frame(OBJ_PTR fmkr);
|
230
|
+
extern OBJ_PTR FM_stroke_frame(OBJ_PTR fmkr);
|
231
|
+
extern OBJ_PTR FM_fill_and_stroke_frame(OBJ_PTR fmkr);
|
232
|
+
extern OBJ_PTR FM_clip_to_frame(OBJ_PTR fmkr);
|
233
|
+
|
234
|
+
/*======================================================================*/
|
235
|
+
// pdftext.c
|
236
|
+
extern OBJ_PTR FM_register_font(OBJ_PTR fmkr, OBJ_PTR font_name); // returns font number.
|
237
|
+
extern OBJ_PTR FM_marker_string_info(OBJ_PTR fmkr, OBJ_PTR font_number, OBJ_PTR string, OBJ_PTR scale);
|
238
|
+
extern OBJ_PTR FM_private_show_marker(OBJ_PTR fmkr, OBJ_PTR integer_args, OBJ_PTR stroke_width, OBJ_PTR string,
|
239
|
+
OBJ_PTR x, OBJ_PTR y, OBJ_PTR x_vec, OBJ_PTR y_vec,
|
240
|
+
OBJ_PTR h_scale, OBJ_PTR v_scale, OBJ_PTR scale, OBJ_PTR it_angle, OBJ_PTR ascent_angle, OBJ_PTR angle,
|
241
|
+
OBJ_PTR fill_color, OBJ_PTR stroke_color);
|
242
|
+
|
243
|
+
/*======================================================================*/
|
244
|
+
// texout.c
|
245
|
+
extern OBJ_PTR FM_rescale_text(OBJ_PTR fmkr, OBJ_PTR scaling);
|
246
|
+
extern OBJ_PTR FM_show_rotated_text(OBJ_PTR fmkr, OBJ_PTR text, OBJ_PTR frame_side, OBJ_PTR shift,
|
247
|
+
OBJ_PTR fraction, OBJ_PTR scale, OBJ_PTR angle, OBJ_PTR justification, OBJ_PTR alignment, OBJ_PTR measure_name);
|
248
|
+
extern OBJ_PTR FM_show_rotated_label(OBJ_PTR fmkr, OBJ_PTR text, OBJ_PTR xloc, OBJ_PTR yloc, OBJ_PTR scale, OBJ_PTR angle, OBJ_PTR justification, OBJ_PTR alignment, OBJ_PTR measure_name);
|
249
|
+
extern OBJ_PTR FM_check_label_clip(OBJ_PTR fmkr, OBJ_PTR xloc, OBJ_PTR yloc);
|
250
|
+
|
251
|
+
|
252
|
+
/* For saving results of text measurements. */
|
253
|
+
extern OBJ_PTR FM_save_measure(OBJ_PTR fmkr, OBJ_PTR measure_name,
|
254
|
+
OBJ_PTR width, OBJ_PTR height,
|
255
|
+
OBJ_PTR depth);
|
256
|
+
|
257
|
+
|
258
|
+
#endif /* __wrappers_H__ */
|
259
|
+
|
data/split/extconf.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require './mkmf2.rb'
|
4
4
|
|
5
|
+
$CFLAGS += " -O2 -Wall "
|
6
|
+
|
5
7
|
# Now, if you want to install the include file, you need to
|
6
8
|
# set the EXTCONF_RB_INCLUDE
|
7
9
|
if ENV.key?("EXTCONF_RB_INCLUDE")
|
@@ -102,6 +104,8 @@ else
|
|
102
104
|
puts "Skipping MacOS-specific files"
|
103
105
|
end
|
104
106
|
|
107
|
+
# Adding the Tioga directory to search for include files
|
108
|
+
add_include_path 'Tioga'
|
105
109
|
|
106
110
|
write_makefile
|
107
111
|
|
data/split/mkmf2.rb
CHANGED
@@ -918,7 +918,18 @@ module Mkmf2
|
|
918
918
|
|
919
919
|
# Now, the infrastructure for dealing with include and library
|
920
920
|
# directories:
|
921
|
-
|
921
|
+
if CONFIG.key?('rubyhdrdir')
|
922
|
+
@@include_path = [
|
923
|
+
Mkmf2.config_var("rubyhdrdir")+"/ruby",
|
924
|
+
Mkmf2.config_var("rubyhdrdir"),
|
925
|
+
Mkmf2.config_var("rubyhdrdir") + "/" +
|
926
|
+
Mkmf2.config_var("arch")
|
927
|
+
]
|
928
|
+
else
|
929
|
+
@@include_path = [ Mkmf2.config_var("rubylibdir") ]
|
930
|
+
end
|
931
|
+
|
932
|
+
@@include_path += [
|
922
933
|
Mkmf2.config_var("archdir"),
|
923
934
|
'.',
|
924
935
|
File.join('.','include')
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# A small benchmarking file for fancy_read and fast_fancy_read, just to make
|
2
|
+
# sure the latter deserves its name ;-)...
|
3
|
+
|
4
|
+
require 'Dobjects/Dvector'
|
5
|
+
require 'benchmark'
|
6
|
+
require 'stringio'
|
7
|
+
require 'tempfile'
|
8
|
+
|
9
|
+
Benchmark.bm do |x|
|
10
|
+
# We first create a 'dummy file':
|
11
|
+
f = Tempfile.new("data")
|
12
|
+
x.report("data writing(100000):") do
|
13
|
+
100000.times do |i|
|
14
|
+
f.puts "#{i*1.0}\t#{i**1.3}\t#{i**0.7}"
|
15
|
+
end
|
16
|
+
f.close
|
17
|
+
end
|
18
|
+
x.report("fancy_read(100000):") do
|
19
|
+
stream = File.open(f.path)
|
20
|
+
Dobjects::Dvector.fancy_read(stream, nil, 'default'=> 0.0).size
|
21
|
+
end
|
22
|
+
x.report("fancy_read(100000, 2nd):") do
|
23
|
+
stream = File.open(f.path)
|
24
|
+
Dobjects::Dvector.fancy_read(stream, nil, 'default'=> 0.0).size
|
25
|
+
end
|
26
|
+
x.report("fast_fancy_read(100000):") do
|
27
|
+
stream = File.open(f.path)
|
28
|
+
Dobjects::Dvector.fast_fancy_read(stream, {
|
29
|
+
'sep' => /\s+/,
|
30
|
+
'comments' => /^\s*\#/,
|
31
|
+
'skip_first' => 0,
|
32
|
+
'index_col' => false,
|
33
|
+
'remove_space' => true,
|
34
|
+
'default'=> 0.0}).size
|
35
|
+
end
|
36
|
+
x.report("fast_fancy_read(100000, 2nd):") do
|
37
|
+
stream = File.open(f.path)
|
38
|
+
Dobjects::Dvector.fast_fancy_read(stream, {
|
39
|
+
'sep' => /\s+/,
|
40
|
+
'comments' => /^\s*\#/,
|
41
|
+
'skip_first' => 0,
|
42
|
+
'index_col' => false,
|
43
|
+
'remove_space' => true,
|
44
|
+
'default'=> 0.0}).size
|
45
|
+
end
|
46
|
+
# We create a smaller file:
|
47
|
+
f = Tempfile.new("data")
|
48
|
+
1000.times do |i|
|
49
|
+
f.puts "#{i*1.0}\t#{i**1.3}\t#{i**0.7}"
|
50
|
+
end
|
51
|
+
f.close
|
52
|
+
x.report("fast_fancy_read(100 * 1000):") do
|
53
|
+
stream = File.open(f.path)
|
54
|
+
100.times do
|
55
|
+
Dobjects::Dvector.fast_fancy_read(stream, {
|
56
|
+
'sep' => /\s+/,
|
57
|
+
'comments' => /^\s*\#/,
|
58
|
+
'skip_first' => 0,
|
59
|
+
'index_col' => false,
|
60
|
+
'remove_space' => true,
|
61
|
+
'default'=> 0.0})
|
62
|
+
end
|
63
|
+
end
|
64
|
+
x.report("fancy_read(100 * 1000):") do
|
65
|
+
stream = File.open(f.path)
|
66
|
+
100.times do
|
67
|
+
Dobjects::Dvector.fancy_read(stream, nil, 'default'=> 0.0)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# We use a StringIO
|
72
|
+
string = ""
|
73
|
+
x.report("string creation:") do
|
74
|
+
50000.times do |i|
|
75
|
+
string += "#{i*1.0}\t#{i**1.3}\t#{i**0.7}\n"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
x.report("fancy_read(50000):") do
|
79
|
+
stream = StringIO.new(string)
|
80
|
+
Dobjects::Dvector.fancy_read(stream, nil, 'default'=> 0.0).size
|
81
|
+
end
|
82
|
+
x.report("fast_fancy_read(50000):") do
|
83
|
+
stream = StringIO.new(string)
|
84
|
+
Dobjects::Dvector.fast_fancy_read(stream, {
|
85
|
+
'sep' => /\s+/,
|
86
|
+
'comments' => /^\s*\#/,
|
87
|
+
'skip_first' => 0,
|
88
|
+
'index_col' => false,
|
89
|
+
'remove_space' => true,
|
90
|
+
'default'=> 0.0}).size
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
data/tests/tc_Dvector.rb
CHANGED
@@ -337,6 +337,10 @@ class TestDvector < Test::Unit::TestCase
|
|
337
337
|
assert_equal(Dvector[44, 55], a.replace(Dvector[44, 55]))
|
338
338
|
a = Dvector[11]
|
339
339
|
assert_equal(Dvector[44, 55], a.replace([44, 55]))
|
340
|
+
a = Dvector[11, 12]
|
341
|
+
assert_equal(Dvector[44, 55], a.replace([44, 55]))
|
342
|
+
a = Dvector.new(0)
|
343
|
+
assert_equal(Dvector[44, 55], a.replace([44, 55]))
|
340
344
|
end
|
341
345
|
|
342
346
|
def test_push
|
@@ -721,9 +725,10 @@ EOT
|
|
721
725
|
# some comments
|
722
726
|
|
723
727
|
# and a blank line above
|
724
|
-
|
725
|
-
-1.
|
726
|
-
-1.2
|
728
|
+
# note the initial whitespace, stripped by default:
|
729
|
+
-1.2 2.4
|
730
|
+
-1.3 2.4\t3.5
|
731
|
+
-1.2
|
727
732
|
EOT
|
728
733
|
|
729
734
|
def test_fancy_read
|
@@ -745,7 +750,34 @@ EOT
|
|
745
750
|
cols2 = [Dvector[-1.2, -1.3, -1.2], Dvector[2.4, 2.4, 0.0],
|
746
751
|
Dvector[0.0, 3.5, 0.0]]
|
747
752
|
assert_equal(cols, cols2)
|
753
|
+
end
|
754
|
+
|
755
|
+
def test_fast_fancy_read
|
756
|
+
stream = StringIO.new(FANCY_READ_TEXT)
|
757
|
+
cols = Dvector.fast_fancy_read(stream, {
|
758
|
+
'sep' => /\s+/,
|
759
|
+
'comments' => /^\s*\#/,
|
760
|
+
'skip_first' => 0,
|
761
|
+
'index_col' => false,
|
762
|
+
'remove_space' => true,
|
763
|
+
'default'=> 0.0})
|
764
|
+
cols2 = [Dvector[1.2, 1.3, 1.2], Dvector[2.4, 2.4, 0.0],
|
765
|
+
Dvector[0.0, 3.5, 0.0]]
|
766
|
+
3.times do |i|
|
767
|
+
assert_equal(cols[i], cols2[i])
|
768
|
+
end
|
748
769
|
|
770
|
+
stream = StringIO.new(FANCY_READ_TEXT_2)
|
771
|
+
cols = Dvector.fast_fancy_read(stream, {
|
772
|
+
'sep' => /\s+/,
|
773
|
+
'comments' => /^\s*\#/,
|
774
|
+
'skip_first' => 0,
|
775
|
+
'index_col' => false,
|
776
|
+
'remove_space' => true,
|
777
|
+
'default'=> 0.0})
|
778
|
+
cols2 = [Dvector[-1.2, -1.3, -1.2], Dvector[2.4, 2.4, 0.0],
|
779
|
+
Dvector[0.0, 3.5, 0.0]]
|
780
|
+
assert_equal(cols, cols2)
|
749
781
|
end
|
750
782
|
|
751
783
|
def test_compute_formula
|