ruby-dcl 1.8.1 → 1.8.2
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.
- checksums.yaml +5 -5
- data/ChangeLog +97 -14
- data/LICENSE.txt +1 -1
- data/demo/gokuraku/jump/jump2.rb +1 -1
- data/demo/grph1/sgpack/sgfont.rb +1 -1
- data/demo/grph1/sgpack/sgfonz.rb +1 -1
- data/demo/grph1/sgpack/sgpk07.rb +8 -6
- data/demo/grph1/slpack/slpk04.rb +1 -1
- data/demo/grph2/udegpk/u2df03.rb +2 -2
- data/demo/grph2/umpack/test04.rb +1 -1
- data/demo/grph2/umpack/test05r.rb +86 -0
- data/demo/grph2/uspack/uspk06.rb +1 -1
- data/demo/grph2/uspack/uspk08.rb +1 -1
- data/demo/grph2/ximage/ximg01.rb +1 -1
- data/demo/misc2/tmpack/tmpk01.rb +46 -0
- data/demo/misc2/tmpack/tmpk02.rb +58 -0
- data/demo/misc2/tmpack/tmpk03.rb +56 -0
- data/demo/rakuraku/color/color2.rb +4 -3
- data/demo/rakuraku/kihon/kihon7.rb +9 -3
- data/demo/rakuraku/kihon/kihonb.rb +11 -9
- data/demo/rakuraku/uspack/uspac1.rb +1 -1
- data/demo/rakuraku/uspack/uspac3.rb +1 -1
- data/ext/numru/dcl_cary2obj.c +1 -1
- data/ext/numru/dcl_narrayed_funcs.c +21 -21
- data/ext/numru/dcl_obj2cary.c +1 -1
- data/ext/numru/dcl_rubydcloriginal.c +0 -1
- data/ext/numru/extconf.rb +28 -9
- data/ext/numru/grph1_csgi.c +29 -3
- data/ext/numru/grph1_scpack.c +40 -41
- data/ext/numru/grph1_sgpack.c +158 -159
- data/ext/numru/grph1_slpack.c +14 -15
- data/ext/numru/grph1_stpack.c +35 -36
- data/ext/numru/grph1_swpack.c +89 -90
- data/ext/numru/grph2_grpack.c +13 -14
- data/ext/numru/grph2_ucpack.c +46 -47
- data/ext/numru/grph2_udpack.c +52 -53
- data/ext/numru/grph2_uepack.c +51 -52
- data/ext/numru/grph2_ugpack.c +40 -41
- data/ext/numru/grph2_uhpack.c +16 -17
- data/ext/numru/grph2_uipack.c +48 -49
- data/ext/numru/grph2_ulpack.c +50 -51
- data/ext/numru/grph2_umpack.c +66 -67
- data/ext/numru/grph2_uspack.c +88 -89
- data/ext/numru/grph2_uupack.c +69 -70
- data/ext/numru/grph2_uvpack.c +16 -17
- data/ext/numru/grph2_uwpack.c +21 -22
- data/ext/numru/grph2_uxpack.c +14 -15
- data/ext/numru/grph2_uypack.c +14 -15
- data/ext/numru/grph2_uzpack.c +60 -61
- data/ext/numru/init.c.default +5 -2
- data/ext/numru/math1_blklib.c +4 -5
- data/ext/numru/math1_chrlib.c +7 -8
- data/ext/numru/math1_clsplib.c +4 -5
- data/ext/numru/math1_fnclib.c +7 -8
- data/ext/numru/math1_gnmlib.c +12 -13
- data/ext/numru/math1_gt2dlib.c +9 -10
- data/ext/numru/math1_ifalib.c +9 -10
- data/ext/numru/math1_indxlib.c +15 -16
- data/ext/numru/math1_intlib.c +4 -5
- data/ext/numru/math1_lrllib.c +24 -25
- data/ext/numru/math1_maplib.c +5 -6
- data/ext/numru/math1_oslib.c +2 -3
- data/ext/numru/math1_rfalib.c +30 -31
- data/ext/numru/math1_rfblib.c +3 -4
- data/ext/numru/math1_sublib.c +4 -5
- data/ext/numru/math1_syslib.c +73 -74
- data/ext/numru/math1_vialib.c +22 -23
- data/ext/numru/math1_viblib.c +15 -16
- data/ext/numru/math1_vralib.c +22 -23
- data/ext/numru/math1_vrblib.c +15 -16
- data/ext/numru/math1_xfclib.c +3 -4
- data/ext/numru/math2_fftlib.c +19 -20
- data/ext/numru/math2_intrlib.c +2 -3
- data/ext/numru/math2_rnmlib.c +3 -4
- data/ext/numru/math2_shtlib.c +25 -26
- data/ext/numru/math2_vstlib.c +6 -7
- data/ext/numru/misc1_chnlib.c +3 -4
- data/ext/numru/misc1_datelib.c +27 -28
- data/ext/numru/misc1_fmtlib.c +1 -2
- data/ext/numru/misc1_misclib.c +2 -3
- data/ext/numru/misc1_randlib.c +4 -5
- data/ext/numru/misc1_timelib.c +11 -12
- data/ext/numru/misc2_tmpack.c +1200 -0
- data/lib/numru/dcl/dcl.rb +73 -1
- data/lib/numru/dcl/version.rb +1 -1
- data/ruby-dcl.gemspec +2 -2
- metadata +12 -4
@@ -0,0 +1,1200 @@
|
|
1
|
+
/*
|
2
|
+
* $Id$
|
3
|
+
*/
|
4
|
+
|
5
|
+
#include <stdio.h>
|
6
|
+
#include "ruby.h"
|
7
|
+
#include "narray.h"
|
8
|
+
#include "cdcl.h"
|
9
|
+
|
10
|
+
/* for compatibility with ruby 1.6 */
|
11
|
+
#ifndef StringValuePtr
|
12
|
+
#define StringValuePtr(s) STR2CSTR(s)
|
13
|
+
#endif
|
14
|
+
|
15
|
+
#define DFLT_SIZE 32
|
16
|
+
|
17
|
+
#ifndef NARRAY_BIGMEM
|
18
|
+
typedef int na_shape_t;
|
19
|
+
#endif
|
20
|
+
|
21
|
+
extern char *dcl_obj2ccharary(VALUE, int, int);
|
22
|
+
extern integer *dcl_obj2cintegerary(VALUE);
|
23
|
+
extern real *dcl_obj2crealary(VALUE);
|
24
|
+
extern complex *dcl_obj2ccomplexary(VALUE);
|
25
|
+
extern logical *dcl_obj2clogicalary(VALUE);
|
26
|
+
|
27
|
+
extern VALUE dcl_ccharary2obj(char *, int, int);
|
28
|
+
extern VALUE dcl_cintegerary2obj(integer *, na_shape_t, int, na_shape_t *);
|
29
|
+
extern VALUE dcl_crealary2obj(real *, na_shape_t, int, na_shape_t *);
|
30
|
+
/* extern VALUE dcl_ccomplexary2obj(complex *, int, char *); */
|
31
|
+
extern VALUE dcl_clogicalary2obj(logical *, na_shape_t, int, na_shape_t *);
|
32
|
+
|
33
|
+
extern void dcl_freeccharary(char *);
|
34
|
+
extern void dcl_freecintegerary(integer *);
|
35
|
+
extern void dcl_freecrealary(real *);
|
36
|
+
extern void dcl_freeccomplexary(complex *);
|
37
|
+
extern void dcl_freeclogicalary(logical *);
|
38
|
+
|
39
|
+
/* for functions which return real */
|
40
|
+
/* fnclib */
|
41
|
+
extern real rd2r_(real *);
|
42
|
+
extern real rr2d_(real *);
|
43
|
+
extern real rexp_(real *, integer *, integer *);
|
44
|
+
extern real rfpi_(void);
|
45
|
+
extern real rmod_(real *, real *);
|
46
|
+
/* gnmlib */
|
47
|
+
extern real rgnlt_(real *);
|
48
|
+
extern real rgnle_(real *);
|
49
|
+
extern real rgngt_(real *);
|
50
|
+
extern real rgnge_(real *);
|
51
|
+
/* rfalib */
|
52
|
+
extern real rmax_(real *, integer *, integer *);
|
53
|
+
extern real rmin_(real *, integer *, integer *);
|
54
|
+
extern real rsum_(real *, integer *, integer *);
|
55
|
+
extern real rave_(real *, integer *, integer *);
|
56
|
+
extern real rvar_(real *, integer *, integer *);
|
57
|
+
extern real rstd_(real *, integer *, integer *);
|
58
|
+
extern real rrms_(real *, integer *, integer *);
|
59
|
+
extern real ramp_(real *, integer *, integer *);
|
60
|
+
/* rfblib */
|
61
|
+
extern real rprd_(real *, real *, integer *, integer *, integer *);
|
62
|
+
extern real rcov_(real *, real *, integer *, integer *, integer *);
|
63
|
+
extern real rcor_(real *, real *, integer *, integer *, integer *);
|
64
|
+
|
65
|
+
|
66
|
+
extern VALUE mDCL;
|
67
|
+
|
68
|
+
#if DCLVER >= 730
|
69
|
+
|
70
|
+
static VALUE
|
71
|
+
dcl_tmiget(obj, cp)
|
72
|
+
VALUE obj, cp;
|
73
|
+
{
|
74
|
+
char *i_cp;
|
75
|
+
integer o_ipara;
|
76
|
+
VALUE ipara;
|
77
|
+
|
78
|
+
if (TYPE(cp) != T_STRING) {
|
79
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
80
|
+
}
|
81
|
+
|
82
|
+
i_cp = StringValuePtr(cp);
|
83
|
+
|
84
|
+
|
85
|
+
tmiget__(i_cp, &o_ipara, (ftnlen)strlen(i_cp));
|
86
|
+
|
87
|
+
ipara = INT2NUM(o_ipara);
|
88
|
+
|
89
|
+
|
90
|
+
return ipara;
|
91
|
+
|
92
|
+
}
|
93
|
+
|
94
|
+
static VALUE
|
95
|
+
dcl_tmiset(obj, cp, ipara)
|
96
|
+
VALUE obj, cp, ipara;
|
97
|
+
{
|
98
|
+
char *i_cp;
|
99
|
+
integer i_ipara;
|
100
|
+
|
101
|
+
if (TYPE(cp) != T_STRING) {
|
102
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
103
|
+
}
|
104
|
+
if ((TYPE(ipara) != T_BIGNUM) || (TYPE(ipara) != T_FIXNUM)) {
|
105
|
+
ipara = rb_funcall(ipara, rb_intern("to_i"), 0);
|
106
|
+
}
|
107
|
+
|
108
|
+
i_cp = StringValuePtr(cp);
|
109
|
+
i_ipara = NUM2INT(ipara);
|
110
|
+
|
111
|
+
|
112
|
+
tmiset__(i_cp, &i_ipara, (ftnlen)strlen(i_cp));
|
113
|
+
|
114
|
+
return Qnil;
|
115
|
+
|
116
|
+
}
|
117
|
+
|
118
|
+
static VALUE
|
119
|
+
dcl_tmistx(obj, cp, ipara)
|
120
|
+
VALUE obj, cp, ipara;
|
121
|
+
{
|
122
|
+
char *i_cp;
|
123
|
+
integer i_ipara;
|
124
|
+
|
125
|
+
if (TYPE(cp) != T_STRING) {
|
126
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
127
|
+
}
|
128
|
+
if ((TYPE(ipara) != T_BIGNUM) || (TYPE(ipara) != T_FIXNUM)) {
|
129
|
+
ipara = rb_funcall(ipara, rb_intern("to_i"), 0);
|
130
|
+
}
|
131
|
+
|
132
|
+
i_cp = StringValuePtr(cp);
|
133
|
+
i_ipara = NUM2INT(ipara);
|
134
|
+
|
135
|
+
|
136
|
+
tmistx__(i_cp, &i_ipara, (ftnlen)strlen(i_cp));
|
137
|
+
|
138
|
+
return Qnil;
|
139
|
+
|
140
|
+
}
|
141
|
+
|
142
|
+
static VALUE
|
143
|
+
dcl_tmiqnp(obj)
|
144
|
+
VALUE obj;
|
145
|
+
{
|
146
|
+
integer o_ncp;
|
147
|
+
VALUE ncp;
|
148
|
+
|
149
|
+
tmiqnp__(&o_ncp);
|
150
|
+
|
151
|
+
ncp = INT2NUM(o_ncp);
|
152
|
+
|
153
|
+
|
154
|
+
return ncp;
|
155
|
+
|
156
|
+
}
|
157
|
+
|
158
|
+
static VALUE
|
159
|
+
dcl_tmiqid(obj, cp)
|
160
|
+
VALUE obj, cp;
|
161
|
+
{
|
162
|
+
char *i_cp;
|
163
|
+
integer o_idx;
|
164
|
+
VALUE idx;
|
165
|
+
|
166
|
+
if (TYPE(cp) != T_STRING) {
|
167
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
168
|
+
}
|
169
|
+
|
170
|
+
i_cp = StringValuePtr(cp);
|
171
|
+
|
172
|
+
|
173
|
+
tmiqid__(i_cp, &o_idx, (ftnlen)strlen(i_cp));
|
174
|
+
|
175
|
+
idx = INT2NUM(o_idx);
|
176
|
+
|
177
|
+
|
178
|
+
return idx;
|
179
|
+
|
180
|
+
}
|
181
|
+
|
182
|
+
static VALUE
|
183
|
+
dcl_tmiqcp(obj, idx)
|
184
|
+
VALUE obj, idx;
|
185
|
+
{
|
186
|
+
integer i_idx;
|
187
|
+
char *o_cp;
|
188
|
+
VALUE cp;
|
189
|
+
|
190
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
191
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
192
|
+
}
|
193
|
+
|
194
|
+
i_idx = NUM2INT(idx);
|
195
|
+
|
196
|
+
o_cp= ALLOCA_N(char, (DFLT_SIZE+1));
|
197
|
+
memset(o_cp, '\0', DFLT_SIZE+1);
|
198
|
+
|
199
|
+
tmiqcp__(&i_idx, o_cp, (ftnlen)DFLT_SIZE);
|
200
|
+
|
201
|
+
cp = rb_str_new2(o_cp);
|
202
|
+
|
203
|
+
|
204
|
+
return cp;
|
205
|
+
|
206
|
+
}
|
207
|
+
|
208
|
+
static VALUE
|
209
|
+
dcl_tmiqcl(obj, idx)
|
210
|
+
VALUE obj, idx;
|
211
|
+
{
|
212
|
+
integer i_idx;
|
213
|
+
char *o_cp;
|
214
|
+
VALUE cp;
|
215
|
+
|
216
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
217
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
218
|
+
}
|
219
|
+
|
220
|
+
i_idx = NUM2INT(idx);
|
221
|
+
|
222
|
+
o_cp= ALLOCA_N(char, (DFLT_SIZE+1));
|
223
|
+
memset(o_cp, '\0', DFLT_SIZE+1);
|
224
|
+
|
225
|
+
tmiqcl__(&i_idx, o_cp, (ftnlen)DFLT_SIZE);
|
226
|
+
|
227
|
+
cp = rb_str_new2(o_cp);
|
228
|
+
|
229
|
+
|
230
|
+
return cp;
|
231
|
+
|
232
|
+
}
|
233
|
+
|
234
|
+
static VALUE
|
235
|
+
dcl_tmiqvl(obj, idx)
|
236
|
+
VALUE obj, idx;
|
237
|
+
{
|
238
|
+
integer i_idx;
|
239
|
+
integer o_ipara;
|
240
|
+
VALUE ipara;
|
241
|
+
|
242
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
243
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
244
|
+
}
|
245
|
+
|
246
|
+
i_idx = NUM2INT(idx);
|
247
|
+
|
248
|
+
|
249
|
+
tmiqvl__(&i_idx, &o_ipara);
|
250
|
+
|
251
|
+
ipara = INT2NUM(o_ipara);
|
252
|
+
|
253
|
+
|
254
|
+
return ipara;
|
255
|
+
|
256
|
+
}
|
257
|
+
|
258
|
+
static VALUE
|
259
|
+
dcl_tmisvl(obj, idx, ipara)
|
260
|
+
VALUE obj, idx, ipara;
|
261
|
+
{
|
262
|
+
integer i_idx;
|
263
|
+
integer i_ipara;
|
264
|
+
|
265
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
266
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
267
|
+
}
|
268
|
+
if ((TYPE(ipara) != T_BIGNUM) || (TYPE(ipara) != T_FIXNUM)) {
|
269
|
+
ipara = rb_funcall(ipara, rb_intern("to_i"), 0);
|
270
|
+
}
|
271
|
+
|
272
|
+
i_idx = NUM2INT(idx);
|
273
|
+
i_ipara = NUM2INT(ipara);
|
274
|
+
|
275
|
+
|
276
|
+
tmisvl__(&i_idx, &i_ipara);
|
277
|
+
|
278
|
+
return Qnil;
|
279
|
+
|
280
|
+
}
|
281
|
+
|
282
|
+
static VALUE
|
283
|
+
dcl_tmiqin(obj, cp)
|
284
|
+
VALUE obj, cp;
|
285
|
+
{
|
286
|
+
char *i_cp;
|
287
|
+
integer o_in;
|
288
|
+
VALUE in;
|
289
|
+
|
290
|
+
if (TYPE(cp) != T_STRING) {
|
291
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
292
|
+
}
|
293
|
+
|
294
|
+
i_cp = StringValuePtr(cp);
|
295
|
+
|
296
|
+
|
297
|
+
tmiqin__(i_cp, &o_in, (ftnlen)strlen(i_cp));
|
298
|
+
|
299
|
+
in = INT2NUM(o_in);
|
300
|
+
|
301
|
+
|
302
|
+
return in;
|
303
|
+
|
304
|
+
}
|
305
|
+
|
306
|
+
static VALUE
|
307
|
+
dcl_tmlget(obj, cp)
|
308
|
+
VALUE obj, cp;
|
309
|
+
{
|
310
|
+
char *i_cp;
|
311
|
+
logical o_lpara;
|
312
|
+
VALUE lpara;
|
313
|
+
|
314
|
+
if (TYPE(cp) != T_STRING) {
|
315
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
316
|
+
}
|
317
|
+
|
318
|
+
i_cp = StringValuePtr(cp);
|
319
|
+
|
320
|
+
|
321
|
+
tmlget__(i_cp, &o_lpara, (ftnlen)strlen(i_cp));
|
322
|
+
|
323
|
+
lpara = (o_lpara == FALSE_) ? Qfalse : Qtrue;
|
324
|
+
|
325
|
+
|
326
|
+
return lpara;
|
327
|
+
|
328
|
+
}
|
329
|
+
|
330
|
+
static VALUE
|
331
|
+
dcl_tmlset(obj, cp, lpara)
|
332
|
+
VALUE obj, cp, lpara;
|
333
|
+
{
|
334
|
+
char *i_cp;
|
335
|
+
logical i_lpara;
|
336
|
+
|
337
|
+
if (TYPE(cp) != T_STRING) {
|
338
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
339
|
+
}
|
340
|
+
|
341
|
+
i_cp = StringValuePtr(cp);
|
342
|
+
i_lpara = ((lpara == Qnil)||(lpara == Qfalse)) ? FALSE_ : TRUE_;
|
343
|
+
|
344
|
+
|
345
|
+
tmlset__(i_cp, &i_lpara, (ftnlen)strlen(i_cp));
|
346
|
+
|
347
|
+
return Qnil;
|
348
|
+
|
349
|
+
}
|
350
|
+
|
351
|
+
static VALUE
|
352
|
+
dcl_tmlstx(obj, cp, lpara)
|
353
|
+
VALUE obj, cp, lpara;
|
354
|
+
{
|
355
|
+
char *i_cp;
|
356
|
+
logical i_lpara;
|
357
|
+
|
358
|
+
if (TYPE(cp) != T_STRING) {
|
359
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
360
|
+
}
|
361
|
+
|
362
|
+
i_cp = StringValuePtr(cp);
|
363
|
+
i_lpara = ((lpara == Qnil)||(lpara == Qfalse)) ? FALSE_ : TRUE_;
|
364
|
+
|
365
|
+
|
366
|
+
tmlstx__(i_cp, &i_lpara, (ftnlen)strlen(i_cp));
|
367
|
+
|
368
|
+
return Qnil;
|
369
|
+
|
370
|
+
}
|
371
|
+
|
372
|
+
static VALUE
|
373
|
+
dcl_tmlqnp(obj)
|
374
|
+
VALUE obj;
|
375
|
+
{
|
376
|
+
integer o_ncp;
|
377
|
+
VALUE ncp;
|
378
|
+
|
379
|
+
tmlqnp__(&o_ncp);
|
380
|
+
|
381
|
+
ncp = INT2NUM(o_ncp);
|
382
|
+
|
383
|
+
|
384
|
+
return ncp;
|
385
|
+
|
386
|
+
}
|
387
|
+
|
388
|
+
static VALUE
|
389
|
+
dcl_tmlqid(obj, cp)
|
390
|
+
VALUE obj, cp;
|
391
|
+
{
|
392
|
+
char *i_cp;
|
393
|
+
integer o_idx;
|
394
|
+
VALUE idx;
|
395
|
+
|
396
|
+
if (TYPE(cp) != T_STRING) {
|
397
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
398
|
+
}
|
399
|
+
|
400
|
+
i_cp = StringValuePtr(cp);
|
401
|
+
|
402
|
+
|
403
|
+
tmlqid__(i_cp, &o_idx, (ftnlen)strlen(i_cp));
|
404
|
+
|
405
|
+
idx = INT2NUM(o_idx);
|
406
|
+
|
407
|
+
|
408
|
+
return idx;
|
409
|
+
|
410
|
+
}
|
411
|
+
|
412
|
+
static VALUE
|
413
|
+
dcl_tmlqcp(obj, idx)
|
414
|
+
VALUE obj, idx;
|
415
|
+
{
|
416
|
+
integer i_idx;
|
417
|
+
char *o_cp;
|
418
|
+
VALUE cp;
|
419
|
+
|
420
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
421
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
422
|
+
}
|
423
|
+
|
424
|
+
i_idx = NUM2INT(idx);
|
425
|
+
|
426
|
+
o_cp= ALLOCA_N(char, (DFLT_SIZE+1));
|
427
|
+
memset(o_cp, '\0', DFLT_SIZE+1);
|
428
|
+
|
429
|
+
tmlqcp__(&i_idx, o_cp, (ftnlen)DFLT_SIZE);
|
430
|
+
|
431
|
+
cp = rb_str_new2(o_cp);
|
432
|
+
|
433
|
+
|
434
|
+
return cp;
|
435
|
+
|
436
|
+
}
|
437
|
+
|
438
|
+
static VALUE
|
439
|
+
dcl_tmlqcl(obj, idx)
|
440
|
+
VALUE obj, idx;
|
441
|
+
{
|
442
|
+
integer i_idx;
|
443
|
+
char *o_cp;
|
444
|
+
VALUE cp;
|
445
|
+
|
446
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
447
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
448
|
+
}
|
449
|
+
|
450
|
+
i_idx = NUM2INT(idx);
|
451
|
+
|
452
|
+
o_cp= ALLOCA_N(char, (DFLT_SIZE+1));
|
453
|
+
memset(o_cp, '\0', DFLT_SIZE+1);
|
454
|
+
|
455
|
+
tmlqcl__(&i_idx, o_cp, (ftnlen)DFLT_SIZE);
|
456
|
+
|
457
|
+
cp = rb_str_new2(o_cp);
|
458
|
+
|
459
|
+
|
460
|
+
return cp;
|
461
|
+
|
462
|
+
}
|
463
|
+
|
464
|
+
static VALUE
|
465
|
+
dcl_tmlqvl(obj, idx)
|
466
|
+
VALUE obj, idx;
|
467
|
+
{
|
468
|
+
integer i_idx;
|
469
|
+
logical o_lpara;
|
470
|
+
VALUE lpara;
|
471
|
+
|
472
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
473
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
474
|
+
}
|
475
|
+
|
476
|
+
i_idx = NUM2INT(idx);
|
477
|
+
|
478
|
+
|
479
|
+
tmlqvl__(&i_idx, &o_lpara);
|
480
|
+
|
481
|
+
lpara = (o_lpara == FALSE_) ? Qfalse : Qtrue;
|
482
|
+
|
483
|
+
|
484
|
+
return lpara;
|
485
|
+
|
486
|
+
}
|
487
|
+
|
488
|
+
static VALUE
|
489
|
+
dcl_tmlsvl(obj, idx, lpara)
|
490
|
+
VALUE obj, idx, lpara;
|
491
|
+
{
|
492
|
+
integer i_idx;
|
493
|
+
logical i_lpara;
|
494
|
+
|
495
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
496
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
497
|
+
}
|
498
|
+
|
499
|
+
i_idx = NUM2INT(idx);
|
500
|
+
i_lpara = ((lpara == Qnil)||(lpara == Qfalse)) ? FALSE_ : TRUE_;
|
501
|
+
|
502
|
+
|
503
|
+
tmlsvl__(&i_idx, &i_lpara);
|
504
|
+
|
505
|
+
return Qnil;
|
506
|
+
|
507
|
+
}
|
508
|
+
|
509
|
+
static VALUE
|
510
|
+
dcl_tmlqin(obj, cp)
|
511
|
+
VALUE obj, cp;
|
512
|
+
{
|
513
|
+
char *i_cp;
|
514
|
+
integer o_in;
|
515
|
+
VALUE in;
|
516
|
+
|
517
|
+
if (TYPE(cp) != T_STRING) {
|
518
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
519
|
+
}
|
520
|
+
|
521
|
+
i_cp = StringValuePtr(cp);
|
522
|
+
|
523
|
+
|
524
|
+
tmlqin__(i_cp, &o_in, (ftnlen)strlen(i_cp));
|
525
|
+
|
526
|
+
in = INT2NUM(o_in);
|
527
|
+
|
528
|
+
|
529
|
+
return in;
|
530
|
+
|
531
|
+
}
|
532
|
+
|
533
|
+
static VALUE
|
534
|
+
dcl_tmpqnp(obj)
|
535
|
+
VALUE obj;
|
536
|
+
{
|
537
|
+
integer o_ncp;
|
538
|
+
VALUE ncp;
|
539
|
+
|
540
|
+
tmpqnp__(&o_ncp);
|
541
|
+
|
542
|
+
ncp = INT2NUM(o_ncp);
|
543
|
+
|
544
|
+
|
545
|
+
return ncp;
|
546
|
+
|
547
|
+
}
|
548
|
+
|
549
|
+
static VALUE
|
550
|
+
dcl_tmpqid(obj, cp)
|
551
|
+
VALUE obj, cp;
|
552
|
+
{
|
553
|
+
char *i_cp;
|
554
|
+
integer o_idx;
|
555
|
+
VALUE idx;
|
556
|
+
|
557
|
+
if (TYPE(cp) != T_STRING) {
|
558
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
559
|
+
}
|
560
|
+
|
561
|
+
i_cp = StringValuePtr(cp);
|
562
|
+
|
563
|
+
|
564
|
+
tmpqid__(i_cp, &o_idx, (ftnlen)strlen(i_cp));
|
565
|
+
|
566
|
+
idx = INT2NUM(o_idx);
|
567
|
+
|
568
|
+
|
569
|
+
return idx;
|
570
|
+
|
571
|
+
}
|
572
|
+
|
573
|
+
static VALUE
|
574
|
+
dcl_tmpqcp(obj, idx)
|
575
|
+
VALUE obj, idx;
|
576
|
+
{
|
577
|
+
integer i_idx;
|
578
|
+
char *o_cp;
|
579
|
+
VALUE cp;
|
580
|
+
|
581
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
582
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
583
|
+
}
|
584
|
+
|
585
|
+
i_idx = NUM2INT(idx);
|
586
|
+
|
587
|
+
o_cp= ALLOCA_N(char, (DFLT_SIZE+1));
|
588
|
+
memset(o_cp, '\0', DFLT_SIZE+1);
|
589
|
+
|
590
|
+
tmpqcp__(&i_idx, o_cp, (ftnlen)DFLT_SIZE);
|
591
|
+
|
592
|
+
cp = rb_str_new2(o_cp);
|
593
|
+
|
594
|
+
|
595
|
+
return cp;
|
596
|
+
|
597
|
+
}
|
598
|
+
|
599
|
+
static VALUE
|
600
|
+
dcl_tmpqcl(obj, idx)
|
601
|
+
VALUE obj, idx;
|
602
|
+
{
|
603
|
+
integer i_idx;
|
604
|
+
char *o_cp;
|
605
|
+
VALUE cp;
|
606
|
+
|
607
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
608
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
609
|
+
}
|
610
|
+
|
611
|
+
i_idx = NUM2INT(idx);
|
612
|
+
|
613
|
+
o_cp= ALLOCA_N(char, (DFLT_SIZE+1));
|
614
|
+
memset(o_cp, '\0', DFLT_SIZE+1);
|
615
|
+
|
616
|
+
tmpqcl__(&i_idx, o_cp, (ftnlen)DFLT_SIZE);
|
617
|
+
|
618
|
+
cp = rb_str_new2(o_cp);
|
619
|
+
|
620
|
+
|
621
|
+
return cp;
|
622
|
+
|
623
|
+
}
|
624
|
+
|
625
|
+
static VALUE
|
626
|
+
dcl_tmpqit(obj, idx)
|
627
|
+
VALUE obj, idx;
|
628
|
+
{
|
629
|
+
integer i_idx;
|
630
|
+
integer o_itp;
|
631
|
+
VALUE itp;
|
632
|
+
|
633
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
634
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
635
|
+
}
|
636
|
+
|
637
|
+
i_idx = NUM2INT(idx);
|
638
|
+
|
639
|
+
|
640
|
+
tmpqit__(&i_idx, &o_itp);
|
641
|
+
|
642
|
+
itp = INT2NUM(o_itp);
|
643
|
+
|
644
|
+
|
645
|
+
return itp;
|
646
|
+
|
647
|
+
}
|
648
|
+
|
649
|
+
static VALUE
|
650
|
+
dcl_tmpqvl(obj, idx)
|
651
|
+
VALUE obj, idx;
|
652
|
+
{
|
653
|
+
integer i_idx;
|
654
|
+
integer o_ipara;
|
655
|
+
VALUE ipara;
|
656
|
+
|
657
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
658
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
659
|
+
}
|
660
|
+
|
661
|
+
i_idx = NUM2INT(idx);
|
662
|
+
|
663
|
+
|
664
|
+
tmpqvl__(&i_idx, &o_ipara);
|
665
|
+
|
666
|
+
ipara = INT2NUM(o_ipara);
|
667
|
+
|
668
|
+
|
669
|
+
return ipara;
|
670
|
+
|
671
|
+
}
|
672
|
+
|
673
|
+
static VALUE
|
674
|
+
dcl_tmpsvl(obj, idx, ipara)
|
675
|
+
VALUE obj, idx, ipara;
|
676
|
+
{
|
677
|
+
integer i_idx;
|
678
|
+
integer i_ipara;
|
679
|
+
|
680
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
681
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
682
|
+
}
|
683
|
+
if ((TYPE(ipara) != T_BIGNUM) || (TYPE(ipara) != T_FIXNUM)) {
|
684
|
+
ipara = rb_funcall(ipara, rb_intern("to_i"), 0);
|
685
|
+
}
|
686
|
+
|
687
|
+
i_idx = NUM2INT(idx);
|
688
|
+
i_ipara = NUM2INT(ipara);
|
689
|
+
|
690
|
+
|
691
|
+
tmpsvl__(&i_idx, &i_ipara);
|
692
|
+
|
693
|
+
return Qnil;
|
694
|
+
|
695
|
+
}
|
696
|
+
|
697
|
+
static VALUE
|
698
|
+
dcl_tmpqin(obj, cp)
|
699
|
+
VALUE obj, cp;
|
700
|
+
{
|
701
|
+
char *i_cp;
|
702
|
+
integer o_in;
|
703
|
+
VALUE in;
|
704
|
+
|
705
|
+
if (TYPE(cp) != T_STRING) {
|
706
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
707
|
+
}
|
708
|
+
|
709
|
+
i_cp = StringValuePtr(cp);
|
710
|
+
|
711
|
+
|
712
|
+
tmpqin__(i_cp, &o_in, (ftnlen)strlen(i_cp));
|
713
|
+
|
714
|
+
in = INT2NUM(o_in);
|
715
|
+
|
716
|
+
|
717
|
+
return in;
|
718
|
+
|
719
|
+
}
|
720
|
+
|
721
|
+
static VALUE
|
722
|
+
dcl_tmrget(obj, cp)
|
723
|
+
VALUE obj, cp;
|
724
|
+
{
|
725
|
+
char *i_cp;
|
726
|
+
real o_rpara;
|
727
|
+
VALUE rpara;
|
728
|
+
|
729
|
+
if (TYPE(cp) != T_STRING) {
|
730
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
731
|
+
}
|
732
|
+
|
733
|
+
i_cp = StringValuePtr(cp);
|
734
|
+
|
735
|
+
|
736
|
+
tmrget__(i_cp, &o_rpara, (ftnlen)strlen(i_cp));
|
737
|
+
|
738
|
+
rpara = rb_float_new((double)o_rpara);
|
739
|
+
|
740
|
+
|
741
|
+
return rpara;
|
742
|
+
|
743
|
+
}
|
744
|
+
|
745
|
+
static VALUE
|
746
|
+
dcl_tmrset(obj, cp, rpara)
|
747
|
+
VALUE obj, cp, rpara;
|
748
|
+
{
|
749
|
+
char *i_cp;
|
750
|
+
real i_rpara;
|
751
|
+
|
752
|
+
if (TYPE(cp) != T_STRING) {
|
753
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
754
|
+
}
|
755
|
+
if (TYPE(rpara) != T_FLOAT) {
|
756
|
+
rpara = rb_funcall(rpara, rb_intern("to_f"), 0);
|
757
|
+
}
|
758
|
+
|
759
|
+
i_cp = StringValuePtr(cp);
|
760
|
+
i_rpara = (real)NUM2DBL(rpara);
|
761
|
+
|
762
|
+
|
763
|
+
tmrset__(i_cp, &i_rpara, (ftnlen)strlen(i_cp));
|
764
|
+
|
765
|
+
return Qnil;
|
766
|
+
|
767
|
+
}
|
768
|
+
|
769
|
+
static VALUE
|
770
|
+
dcl_tmrstx(obj, cp, rpara)
|
771
|
+
VALUE obj, cp, rpara;
|
772
|
+
{
|
773
|
+
char *i_cp;
|
774
|
+
real i_rpara;
|
775
|
+
|
776
|
+
if (TYPE(cp) != T_STRING) {
|
777
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
778
|
+
}
|
779
|
+
if (TYPE(rpara) != T_FLOAT) {
|
780
|
+
rpara = rb_funcall(rpara, rb_intern("to_f"), 0);
|
781
|
+
}
|
782
|
+
|
783
|
+
i_cp = StringValuePtr(cp);
|
784
|
+
i_rpara = (real)NUM2DBL(rpara);
|
785
|
+
|
786
|
+
|
787
|
+
tmrstx__(i_cp, &i_rpara, (ftnlen)strlen(i_cp));
|
788
|
+
|
789
|
+
return Qnil;
|
790
|
+
|
791
|
+
}
|
792
|
+
|
793
|
+
static VALUE
|
794
|
+
dcl_tmrqnp(obj)
|
795
|
+
VALUE obj;
|
796
|
+
{
|
797
|
+
integer o_ncp;
|
798
|
+
VALUE ncp;
|
799
|
+
|
800
|
+
tmrqnp__(&o_ncp);
|
801
|
+
|
802
|
+
ncp = INT2NUM(o_ncp);
|
803
|
+
|
804
|
+
|
805
|
+
return ncp;
|
806
|
+
|
807
|
+
}
|
808
|
+
|
809
|
+
static VALUE
|
810
|
+
dcl_tmrqid(obj, cp)
|
811
|
+
VALUE obj, cp;
|
812
|
+
{
|
813
|
+
char *i_cp;
|
814
|
+
integer o_idx;
|
815
|
+
VALUE idx;
|
816
|
+
|
817
|
+
if (TYPE(cp) != T_STRING) {
|
818
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
819
|
+
}
|
820
|
+
|
821
|
+
i_cp = StringValuePtr(cp);
|
822
|
+
|
823
|
+
|
824
|
+
tmrqid__(i_cp, &o_idx, (ftnlen)strlen(i_cp));
|
825
|
+
|
826
|
+
idx = INT2NUM(o_idx);
|
827
|
+
|
828
|
+
|
829
|
+
return idx;
|
830
|
+
|
831
|
+
}
|
832
|
+
|
833
|
+
static VALUE
|
834
|
+
dcl_tmrqcp(obj, idx)
|
835
|
+
VALUE obj, idx;
|
836
|
+
{
|
837
|
+
integer i_idx;
|
838
|
+
char *o_cp;
|
839
|
+
VALUE cp;
|
840
|
+
|
841
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
842
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
843
|
+
}
|
844
|
+
|
845
|
+
i_idx = NUM2INT(idx);
|
846
|
+
|
847
|
+
o_cp= ALLOCA_N(char, (DFLT_SIZE+1));
|
848
|
+
memset(o_cp, '\0', DFLT_SIZE+1);
|
849
|
+
|
850
|
+
tmrqcp__(&i_idx, o_cp, (ftnlen)DFLT_SIZE);
|
851
|
+
|
852
|
+
cp = rb_str_new2(o_cp);
|
853
|
+
|
854
|
+
|
855
|
+
return cp;
|
856
|
+
|
857
|
+
}
|
858
|
+
|
859
|
+
static VALUE
|
860
|
+
dcl_tmrqcl(obj, idx)
|
861
|
+
VALUE obj, idx;
|
862
|
+
{
|
863
|
+
integer i_idx;
|
864
|
+
char *o_cp;
|
865
|
+
VALUE cp;
|
866
|
+
|
867
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
868
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
869
|
+
}
|
870
|
+
|
871
|
+
i_idx = NUM2INT(idx);
|
872
|
+
|
873
|
+
o_cp= ALLOCA_N(char, (DFLT_SIZE+1));
|
874
|
+
memset(o_cp, '\0', DFLT_SIZE+1);
|
875
|
+
|
876
|
+
tmrqcl__(&i_idx, o_cp, (ftnlen)DFLT_SIZE);
|
877
|
+
|
878
|
+
cp = rb_str_new2(o_cp);
|
879
|
+
|
880
|
+
|
881
|
+
return cp;
|
882
|
+
|
883
|
+
}
|
884
|
+
|
885
|
+
static VALUE
|
886
|
+
dcl_tmrqvl(obj, idx)
|
887
|
+
VALUE obj, idx;
|
888
|
+
{
|
889
|
+
integer i_idx;
|
890
|
+
real o_rpara;
|
891
|
+
VALUE rpara;
|
892
|
+
|
893
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
894
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
895
|
+
}
|
896
|
+
|
897
|
+
i_idx = NUM2INT(idx);
|
898
|
+
|
899
|
+
|
900
|
+
tmrqvl__(&i_idx, &o_rpara);
|
901
|
+
|
902
|
+
rpara = rb_float_new((double)o_rpara);
|
903
|
+
|
904
|
+
|
905
|
+
return rpara;
|
906
|
+
|
907
|
+
}
|
908
|
+
|
909
|
+
static VALUE
|
910
|
+
dcl_tmrsvl(obj, idx, rpara)
|
911
|
+
VALUE obj, idx, rpara;
|
912
|
+
{
|
913
|
+
integer i_idx;
|
914
|
+
real i_rpara;
|
915
|
+
|
916
|
+
if ((TYPE(idx) != T_BIGNUM) || (TYPE(idx) != T_FIXNUM)) {
|
917
|
+
idx = rb_funcall(idx, rb_intern("to_i"), 0);
|
918
|
+
}
|
919
|
+
if (TYPE(rpara) != T_FLOAT) {
|
920
|
+
rpara = rb_funcall(rpara, rb_intern("to_f"), 0);
|
921
|
+
}
|
922
|
+
|
923
|
+
i_idx = NUM2INT(idx);
|
924
|
+
i_rpara = (real)NUM2DBL(rpara);
|
925
|
+
|
926
|
+
|
927
|
+
tmrsvl__(&i_idx, &i_rpara);
|
928
|
+
|
929
|
+
return Qnil;
|
930
|
+
|
931
|
+
}
|
932
|
+
|
933
|
+
static VALUE
|
934
|
+
dcl_tmrqin(obj, cp)
|
935
|
+
VALUE obj, cp;
|
936
|
+
{
|
937
|
+
char *i_cp;
|
938
|
+
integer o_in;
|
939
|
+
VALUE in;
|
940
|
+
|
941
|
+
if (TYPE(cp) != T_STRING) {
|
942
|
+
cp = rb_funcall(cp, rb_intern("to_str"), 0);
|
943
|
+
}
|
944
|
+
|
945
|
+
i_cp = StringValuePtr(cp);
|
946
|
+
|
947
|
+
|
948
|
+
tmrqin__(i_cp, &o_in, (ftnlen)strlen(i_cp));
|
949
|
+
|
950
|
+
in = INT2NUM(o_in);
|
951
|
+
|
952
|
+
|
953
|
+
return in;
|
954
|
+
|
955
|
+
}
|
956
|
+
|
957
|
+
static VALUE
|
958
|
+
dcl_tmstla(obj, r, t, u, v, nx, ny)
|
959
|
+
VALUE obj, r, t, u, v, nx, ny;
|
960
|
+
{
|
961
|
+
real *i_r;
|
962
|
+
real *i_t;
|
963
|
+
real *i_u;
|
964
|
+
real *i_v;
|
965
|
+
integer i_nx;
|
966
|
+
integer i_ny;
|
967
|
+
|
968
|
+
if (TYPE(r) == T_FLOAT) {
|
969
|
+
r = rb_Array(r);
|
970
|
+
}
|
971
|
+
/* if ((TYPE(r) != T_ARRAY) &&
|
972
|
+
(rb_obj_is_kind_of(r, cNArray) != Qtrue)) {
|
973
|
+
rb_raise(rb_eTypeError, "invalid type");
|
974
|
+
} -- no check since obj2c*ary will do that */
|
975
|
+
if (TYPE(t) == T_FLOAT) {
|
976
|
+
t = rb_Array(t);
|
977
|
+
}
|
978
|
+
/* if ((TYPE(t) != T_ARRAY) &&
|
979
|
+
(rb_obj_is_kind_of(t, cNArray) != Qtrue)) {
|
980
|
+
rb_raise(rb_eTypeError, "invalid type");
|
981
|
+
} -- no check since obj2c*ary will do that */
|
982
|
+
if (TYPE(u) == T_FLOAT) {
|
983
|
+
u = rb_Array(u);
|
984
|
+
}
|
985
|
+
/* if ((TYPE(u) != T_ARRAY) &&
|
986
|
+
(rb_obj_is_kind_of(u, cNArray) != Qtrue)) {
|
987
|
+
rb_raise(rb_eTypeError, "invalid type");
|
988
|
+
} -- no check since obj2c*ary will do that */
|
989
|
+
if (TYPE(v) == T_FLOAT) {
|
990
|
+
v = rb_Array(v);
|
991
|
+
}
|
992
|
+
/* if ((TYPE(v) != T_ARRAY) &&
|
993
|
+
(rb_obj_is_kind_of(v, cNArray) != Qtrue)) {
|
994
|
+
rb_raise(rb_eTypeError, "invalid type");
|
995
|
+
} -- no check since obj2c*ary will do that */
|
996
|
+
if ((TYPE(nx) != T_BIGNUM) || (TYPE(nx) != T_FIXNUM)) {
|
997
|
+
nx = rb_funcall(nx, rb_intern("to_i"), 0);
|
998
|
+
}
|
999
|
+
if ((TYPE(ny) != T_BIGNUM) || (TYPE(ny) != T_FIXNUM)) {
|
1000
|
+
ny = rb_funcall(ny, rb_intern("to_i"), 0);
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
i_nx = NUM2INT(nx);
|
1004
|
+
i_ny = NUM2INT(ny);
|
1005
|
+
i_r = dcl_obj2crealary(r);
|
1006
|
+
i_t = dcl_obj2crealary(t);
|
1007
|
+
i_u = dcl_obj2crealary(u);
|
1008
|
+
i_v = dcl_obj2crealary(v);
|
1009
|
+
|
1010
|
+
|
1011
|
+
tmstla__(i_r, i_t, i_u, i_v, &i_nx, &i_ny);
|
1012
|
+
|
1013
|
+
dcl_freecrealary(i_r);
|
1014
|
+
dcl_freecrealary(i_t);
|
1015
|
+
dcl_freecrealary(i_u);
|
1016
|
+
dcl_freecrealary(i_v);
|
1017
|
+
|
1018
|
+
return Qnil;
|
1019
|
+
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
static VALUE
|
1023
|
+
dcl_tmstlc(obj, x, y, u, v, nx, ny)
|
1024
|
+
VALUE obj, x, y, u, v, nx, ny;
|
1025
|
+
{
|
1026
|
+
real *i_x;
|
1027
|
+
real *i_y;
|
1028
|
+
real *i_u;
|
1029
|
+
real *i_v;
|
1030
|
+
integer i_nx;
|
1031
|
+
integer i_ny;
|
1032
|
+
|
1033
|
+
if (TYPE(x) == T_FLOAT) {
|
1034
|
+
x = rb_Array(x);
|
1035
|
+
}
|
1036
|
+
/* if ((TYPE(x) != T_ARRAY) &&
|
1037
|
+
(rb_obj_is_kind_of(x, cNArray) != Qtrue)) {
|
1038
|
+
rb_raise(rb_eTypeError, "invalid type");
|
1039
|
+
} -- no check since obj2c*ary will do that */
|
1040
|
+
if (TYPE(y) == T_FLOAT) {
|
1041
|
+
y = rb_Array(y);
|
1042
|
+
}
|
1043
|
+
/* if ((TYPE(y) != T_ARRAY) &&
|
1044
|
+
(rb_obj_is_kind_of(y, cNArray) != Qtrue)) {
|
1045
|
+
rb_raise(rb_eTypeError, "invalid type");
|
1046
|
+
} -- no check since obj2c*ary will do that */
|
1047
|
+
if (TYPE(u) == T_FLOAT) {
|
1048
|
+
u = rb_Array(u);
|
1049
|
+
}
|
1050
|
+
/* if ((TYPE(u) != T_ARRAY) &&
|
1051
|
+
(rb_obj_is_kind_of(u, cNArray) != Qtrue)) {
|
1052
|
+
rb_raise(rb_eTypeError, "invalid type");
|
1053
|
+
} -- no check since obj2c*ary will do that */
|
1054
|
+
if (TYPE(v) == T_FLOAT) {
|
1055
|
+
v = rb_Array(v);
|
1056
|
+
}
|
1057
|
+
/* if ((TYPE(v) != T_ARRAY) &&
|
1058
|
+
(rb_obj_is_kind_of(v, cNArray) != Qtrue)) {
|
1059
|
+
rb_raise(rb_eTypeError, "invalid type");
|
1060
|
+
} -- no check since obj2c*ary will do that */
|
1061
|
+
if ((TYPE(nx) != T_BIGNUM) || (TYPE(nx) != T_FIXNUM)) {
|
1062
|
+
nx = rb_funcall(nx, rb_intern("to_i"), 0);
|
1063
|
+
}
|
1064
|
+
if ((TYPE(ny) != T_BIGNUM) || (TYPE(ny) != T_FIXNUM)) {
|
1065
|
+
ny = rb_funcall(ny, rb_intern("to_i"), 0);
|
1066
|
+
}
|
1067
|
+
|
1068
|
+
i_nx = NUM2INT(nx);
|
1069
|
+
i_ny = NUM2INT(ny);
|
1070
|
+
i_x = dcl_obj2crealary(x);
|
1071
|
+
i_y = dcl_obj2crealary(y);
|
1072
|
+
i_u = dcl_obj2crealary(u);
|
1073
|
+
i_v = dcl_obj2crealary(v);
|
1074
|
+
|
1075
|
+
|
1076
|
+
tmstlc__(i_x, i_y, i_u, i_v, &i_nx, &i_ny);
|
1077
|
+
|
1078
|
+
dcl_freecrealary(i_x);
|
1079
|
+
dcl_freecrealary(i_y);
|
1080
|
+
dcl_freecrealary(i_u);
|
1081
|
+
dcl_freecrealary(i_v);
|
1082
|
+
|
1083
|
+
return Qnil;
|
1084
|
+
|
1085
|
+
}
|
1086
|
+
|
1087
|
+
static VALUE
|
1088
|
+
dcl_tmstls(obj, l, t, u, v, nx, ny)
|
1089
|
+
VALUE obj, l, t, u, v, nx, ny;
|
1090
|
+
{
|
1091
|
+
real *i_l;
|
1092
|
+
real *i_t;
|
1093
|
+
real *i_u;
|
1094
|
+
real *i_v;
|
1095
|
+
integer i_nx;
|
1096
|
+
integer i_ny;
|
1097
|
+
|
1098
|
+
if (TYPE(l) == T_FLOAT) {
|
1099
|
+
l = rb_Array(l);
|
1100
|
+
}
|
1101
|
+
/* if ((TYPE(l) != T_ARRAY) &&
|
1102
|
+
(rb_obj_is_kind_of(l, cNArray) != Qtrue)) {
|
1103
|
+
rb_raise(rb_eTypeError, "invalid type");
|
1104
|
+
} -- no check since obj2c*ary will do that */
|
1105
|
+
if (TYPE(t) == T_FLOAT) {
|
1106
|
+
t = rb_Array(t);
|
1107
|
+
}
|
1108
|
+
/* if ((TYPE(t) != T_ARRAY) &&
|
1109
|
+
(rb_obj_is_kind_of(t, cNArray) != Qtrue)) {
|
1110
|
+
rb_raise(rb_eTypeError, "invalid type");
|
1111
|
+
} -- no check since obj2c*ary will do that */
|
1112
|
+
if (TYPE(u) == T_FLOAT) {
|
1113
|
+
u = rb_Array(u);
|
1114
|
+
}
|
1115
|
+
/* if ((TYPE(u) != T_ARRAY) &&
|
1116
|
+
(rb_obj_is_kind_of(u, cNArray) != Qtrue)) {
|
1117
|
+
rb_raise(rb_eTypeError, "invalid type");
|
1118
|
+
} -- no check since obj2c*ary will do that */
|
1119
|
+
if (TYPE(v) == T_FLOAT) {
|
1120
|
+
v = rb_Array(v);
|
1121
|
+
}
|
1122
|
+
/* if ((TYPE(v) != T_ARRAY) &&
|
1123
|
+
(rb_obj_is_kind_of(v, cNArray) != Qtrue)) {
|
1124
|
+
rb_raise(rb_eTypeError, "invalid type");
|
1125
|
+
} -- no check since obj2c*ary will do that */
|
1126
|
+
if ((TYPE(nx) != T_BIGNUM) || (TYPE(nx) != T_FIXNUM)) {
|
1127
|
+
nx = rb_funcall(nx, rb_intern("to_i"), 0);
|
1128
|
+
}
|
1129
|
+
if ((TYPE(ny) != T_BIGNUM) || (TYPE(ny) != T_FIXNUM)) {
|
1130
|
+
ny = rb_funcall(ny, rb_intern("to_i"), 0);
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
i_nx = NUM2INT(nx);
|
1134
|
+
i_ny = NUM2INT(ny);
|
1135
|
+
i_l = dcl_obj2crealary(l);
|
1136
|
+
i_t = dcl_obj2crealary(t);
|
1137
|
+
i_u = dcl_obj2crealary(u);
|
1138
|
+
i_v = dcl_obj2crealary(v);
|
1139
|
+
|
1140
|
+
|
1141
|
+
tmstls__(i_l, i_t, i_u, i_v, &i_nx, &i_ny);
|
1142
|
+
|
1143
|
+
dcl_freecrealary(i_l);
|
1144
|
+
dcl_freecrealary(i_t);
|
1145
|
+
dcl_freecrealary(i_u);
|
1146
|
+
dcl_freecrealary(i_v);
|
1147
|
+
|
1148
|
+
return Qnil;
|
1149
|
+
|
1150
|
+
}
|
1151
|
+
|
1152
|
+
#endif
|
1153
|
+
void
|
1154
|
+
init_misc2_tmpack(mDCL)
|
1155
|
+
VALUE mDCL;
|
1156
|
+
{
|
1157
|
+
#if DCLVER >= 730
|
1158
|
+
rb_define_module_function(mDCL, "tmiget", dcl_tmiget, 1);
|
1159
|
+
rb_define_module_function(mDCL, "tmiset", dcl_tmiset, 2);
|
1160
|
+
rb_define_module_function(mDCL, "tmistx", dcl_tmistx, 2);
|
1161
|
+
rb_define_module_function(mDCL, "tmiqnp", dcl_tmiqnp, 0);
|
1162
|
+
rb_define_module_function(mDCL, "tmiqid", dcl_tmiqid, 1);
|
1163
|
+
rb_define_module_function(mDCL, "tmiqcp", dcl_tmiqcp, 1);
|
1164
|
+
rb_define_module_function(mDCL, "tmiqcl", dcl_tmiqcl, 1);
|
1165
|
+
rb_define_module_function(mDCL, "tmiqvl", dcl_tmiqvl, 1);
|
1166
|
+
rb_define_module_function(mDCL, "tmisvl", dcl_tmisvl, 2);
|
1167
|
+
rb_define_module_function(mDCL, "tmiqin", dcl_tmiqin, 1);
|
1168
|
+
rb_define_module_function(mDCL, "tmlget", dcl_tmlget, 1);
|
1169
|
+
rb_define_module_function(mDCL, "tmlset", dcl_tmlset, 2);
|
1170
|
+
rb_define_module_function(mDCL, "tmlstx", dcl_tmlstx, 2);
|
1171
|
+
rb_define_module_function(mDCL, "tmlqnp", dcl_tmlqnp, 0);
|
1172
|
+
rb_define_module_function(mDCL, "tmlqid", dcl_tmlqid, 1);
|
1173
|
+
rb_define_module_function(mDCL, "tmlqcp", dcl_tmlqcp, 1);
|
1174
|
+
rb_define_module_function(mDCL, "tmlqcl", dcl_tmlqcl, 1);
|
1175
|
+
rb_define_module_function(mDCL, "tmlqvl", dcl_tmlqvl, 1);
|
1176
|
+
rb_define_module_function(mDCL, "tmlsvl", dcl_tmlsvl, 2);
|
1177
|
+
rb_define_module_function(mDCL, "tmlqin", dcl_tmlqin, 1);
|
1178
|
+
rb_define_module_function(mDCL, "tmpqnp", dcl_tmpqnp, 0);
|
1179
|
+
rb_define_module_function(mDCL, "tmpqid", dcl_tmpqid, 1);
|
1180
|
+
rb_define_module_function(mDCL, "tmpqcp", dcl_tmpqcp, 1);
|
1181
|
+
rb_define_module_function(mDCL, "tmpqcl", dcl_tmpqcl, 1);
|
1182
|
+
rb_define_module_function(mDCL, "tmpqit", dcl_tmpqit, 1);
|
1183
|
+
rb_define_module_function(mDCL, "tmpqvl", dcl_tmpqvl, 1);
|
1184
|
+
rb_define_module_function(mDCL, "tmpsvl", dcl_tmpsvl, 2);
|
1185
|
+
rb_define_module_function(mDCL, "tmpqin", dcl_tmpqin, 1);
|
1186
|
+
rb_define_module_function(mDCL, "tmrget", dcl_tmrget, 1);
|
1187
|
+
rb_define_module_function(mDCL, "tmrset", dcl_tmrset, 2);
|
1188
|
+
rb_define_module_function(mDCL, "tmrstx", dcl_tmrstx, 2);
|
1189
|
+
rb_define_module_function(mDCL, "tmrqnp", dcl_tmrqnp, 0);
|
1190
|
+
rb_define_module_function(mDCL, "tmrqid", dcl_tmrqid, 1);
|
1191
|
+
rb_define_module_function(mDCL, "tmrqcp", dcl_tmrqcp, 1);
|
1192
|
+
rb_define_module_function(mDCL, "tmrqcl", dcl_tmrqcl, 1);
|
1193
|
+
rb_define_module_function(mDCL, "tmrqvl", dcl_tmrqvl, 1);
|
1194
|
+
rb_define_module_function(mDCL, "tmrsvl", dcl_tmrsvl, 2);
|
1195
|
+
rb_define_module_function(mDCL, "tmrqin", dcl_tmrqin, 1);
|
1196
|
+
rb_define_module_function(mDCL, "tmstla", dcl_tmstla, 6);
|
1197
|
+
rb_define_module_function(mDCL, "tmstlc", dcl_tmstlc, 6);
|
1198
|
+
rb_define_module_function(mDCL, "tmstls", dcl_tmstls, 6);
|
1199
|
+
#endif
|
1200
|
+
}
|