import source from 1.3.40
[external/swig.git] / Lib / ruby / rubyapi.swg
1 /* -----------------------------------------------------------------------------
2  * Ruby API portion that goes into the runtime
3  * ----------------------------------------------------------------------------- */
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 SWIGINTERN VALUE
10 SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
11   if (NIL_P(target)) {
12     target = o;
13   } else {
14     if (TYPE(target) != T_ARRAY) {
15       VALUE o2 = target;
16       target = rb_ary_new();
17       rb_ary_push(target, o2);
18     }
19     rb_ary_push(target, o);
20   }
21   return target;
22 }
23
24 /* For ruby1.8.4 and earlier. */
25 #ifndef RUBY_INIT_STACK
26    RUBY_EXTERN void Init_stack(VALUE* addr);
27 #  define RUBY_INIT_STACK \
28    VALUE variable_in_this_stack_frame; \
29    Init_stack(&variable_in_this_stack_frame);
30 #endif
31
32
33 #ifdef __cplusplus
34 }
35 #endif
36