romanbsd-gsl 1.11.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. data/README.rdoc +29 -0
  2. data/Rakefile +54 -0
  3. data/VERSION +1 -0
  4. data/ext/MANIFEST +116 -0
  5. data/ext/array.c +665 -0
  6. data/ext/array_complex.c +247 -0
  7. data/ext/blas.c +29 -0
  8. data/ext/blas1.c +729 -0
  9. data/ext/blas2.c +1093 -0
  10. data/ext/blas3.c +881 -0
  11. data/ext/block.c +44 -0
  12. data/ext/block_source.c +885 -0
  13. data/ext/bspline.c +116 -0
  14. data/ext/bundle.c +3 -0
  15. data/ext/cdf.c +754 -0
  16. data/ext/cheb.c +538 -0
  17. data/ext/combination.c +283 -0
  18. data/ext/common.c +310 -0
  19. data/ext/complex.c +1005 -0
  20. data/ext/const.c +668 -0
  21. data/ext/const_additional.c +120 -0
  22. data/ext/cqp.c +283 -0
  23. data/ext/deriv.c +194 -0
  24. data/ext/dht.c +360 -0
  25. data/ext/diff.c +165 -0
  26. data/ext/dirac.c +395 -0
  27. data/ext/eigen.c +2373 -0
  28. data/ext/error.c +194 -0
  29. data/ext/extconf.rb +272 -0
  30. data/ext/fcmp.c +66 -0
  31. data/ext/fft.c +1092 -0
  32. data/ext/fit.c +205 -0
  33. data/ext/fresnel.c +312 -0
  34. data/ext/function.c +522 -0
  35. data/ext/graph.c +1634 -0
  36. data/ext/gsl.c +265 -0
  37. data/ext/gsl_narray.c +652 -0
  38. data/ext/histogram.c +1717 -0
  39. data/ext/histogram2d.c +1067 -0
  40. data/ext/histogram3d.c +883 -0
  41. data/ext/histogram3d_source.c +750 -0
  42. data/ext/histogram_find.c +101 -0
  43. data/ext/histogram_oper.c +159 -0
  44. data/ext/ieee.c +98 -0
  45. data/ext/integration.c +1138 -0
  46. data/ext/interp.c +511 -0
  47. data/ext/jacobi.c +737 -0
  48. data/ext/linalg.c +4045 -0
  49. data/ext/linalg_complex.c +743 -0
  50. data/ext/math.c +724 -0
  51. data/ext/matrix.c +39 -0
  52. data/ext/matrix_complex.c +1731 -0
  53. data/ext/matrix_double.c +560 -0
  54. data/ext/matrix_int.c +256 -0
  55. data/ext/matrix_source.c +2678 -0
  56. data/ext/min.c +234 -0
  57. data/ext/monte.c +759 -0
  58. data/ext/multifit.c +1810 -0
  59. data/ext/multimin.c +793 -0
  60. data/ext/multimin_fsdf.c +156 -0
  61. data/ext/multiroots.c +952 -0
  62. data/ext/ndlinear.c +320 -0
  63. data/ext/nmf.c +159 -0
  64. data/ext/nmf_wrap.c +63 -0
  65. data/ext/ntuple.c +469 -0
  66. data/ext/odeiv.c +958 -0
  67. data/ext/ool.c +879 -0
  68. data/ext/oper_complex_source.c +253 -0
  69. data/ext/permutation.c +596 -0
  70. data/ext/poly.c +42 -0
  71. data/ext/poly2.c +265 -0
  72. data/ext/poly_source.c +1799 -0
  73. data/ext/qrng.c +171 -0
  74. data/ext/randist.c +1869 -0
  75. data/ext/rational.c +480 -0
  76. data/ext/rng.c +612 -0
  77. data/ext/root.c +408 -0
  78. data/ext/sf.c +1494 -0
  79. data/ext/sf_airy.c +200 -0
  80. data/ext/sf_bessel.c +867 -0
  81. data/ext/sf_clausen.c +28 -0
  82. data/ext/sf_coulomb.c +206 -0
  83. data/ext/sf_coupling.c +118 -0
  84. data/ext/sf_dawson.c +29 -0
  85. data/ext/sf_debye.c +157 -0
  86. data/ext/sf_dilog.c +42 -0
  87. data/ext/sf_elementary.c +44 -0
  88. data/ext/sf_ellint.c +206 -0
  89. data/ext/sf_elljac.c +29 -0
  90. data/ext/sf_erfc.c +93 -0
  91. data/ext/sf_exp.c +164 -0
  92. data/ext/sf_expint.c +211 -0
  93. data/ext/sf_fermi_dirac.c +148 -0
  94. data/ext/sf_gamma.c +344 -0
  95. data/ext/sf_gegenbauer.c +96 -0
  96. data/ext/sf_hyperg.c +197 -0
  97. data/ext/sf_laguerre.c +112 -0
  98. data/ext/sf_lambert.c +47 -0
  99. data/ext/sf_legendre.c +367 -0
  100. data/ext/sf_log.c +104 -0
  101. data/ext/sf_mathieu.c +238 -0
  102. data/ext/sf_power.c +46 -0
  103. data/ext/sf_psi.c +98 -0
  104. data/ext/sf_synchrotron.c +48 -0
  105. data/ext/sf_transport.c +76 -0
  106. data/ext/sf_trigonometric.c +207 -0
  107. data/ext/sf_zeta.c +119 -0
  108. data/ext/signal.c +310 -0
  109. data/ext/siman.c +718 -0
  110. data/ext/sort.c +208 -0
  111. data/ext/spline.c +393 -0
  112. data/ext/stats.c +799 -0
  113. data/ext/sum.c +168 -0
  114. data/ext/tamu_anova.c +56 -0
  115. data/ext/tensor.c +38 -0
  116. data/ext/tensor_source.c +1121 -0
  117. data/ext/vector.c +38 -0
  118. data/ext/vector_complex.c +2139 -0
  119. data/ext/vector_double.c +1445 -0
  120. data/ext/vector_int.c +204 -0
  121. data/ext/vector_source.c +3325 -0
  122. data/ext/wavelet.c +937 -0
  123. data/include/rb_gsl.h +140 -0
  124. data/include/rb_gsl_array.h +230 -0
  125. data/include/rb_gsl_cheb.h +21 -0
  126. data/include/rb_gsl_common.h +343 -0
  127. data/include/rb_gsl_complex.h +25 -0
  128. data/include/rb_gsl_const.h +29 -0
  129. data/include/rb_gsl_dirac.h +15 -0
  130. data/include/rb_gsl_eigen.h +17 -0
  131. data/include/rb_gsl_fft.h +62 -0
  132. data/include/rb_gsl_fit.h +25 -0
  133. data/include/rb_gsl_function.h +27 -0
  134. data/include/rb_gsl_graph.h +70 -0
  135. data/include/rb_gsl_histogram.h +65 -0
  136. data/include/rb_gsl_histogram3d.h +97 -0
  137. data/include/rb_gsl_integration.h +17 -0
  138. data/include/rb_gsl_interp.h +46 -0
  139. data/include/rb_gsl_linalg.h +25 -0
  140. data/include/rb_gsl_math.h +26 -0
  141. data/include/rb_gsl_odeiv.h +21 -0
  142. data/include/rb_gsl_poly.h +71 -0
  143. data/include/rb_gsl_rational.h +37 -0
  144. data/include/rb_gsl_rng.h +21 -0
  145. data/include/rb_gsl_root.h +22 -0
  146. data/include/rb_gsl_sf.h +119 -0
  147. data/include/rb_gsl_statistics.h +17 -0
  148. data/include/rb_gsl_tensor.h +45 -0
  149. data/include/rb_gsl_with_narray.h +22 -0
  150. data/include/templates_off.h +87 -0
  151. data/include/templates_on.h +241 -0
  152. data/lib/gsl/gnuplot.rb +41 -0
  153. data/lib/gsl/oper.rb +68 -0
  154. data/lib/ool.rb +22 -0
  155. data/lib/ool/conmin.rb +30 -0
  156. metadata +221 -0
data/ext/graph.c ADDED
@@ -0,0 +1,1634 @@
1
+ /*
2
+ graph.c
3
+ Ruby/GSL: Ruby extension library for GSL (GNU Scientific Library)
4
+ (C) Copyright 2004 by Yoshiki Tsunesada
5
+
6
+ Ruby/GSL is free software: you can redistribute it and/or modify it
7
+ under the terms of the GNU General Public License.
8
+ This library is distributed in the hope that it will be useful, but
9
+ WITHOUT ANY WARRANTY.
10
+ */
11
+ #include "rb_gsl_config.h"
12
+ #include "rb_gsl_graph.h"
13
+
14
+ void make_graphcommand(char *command, VALUE hash)
15
+ {
16
+ VALUE val;
17
+ if (TYPE(hash) == T_STRING) {
18
+ sprintf(command, "graph -T X -g 3 %s", STR2CSTR(hash));
19
+ return;
20
+ }
21
+
22
+ strcpy(command, "graph");
23
+ if (TYPE(hash) != T_HASH) rb_raise(rb_eTypeError,
24
+ "wrong argument type %s (Hash expected)",
25
+ rb_class2name(CLASS_OF(hash)));
26
+ if ((val = rb_hash_aref(hash, rb_str_new2("T"))) != Qnil)
27
+ sprintf(command, "%s -T %s", command, STR2CSTR(val));
28
+ else
29
+ sprintf(command, "%s -T X", command);
30
+
31
+ val = rb_hash_aref(hash, rb_str_new2("C"));
32
+ if (val == Qtrue)
33
+ sprintf(command, "%s -C", command);
34
+
35
+ if ((val = rb_hash_aref(hash, rb_str_new2("g"))) != Qnil)
36
+ sprintf(command, "%s -g %d", command, (int) FIX2INT(val));
37
+ else
38
+ sprintf(command, "%s -g 3", command);
39
+
40
+ if ((val = rb_hash_aref(hash, rb_str_new2("B"))) == Qtrue)
41
+ sprintf(command, "%s -B", command);
42
+ if ((val = rb_hash_aref(hash, rb_str_new2("E"))) != Qnil)
43
+ sprintf(command, "%s -E %s", command, STR2CSTR(val));
44
+ if ((val = rb_hash_aref(hash, rb_str_new2("f"))) != Qnil)
45
+ sprintf(command, "%s -f %f", command, NUM2DBL(val));
46
+ if ((val = rb_hash_aref(hash, rb_str_new2("F"))) != Qnil)
47
+ sprintf(command, "%s -F %s", command, STR2CSTR(val));
48
+
49
+ if ((val = rb_hash_aref(hash, rb_str_new2("h"))) != Qnil)
50
+ sprintf(command, "%s -h %f", command, NUM2DBL(val));
51
+ if ((val = rb_hash_aref(hash, rb_str_new2("k"))) != Qnil)
52
+ sprintf(command, "%s -k %f", command, NUM2DBL(val));
53
+ if ((val = rb_hash_aref(hash, rb_str_new2("K"))) != Qnil)
54
+ sprintf(command, "%s -K %d", command, (int) FIX2INT(val));
55
+ if ((val = rb_hash_aref(hash, rb_str_new2("l"))) != Qnil) {
56
+ if (str_tail_grep(STR2CSTR(val), "xy") || str_tail_grep(STR2CSTR(val), "x/y"))
57
+ sprintf(command, "%s -l x -l y", command);
58
+ else
59
+ sprintf(command, "%s -l %s", command, STR2CSTR(val));
60
+ }
61
+
62
+ if ((val = rb_hash_aref(hash, rb_str_new2("L"))) != Qnil)
63
+ sprintf(command, "%s -L \"%s\"", command, STR2CSTR(val));
64
+ if ((val = rb_hash_aref(hash, rb_str_new2("N"))) != Qnil)
65
+ sprintf(command, "%s -N %s", command, STR2CSTR(val));
66
+ if ((val = rb_hash_aref(hash, rb_str_new2("r"))) != Qnil)
67
+ sprintf(command, "%s -r %f", command, NUM2DBL(val));
68
+ if ((val = rb_hash_aref(hash, rb_str_new2("R"))) != Qnil)
69
+ sprintf(command, "%s -R %s", command, STR2CSTR(val));
70
+ if ((val = rb_hash_aref(hash, rb_str_new2("s"))) == Qtrue)
71
+ sprintf(command, "%s -s", command);
72
+ if ((val = rb_hash_aref(hash, rb_str_new2("t"))) == Qtrue)
73
+ sprintf(command, "%s -t", command);
74
+ if ((val = rb_hash_aref(hash, rb_str_new2("u"))) != Qnil)
75
+ sprintf(command, "%s -u %f", command, NUM2DBL(val));
76
+ if ((val = rb_hash_aref(hash, rb_str_new2("w"))) != Qnil)
77
+ sprintf(command, "%s -w %f", command, NUM2DBL(val));
78
+ if ((val = rb_hash_aref(hash, rb_str_new2("x"))) != Qnil)
79
+ sprintf(command, "%s -x %s", command, STR2CSTR(val));
80
+ if ((val = rb_hash_aref(hash, rb_str_new2("X"))) != Qnil)
81
+ sprintf(command, "%s -X \"%s\"", command, STR2CSTR(val));
82
+ if ((val = rb_hash_aref(hash, rb_str_new2("y"))) != Qnil)
83
+ sprintf(command, "%s -y %s", command, STR2CSTR(val));
84
+ if ((val = rb_hash_aref(hash, rb_str_new2("Y"))) != Qnil)
85
+ sprintf(command, "%s -Y \"%s\"", command, STR2CSTR(val));
86
+ if ((val = rb_hash_aref(hash, rb_str_new2("bg-color"))) != Qnil)
87
+ sprintf(command, "%s --bg-color %s", command, STR2CSTR(val));
88
+ if ((val = rb_hash_aref(hash, rb_str_new2("bitmap-size"))) != Qnil)
89
+ sprintf(command, "%s --bitmap-size %s", command, STR2CSTR(val));
90
+ if ((val = rb_hash_aref(hash, rb_str_new2("frame-color"))) != Qnil)
91
+ sprintf(command, "%s --frame-color %s", command, STR2CSTR(val));
92
+ if ((val = rb_hash_aref(hash, rb_str_new2("frame-line-width"))) != Qnil)
93
+ sprintf(command, "%s --frame-line-width %f", command, NUM2DBL(val));
94
+ if ((val = rb_hash_aref(hash, rb_str_new2("max-line-length"))) != Qnil)
95
+ sprintf(command, "%s --max-line-length %f", command, NUM2DBL(val));
96
+ if ((val = rb_hash_aref(hash, rb_str_new2("page-size"))) != Qnil)
97
+ sprintf(command, "%s --page-size %s", command, STR2CSTR(val));
98
+ if ((val = rb_hash_aref(hash, rb_str_new2("pen-colors"))) != Qnil)
99
+ sprintf(command, "%s --pen-colors %s", command, STR2CSTR(val));
100
+ if ((val = rb_hash_aref(hash, rb_str_new2("rotation"))) != Qnil)
101
+ sprintf(command, "%s --rotation %f", command, NUM2DBL(val));
102
+ if ((val = rb_hash_aref(hash, rb_str_new2("title-font-name"))) != Qnil)
103
+ sprintf(command, "%s --title-font-name %s", command, STR2CSTR(val));
104
+ if ((val = rb_hash_aref(hash, rb_str_new2("title-font-size"))) != Qnil)
105
+ sprintf(command, "%s --title-font-size %f", command, NUM2DBL(val));
106
+
107
+ if ((val = rb_hash_aref(hash, rb_str_new2("toggle-rotate-y-label"))) == Qtrue)
108
+ sprintf(command, "%s --toggle-rotate-y-label", command);
109
+
110
+ if ((val = rb_hash_aref(hash, rb_str_new2("m"))) != Qnil)
111
+ sprintf(command, "%s -m %d", command, (int) FIX2INT(val));
112
+ if ((val = rb_hash_aref(hash, rb_str_new2("S"))) != Qnil)
113
+ sprintf(command, "%s -S %d", command, (int) FIX2INT(val));
114
+ if ((val = rb_hash_aref(hash, rb_str_new2("W"))) != Qnil)
115
+ sprintf(command, "%s -W %f", command, NUM2DBL(val));
116
+ if ((val = rb_hash_aref(hash, rb_str_new2("q"))) != Qnil)
117
+ sprintf(command, "%s -q %f", command, NUM2DBL(val));
118
+
119
+ if ((val = rb_hash_aref(hash, rb_str_new2("symbol-font-name"))) != Qnil)
120
+ sprintf(command, "%s --symbol-font-name %s", command, STR2CSTR(val));
121
+
122
+ if ((val = rb_hash_aref(hash, rb_str_new2("reposition"))) != Qnil)
123
+ sprintf(command, "%s --reposition %s", command, STR2CSTR(val));
124
+ if ((val = rb_hash_aref(hash, rb_str_new2("blankout"))) != Qnil)
125
+ sprintf(command, "%s --blankout %s", command, STR2CSTR(val));
126
+
127
+ if ((val = rb_hash_aref(hash, rb_str_new2("O"))) == Qtrue)
128
+ sprintf(command, "%s -O", command);
129
+ }
130
+
131
+ static void gsl_graph_init(gsl_graph *g);
132
+ gsl_graph* gsl_graph_new()
133
+ {
134
+ gsl_graph *g = NULL;
135
+ g = ALLOC(gsl_graph);
136
+ gsl_graph_init(g);
137
+ return g;
138
+ }
139
+
140
+ static void gsl_graph_init(gsl_graph *g)
141
+ {
142
+ g->xdata = Qnil;
143
+ g->ydata = Qnil;
144
+
145
+ g->T = Qnil;
146
+ g->E = Qnil;
147
+ g->f = Qnil;
148
+ g->F = Qnil;
149
+ g->g = Qnil;
150
+ g->h = Qnil;
151
+ g->k = Qnil;
152
+ g->K = Qnil;
153
+ g->l = Qnil;
154
+ g->L = Qnil;
155
+ g->N = Qnil;
156
+ g->r = Qnil;
157
+ g->R = Qnil;
158
+ g->u = Qnil;
159
+ g->w = Qnil;
160
+ g->x = Qnil;
161
+ g->y = Qnil;
162
+ g->X = Qnil;
163
+ g->Y = Qnil;
164
+
165
+ g->bg = Qnil;
166
+ g->bitmap_size = Qnil;
167
+ g->frame = Qnil;
168
+ g->frame_line_width = Qnil;
169
+ g->max_line_length = Qnil;
170
+ g->page_size = Qnil;
171
+ g->pen_colors = Qnil;
172
+ g->rotation = Qnil;
173
+ g->title_font_size = Qnil;
174
+ g->title_font_name = Qnil;
175
+ g->rotate_y_label = Qfalse;
176
+
177
+ g->I = Qnil;
178
+ g->m = Qnil;
179
+ g->S = Qnil;
180
+ g->W = Qnil;
181
+ g->q = Qnil;
182
+ g->symbol_font_name = Qnil;
183
+ g->reposition = Qnil;
184
+ g->blankout = Qnil;
185
+
186
+ g->s = Qfalse;
187
+ g->t = Qfalse;
188
+
189
+ g->B = Qfalse;
190
+ g->C = Qfalse;
191
+ g->O = Qfalse;
192
+ }
193
+
194
+ static void gsl_graph_mark(gsl_graph *g)
195
+ {
196
+ rb_gc_mark(g->xdata);
197
+ rb_gc_mark(g->ydata);
198
+ rb_gc_mark(g->T);
199
+ rb_gc_mark(g->E);
200
+ rb_gc_mark(g->f);
201
+ rb_gc_mark(g->F);
202
+ rb_gc_mark(g->g);
203
+ rb_gc_mark(g->h);
204
+ rb_gc_mark(g->k);
205
+ rb_gc_mark(g->K);
206
+ rb_gc_mark(g->l);
207
+ rb_gc_mark(g->L);
208
+ rb_gc_mark(g->N);
209
+ rb_gc_mark(g->r);
210
+ rb_gc_mark(g->R);
211
+ rb_gc_mark(g->s);
212
+ rb_gc_mark(g->t);
213
+ rb_gc_mark(g->u);
214
+ rb_gc_mark(g->w);
215
+ rb_gc_mark(g->x);
216
+ rb_gc_mark(g->y);
217
+ rb_gc_mark(g->X);
218
+ rb_gc_mark(g->Y);
219
+ rb_gc_mark(g->bg);
220
+ rb_gc_mark(g->bitmap_size);
221
+ rb_gc_mark(g->frame);
222
+ rb_gc_mark(g->frame_line_width);
223
+ rb_gc_mark(g->max_line_length);
224
+ rb_gc_mark(g->page_size);
225
+ rb_gc_mark(g->pen_colors);
226
+ rb_gc_mark(g->rotation);
227
+ rb_gc_mark(g->title_font_name);
228
+ rb_gc_mark(g->title_font_size);
229
+ rb_gc_mark(g->rotate_y_label);
230
+ rb_gc_mark(g->I);
231
+ rb_gc_mark(g->B);
232
+ rb_gc_mark(g->m);
233
+ rb_gc_mark(g->S);
234
+ rb_gc_mark(g->W);
235
+ rb_gc_mark(g->q);
236
+ rb_gc_mark(g->C);
237
+ rb_gc_mark(g->symbol_font_name);
238
+ rb_gc_mark(g->reposition);
239
+ rb_gc_mark(g->blankout);
240
+ rb_gc_mark(g->O);
241
+ }
242
+
243
+ void gsl_graph_free(gsl_graph *g)
244
+ {
245
+ free((gsl_graph *) g);
246
+ }
247
+
248
+ static VALUE rb_gsl_graph_set_xdata(VALUE obj, VALUE xx);
249
+ static VALUE rb_gsl_graph_set_ydata(VALUE obj, VALUE yy);
250
+ static VALUE rb_gsl_graph_set_xydata(VALUE obj, VALUE xx, VALUE yy);
251
+ static VALUE rb_gsl_graph_new(int argc, VALUE *argv, VALUE klass)
252
+ {
253
+ gsl_graph *g = NULL;
254
+ VALUE obj;
255
+ g = gsl_graph_new();
256
+ obj = Data_Wrap_Struct(klass, gsl_graph_mark, gsl_graph_free, g);
257
+ switch (argc) {
258
+ case 1:
259
+ rb_gsl_graph_set_xdata(obj, argv[0]);
260
+ break;
261
+ case 2:
262
+ rb_gsl_graph_set_xydata(obj, argv[0], argv[1]);
263
+ break;
264
+ }
265
+ return obj;
266
+ }
267
+
268
+ static VALUE rb_gsl_graph_init(VALUE obj)
269
+ {
270
+ gsl_graph *g = NULL;
271
+ Data_Get_Struct(obj, gsl_graph, g);
272
+ gsl_graph_init(g);
273
+ return obj;
274
+ }
275
+
276
+ static VALUE rb_gsl_graph_xdata(VALUE obj)
277
+ {
278
+ gsl_graph *g = NULL;
279
+ Data_Get_Struct(obj, gsl_graph, g);
280
+ return g->xdata;
281
+ }
282
+
283
+ static VALUE rb_gsl_graph_ydata(VALUE obj)
284
+ {
285
+ gsl_graph *g = NULL;
286
+ Data_Get_Struct(obj, gsl_graph, g);
287
+ return g->ydata;
288
+ }
289
+
290
+ static VALUE rb_gsl_graph_xydata(VALUE obj)
291
+ {
292
+ gsl_graph *g = NULL;
293
+ Data_Get_Struct(obj, gsl_graph, g);
294
+ return rb_ary_new3(2, g->xdata, g->ydata);
295
+ }
296
+
297
+ static VALUE rb_gsl_graph_set_xdata(VALUE obj, VALUE xx)
298
+ {
299
+ gsl_graph *g = NULL;
300
+ Data_Get_Struct(obj, gsl_graph, g);
301
+ CHECK_VECTOR(xx);
302
+ g->xdata = xx;
303
+ return obj;
304
+ }
305
+
306
+ static VALUE rb_gsl_graph_set_ydata(VALUE obj, VALUE yy)
307
+ {
308
+ gsl_graph *g = NULL;
309
+ Data_Get_Struct(obj, gsl_graph, g);
310
+ CHECK_VECTOR(yy);
311
+ g->ydata = yy;
312
+ return obj;
313
+ }
314
+
315
+ static VALUE rb_gsl_graph_set_xydata(VALUE obj, VALUE xx, VALUE yy)
316
+ {
317
+ gsl_graph *g = NULL;
318
+ Data_Get_Struct(obj, gsl_graph, g);
319
+ CHECK_VECTOR(xx); CHECK_VECTOR(yy);
320
+ g->xdata = xx;
321
+ g->ydata = yy;
322
+ return obj;
323
+ }
324
+
325
+ static VALUE rb_gsl_graph_set_T(VALUE obj, VALUE T)
326
+ {
327
+ gsl_graph *g = NULL;
328
+ Data_Get_Struct(obj, gsl_graph, g);
329
+ Check_Type(T, T_STRING);
330
+ g->T = T;
331
+ return T;
332
+ }
333
+
334
+ static VALUE rb_gsl_graph_T(VALUE obj)
335
+ {
336
+ gsl_graph *g = NULL;
337
+ Data_Get_Struct(obj, gsl_graph, g);
338
+ return g->T;
339
+ }
340
+
341
+ static VALUE rb_gsl_graph_set_E(VALUE obj, VALUE E)
342
+ {
343
+ gsl_graph *g = NULL;
344
+ Data_Get_Struct(obj, gsl_graph, g);
345
+ Check_Type(E, T_STRING);
346
+ g->E = E;
347
+ return E;
348
+ }
349
+
350
+ static VALUE rb_gsl_graph_E(VALUE obj)
351
+ {
352
+ gsl_graph *g = NULL;
353
+ Data_Get_Struct(obj, gsl_graph, g);
354
+ return g->E;
355
+ }
356
+
357
+ static VALUE rb_gsl_graph_set_f(VALUE obj, VALUE f)
358
+ {
359
+ gsl_graph *g = NULL;
360
+ Data_Get_Struct(obj, gsl_graph, g);
361
+ g->f = f;
362
+ return f;
363
+ }
364
+
365
+ static VALUE rb_gsl_graph_f(VALUE obj)
366
+ {
367
+ gsl_graph *g = NULL;
368
+ Data_Get_Struct(obj, gsl_graph, g);
369
+ return g->f;
370
+ }
371
+
372
+ static VALUE rb_gsl_graph_set_F(VALUE obj, VALUE F)
373
+ {
374
+ gsl_graph *g = NULL;
375
+ Data_Get_Struct(obj, gsl_graph, g);
376
+ g->F = F;
377
+ return F;
378
+ }
379
+
380
+ static VALUE rb_gsl_graph_F(VALUE obj)
381
+ {
382
+ gsl_graph *g = NULL;
383
+ Data_Get_Struct(obj, gsl_graph, g);
384
+ return g->F;
385
+ }
386
+
387
+ static VALUE rb_gsl_graph_set_g(VALUE obj, VALUE gg)
388
+ {
389
+ gsl_graph *g = NULL;
390
+ Data_Get_Struct(obj, gsl_graph, g);
391
+ Check_Type(gg, T_FIXNUM);
392
+ g->g = gg;
393
+ return gg;
394
+ }
395
+
396
+ static VALUE rb_gsl_graph_g(VALUE obj)
397
+ {
398
+ gsl_graph *g = NULL;
399
+ Data_Get_Struct(obj, gsl_graph, g);
400
+ return g->g;
401
+ }
402
+
403
+ static VALUE rb_gsl_graph_set_h(VALUE obj, VALUE h)
404
+ {
405
+ gsl_graph *g = NULL;
406
+ Data_Get_Struct(obj, gsl_graph, g);
407
+ g->h = h;
408
+ return h;
409
+ }
410
+
411
+ static VALUE rb_gsl_graph_h(VALUE obj)
412
+ {
413
+ gsl_graph *g = NULL;
414
+ Data_Get_Struct(obj, gsl_graph, g);
415
+ return g->h;
416
+ }
417
+
418
+ static VALUE rb_gsl_graph_set_k(VALUE obj, VALUE k)
419
+ {
420
+ gsl_graph *g = NULL;
421
+ Data_Get_Struct(obj, gsl_graph, g);
422
+ g->k = k;
423
+ return k;
424
+ }
425
+
426
+ static VALUE rb_gsl_graph_k(VALUE obj)
427
+ {
428
+ gsl_graph *g = NULL;
429
+ Data_Get_Struct(obj, gsl_graph, g);
430
+ return g->k;
431
+ }
432
+
433
+ static VALUE rb_gsl_graph_set_K(VALUE obj, VALUE K)
434
+ {
435
+ gsl_graph *g = NULL;
436
+ Data_Get_Struct(obj, gsl_graph, g);
437
+ g->K = K;
438
+ return K;
439
+ }
440
+
441
+ static VALUE rb_gsl_graph_K(VALUE obj)
442
+ {
443
+ gsl_graph *g = NULL;
444
+ Data_Get_Struct(obj, gsl_graph, g);
445
+ return g->K;
446
+ }
447
+
448
+ static VALUE rb_gsl_graph_set_l(VALUE obj, VALUE l)
449
+ {
450
+ gsl_graph *g = NULL;
451
+ Data_Get_Struct(obj, gsl_graph, g);
452
+ g->l = l;
453
+ return l;
454
+ }
455
+
456
+ static VALUE rb_gsl_graph_l(VALUE obj)
457
+ {
458
+ gsl_graph *g = NULL;
459
+ Data_Get_Struct(obj, gsl_graph, g);
460
+ return g->l;
461
+ }
462
+
463
+ static VALUE rb_gsl_graph_set_L(VALUE obj, VALUE L)
464
+ {
465
+ gsl_graph *g = NULL;
466
+ Data_Get_Struct(obj, gsl_graph, g);
467
+ g->L = L;
468
+ return L;
469
+ }
470
+
471
+ static VALUE rb_gsl_graph_L(VALUE obj)
472
+ {
473
+ gsl_graph *g = NULL;
474
+ Data_Get_Struct(obj, gsl_graph, g);
475
+ return g->L;
476
+ }
477
+
478
+ static VALUE rb_gsl_graph_set_N(VALUE obj, VALUE N)
479
+ {
480
+ gsl_graph *g = NULL;
481
+ Data_Get_Struct(obj, gsl_graph, g);
482
+ g->N = N;
483
+ return N;
484
+ }
485
+
486
+ static VALUE rb_gsl_graph_N(VALUE obj)
487
+ {
488
+ gsl_graph *g = NULL;
489
+ Data_Get_Struct(obj, gsl_graph, g);
490
+ return g->N;
491
+ }
492
+
493
+ static VALUE rb_gsl_graph_set_r(VALUE obj, VALUE r)
494
+ {
495
+ gsl_graph *g = NULL;
496
+ Data_Get_Struct(obj, gsl_graph, g);
497
+ g->r = r;
498
+ return r;
499
+ }
500
+
501
+ static VALUE rb_gsl_graph_r(VALUE obj)
502
+ {
503
+ gsl_graph *g = NULL;
504
+ Data_Get_Struct(obj, gsl_graph, g);
505
+ return g->r;
506
+ }
507
+
508
+ static VALUE rb_gsl_graph_set_R(VALUE obj, VALUE R)
509
+ {
510
+ gsl_graph *g = NULL;
511
+ Data_Get_Struct(obj, gsl_graph, g);
512
+ g->R = R;
513
+ return R;
514
+ }
515
+
516
+ static VALUE rb_gsl_graph_R(VALUE obj)
517
+ {
518
+ gsl_graph *g = NULL;
519
+ Data_Get_Struct(obj, gsl_graph, g);
520
+ return g->R;
521
+ }
522
+
523
+ static VALUE rb_gsl_graph_set_s(VALUE obj, VALUE s)
524
+ {
525
+ gsl_graph *g = NULL;
526
+ Data_Get_Struct(obj, gsl_graph, g);
527
+ g->s = s;
528
+ return s;
529
+ }
530
+
531
+ static VALUE rb_gsl_graph_s(VALUE obj)
532
+ {
533
+ gsl_graph *g = NULL;
534
+ Data_Get_Struct(obj, gsl_graph, g);
535
+ return g->s;
536
+ }
537
+
538
+ static VALUE rb_gsl_graph_set_t(VALUE obj, VALUE t)
539
+ {
540
+ gsl_graph *g = NULL;
541
+ Data_Get_Struct(obj, gsl_graph, g);
542
+ g->t = t;
543
+ return t;
544
+ }
545
+
546
+ static VALUE rb_gsl_graph_t(VALUE obj)
547
+ {
548
+ gsl_graph *g = NULL;
549
+ Data_Get_Struct(obj, gsl_graph, g);
550
+ return g->t;
551
+ }
552
+
553
+ static VALUE rb_gsl_graph_set_u(VALUE obj, VALUE u)
554
+ {
555
+ gsl_graph *g = NULL;
556
+ Data_Get_Struct(obj, gsl_graph, g);
557
+ g->u = u;
558
+ return u;
559
+ }
560
+
561
+ static VALUE rb_gsl_graph_u(VALUE obj)
562
+ {
563
+ gsl_graph *g = NULL;
564
+ Data_Get_Struct(obj, gsl_graph, g);
565
+ return g->u;
566
+ }
567
+
568
+ static VALUE rb_gsl_graph_set_w(VALUE obj, VALUE w)
569
+ {
570
+ gsl_graph *g = NULL;
571
+ Data_Get_Struct(obj, gsl_graph, g);
572
+ g->w = w;
573
+ return w;
574
+ }
575
+
576
+ static VALUE rb_gsl_graph_w(VALUE obj)
577
+ {
578
+ gsl_graph *g = NULL;
579
+ Data_Get_Struct(obj, gsl_graph, g);
580
+ return g->w;
581
+ }
582
+
583
+ static VALUE rb_gsl_graph_set_x(VALUE obj, VALUE x)
584
+ {
585
+ gsl_graph *g = NULL;
586
+ Data_Get_Struct(obj, gsl_graph, g);
587
+ g->x = x;
588
+ return x;
589
+ }
590
+
591
+ static VALUE rb_gsl_graph_x(VALUE obj)
592
+ {
593
+ gsl_graph *g = NULL;
594
+ Data_Get_Struct(obj, gsl_graph, g);
595
+ return g->x;
596
+ }
597
+
598
+ static VALUE rb_gsl_graph_set_y(VALUE obj, VALUE y)
599
+ {
600
+ gsl_graph *g = NULL;
601
+ Data_Get_Struct(obj, gsl_graph, g);
602
+ g->y = y;
603
+ return y;
604
+ }
605
+
606
+ static VALUE rb_gsl_graph_y(VALUE obj)
607
+ {
608
+ gsl_graph *g = NULL;
609
+ Data_Get_Struct(obj, gsl_graph, g);
610
+ return g->y;
611
+ }
612
+ static VALUE rb_gsl_graph_set_X(VALUE obj, VALUE X)
613
+ {
614
+ gsl_graph *g = NULL;
615
+ Data_Get_Struct(obj, gsl_graph, g);
616
+ Check_Type(X, T_STRING);
617
+ g->X = X;
618
+ return X;
619
+ }
620
+
621
+ static VALUE rb_gsl_graph_set_Y(VALUE obj, VALUE Y)
622
+ {
623
+ gsl_graph *g = NULL;
624
+ Data_Get_Struct(obj, gsl_graph, g);
625
+ Check_Type(Y, T_STRING);
626
+ g->Y = Y;
627
+ return Y;
628
+ }
629
+
630
+ static VALUE rb_gsl_graph_X(VALUE obj)
631
+ {
632
+ gsl_graph *g = NULL;
633
+ Data_Get_Struct(obj, gsl_graph, g);
634
+ return g->X;
635
+ }
636
+
637
+ static VALUE rb_gsl_graph_Y(VALUE obj)
638
+ {
639
+ gsl_graph *g = NULL;
640
+ Data_Get_Struct(obj, gsl_graph, g);
641
+ return g->Y;
642
+ }
643
+
644
+ static VALUE rb_gsl_graph_set_bg(VALUE obj, VALUE bg)
645
+ {
646
+ gsl_graph *g = NULL;
647
+ Data_Get_Struct(obj, gsl_graph, g);
648
+ g->bg = bg;
649
+ return bg;
650
+ }
651
+
652
+ static VALUE rb_gsl_graph_bg(VALUE obj)
653
+ {
654
+ gsl_graph *g = NULL;
655
+ Data_Get_Struct(obj, gsl_graph, g);
656
+ return g->bg;
657
+ }
658
+
659
+ static VALUE rb_gsl_graph_set_bitmap_size(VALUE obj, VALUE bitmap_size)
660
+ {
661
+ gsl_graph *g = NULL;
662
+ Data_Get_Struct(obj, gsl_graph, g);
663
+ g->bitmap_size = bitmap_size;
664
+ return bitmap_size;
665
+ }
666
+
667
+ static VALUE rb_gsl_graph_bitmap_size(VALUE obj)
668
+ {
669
+ gsl_graph *g = NULL;
670
+ Data_Get_Struct(obj, gsl_graph, g);
671
+ return g->bitmap_size;
672
+ }
673
+
674
+ static VALUE rb_gsl_graph_set_frame(VALUE obj, VALUE frame)
675
+ {
676
+ gsl_graph *g = NULL;
677
+ Data_Get_Struct(obj, gsl_graph, g);
678
+ g->frame = frame;
679
+ return frame;
680
+ }
681
+
682
+ static VALUE rb_gsl_graph_frame(VALUE obj)
683
+ {
684
+ gsl_graph *g = NULL;
685
+ Data_Get_Struct(obj, gsl_graph, g);
686
+ return g->frame;
687
+ }
688
+
689
+ static VALUE rb_gsl_graph_set_frame_line_width(VALUE obj, VALUE frame_line_width)
690
+ {
691
+ gsl_graph *g = NULL;
692
+ Data_Get_Struct(obj, gsl_graph, g);
693
+ g->frame_line_width = frame_line_width;
694
+ return frame_line_width;
695
+ }
696
+
697
+ static VALUE rb_gsl_graph_frame_line_width(VALUE obj)
698
+ {
699
+ gsl_graph *g = NULL;
700
+ Data_Get_Struct(obj, gsl_graph, g);
701
+ return g->frame_line_width;
702
+ }
703
+
704
+ static VALUE rb_gsl_graph_set_max_line_length(VALUE obj, VALUE max_line_length)
705
+ {
706
+ gsl_graph *g = NULL;
707
+ Data_Get_Struct(obj, gsl_graph, g);
708
+ g->max_line_length = max_line_length;
709
+ return max_line_length;
710
+ }
711
+
712
+ static VALUE rb_gsl_graph_max_line_length(VALUE obj)
713
+ {
714
+ gsl_graph *g = NULL;
715
+ Data_Get_Struct(obj, gsl_graph, g);
716
+ return g->max_line_length;
717
+ }
718
+
719
+ static VALUE rb_gsl_graph_set_page_size(VALUE obj, VALUE page_size)
720
+ {
721
+ gsl_graph *g = NULL;
722
+ Data_Get_Struct(obj, gsl_graph, g);
723
+ g->page_size = page_size;
724
+ return page_size;
725
+ }
726
+
727
+ static VALUE rb_gsl_graph_page_size(VALUE obj)
728
+ {
729
+ gsl_graph *g = NULL;
730
+ Data_Get_Struct(obj, gsl_graph, g);
731
+ return g->page_size;
732
+ }
733
+
734
+ static VALUE rb_gsl_graph_set_pen_colors(VALUE obj, VALUE pen_colors)
735
+ {
736
+ gsl_graph *g = NULL;
737
+ Data_Get_Struct(obj, gsl_graph, g);
738
+ g->pen_colors = pen_colors;
739
+ return pen_colors;
740
+ }
741
+
742
+ static VALUE rb_gsl_graph_pen_colors(VALUE obj)
743
+ {
744
+ gsl_graph *g = NULL;
745
+ Data_Get_Struct(obj, gsl_graph, g);
746
+ return g->pen_colors;
747
+ }
748
+
749
+ static VALUE rb_gsl_graph_set_rotation(VALUE obj, VALUE rotation)
750
+ {
751
+ gsl_graph *g = NULL;
752
+ Data_Get_Struct(obj, gsl_graph, g);
753
+ g->rotation = rotation;
754
+ return rotation;
755
+ }
756
+
757
+ static VALUE rb_gsl_graph_rotation(VALUE obj)
758
+ {
759
+ gsl_graph *g = NULL;
760
+ Data_Get_Struct(obj, gsl_graph, g);
761
+ return g->rotation;
762
+ }
763
+
764
+ static VALUE rb_gsl_graph_set_title_font_name(VALUE obj, VALUE title_font_name)
765
+ {
766
+ gsl_graph *g = NULL;
767
+ Data_Get_Struct(obj, gsl_graph, g);
768
+ g->title_font_name = title_font_name;
769
+ return title_font_name;
770
+ }
771
+
772
+ static VALUE rb_gsl_graph_title_font_name(VALUE obj)
773
+ {
774
+ gsl_graph *g = NULL;
775
+ Data_Get_Struct(obj, gsl_graph, g);
776
+ return g->title_font_name;
777
+ }
778
+
779
+ static VALUE rb_gsl_graph_set_title_font_size(VALUE obj, VALUE title_font_size)
780
+ {
781
+ gsl_graph *g = NULL;
782
+ Data_Get_Struct(obj, gsl_graph, g);
783
+ g->title_font_size = title_font_size;
784
+ return title_font_size;
785
+ }
786
+
787
+ static VALUE rb_gsl_graph_title_font_size(VALUE obj)
788
+ {
789
+ gsl_graph *g = NULL;
790
+ Data_Get_Struct(obj, gsl_graph, g);
791
+ return g->title_font_size;
792
+ }
793
+
794
+ static VALUE rb_gsl_graph_set_rotate_y_label(VALUE obj, VALUE rotate_y_label)
795
+ {
796
+ gsl_graph *g = NULL;
797
+ Data_Get_Struct(obj, gsl_graph, g);
798
+ g->rotate_y_label = rotate_y_label;
799
+ return rotate_y_label;
800
+ }
801
+
802
+ static VALUE rb_gsl_graph_rotate_y_label(VALUE obj)
803
+ {
804
+ gsl_graph *g = NULL;
805
+ Data_Get_Struct(obj, gsl_graph, g);
806
+ return g->rotate_y_label;
807
+ }
808
+
809
+ static VALUE rb_gsl_graph_set_I(VALUE obj, VALUE I)
810
+ {
811
+ gsl_graph *g = NULL;
812
+ Data_Get_Struct(obj, gsl_graph, g);
813
+ g->I = I;
814
+ return I;
815
+ }
816
+
817
+ static VALUE rb_gsl_graph_I(VALUE obj)
818
+ {
819
+ gsl_graph *g = NULL;
820
+ Data_Get_Struct(obj, gsl_graph, g);
821
+ return g->I;
822
+ }
823
+
824
+ static VALUE rb_gsl_graph_set_B(VALUE obj, VALUE B)
825
+ {
826
+ gsl_graph *g = NULL;
827
+ Data_Get_Struct(obj, gsl_graph, g);
828
+ g->B = B;
829
+ return B;
830
+ }
831
+
832
+ static VALUE rb_gsl_graph_B(VALUE obj)
833
+ {
834
+ gsl_graph *g = NULL;
835
+ Data_Get_Struct(obj, gsl_graph, g);
836
+ return g->B;
837
+ }
838
+
839
+ static VALUE rb_gsl_graph_set_m(VALUE obj, VALUE m)
840
+ {
841
+ gsl_graph *g = NULL;
842
+ Data_Get_Struct(obj, gsl_graph, g);
843
+ g->m = m;
844
+ return m;
845
+ }
846
+
847
+ static VALUE rb_gsl_graph_m(VALUE obj)
848
+ {
849
+ gsl_graph *g = NULL;
850
+ Data_Get_Struct(obj, gsl_graph, g);
851
+ return g->m;
852
+ }
853
+
854
+ static VALUE rb_gsl_graph_set_S(VALUE obj, VALUE S)
855
+ {
856
+ gsl_graph *g = NULL;
857
+ Data_Get_Struct(obj, gsl_graph, g);
858
+ g->S = S;
859
+ return S;
860
+ }
861
+
862
+ static VALUE rb_gsl_graph_S(VALUE obj)
863
+ {
864
+ gsl_graph *g = NULL;
865
+ Data_Get_Struct(obj, gsl_graph, g);
866
+ return g->S;
867
+ }
868
+
869
+ static VALUE rb_gsl_graph_set_W(VALUE obj, VALUE W)
870
+ {
871
+ gsl_graph *g = NULL;
872
+ Data_Get_Struct(obj, gsl_graph, g);
873
+ g->W = W;
874
+ return W;
875
+ }
876
+
877
+ static VALUE rb_gsl_graph_W(VALUE obj)
878
+ {
879
+ gsl_graph *g = NULL;
880
+ Data_Get_Struct(obj, gsl_graph, g);
881
+ return g->W;
882
+ }
883
+
884
+ static VALUE rb_gsl_graph_set_q(VALUE obj, VALUE q)
885
+ {
886
+ gsl_graph *g = NULL;
887
+ Data_Get_Struct(obj, gsl_graph, g);
888
+ g->q = q;
889
+ return q;
890
+ }
891
+
892
+ static VALUE rb_gsl_graph_q(VALUE obj)
893
+ {
894
+ gsl_graph *g = NULL;
895
+ Data_Get_Struct(obj, gsl_graph, g);
896
+ return g->q;
897
+ }
898
+
899
+ static VALUE rb_gsl_graph_set_C(VALUE obj, VALUE C)
900
+ {
901
+ gsl_graph *g = NULL;
902
+ Data_Get_Struct(obj, gsl_graph, g);
903
+ g->C = C;
904
+ return C;
905
+ }
906
+
907
+ static VALUE rb_gsl_graph_C(VALUE obj)
908
+ {
909
+ gsl_graph *g = NULL;
910
+ Data_Get_Struct(obj, gsl_graph, g);
911
+ return g->C;
912
+ }
913
+
914
+ static VALUE rb_gsl_graph_set_symbol_font_name(VALUE obj, VALUE symbol_font_name)
915
+ {
916
+ gsl_graph *g = NULL;
917
+ Data_Get_Struct(obj, gsl_graph, g);
918
+ g->symbol_font_name = symbol_font_name;
919
+ return symbol_font_name;
920
+ }
921
+
922
+ static VALUE rb_gsl_graph_symbol_font_name(VALUE obj)
923
+ {
924
+ gsl_graph *g = NULL;
925
+ Data_Get_Struct(obj, gsl_graph, g);
926
+ return g->symbol_font_name;
927
+ }
928
+
929
+ static VALUE rb_gsl_graph_set_reposition(VALUE obj, VALUE r)
930
+ {
931
+ gsl_graph *g = NULL;
932
+ Data_Get_Struct(obj, gsl_graph, g);
933
+ g->reposition = r;
934
+ return r;
935
+ }
936
+
937
+ static VALUE rb_gsl_graph_reposition(VALUE obj)
938
+ {
939
+ gsl_graph *g = NULL;
940
+ Data_Get_Struct(obj, gsl_graph, g);
941
+ return g->reposition;
942
+ }
943
+
944
+ static VALUE rb_gsl_graph_set_blankout(VALUE obj, VALUE r)
945
+ {
946
+ gsl_graph *g = NULL;
947
+ Data_Get_Struct(obj, gsl_graph, g);
948
+ g->blankout = r;
949
+ return r;
950
+ }
951
+
952
+ static VALUE rb_gsl_graph_blankout(VALUE obj)
953
+ {
954
+ gsl_graph *g = NULL;
955
+ Data_Get_Struct(obj, gsl_graph, g);
956
+ return g->blankout;
957
+ }
958
+
959
+ static VALUE rb_gsl_graph_set_O(VALUE obj, VALUE O)
960
+ {
961
+ gsl_graph *g = NULL;
962
+ Data_Get_Struct(obj, gsl_graph, g);
963
+ g->O = O;
964
+ return O;
965
+ }
966
+
967
+ static VALUE rb_gsl_graph_O(VALUE obj)
968
+ {
969
+ gsl_graph *g = NULL;
970
+ Data_Get_Struct(obj, gsl_graph, g);
971
+ return g->O;
972
+ }
973
+
974
+ static void gsl_graph_set_command(gsl_graph *g, char *command)
975
+ {
976
+ char str[256];
977
+ size_t i, len;
978
+ VALUE val;
979
+ strcpy(command, "graph");
980
+ if (g->T == Qnil)
981
+ sprintf(command, "%s -T X", command);
982
+ else
983
+ sprintf(command, "%s -T %s", command, STR2CSTR(g->T));
984
+
985
+ if (TYPE(g->E) == T_STRING) {
986
+ strcpy(str, STR2CSTR(g->E));
987
+ if (strcmp(str, "x") == 0)
988
+ sprintf(command, "%s -E x", command);
989
+ else if (strcmp(str, "y") == 0)
990
+ sprintf(command, "%s -E y", command);
991
+ else if (strcmp(str, "xy")*strcmp(str, "x/y") == 0)
992
+ sprintf(command, "%s -E x -E y", command);
993
+ else
994
+ rb_raise(rb_eRuntimeError, "unrecognized -E option %s", str);
995
+ }
996
+
997
+ if (g->f != Qnil)
998
+ sprintf(command, "%s -f %f", command, NUM2DBL(g->f));
999
+
1000
+ if (TYPE(g->F) == T_STRING)
1001
+ sprintf(command, "%s -F %s", command, STR2CSTR(g->F));
1002
+
1003
+ if (TYPE(g->g) == T_FIXNUM)
1004
+ sprintf(command, "%s -g %d", command, (int) FIX2INT(g->g));
1005
+
1006
+ if (g->h != Qnil)
1007
+ sprintf(command, "%s -h %f", command, NUM2DBL(g->h));
1008
+
1009
+ if (g->k != Qnil)
1010
+ sprintf(command, "%s -k %f", command, NUM2DBL(g->k));
1011
+
1012
+ if (TYPE(g->K) == T_FIXNUM)
1013
+ sprintf(command, "%s -K %d", command, (int) FIX2INT(g->K));
1014
+
1015
+ if (TYPE(g->l) == T_STRING) {
1016
+ strcpy(str, STR2CSTR(g->l));
1017
+ if (strcmp(str, "x") == 0)
1018
+ sprintf(command, "%s -l x", command);
1019
+ else if (strcmp(str, "y") == 0)
1020
+ sprintf(command, "%s -l y", command);
1021
+ else if (strcmp(str, "xy")*strcmp(str, "x/y") == 0)
1022
+ sprintf(command, "%s -l x -l y", command);
1023
+ else
1024
+ rb_raise(rb_eRuntimeError, "unrecognized -l option %s", str);
1025
+ }
1026
+
1027
+ if (TYPE(g->L) == T_STRING)
1028
+ sprintf(command, "%s -L \"%s\"", command, STR2CSTR(g->L));
1029
+
1030
+ if (TYPE(g->N) == T_STRING) {
1031
+ strcpy(str, STR2CSTR(g->N));
1032
+ if (strcmp(str, "x") == 0)
1033
+ sprintf(command, "%s -N x", command);
1034
+ else if (strcmp(str, "y") == 0)
1035
+ sprintf(command, "%s -N y", command);
1036
+ else if (strcmp(str, "xy")*strcmp(str, "x/y") == 0)
1037
+ sprintf(command, "%s -N x -N y", command);
1038
+ else
1039
+ rb_raise(rb_eRuntimeError, "unrecognized -N option %s", str);
1040
+ }
1041
+
1042
+ if (g->r != Qnil)
1043
+ sprintf(command, "%s -r %f", command, NUM2DBL(g->r));
1044
+
1045
+ if (TYPE(g->R) == T_STRING) {
1046
+ strcpy(str, STR2CSTR(g->R));
1047
+ if (strcmp(str, "x") == 0)
1048
+ sprintf(command, "%s -R x", command);
1049
+ else if (strcmp(str, "y") == 0)
1050
+ sprintf(command, "%s -R y", command);
1051
+ else if (strcmp(str, "xy")*strcmp(str, "x/y") == 0)
1052
+ sprintf(command, "%s -R x -R y", command);
1053
+ else
1054
+ rb_raise(rb_eRuntimeError, "unrecognized -R option %s", str);
1055
+ }
1056
+
1057
+ if (g->u != Qnil)
1058
+ sprintf(command, "%s -u %f", command, NUM2DBL(g->u));
1059
+
1060
+ if (g->w != Qnil)
1061
+ sprintf(command, "%s -w %f", command, NUM2DBL(g->w));
1062
+
1063
+ switch (TYPE(g->x)) {
1064
+ case T_STRING:
1065
+ sprintf(command, "%s -x %s", command, STR2CSTR(g->x));
1066
+ break;
1067
+ case T_ARRAY:
1068
+ sprintf(command, "%s -x", command);
1069
+ len = RARRAY(g->x)->len;
1070
+ for (i = 0; i < len; i++) {
1071
+ val = rb_ary_entry(g->x, i);
1072
+ Need_Float(val);
1073
+ sprintf(command, "%s %f", command, NUM2DBL(val));
1074
+ }
1075
+ break;
1076
+ default:
1077
+ /* do nothing */
1078
+ break;
1079
+ }
1080
+
1081
+ switch (TYPE(g->y)) {
1082
+ case T_STRING:
1083
+ sprintf(command, "%s -y %s", command, STR2CSTR(g->y));
1084
+ break;
1085
+ case T_ARRAY:
1086
+ sprintf(command, "%s -y", command);
1087
+ len = RARRAY(g->y)->len;
1088
+ for (i = 0; i < len; i++) {
1089
+ val = rb_ary_entry(g->y, i);
1090
+ Need_Float(val);
1091
+ sprintf(command, "%s %f", command, NUM2DBL(val));
1092
+ }
1093
+ break;
1094
+ default:
1095
+ /* do nothing */
1096
+ break;
1097
+ }
1098
+
1099
+ if (g->X != Qnil)
1100
+ sprintf(command, "%s -X \"%s\"", command, STR2CSTR(g->X));
1101
+ if (g->Y != Qnil)
1102
+ sprintf(command, "%s -Y \"%s\"", command, STR2CSTR(g->Y));
1103
+
1104
+ if (TYPE(g->bg) == T_STRING)
1105
+ sprintf(command, "%s --bg-color %s", command, STR2CSTR(g->bg));
1106
+
1107
+ if (TYPE(g->bitmap_size) == T_STRING)
1108
+ sprintf(command, "%s --bitmap-size %s", command, STR2CSTR(g->bitmap_size));
1109
+
1110
+ if (TYPE(g->frame) == T_STRING)
1111
+ sprintf(command, "%s --frame-color %s", command, STR2CSTR(g->frame));
1112
+
1113
+ if (g->frame_line_width != Qnil)
1114
+ sprintf(command, "%s --frame-line-width %f", command, NUM2DBL(g->frame_line_width));
1115
+
1116
+ if (g->max_line_length != Qnil)
1117
+ sprintf(command, "%s --max_line_length %d", command,
1118
+ (int) FIX2INT(g->max_line_length));
1119
+
1120
+ if (g->page_size != Qnil)
1121
+ sprintf(command, "%s --page-size %s", command, STR2CSTR(g->page_size));
1122
+
1123
+ if (g->pen_colors != Qnil)
1124
+ sprintf(command, "%s --pen-colors %s", command, STR2CSTR(g->pen_colors));
1125
+
1126
+ if (g->rotation != Qnil)
1127
+ sprintf(command, "%s --rotation %d", command, (int) FIX2INT(g->rotation));
1128
+
1129
+ if (g->title_font_name != Qnil)
1130
+ sprintf(command, "%s --title-font-name %s", command, STR2CSTR(g->title_font_name)); if (g->title_font_size != Qnil)
1131
+ sprintf(command, "%s --title-font-size %f", command, NUM2DBL(g->title_font_size));
1132
+
1133
+ if (g->rotate_y_label == Qtrue)
1134
+ sprintf(command, "%s --toggle-rotate-y-label", command);
1135
+
1136
+ if (g->I != Qnil)
1137
+ sprintf(command, "%s -I %s", command, STR2CSTR(g->I));
1138
+
1139
+ if (g->s == Qtrue)
1140
+ sprintf(command, "%s -s", command);
1141
+ if (g->t == Qtrue)
1142
+ sprintf(command, "%s -t", command);
1143
+ if (g->B == Qtrue)
1144
+ sprintf(command, "%s -B", command);
1145
+
1146
+ if (g->m != Qnil)
1147
+ sprintf(command, "%s -m %d", command, (int) FIX2INT(g->m));
1148
+
1149
+ switch (TYPE(g->S)) {
1150
+ case T_STRING:
1151
+ sprintf(command, "%s -S %s", command, STR2CSTR(g->S));
1152
+ break;
1153
+ case T_ARRAY:
1154
+ if (RARRAY(g->S)->len == 2)
1155
+ sprintf(command, "%s -S %d %f", command, (int) FIX2INT(rb_ary_entry(g->S, 0)),
1156
+ NUM2DBL(rb_ary_entry(g->S, 1)));
1157
+ break;
1158
+ default:
1159
+ /* do nothing */
1160
+ break;
1161
+ }
1162
+
1163
+ if (g->W != Qnil)
1164
+ sprintf(command, "%s -W %f", command, NUM2DBL(g->W));
1165
+
1166
+ if (g->q != Qnil)
1167
+ sprintf(command, "%s -q %f", command, NUM2DBL(g->q));
1168
+
1169
+ if (g->C == Qtrue)
1170
+ sprintf(command, "%s -C", command);
1171
+
1172
+ if (g->symbol_font_name != Qnil)
1173
+ sprintf(command, "%s --symbol_font_name %s", command, STR2CSTR(g->symbol_font_name));
1174
+
1175
+ switch (TYPE(g->reposition)) {
1176
+ case T_STRING:
1177
+ sprintf(command, "%s --reposition %s", command, STR2CSTR(g->reposition));
1178
+ break;
1179
+ case T_ARRAY:
1180
+ sprintf(command, "%s --reposition", command);
1181
+ len = RARRAY(g->reposition)->len;
1182
+ for (i = 0; i <len; i++) {
1183
+ val = rb_ary_entry(g->reposition, i);
1184
+ Need_Float(val);
1185
+ sprintf(command, "%s %f", command, NUM2DBL(val));
1186
+ }
1187
+ break;
1188
+ default:
1189
+ /* do nothing */
1190
+ break;
1191
+ }
1192
+
1193
+ if (g->blankout != Qnil)
1194
+ sprintf(command, "%s --blankout %f", command, NUM2DBL(g->blankout));
1195
+
1196
+ if (g->O == Qtrue)
1197
+ sprintf(command, "%s -O", command);
1198
+ }
1199
+
1200
+ static VALUE rb_gsl_graph_graph(int argc, VALUE *argv, VALUE obj)
1201
+ {
1202
+ #ifdef HAVE_GNU_GRAPH
1203
+ gsl_graph *g = NULL;
1204
+ gsl_histogram *h = NULL;
1205
+ gsl_vector *x = NULL, *y = NULL;
1206
+ size_t i, size;
1207
+ FILE *fp;
1208
+ char command[1024];
1209
+ Data_Get_Struct(obj, gsl_graph, g);
1210
+
1211
+ gsl_graph_set_command(g, command);
1212
+ switch (argc) {
1213
+ case 3:
1214
+ Check_Type(argv[2], T_STRING);
1215
+ sprintf(command, "%s %s", command, STR2CSTR(argv[2]));
1216
+ /* no break */
1217
+ case 2:
1218
+ if (TYPE(argv[1]) == T_STRING) {
1219
+ sprintf(command, "%s %s", command, STR2CSTR(argv[1]));
1220
+ } else if (VECTOR_P(argv[1])) {
1221
+ g->ydata = argv[1];
1222
+ } else {
1223
+ rb_raise(rb_eTypeError, "wrong argument type %s (Vector or String expected)",
1224
+ rb_class2name(CLASS_OF(argv[1])));
1225
+ }
1226
+ /* no break */
1227
+ case 1:
1228
+ if (TYPE(argv[0]) == T_STRING) {
1229
+ sprintf(command, "%s %s", command, STR2CSTR(argv[0]));
1230
+ } else if (VECTOR_P(argv[0])) {
1231
+ g->xdata = argv[0];
1232
+ } else if (HISTOGRAM_P(argv[0])) {
1233
+ Data_Get_Struct(argv[0], gsl_histogram, h);
1234
+ } else {
1235
+ rb_raise(rb_eTypeError, "wrong argument type %s (Vector or String expected)",
1236
+ rb_class2name(CLASS_OF(argv[0])));
1237
+ }
1238
+ break;
1239
+ default:
1240
+ rb_raise(rb_eArgError, "wrong number of argumeuts (%d for 1-3)", argc);
1241
+ break;
1242
+ }
1243
+ if (VECTOR_P(g->xdata)) Data_Get_Struct(g->xdata, gsl_vector, x);
1244
+ if (VECTOR_P(g->ydata)) Data_Get_Struct(g->ydata, gsl_vector, y);
1245
+
1246
+ if (x == NULL && h == NULL)
1247
+ rb_raise(rb_eRuntimeError, "data is not given");
1248
+
1249
+ if (h) size = h->n;
1250
+ else size = x->size;
1251
+
1252
+ fp = popen(command, "w");
1253
+ if (fp == NULL) rb_raise(rb_eIOError, "GNU graph not found.");
1254
+ for (i = 0; i < size; i++) {
1255
+ if (h)
1256
+ fprintf(fp, "%g %g\n%g %g\n", h->range[i], h->bin[i], h->range[i+1], h->bin[i]);
1257
+ else if (y == NULL)
1258
+ fprintf(fp, "%d %g\n", (int) i, gsl_vector_get(x, i));
1259
+ else
1260
+ fprintf(fp, "%g %g\n", gsl_vector_get(x, i), gsl_vector_get(y, i));
1261
+ }
1262
+ fflush(fp);
1263
+ pclose(fp);
1264
+ fp = NULL;
1265
+ return Qtrue;
1266
+ #else
1267
+ rb_raise(rb_eNoMethodError, "GNU plotutils required");
1268
+ return Qfalse;
1269
+ #endif
1270
+ }
1271
+
1272
+ static VALUE rb_gsl_graph_step(int argc, VALUE *argv, VALUE obj)
1273
+ {
1274
+ #ifdef HAVE_GNU_GRAPH
1275
+ gsl_graph *g = NULL;
1276
+ gsl_vector *x = NULL, *y = NULL;
1277
+ size_t i, size;
1278
+ FILE *fp;
1279
+ char command[1024];
1280
+ Data_Get_Struct(obj, gsl_graph, g);
1281
+
1282
+ gsl_graph_set_command(g, command);
1283
+ switch (argc) {
1284
+ case 3:
1285
+ Check_Type(argv[2], T_STRING);
1286
+ sprintf(command, "%s %s", command, STR2CSTR(argv[2]));
1287
+ /* no break */
1288
+ case 2:
1289
+ if (TYPE(argv[1]) == T_STRING) {
1290
+ sprintf(command, "%s %s", command, STR2CSTR(argv[1]));
1291
+ } else if (VECTOR_P(argv[1])) {
1292
+ g->ydata = argv[1];
1293
+ } else {
1294
+ rb_raise(rb_eTypeError, "wrong argument type %s (Vector or String expected)",
1295
+ rb_class2name(CLASS_OF(argv[1])));
1296
+ }
1297
+ /* no break */
1298
+ case 1:
1299
+ if (TYPE(argv[0]) == T_STRING) {
1300
+ sprintf(command, "%s %s", command, STR2CSTR(argv[0]));
1301
+ } else if (VECTOR_P(argv[0])) {
1302
+ g->xdata = argv[0];
1303
+ } else {
1304
+ rb_raise(rb_eTypeError, "wrong argument type %s (Vector or String expected)",
1305
+ rb_class2name(CLASS_OF(argv[0])));
1306
+ }
1307
+ break;
1308
+ default:
1309
+ rb_raise(rb_eArgError, "wrong number of argumeuts (%d for 1-3)", argc);
1310
+ break;
1311
+ }
1312
+ if (VECTOR_P(g->xdata)) Data_Get_Struct(g->xdata, gsl_vector, x);
1313
+ if (VECTOR_P(g->ydata)) Data_Get_Struct(g->ydata, gsl_vector, y);
1314
+
1315
+ if (x == NULL)
1316
+ rb_raise(rb_eRuntimeError, "data is not given");
1317
+
1318
+ size = x->size;
1319
+
1320
+ fp = popen(command, "w");
1321
+ if (fp == NULL) rb_raise(rb_eIOError, "GNU graph not found.");
1322
+ for (i = 0; i < size; i++) {
1323
+ if (y == NULL) {
1324
+ fprintf(fp, "%d %g\n%d %g\n", (int) i, gsl_vector_get(x, i),
1325
+ (int) (i+1), gsl_vector_get(x, i));
1326
+ } else {
1327
+ if (i != size-1)
1328
+ fprintf(fp, "%g %g\n%g %g\n", gsl_vector_get(x, i), gsl_vector_get(y, i),
1329
+ gsl_vector_get(x, i+1), gsl_vector_get(y, i));
1330
+ else
1331
+ fprintf(fp, "%g %g\n%g %g", gsl_vector_get(x, i), gsl_vector_get(y, i),
1332
+ 2.0*gsl_vector_get(x, i)-gsl_vector_get(x, i-1), gsl_vector_get(y, i));
1333
+ }
1334
+ }
1335
+ fflush(fp);
1336
+ pclose(fp);
1337
+ fp = NULL;
1338
+ return Qtrue;
1339
+ #else
1340
+ rb_raise(rb_eNoMethodError, "GNU plotutils required");
1341
+ return Qfalse;
1342
+ #endif
1343
+ }
1344
+
1345
+ void Init_gsl_graph(VALUE module)
1346
+ {
1347
+ VALUE cgsl_graph;
1348
+
1349
+ cgsl_graph = rb_define_class_under(module, "Graph", cGSL_Object);
1350
+
1351
+ rb_define_singleton_method(cgsl_graph, "new", rb_gsl_graph_new, -1);
1352
+ rb_define_singleton_method(cgsl_graph, "alloc", rb_gsl_graph_new, -1);
1353
+
1354
+ /*****/
1355
+
1356
+ rb_define_method(cgsl_graph, "init", rb_gsl_graph_init, 0);
1357
+
1358
+ rb_define_method(cgsl_graph, "set_xdata", rb_gsl_graph_set_xdata, 1);
1359
+ rb_define_method(cgsl_graph, "set_ydata", rb_gsl_graph_set_ydata, 1);
1360
+ rb_define_method(cgsl_graph, "set_xydata", rb_gsl_graph_set_xydata, 2);
1361
+
1362
+ rb_define_method(cgsl_graph, "xdata", rb_gsl_graph_xdata, 0);
1363
+ rb_define_method(cgsl_graph, "ydata", rb_gsl_graph_ydata, 0);
1364
+ rb_define_method(cgsl_graph, "xydata", rb_gsl_graph_xydata, 0);
1365
+
1366
+ rb_define_method(cgsl_graph, "graph", rb_gsl_graph_graph, -1);
1367
+ rb_define_alias(cgsl_graph, "draw", "graph");
1368
+ rb_define_alias(cgsl_graph, "plot", "graph");
1369
+
1370
+ rb_define_method(cgsl_graph, "graph_step", rb_gsl_graph_step, -1);
1371
+ rb_define_alias(cgsl_graph, "step", "graph_step");
1372
+
1373
+ /*****/
1374
+ rb_define_method(cgsl_graph, "set_T", rb_gsl_graph_set_T, 1);
1375
+ rb_define_alias(cgsl_graph, "T=", "set_T");
1376
+ rb_define_alias(cgsl_graph, "display_type=", "set_T");
1377
+ rb_define_method(cgsl_graph, "T", rb_gsl_graph_T, 0);
1378
+ rb_define_alias(cgsl_graph, "display_type", "T");
1379
+
1380
+ rb_define_method(cgsl_graph, "set_E", rb_gsl_graph_set_E, 1);
1381
+ rb_define_alias(cgsl_graph, "E=", "set_E");
1382
+ rb_define_alias(cgsl_graph, "axis_end=", "set_E");
1383
+ rb_define_alias(cgsl_graph, "toggle_axis_end=", "set_E");
1384
+ rb_define_method(cgsl_graph, "E", rb_gsl_graph_E, 0);
1385
+ rb_define_alias(cgsl_graph, "axis_end", "E");
1386
+ rb_define_alias(cgsl_graph, "toggle_axis_end", "E");
1387
+
1388
+ rb_define_method(cgsl_graph, "set_f", rb_gsl_graph_set_f, 1);
1389
+ rb_define_alias(cgsl_graph, "f=", "set_f");
1390
+ rb_define_alias(cgsl_graph, "font_size=", "set_f");
1391
+ rb_define_method(cgsl_graph, "f", rb_gsl_graph_f, 0);
1392
+ rb_define_alias(cgsl_graph, "font_size", "f");
1393
+
1394
+ rb_define_method(cgsl_graph, "set_F", rb_gsl_graph_set_F, 1);
1395
+ rb_define_alias(cgsl_graph, "F=", "set_F");
1396
+ rb_define_alias(cgsl_graph, "font_name=", "set_F");
1397
+ rb_define_method(cgsl_graph, "F", rb_gsl_graph_F, 0);
1398
+ rb_define_alias(cgsl_graph, "font_name", "F");
1399
+
1400
+ rb_define_method(cgsl_graph, "set_g", rb_gsl_graph_set_g, 1);
1401
+ rb_define_alias(cgsl_graph, "g=", "set_g");
1402
+ rb_define_alias(cgsl_graph, "grid_style=", "set_g");
1403
+ rb_define_method(cgsl_graph, "g", rb_gsl_graph_g, 0);
1404
+ rb_define_alias(cgsl_graph, "grid_style", "g");
1405
+
1406
+ rb_define_method(cgsl_graph, "set_h", rb_gsl_graph_set_h, 1);
1407
+ rb_define_alias(cgsl_graph, "h=", "set_h");
1408
+ rb_define_alias(cgsl_graph, "height=", "set_h");
1409
+ rb_define_alias(cgsl_graph, "height_of_plot=", "set_h");
1410
+ rb_define_method(cgsl_graph, "h", rb_gsl_graph_h, 0);
1411
+ rb_define_alias(cgsl_graph, "height", "h");
1412
+ rb_define_alias(cgsl_graph, "height_of_plot", "h");
1413
+
1414
+ rb_define_method(cgsl_graph, "set_k", rb_gsl_graph_set_k, 1);
1415
+ rb_define_alias(cgsl_graph, "k=", "set_k");
1416
+ rb_define_alias(cgsl_graph, "tick_size=", "set_k");
1417
+ rb_define_method(cgsl_graph, "k", rb_gsl_graph_k, 0);
1418
+ rb_define_alias(cgsl_graph, "tick_size", "k");
1419
+
1420
+ rb_define_method(cgsl_graph, "set_K", rb_gsl_graph_set_K, 1);
1421
+ rb_define_alias(cgsl_graph, "K=", "set_K");
1422
+ rb_define_alias(cgsl_graph, "clip_mode=", "set_K");
1423
+ rb_define_method(cgsl_graph, "K", rb_gsl_graph_K, 0);
1424
+ rb_define_alias(cgsl_graph, "clip_mode", "K");
1425
+
1426
+ rb_define_method(cgsl_graph, "set_l", rb_gsl_graph_set_l, 1);
1427
+ rb_define_alias(cgsl_graph, "l=", "set_l");
1428
+ rb_define_alias(cgsl_graph, "log_axis=", "set_l");
1429
+ rb_define_alias(cgsl_graph, "toggle_log_axis=", "set_l");
1430
+ rb_define_method(cgsl_graph, "l", rb_gsl_graph_l, 0);
1431
+ rb_define_alias(cgsl_graph, "log_axis", "l");
1432
+ rb_define_alias(cgsl_graph, "toggle_log_axis", "l");
1433
+
1434
+ rb_define_method(cgsl_graph, "set_L", rb_gsl_graph_set_L, 1);
1435
+ rb_define_alias(cgsl_graph, "L=", "set_L");
1436
+ rb_define_alias(cgsl_graph, "top_label=", "set_L");
1437
+ rb_define_method(cgsl_graph, "L", rb_gsl_graph_L, 0);
1438
+ rb_define_alias(cgsl_graph, "top_label", "L");
1439
+
1440
+ rb_define_method(cgsl_graph, "set_N", rb_gsl_graph_set_N, 1);
1441
+ rb_define_alias(cgsl_graph, "N=", "set_N");
1442
+ rb_define_alias(cgsl_graph, "no_tics=", "set_N");
1443
+ rb_define_alias(cgsl_graph, "toggle_no_tics=", "set_N");
1444
+ rb_define_method(cgsl_graph, "N", rb_gsl_graph_N, 0);
1445
+ rb_define_alias(cgsl_graph, "no_tics", "N");
1446
+ rb_define_alias(cgsl_graph, "toggle_no_tics", "N");
1447
+
1448
+ rb_define_method(cgsl_graph, "set_r", rb_gsl_graph_set_r, 1);
1449
+ rb_define_alias(cgsl_graph, "r=", "set_r");
1450
+ rb_define_alias(cgsl_graph, "right_shift=", "set_r");
1451
+ rb_define_method(cgsl_graph, "r", rb_gsl_graph_r, 0);
1452
+ rb_define_alias(cgsl_graph, "right_shift", "r");
1453
+
1454
+ rb_define_method(cgsl_graph, "set_R", rb_gsl_graph_set_R, 1);
1455
+ rb_define_alias(cgsl_graph, "R=", "set_R");
1456
+ rb_define_alias(cgsl_graph, "round-to-next-tick=", "set_R");
1457
+ rb_define_alias(cgsl_graph, "toggle_round-to-next-tick=", "set_R");
1458
+ rb_define_method(cgsl_graph, "R", rb_gsl_graph_R, 0);
1459
+ rb_define_alias(cgsl_graph, "round-to-next-tick", "R");
1460
+ rb_define_alias(cgsl_graph, "toggle_round-to-next-tick", "R");
1461
+
1462
+ rb_define_method(cgsl_graph, "set_s", rb_gsl_graph_set_s, 1);
1463
+ rb_define_alias(cgsl_graph, "s=", "set_s");
1464
+ rb_define_alias(cgsl_graph, "save_screen=", "set_s");
1465
+ rb_define_method(cgsl_graph, "s", rb_gsl_graph_s, 0);
1466
+ rb_define_alias(cgsl_graph, "save_screen", "s");
1467
+
1468
+ rb_define_method(cgsl_graph, "set_t", rb_gsl_graph_set_t, 1);
1469
+ rb_define_alias(cgsl_graph, "t=", "set_t");
1470
+ rb_define_alias(cgsl_graph, "transpose_axes=", "set_t");
1471
+ rb_define_alias(cgsl_graph, "toggle_transpose_axes=", "set_t");
1472
+ rb_define_method(cgsl_graph, "t", rb_gsl_graph_t, 0);
1473
+ rb_define_alias(cgsl_graph, "transpose_axes", "t");
1474
+ rb_define_alias(cgsl_graph, "toggle_transpose_axes", "t");
1475
+
1476
+ rb_define_method(cgsl_graph, "set_u", rb_gsl_graph_set_u, 1);
1477
+ rb_define_alias(cgsl_graph, "u=", "set_u");
1478
+ rb_define_alias(cgsl_graph, "upward_shift=", "set_u");
1479
+ rb_define_method(cgsl_graph, "u", rb_gsl_graph_u, 0);
1480
+ rb_define_alias(cgsl_graph, "upward_shift", "u");
1481
+
1482
+ rb_define_method(cgsl_graph, "set_w", rb_gsl_graph_set_w, 1);
1483
+ rb_define_alias(cgsl_graph, "w=", "set_w");
1484
+ rb_define_alias(cgsl_graph, "width=", "set_w");
1485
+ rb_define_alias(cgsl_graph, "width_of_plot=", "set_w");
1486
+ rb_define_method(cgsl_graph, "w", rb_gsl_graph_w, 0);
1487
+ rb_define_alias(cgsl_graph, "width", "w");
1488
+ rb_define_alias(cgsl_graph, "width_of_plot", "w");
1489
+
1490
+ rb_define_method(cgsl_graph, "set_x", rb_gsl_graph_set_x, 1);
1491
+ rb_define_alias(cgsl_graph, "x=", "set_x");
1492
+ rb_define_alias(cgsl_graph, "x_limits=", "set_x");
1493
+ rb_define_method(cgsl_graph, "x", rb_gsl_graph_x, 0);
1494
+ rb_define_alias(cgsl_graph, "x_limits", "x");
1495
+
1496
+ rb_define_method(cgsl_graph, "set_y", rb_gsl_graph_set_y, 1);
1497
+ rb_define_alias(cgsl_graph, "y=", "set_y");
1498
+ rb_define_alias(cgsl_graph, "y_limits=", "set_y");
1499
+ rb_define_method(cgsl_graph, "y", rb_gsl_graph_y, 0);
1500
+ rb_define_alias(cgsl_graph, "y_limits", "y");
1501
+
1502
+ rb_define_method(cgsl_graph, "set_X", rb_gsl_graph_set_X, 1);
1503
+ rb_define_alias(cgsl_graph, "X=", "set_X");
1504
+ rb_define_alias(cgsl_graph, "x_label=", "set_X");
1505
+ rb_define_method(cgsl_graph, "X", rb_gsl_graph_X, 0);
1506
+ rb_define_alias(cgsl_graph, "x_label", "X");
1507
+ rb_define_method(cgsl_graph, "set_Y", rb_gsl_graph_set_Y, 1);
1508
+ rb_define_alias(cgsl_graph, "Y=", "set_Y");
1509
+ rb_define_alias(cgsl_graph, "y_label=", "set_Y");
1510
+ rb_define_method(cgsl_graph, "Y", rb_gsl_graph_Y, 0);
1511
+ rb_define_alias(cgsl_graph, "y_label", "Y");
1512
+
1513
+ rb_define_method(cgsl_graph, "set_bg", rb_gsl_graph_set_bg, 1);
1514
+ rb_define_alias(cgsl_graph, "bg=", "set_bg");
1515
+ rb_define_alias(cgsl_graph, "bg_color=", "set_bg");
1516
+ rb_define_alias(cgsl_graph, "set_bg_color", "set_bg");
1517
+ rb_define_method(cgsl_graph, "bg", rb_gsl_graph_bg, 0);
1518
+ rb_define_alias(cgsl_graph, "bg_color", "bg");
1519
+
1520
+ rb_define_method(cgsl_graph, "set_bitmap_size", rb_gsl_graph_set_bitmap_size, 1);
1521
+ rb_define_alias(cgsl_graph, "bitmap_size=", "set_bitmap_size");
1522
+ rb_define_alias(cgsl_graph, "set_bitmap_size", "set_bitmap_size");
1523
+ rb_define_method(cgsl_graph, "bitmap_size", rb_gsl_graph_bitmap_size, 0);
1524
+
1525
+ rb_define_method(cgsl_graph, "set_frame", rb_gsl_graph_set_frame, 1);
1526
+ rb_define_alias(cgsl_graph, "frame=", "set_frame");
1527
+ rb_define_alias(cgsl_graph, "frame_color=", "set_frame");
1528
+ rb_define_alias(cgsl_graph, "set_frame_color", "set_frame");
1529
+ rb_define_method(cgsl_graph, "frame", rb_gsl_graph_frame, 0);
1530
+ rb_define_alias(cgsl_graph, "frame_color", "frame");
1531
+
1532
+ rb_define_method(cgsl_graph, "set_frame_line_width", rb_gsl_graph_set_frame_line_width, 1);
1533
+ rb_define_alias(cgsl_graph, "frame_line_width=", "set_frame_line_width");
1534
+ rb_define_method(cgsl_graph, "frame_line_width", rb_gsl_graph_frame_line_width, 0);
1535
+
1536
+ rb_define_method(cgsl_graph, "set_max_line_length", rb_gsl_graph_set_max_line_length, 1);
1537
+ rb_define_alias(cgsl_graph, "max_line_length=", "set_max_line_length");
1538
+ rb_define_method(cgsl_graph, "max_line_length", rb_gsl_graph_max_line_length, 0);
1539
+
1540
+ rb_define_method(cgsl_graph, "set_page_size", rb_gsl_graph_set_page_size, 1);
1541
+ rb_define_alias(cgsl_graph, "page_size=", "set_page_size");
1542
+ rb_define_method(cgsl_graph, "page_size", rb_gsl_graph_page_size, 0);
1543
+
1544
+ rb_define_method(cgsl_graph, "set_pen_colors", rb_gsl_graph_set_pen_colors, 1);
1545
+ rb_define_alias(cgsl_graph, "pen_colors=", "set_pen_colors");
1546
+ rb_define_alias(cgsl_graph, "pen=", "set_pen_colors");
1547
+ rb_define_method(cgsl_graph, "pen_colors", rb_gsl_graph_pen_colors, 0);
1548
+ rb_define_alias(cgsl_graph, "pen", "pen_colors");
1549
+
1550
+ rb_define_method(cgsl_graph, "set_rotation", rb_gsl_graph_set_rotation, 1);
1551
+ rb_define_alias(cgsl_graph, "rotation=", "set_rotation");
1552
+ rb_define_method(cgsl_graph, "rotation", rb_gsl_graph_rotation, 0);
1553
+
1554
+ rb_define_method(cgsl_graph, "set_title_font_name", rb_gsl_graph_set_title_font_name, 1);
1555
+ rb_define_alias(cgsl_graph, "title_font_name=", "set_title_font_name");
1556
+ rb_define_method(cgsl_graph, "title_font_name", rb_gsl_graph_title_font_name, 0);
1557
+
1558
+ rb_define_method(cgsl_graph, "set_title_font_size", rb_gsl_graph_set_title_font_size, 1);
1559
+ rb_define_alias(cgsl_graph, "title_font_size=", "set_title_font_size");
1560
+ rb_define_method(cgsl_graph, "title_font_size", rb_gsl_graph_title_font_size, 0);
1561
+
1562
+ rb_define_method(cgsl_graph, "set_rotate_y_label", rb_gsl_graph_set_rotate_y_label, 1);
1563
+ rb_define_alias(cgsl_graph, "rotate_y_label=", "set_rotate_y_label");
1564
+ rb_define_alias(cgsl_graph, "toggle_rotate_y_label=", "set_rotate_y_label");
1565
+ rb_define_method(cgsl_graph, "rotate_y_label", rb_gsl_graph_rotate_y_label, 0);
1566
+ rb_define_alias(cgsl_graph, "toggle_rotate_y_label", "rotate_y_label");
1567
+
1568
+ rb_define_method(cgsl_graph, "set_B", rb_gsl_graph_set_B, 1);
1569
+ rb_define_alias(cgsl_graph, "B=", "set_B");
1570
+ rb_define_alias(cgsl_graph, "auto_dump=", "set_B");
1571
+ rb_define_alias(cgsl_graph, "toggle_auto_dump=", "set_B");
1572
+ rb_define_method(cgsl_graph, "B", rb_gsl_graph_B, 0);
1573
+ rb_define_alias(cgsl_graph, "auto_dump", "B");
1574
+ rb_define_alias(cgsl_graph, "toggle_auto_dump", "B");
1575
+
1576
+ rb_define_method(cgsl_graph, "set_I", rb_gsl_graph_set_I, 1);
1577
+ rb_define_alias(cgsl_graph, "I=", "set_I");
1578
+ rb_define_alias(cgsl_graph, "input_format=", "set_I");
1579
+ rb_define_method(cgsl_graph, "I", rb_gsl_graph_I, 0);
1580
+ rb_define_alias(cgsl_graph, "input_format", "I");
1581
+
1582
+ rb_define_method(cgsl_graph, "set_m", rb_gsl_graph_set_m, 1);
1583
+ rb_define_alias(cgsl_graph, "m=", "set_m");
1584
+ rb_define_alias(cgsl_graph, "line_mode=", "set_m");
1585
+ rb_define_method(cgsl_graph, "m", rb_gsl_graph_m, 0);
1586
+ rb_define_alias(cgsl_graph, "line_mode", "m");
1587
+
1588
+ rb_define_method(cgsl_graph, "set_S", rb_gsl_graph_set_S, 1);
1589
+ rb_define_alias(cgsl_graph, "S=", "set_S");
1590
+ rb_define_alias(cgsl_graph, "symbol=", "set_S");
1591
+ rb_define_method(cgsl_graph, "S", rb_gsl_graph_S, 0);
1592
+ rb_define_alias(cgsl_graph, "symbol", "S");
1593
+
1594
+ rb_define_method(cgsl_graph, "set_W", rb_gsl_graph_set_W, 1);
1595
+ rb_define_alias(cgsl_graph, "W=", "set_W");
1596
+ rb_define_alias(cgsl_graph, "line_width=", "set_W");
1597
+ rb_define_method(cgsl_graph, "W", rb_gsl_graph_W, 0);
1598
+ rb_define_alias(cgsl_graph, "line_width", "W");
1599
+
1600
+ rb_define_method(cgsl_graph, "set_q", rb_gsl_graph_set_q, 1);
1601
+ rb_define_alias(cgsl_graph, "q=", "set_q");
1602
+ rb_define_alias(cgsl_graph, "fill_fraction=", "set_q");
1603
+ rb_define_method(cgsl_graph, "q", rb_gsl_graph_q, 0);
1604
+ rb_define_alias(cgsl_graph, "fill_fraction", "q");
1605
+
1606
+ rb_define_method(cgsl_graph, "set_C", rb_gsl_graph_set_C, 1);
1607
+ rb_define_alias(cgsl_graph, "C=", "set_C");
1608
+ rb_define_alias(cgsl_graph, "use_color=", "set_C");
1609
+ rb_define_alias(cgsl_graph, "toggle_use_color=", "set_C");
1610
+ rb_define_method(cgsl_graph, "C", rb_gsl_graph_C, 0);
1611
+ rb_define_alias(cgsl_graph, "use_color", "C");
1612
+ rb_define_alias(cgsl_graph, "toggle_use_color", "C");
1613
+
1614
+ rb_define_method(cgsl_graph, "set_symbol_font_name",
1615
+ rb_gsl_graph_set_symbol_font_name, 1);
1616
+ rb_define_alias(cgsl_graph, "symbol_font_name=", "set_symbol_font_name");
1617
+ rb_define_method(cgsl_graph, "symbol_font_name", rb_gsl_graph_symbol_font_name, 0);
1618
+
1619
+ rb_define_method(cgsl_graph, "set_reposition",
1620
+ rb_gsl_graph_set_reposition, 1);
1621
+ rb_define_alias(cgsl_graph, "reposition=", "set_reposition");
1622
+ rb_define_method(cgsl_graph, "reposition", rb_gsl_graph_reposition, 0);
1623
+
1624
+ rb_define_method(cgsl_graph, "set_blankout",
1625
+ rb_gsl_graph_set_blankout, 1);
1626
+ rb_define_alias(cgsl_graph, "blankout=", "set_blankout");
1627
+ rb_define_method(cgsl_graph, "blankout", rb_gsl_graph_blankout, 0);
1628
+
1629
+ rb_define_method(cgsl_graph, "set_O", rb_gsl_graph_set_O, 1);
1630
+ rb_define_alias(cgsl_graph, "O=", "set_O");
1631
+ rb_define_alias(cgsl_graph, "portable_output=", "set_O");
1632
+ rb_define_method(cgsl_graph, "O", rb_gsl_graph_O, 0);
1633
+ rb_define_alias(cgsl_graph, "portable_output", "O");
1634
+ }