tulirb 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/tulirb/tulirb.c CHANGED
@@ -1,8 +1,16 @@
1
1
  #include "tulirb.h"
2
2
 
3
- static void xfree_ptr_arr(TI_REAL **, size_t);
3
+ #ifdef TULIRB_SANITIZE
4
+ #define TULIRB_MALLOC(size) malloc(size)
5
+ #define TULIRB_FREE(ptr) free(ptr)
6
+ #else
7
+ #define TULIRB_MALLOC(size) xmalloc(size)
8
+ #define TULIRB_FREE(ptr) xfree(ptr)
9
+ #endif
4
10
 
5
- static inline VALUE ti_wrapper(VALUE inputs, VALUE opts, char *indicator_name)
11
+ static inline void xfree_ptr_arr(TI_REAL **, size_t);
12
+
13
+ static inline VALUE ti_wrapper(VALUE inputs, VALUE opts, const char *indicator_name)
6
14
  {
7
15
  Check_Type(inputs, T_ARRAY);
8
16
  Check_Type(opts, T_ARRAY);
@@ -18,9 +26,9 @@ static inline VALUE ti_wrapper(VALUE inputs, VALUE opts, char *indicator_name)
18
26
  rb_raise(rb_eArgError, "Invalid options size, expected: %i options", indicator->options);
19
27
  }
20
28
 
21
- TI_REAL *options = (TI_REAL *)xmalloc(sizeof(TI_REAL[RARRAY_LEN(opts)]));
29
+ TI_REAL *options = (TI_REAL *)TULIRB_MALLOC(sizeof(TI_REAL[RARRAY_LEN(opts)]));
22
30
 
23
- for (size_t i = 0; i < RARRAY_LEN(opts); i++)
31
+ for (int i = 0; i < RARRAY_LEN(opts); i++)
24
32
  options[i] = NUM2DBL(rb_ary_entry(opts, i));
25
33
 
26
34
  const int start = indicator->start(options);
@@ -31,26 +39,26 @@ static inline VALUE ti_wrapper(VALUE inputs, VALUE opts, char *indicator_name)
31
39
  if (output_length < 0)
32
40
  return Qnil;
33
41
 
34
- TI_REAL **c_inputs = xmalloc(indicator->inputs * sizeof(TI_REAL *));
35
- for (size_t i = 0; i < indicator->inputs; i++)
42
+ TI_REAL **c_inputs = TULIRB_MALLOC(indicator->inputs * sizeof(TI_REAL *));
43
+ for (int i = 0; i < indicator->inputs; i++)
36
44
  {
37
- TI_REAL *c_entry = xmalloc(sizeof(TI_REAL[size]));
45
+ TI_REAL *c_entry = TULIRB_MALLOC(sizeof(TI_REAL[size]));
38
46
  VALUE entry = rb_ary_entry(inputs, i);
39
- for (size_t j = 0; j < size; j++)
47
+ for (int j = 0; j < size; j++)
40
48
  {
41
49
  c_entry[j] = NUM2DBL(rb_ary_entry(entry, j));
42
50
  }
43
51
  c_inputs[i] = c_entry;
44
52
  }
45
53
 
46
- TI_REAL **outputs = xmalloc(indicator->outputs * sizeof(TI_REAL *));
47
- for (size_t i = 0; i < indicator->outputs; i++)
48
- outputs[i] = xmalloc(sizeof(TI_REAL[output_length]));
54
+ TI_REAL **outputs = TULIRB_MALLOC(indicator->outputs * sizeof(TI_REAL *));
55
+ for (int i = 0; i < indicator->outputs; i++)
56
+ outputs[i] = TULIRB_MALLOC(sizeof(TI_REAL[output_length]));
49
57
 
50
58
  int error = indicator->indicator(size, (const TI_REAL *const *)c_inputs, options, outputs);
51
59
 
52
60
  xfree_ptr_arr(c_inputs, indicator->inputs);
53
- xfree(options);
61
+ TULIRB_FREE(options);
54
62
 
55
63
  if (error == TI_INVALID_OPTION)
56
64
  {
@@ -62,7 +70,7 @@ static inline VALUE ti_wrapper(VALUE inputs, VALUE opts, char *indicator_name)
62
70
  for (int i = 0; i < indicator->outputs; i++)
63
71
  {
64
72
  VALUE output = rb_ary_new_capa(output_length);
65
- for (size_t j = 0; j < output_length; j++)
73
+ for (int j = 0; j < output_length; j++)
66
74
  {
67
75
  rb_ary_push(output, DBL2NUM(outputs[i][j]));
68
76
  }
@@ -73,531 +81,531 @@ static inline VALUE ti_wrapper(VALUE inputs, VALUE opts, char *indicator_name)
73
81
  return ret;
74
82
  }
75
83
 
76
- static void xfree_ptr_arr(TI_REAL **ptr, size_t size)
84
+ static inline void xfree_ptr_arr(TI_REAL **ptr, size_t size)
77
85
  {
78
- for (int i = 0; i < size; i++)
79
- xfree(ptr[i]);
80
- xfree(ptr);
86
+ for (size_t i = 0; i < size; i++)
87
+ TULIRB_FREE(ptr[i]);
88
+ TULIRB_FREE(ptr);
81
89
  }
82
90
 
83
91
  // Alphabetical order
84
92
 
85
- VALUE rb_tulip_abs(VALUE self, VALUE inputs, VALUE opts)
93
+ static VALUE rb_tulip_abs(VALUE self, VALUE inputs, VALUE opts)
86
94
  {
87
95
  return ti_wrapper(inputs, opts, "abs");
88
96
  }
89
97
 
90
- VALUE rb_tulip_acos(VALUE self, VALUE inputs, VALUE opts)
98
+ static VALUE rb_tulip_acos(VALUE self, VALUE inputs, VALUE opts)
91
99
  {
92
100
  return ti_wrapper(inputs, opts, "acos");
93
101
  }
94
102
 
95
- VALUE rb_tulip_ad(VALUE self, VALUE inputs, VALUE opts)
103
+ static VALUE rb_tulip_ad(VALUE self, VALUE inputs, VALUE opts)
96
104
  {
97
105
  return ti_wrapper(inputs, opts, "ad");
98
106
  }
99
107
 
100
- VALUE rb_tulip_add(VALUE self, VALUE inputs, VALUE opts)
108
+ static VALUE rb_tulip_add(VALUE self, VALUE inputs, VALUE opts)
101
109
  {
102
110
  return ti_wrapper(inputs, opts, "add");
103
111
  }
104
112
 
105
- VALUE rb_tulip_adosc(VALUE self, VALUE inputs, VALUE opts)
113
+ static VALUE rb_tulip_adosc(VALUE self, VALUE inputs, VALUE opts)
106
114
  {
107
115
  return ti_wrapper(inputs, opts, "adosc");
108
116
  }
109
117
 
110
- VALUE rb_tulip_adx(VALUE self, VALUE inputs, VALUE opts)
118
+ static VALUE rb_tulip_adx(VALUE self, VALUE inputs, VALUE opts)
111
119
  {
112
120
  return ti_wrapper(inputs, opts, "adx");
113
121
  }
114
122
 
115
- VALUE rb_tulip_adxr(VALUE self, VALUE inputs, VALUE opts)
123
+ static VALUE rb_tulip_adxr(VALUE self, VALUE inputs, VALUE opts)
116
124
  {
117
125
  return ti_wrapper(inputs, opts, "adxr");
118
126
  }
119
127
 
120
- VALUE rb_tulip_ao(VALUE self, VALUE inputs, VALUE opts)
128
+ static VALUE rb_tulip_ao(VALUE self, VALUE inputs, VALUE opts)
121
129
  {
122
130
  return ti_wrapper(inputs, opts, "ao");
123
131
  }
124
132
 
125
- VALUE rb_tulip_apo(VALUE self, VALUE inputs, VALUE opts)
133
+ static VALUE rb_tulip_apo(VALUE self, VALUE inputs, VALUE opts)
126
134
  {
127
135
  return ti_wrapper(inputs, opts, "apo");
128
136
  }
129
137
 
130
- VALUE rb_tulip_aroon(VALUE self, VALUE inputs, VALUE opts)
138
+ static VALUE rb_tulip_aroon(VALUE self, VALUE inputs, VALUE opts)
131
139
  {
132
140
  return ti_wrapper(inputs, opts, "aroon");
133
141
  }
134
142
 
135
- VALUE rb_tulip_aroonosc(VALUE self, VALUE inputs, VALUE opts)
143
+ static VALUE rb_tulip_aroonosc(VALUE self, VALUE inputs, VALUE opts)
136
144
  {
137
145
  return ti_wrapper(inputs, opts, "aroonosc");
138
146
  }
139
147
 
140
- VALUE rb_tulip_asin(VALUE self, VALUE inputs, VALUE opts)
148
+ static VALUE rb_tulip_asin(VALUE self, VALUE inputs, VALUE opts)
141
149
  {
142
150
  return ti_wrapper(inputs, opts, "asin");
143
151
  }
144
152
 
145
- VALUE rb_tulip_atan(VALUE self, VALUE inputs, VALUE opts)
153
+ static VALUE rb_tulip_atan(VALUE self, VALUE inputs, VALUE opts)
146
154
  {
147
155
  return ti_wrapper(inputs, opts, "atan");
148
156
  }
149
157
 
150
- VALUE rb_tulip_atr(VALUE self, VALUE inputs, VALUE opts)
158
+ static VALUE rb_tulip_atr(VALUE self, VALUE inputs, VALUE opts)
151
159
  {
152
160
  return ti_wrapper(inputs, opts, "atr");
153
161
  }
154
162
 
155
- VALUE rb_tulip_avgprice(VALUE self, VALUE inputs, VALUE opts)
163
+ static VALUE rb_tulip_avgprice(VALUE self, VALUE inputs, VALUE opts)
156
164
  {
157
165
  return ti_wrapper(inputs, opts, "avgprice");
158
166
  }
159
167
 
160
- VALUE rb_tulip_bbands(VALUE self, VALUE inputs, VALUE opts)
168
+ static VALUE rb_tulip_bbands(VALUE self, VALUE inputs, VALUE opts)
161
169
  {
162
170
  return ti_wrapper(inputs, opts, "bbands");
163
171
  }
164
172
 
165
- VALUE rb_tulip_bop(VALUE self, VALUE inputs, VALUE opts)
173
+ static VALUE rb_tulip_bop(VALUE self, VALUE inputs, VALUE opts)
166
174
  {
167
175
  return ti_wrapper(inputs, opts, "bop");
168
176
  }
169
177
 
170
- VALUE rb_tulip_cci(VALUE self, VALUE inputs, VALUE opts)
178
+ static VALUE rb_tulip_cci(VALUE self, VALUE inputs, VALUE opts)
171
179
  {
172
180
  return ti_wrapper(inputs, opts, "cci");
173
181
  }
174
182
 
175
- VALUE rb_tulip_ceil(VALUE self, VALUE inputs, VALUE opts)
183
+ static VALUE rb_tulip_ceil(VALUE self, VALUE inputs, VALUE opts)
176
184
  {
177
185
  return ti_wrapper(inputs, opts, "ceil");
178
186
  }
179
187
 
180
- VALUE rb_tulip_cmo(VALUE self, VALUE inputs, VALUE opts)
188
+ static VALUE rb_tulip_cmo(VALUE self, VALUE inputs, VALUE opts)
181
189
  {
182
190
  return ti_wrapper(inputs, opts, "cmo");
183
191
  }
184
192
 
185
- VALUE rb_tulip_cos(VALUE self, VALUE inputs, VALUE opts)
193
+ static VALUE rb_tulip_cos(VALUE self, VALUE inputs, VALUE opts)
186
194
  {
187
195
  return ti_wrapper(inputs, opts, "cos");
188
196
  }
189
197
 
190
- VALUE rb_tulip_cosh(VALUE self, VALUE inputs, VALUE opts)
198
+ static VALUE rb_tulip_cosh(VALUE self, VALUE inputs, VALUE opts)
191
199
  {
192
200
  return ti_wrapper(inputs, opts, "cosh");
193
201
  }
194
202
 
195
- VALUE rb_tulip_crossany(VALUE self, VALUE inputs, VALUE opts)
203
+ static VALUE rb_tulip_crossany(VALUE self, VALUE inputs, VALUE opts)
196
204
  {
197
205
  return ti_wrapper(inputs, opts, "crossany");
198
206
  }
199
207
 
200
- VALUE rb_tulip_crossover(VALUE self, VALUE inputs, VALUE opts)
208
+ static VALUE rb_tulip_crossover(VALUE self, VALUE inputs, VALUE opts)
201
209
  {
202
210
  return ti_wrapper(inputs, opts, "crossover");
203
211
  }
204
212
 
205
- VALUE rb_tulip_cvi(VALUE self, VALUE inputs, VALUE opts)
213
+ static VALUE rb_tulip_cvi(VALUE self, VALUE inputs, VALUE opts)
206
214
  {
207
215
  return ti_wrapper(inputs, opts, "cvi");
208
216
  }
209
217
 
210
- VALUE rb_tulip_decay(VALUE self, VALUE inputs, VALUE opts)
218
+ static VALUE rb_tulip_decay(VALUE self, VALUE inputs, VALUE opts)
211
219
  {
212
220
  return ti_wrapper(inputs, opts, "decay");
213
221
  }
214
222
 
215
- VALUE rb_tulip_dema(VALUE self, VALUE inputs, VALUE opts)
223
+ static VALUE rb_tulip_dema(VALUE self, VALUE inputs, VALUE opts)
216
224
  {
217
225
  return ti_wrapper(inputs, opts, "dema");
218
226
  }
219
227
 
220
- VALUE rb_tulip_di(VALUE self, VALUE inputs, VALUE opts)
228
+ static VALUE rb_tulip_di(VALUE self, VALUE inputs, VALUE opts)
221
229
  {
222
230
  return ti_wrapper(inputs, opts, "di");
223
231
  }
224
232
 
225
- VALUE rb_tulip_div(VALUE self, VALUE inputs, VALUE opts)
233
+ static VALUE rb_tulip_div(VALUE self, VALUE inputs, VALUE opts)
226
234
  {
227
235
  return ti_wrapper(inputs, opts, "div");
228
236
  }
229
237
 
230
- VALUE rb_tulip_dm(VALUE self, VALUE inputs, VALUE opts)
238
+ static VALUE rb_tulip_dm(VALUE self, VALUE inputs, VALUE opts)
231
239
  {
232
240
  return ti_wrapper(inputs, opts, "dm");
233
241
  }
234
242
 
235
- VALUE rb_tulip_dpo(VALUE self, VALUE inputs, VALUE opts)
243
+ static VALUE rb_tulip_dpo(VALUE self, VALUE inputs, VALUE opts)
236
244
  {
237
245
  return ti_wrapper(inputs, opts, "dpo");
238
246
  }
239
247
 
240
- VALUE rb_tulip_dx(VALUE self, VALUE inputs, VALUE opts)
248
+ static VALUE rb_tulip_dx(VALUE self, VALUE inputs, VALUE opts)
241
249
  {
242
250
  return ti_wrapper(inputs, opts, "dx");
243
251
  }
244
252
 
245
- VALUE rb_tulip_edecay(VALUE self, VALUE inputs, VALUE opts)
253
+ static VALUE rb_tulip_edecay(VALUE self, VALUE inputs, VALUE opts)
246
254
  {
247
255
  return ti_wrapper(inputs, opts, "edecay");
248
256
  }
249
257
 
250
- VALUE rb_tulip_ema(VALUE self, VALUE inputs, VALUE opts)
258
+ static VALUE rb_tulip_ema(VALUE self, VALUE inputs, VALUE opts)
251
259
  {
252
260
  return ti_wrapper(inputs, opts, "ema");
253
261
  }
254
262
 
255
- VALUE rb_tulip_emv(VALUE self, VALUE inputs, VALUE opts)
263
+ static VALUE rb_tulip_emv(VALUE self, VALUE inputs, VALUE opts)
256
264
  {
257
265
  return ti_wrapper(inputs, opts, "emv");
258
266
  }
259
267
 
260
- VALUE rb_tulip_exp(VALUE self, VALUE inputs, VALUE opts)
268
+ static VALUE rb_tulip_exp(VALUE self, VALUE inputs, VALUE opts)
261
269
  {
262
270
  return ti_wrapper(inputs, opts, "exp");
263
271
  }
264
272
 
265
- VALUE rb_tulip_fisher(VALUE self, VALUE inputs, VALUE opts)
273
+ static VALUE rb_tulip_fisher(VALUE self, VALUE inputs, VALUE opts)
266
274
  {
267
275
  return ti_wrapper(inputs, opts, "fisher");
268
276
  }
269
277
 
270
- VALUE rb_tulip_floor(VALUE self, VALUE inputs, VALUE opts)
278
+ static VALUE rb_tulip_floor(VALUE self, VALUE inputs, VALUE opts)
271
279
  {
272
280
  return ti_wrapper(inputs, opts, "floor");
273
281
  }
274
282
 
275
- VALUE rb_tulip_fosc(VALUE self, VALUE inputs, VALUE opts)
283
+ static VALUE rb_tulip_fosc(VALUE self, VALUE inputs, VALUE opts)
276
284
  {
277
285
  return ti_wrapper(inputs, opts, "fosc");
278
286
  }
279
287
 
280
- VALUE rb_tulip_hma(VALUE self, VALUE inputs, VALUE opts)
288
+ static VALUE rb_tulip_hma(VALUE self, VALUE inputs, VALUE opts)
281
289
  {
282
290
  return ti_wrapper(inputs, opts, "hma");
283
291
  }
284
292
 
285
- VALUE rb_tulip_kama(VALUE self, VALUE inputs, VALUE opts)
293
+ static VALUE rb_tulip_kama(VALUE self, VALUE inputs, VALUE opts)
286
294
  {
287
295
  return ti_wrapper(inputs, opts, "kama");
288
296
  }
289
297
 
290
- VALUE rb_tulip_kvo(VALUE self, VALUE inputs, VALUE opts)
298
+ static VALUE rb_tulip_kvo(VALUE self, VALUE inputs, VALUE opts)
291
299
  {
292
300
  return ti_wrapper(inputs, opts, "kvo");
293
301
  }
294
302
 
295
- VALUE rb_tulip_lag(VALUE self, VALUE inputs, VALUE opts)
303
+ static VALUE rb_tulip_lag(VALUE self, VALUE inputs, VALUE opts)
296
304
  {
297
305
  return ti_wrapper(inputs, opts, "lag");
298
306
  }
299
307
 
300
- VALUE rb_tulip_linreg(VALUE self, VALUE inputs, VALUE opts)
308
+ static VALUE rb_tulip_linreg(VALUE self, VALUE inputs, VALUE opts)
301
309
  {
302
310
  return ti_wrapper(inputs, opts, "linreg");
303
311
  }
304
312
 
305
- VALUE rb_tulip_linregintercept(VALUE self, VALUE inputs, VALUE opts)
313
+ static VALUE rb_tulip_linregintercept(VALUE self, VALUE inputs, VALUE opts)
306
314
  {
307
315
  return ti_wrapper(inputs, opts, "linregintercept");
308
316
  }
309
317
 
310
- VALUE rb_tulip_linregslope(VALUE self, VALUE inputs, VALUE opts)
318
+ static VALUE rb_tulip_linregslope(VALUE self, VALUE inputs, VALUE opts)
311
319
  {
312
320
  return ti_wrapper(inputs, opts, "linregslope");
313
321
  }
314
322
 
315
- VALUE rb_tulip_ln(VALUE self, VALUE inputs, VALUE opts)
323
+ static VALUE rb_tulip_ln(VALUE self, VALUE inputs, VALUE opts)
316
324
  {
317
325
  return ti_wrapper(inputs, opts, "ln");
318
326
  }
319
327
 
320
- VALUE rb_tulip_log10(VALUE self, VALUE inputs, VALUE opts)
328
+ static VALUE rb_tulip_log10(VALUE self, VALUE inputs, VALUE opts)
321
329
  {
322
330
  return ti_wrapper(inputs, opts, "log10");
323
331
  }
324
332
 
325
- VALUE rb_tulip_macd(VALUE self, VALUE inputs, VALUE opts)
333
+ static VALUE rb_tulip_macd(VALUE self, VALUE inputs, VALUE opts)
326
334
  {
327
335
  return ti_wrapper(inputs, opts, "macd");
328
336
  }
329
337
 
330
- VALUE rb_tulip_marketfi(VALUE self, VALUE inputs, VALUE opts)
338
+ static VALUE rb_tulip_marketfi(VALUE self, VALUE inputs, VALUE opts)
331
339
  {
332
340
  return ti_wrapper(inputs, opts, "marketfi");
333
341
  }
334
342
 
335
- VALUE rb_tulip_mass(VALUE self, VALUE inputs, VALUE opts)
343
+ static VALUE rb_tulip_mass(VALUE self, VALUE inputs, VALUE opts)
336
344
  {
337
345
  return ti_wrapper(inputs, opts, "mass");
338
346
  }
339
347
 
340
- VALUE rb_tulip_max(VALUE self, VALUE inputs, VALUE opts)
348
+ static VALUE rb_tulip_max(VALUE self, VALUE inputs, VALUE opts)
341
349
  {
342
350
  return ti_wrapper(inputs, opts, "max");
343
351
  }
344
352
 
345
- VALUE rb_tulip_md(VALUE self, VALUE inputs, VALUE opts)
353
+ static VALUE rb_tulip_md(VALUE self, VALUE inputs, VALUE opts)
346
354
  {
347
355
  return ti_wrapper(inputs, opts, "md");
348
356
  }
349
357
 
350
- VALUE rb_tulip_medprice(VALUE self, VALUE inputs, VALUE opts)
358
+ static VALUE rb_tulip_medprice(VALUE self, VALUE inputs, VALUE opts)
351
359
  {
352
360
  return ti_wrapper(inputs, opts, "medprice");
353
361
  }
354
362
 
355
- VALUE rb_tulip_mfi(VALUE self, VALUE inputs, VALUE opts)
363
+ static VALUE rb_tulip_mfi(VALUE self, VALUE inputs, VALUE opts)
356
364
  {
357
365
  return ti_wrapper(inputs, opts, "mfi");
358
366
  }
359
367
 
360
- VALUE rb_tulip_min(VALUE self, VALUE inputs, VALUE opts)
368
+ static VALUE rb_tulip_min(VALUE self, VALUE inputs, VALUE opts)
361
369
  {
362
370
  return ti_wrapper(inputs, opts, "min");
363
371
  }
364
372
 
365
- VALUE rb_tulip_mom(VALUE self, VALUE inputs, VALUE opts)
373
+ static VALUE rb_tulip_mom(VALUE self, VALUE inputs, VALUE opts)
366
374
  {
367
375
  return ti_wrapper(inputs, opts, "mom");
368
376
  }
369
377
 
370
- VALUE rb_tulip_msw(VALUE self, VALUE inputs, VALUE opts)
378
+ static VALUE rb_tulip_msw(VALUE self, VALUE inputs, VALUE opts)
371
379
  {
372
380
  return ti_wrapper(inputs, opts, "msw");
373
381
  }
374
382
 
375
- VALUE rb_tulip_mul(VALUE self, VALUE inputs, VALUE opts)
383
+ static VALUE rb_tulip_mul(VALUE self, VALUE inputs, VALUE opts)
376
384
  {
377
385
  return ti_wrapper(inputs, opts, "mul");
378
386
  }
379
387
 
380
- VALUE rb_tulip_natr(VALUE self, VALUE inputs, VALUE opts)
388
+ static VALUE rb_tulip_natr(VALUE self, VALUE inputs, VALUE opts)
381
389
  {
382
390
  return ti_wrapper(inputs, opts, "natr");
383
391
  }
384
392
 
385
- VALUE rb_tulip_nvi(VALUE self, VALUE inputs, VALUE opts)
393
+ static VALUE rb_tulip_nvi(VALUE self, VALUE inputs, VALUE opts)
386
394
  {
387
395
  return ti_wrapper(inputs, opts, "nvi");
388
396
  }
389
397
 
390
- VALUE rb_tulip_obv(VALUE self, VALUE inputs, VALUE opts)
398
+ static VALUE rb_tulip_obv(VALUE self, VALUE inputs, VALUE opts)
391
399
  {
392
400
  return ti_wrapper(inputs, opts, "obv");
393
401
  }
394
402
 
395
- VALUE rb_tulip_ppo(VALUE self, VALUE inputs, VALUE opts)
403
+ static VALUE rb_tulip_ppo(VALUE self, VALUE inputs, VALUE opts)
396
404
  {
397
405
  return ti_wrapper(inputs, opts, "ppo");
398
406
  }
399
407
 
400
- VALUE rb_tulip_psar(VALUE self, VALUE inputs, VALUE opts)
408
+ static VALUE rb_tulip_psar(VALUE self, VALUE inputs, VALUE opts)
401
409
  {
402
410
  return ti_wrapper(inputs, opts, "psar");
403
411
  }
404
412
 
405
- VALUE rb_tulip_pvi(VALUE self, VALUE inputs, VALUE opts)
413
+ static VALUE rb_tulip_pvi(VALUE self, VALUE inputs, VALUE opts)
406
414
  {
407
415
  return ti_wrapper(inputs, opts, "pvi");
408
416
  }
409
417
 
410
- VALUE rb_tulip_qstick(VALUE self, VALUE inputs, VALUE opts)
418
+ static VALUE rb_tulip_qstick(VALUE self, VALUE inputs, VALUE opts)
411
419
  {
412
420
  return ti_wrapper(inputs, opts, "qstick");
413
421
  }
414
422
 
415
- VALUE rb_tulip_roc(VALUE self, VALUE inputs, VALUE opts)
423
+ static VALUE rb_tulip_roc(VALUE self, VALUE inputs, VALUE opts)
416
424
  {
417
425
  return ti_wrapper(inputs, opts, "roc");
418
426
  }
419
427
 
420
- VALUE rb_tulip_rocr(VALUE self, VALUE inputs, VALUE opts)
428
+ static VALUE rb_tulip_rocr(VALUE self, VALUE inputs, VALUE opts)
421
429
  {
422
430
  return ti_wrapper(inputs, opts, "rocr");
423
431
  }
424
432
 
425
- VALUE rb_tulip_round(VALUE self, VALUE inputs, VALUE opts)
433
+ static VALUE rb_tulip_round(VALUE self, VALUE inputs, VALUE opts)
426
434
  {
427
435
  return ti_wrapper(inputs, opts, "round");
428
436
  }
429
437
 
430
- VALUE rb_tulip_rsi(VALUE self, VALUE inputs, VALUE opts)
438
+ static VALUE rb_tulip_rsi(VALUE self, VALUE inputs, VALUE opts)
431
439
  {
432
440
  return ti_wrapper(inputs, opts, "rsi");
433
441
  }
434
442
 
435
- VALUE rb_tulip_sin(VALUE self, VALUE inputs, VALUE opts)
443
+ static VALUE rb_tulip_sin(VALUE self, VALUE inputs, VALUE opts)
436
444
  {
437
445
  return ti_wrapper(inputs, opts, "sin");
438
446
  }
439
447
 
440
- VALUE rb_tulip_sinh(VALUE self, VALUE inputs, VALUE opts)
448
+ static VALUE rb_tulip_sinh(VALUE self, VALUE inputs, VALUE opts)
441
449
  {
442
450
  return ti_wrapper(inputs, opts, "sinh");
443
451
  }
444
452
 
445
- VALUE rb_tulip_sma(VALUE self, VALUE inputs, VALUE opts)
453
+ static VALUE rb_tulip_sma(VALUE self, VALUE inputs, VALUE opts)
446
454
  {
447
455
  return ti_wrapper(inputs, opts, "sma");
448
456
  }
449
457
 
450
- VALUE rb_tulip_sqrt(VALUE self, VALUE inputs, VALUE opts)
458
+ static VALUE rb_tulip_sqrt(VALUE self, VALUE inputs, VALUE opts)
451
459
  {
452
460
  return ti_wrapper(inputs, opts, "sqrt");
453
461
  }
454
462
 
455
- VALUE rb_tulip_stddev(VALUE self, VALUE inputs, VALUE opts)
463
+ static VALUE rb_tulip_stddev(VALUE self, VALUE inputs, VALUE opts)
456
464
  {
457
465
  return ti_wrapper(inputs, opts, "stddev");
458
466
  }
459
467
 
460
- VALUE rb_tulip_stderr(VALUE self, VALUE inputs, VALUE opts)
468
+ static VALUE rb_tulip_stderr(VALUE self, VALUE inputs, VALUE opts)
461
469
  {
462
470
  return ti_wrapper(inputs, opts, "stderr");
463
471
  }
464
472
 
465
- VALUE rb_tulip_stoch(VALUE self, VALUE inputs, VALUE opts)
473
+ static VALUE rb_tulip_stoch(VALUE self, VALUE inputs, VALUE opts)
466
474
  {
467
475
  return ti_wrapper(inputs, opts, "stoch");
468
476
  }
469
477
 
470
- VALUE rb_tulip_stochrsi(VALUE self, VALUE inputs, VALUE opts)
478
+ static VALUE rb_tulip_stochrsi(VALUE self, VALUE inputs, VALUE opts)
471
479
  {
472
480
  return ti_wrapper(inputs, opts, "stochrsi");
473
481
  }
474
482
 
475
- VALUE rb_tulip_sub(VALUE self, VALUE inputs, VALUE opts)
483
+ static VALUE rb_tulip_sub(VALUE self, VALUE inputs, VALUE opts)
476
484
  {
477
485
  return ti_wrapper(inputs, opts, "sub");
478
486
  }
479
487
 
480
- VALUE rb_tulip_sum(VALUE self, VALUE inputs, VALUE opts)
488
+ static VALUE rb_tulip_sum(VALUE self, VALUE inputs, VALUE opts)
481
489
  {
482
490
  return ti_wrapper(inputs, opts, "sum");
483
491
  }
484
492
 
485
- VALUE rb_tulip_tan(VALUE self, VALUE inputs, VALUE opts)
493
+ static VALUE rb_tulip_tan(VALUE self, VALUE inputs, VALUE opts)
486
494
  {
487
495
  return ti_wrapper(inputs, opts, "tan");
488
496
  }
489
497
 
490
- VALUE rb_tulip_tanh(VALUE self, VALUE inputs, VALUE opts)
498
+ static VALUE rb_tulip_tanh(VALUE self, VALUE inputs, VALUE opts)
491
499
  {
492
500
  return ti_wrapper(inputs, opts, "tanh");
493
501
  }
494
502
 
495
- VALUE rb_tulip_tema(VALUE self, VALUE inputs, VALUE opts)
503
+ static VALUE rb_tulip_tema(VALUE self, VALUE inputs, VALUE opts)
496
504
  {
497
505
  return ti_wrapper(inputs, opts, "tema");
498
506
  }
499
507
 
500
- VALUE rb_tulip_todeg(VALUE self, VALUE inputs, VALUE opts)
508
+ static VALUE rb_tulip_todeg(VALUE self, VALUE inputs, VALUE opts)
501
509
  {
502
510
  return ti_wrapper(inputs, opts, "todeg");
503
511
  }
504
512
 
505
- VALUE rb_tulip_torad(VALUE self, VALUE inputs, VALUE opts)
513
+ static VALUE rb_tulip_torad(VALUE self, VALUE inputs, VALUE opts)
506
514
  {
507
515
  return ti_wrapper(inputs, opts, "torad");
508
516
  }
509
517
 
510
- VALUE rb_tulip_tr(VALUE self, VALUE inputs, VALUE opts)
518
+ static VALUE rb_tulip_tr(VALUE self, VALUE inputs, VALUE opts)
511
519
  {
512
520
  return ti_wrapper(inputs, opts, "tr");
513
521
  }
514
522
 
515
- VALUE rb_tulip_trima(VALUE self, VALUE inputs, VALUE opts)
523
+ static VALUE rb_tulip_trima(VALUE self, VALUE inputs, VALUE opts)
516
524
  {
517
525
  return ti_wrapper(inputs, opts, "trima");
518
526
  }
519
527
 
520
- VALUE rb_tulip_trix(VALUE self, VALUE inputs, VALUE opts)
528
+ static VALUE rb_tulip_trix(VALUE self, VALUE inputs, VALUE opts)
521
529
  {
522
530
  return ti_wrapper(inputs, opts, "trix");
523
531
  }
524
532
 
525
- VALUE rb_tulip_trunc(VALUE self, VALUE inputs, VALUE opts)
533
+ static VALUE rb_tulip_trunc(VALUE self, VALUE inputs, VALUE opts)
526
534
  {
527
535
  return ti_wrapper(inputs, opts, "trunc");
528
536
  }
529
537
 
530
- VALUE rb_tulip_tsf(VALUE self, VALUE inputs, VALUE opts)
538
+ static VALUE rb_tulip_tsf(VALUE self, VALUE inputs, VALUE opts)
531
539
  {
532
540
  return ti_wrapper(inputs, opts, "tsf");
533
541
  }
534
542
 
535
- VALUE rb_tulip_typprice(VALUE self, VALUE inputs, VALUE opts)
543
+ static VALUE rb_tulip_typprice(VALUE self, VALUE inputs, VALUE opts)
536
544
  {
537
545
  return ti_wrapper(inputs, opts, "typprice");
538
546
  }
539
547
 
540
- VALUE rb_tulip_ultosc(VALUE self, VALUE inputs, VALUE opts)
548
+ static VALUE rb_tulip_ultosc(VALUE self, VALUE inputs, VALUE opts)
541
549
  {
542
550
  return ti_wrapper(inputs, opts, "ultosc");
543
551
  }
544
552
 
545
- VALUE rb_tulip_var(VALUE self, VALUE inputs, VALUE opts)
553
+ static VALUE rb_tulip_var(VALUE self, VALUE inputs, VALUE opts)
546
554
  {
547
555
  return ti_wrapper(inputs, opts, "var");
548
556
  }
549
557
 
550
- VALUE rb_tulip_vhf(VALUE self, VALUE inputs, VALUE opts)
558
+ static VALUE rb_tulip_vhf(VALUE self, VALUE inputs, VALUE opts)
551
559
  {
552
560
  return ti_wrapper(inputs, opts, "vhf");
553
561
  }
554
562
 
555
- VALUE rb_tulip_vidya(VALUE self, VALUE inputs, VALUE opts)
563
+ static VALUE rb_tulip_vidya(VALUE self, VALUE inputs, VALUE opts)
556
564
  {
557
565
  return ti_wrapper(inputs, opts, "vidya");
558
566
  }
559
567
 
560
- VALUE rb_tulip_volatility(VALUE self, VALUE inputs, VALUE opts)
568
+ static VALUE rb_tulip_volatility(VALUE self, VALUE inputs, VALUE opts)
561
569
  {
562
570
  return ti_wrapper(inputs, opts, "volatility");
563
571
  }
564
572
 
565
- VALUE rb_tulip_vosc(VALUE self, VALUE inputs, VALUE opts)
573
+ static VALUE rb_tulip_vosc(VALUE self, VALUE inputs, VALUE opts)
566
574
  {
567
575
  return ti_wrapper(inputs, opts, "vosc");
568
576
  }
569
577
 
570
- VALUE rb_tulip_vwma(VALUE self, VALUE inputs, VALUE opts)
578
+ static VALUE rb_tulip_vwma(VALUE self, VALUE inputs, VALUE opts)
571
579
  {
572
580
  return ti_wrapper(inputs, opts, "vwma");
573
581
  }
574
582
 
575
- VALUE rb_tulip_wad(VALUE self, VALUE inputs, VALUE opts)
583
+ static VALUE rb_tulip_wad(VALUE self, VALUE inputs, VALUE opts)
576
584
  {
577
585
  return ti_wrapper(inputs, opts, "wad");
578
586
  }
579
587
 
580
- VALUE rb_tulip_wcprice(VALUE self, VALUE inputs, VALUE opts)
588
+ static VALUE rb_tulip_wcprice(VALUE self, VALUE inputs, VALUE opts)
581
589
  {
582
590
  return ti_wrapper(inputs, opts, "wcprice");
583
591
  }
584
592
 
585
- VALUE rb_tulip_wilders(VALUE self, VALUE inputs, VALUE opts)
593
+ static VALUE rb_tulip_wilders(VALUE self, VALUE inputs, VALUE opts)
586
594
  {
587
595
  return ti_wrapper(inputs, opts, "wilders");
588
596
  }
589
597
 
590
- VALUE rb_tulip_willr(VALUE self, VALUE inputs, VALUE opts)
598
+ static VALUE rb_tulip_willr(VALUE self, VALUE inputs, VALUE opts)
591
599
  {
592
600
  return ti_wrapper(inputs, opts, "willr");
593
601
  }
594
602
 
595
- VALUE rb_tulip_wma(VALUE self, VALUE inputs, VALUE opts)
603
+ static VALUE rb_tulip_wma(VALUE self, VALUE inputs, VALUE opts)
596
604
  {
597
605
  return ti_wrapper(inputs, opts, "wma");
598
606
  }
599
607
 
600
- VALUE rb_tulip_zlema(VALUE self, VALUE inputs, VALUE opts)
608
+ static VALUE rb_tulip_zlema(VALUE self, VALUE inputs, VALUE opts)
601
609
  {
602
610
  return ti_wrapper(inputs, opts, "zlema");
603
611
  }
@@ -607,7 +615,7 @@ static inline VALUE parameterize(char *str)
607
615
  return rb_funcall(rb_str_new2(str), rb_intern("gsub"), 2, rb_str_new2(" "), rb_str_new2("_"));
608
616
  }
609
617
 
610
- static inline VALUE rb_indicators_info()
618
+ static inline VALUE rb_indicators_info(void)
611
619
  {
612
620
  VALUE ret = rb_hash_new();
613
621
  for (size_t i = 0; i < TI_INDICATOR_COUNT; i++)
@@ -632,7 +640,7 @@ static inline VALUE rb_indicators_info()
632
640
  };
633
641
  rb_hash_aset(ret, ID2SYM(rb_intern(indicator.name)), indicators_hash);
634
642
  }
635
- return ret;
643
+ return rb_obj_freeze(ret);
636
644
  };
637
645
 
638
646
  void Init_tulirb(void)