From 57cca3c3cb05e1d98a477cb077598fa6a5b980fc Mon Sep 17 00:00:00 2001 From: Gonzalo Garramuno Date: Sun, 29 Apr 2007 22:56:18 +0000 Subject: [PATCH] Minor cleanup. Mode RUBY_INIT_STACK macro definition to rubyhead.swg where all the backward compatability macros are kept. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9715 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/ruby/rubyhead.swg | 9 +++++++++ Lib/ruby/rubyrun.swg | 17 +++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Lib/ruby/rubyhead.swg b/Lib/ruby/rubyhead.swg index bf46dc88d..d55d49882 100644 --- a/Lib/ruby/rubyhead.swg +++ b/Lib/ruby/rubyhead.swg @@ -96,5 +96,14 @@ #endif +// For ruby1.8.4 and earlier. +#ifndef RUBY_INIT_STACK + extern void Init_stack(VALUE* addr); +# define RUBY_INIT_STACK \ + VALUE variable_in_this_stack_frame; \ + Init_stack(&variable_in_this_stack_frame); +#endif + + /* Global module used to keep some internal SWIG stuff */ static VALUE _mSWIG = Qnil; diff --git a/Lib/ruby/rubyrun.swg b/Lib/ruby/rubyrun.swg index cce2fa9f6..39e30a281 100644 --- a/Lib/ruby/rubyrun.swg +++ b/Lib/ruby/rubyrun.swg @@ -84,20 +84,13 @@ static VALUE swig_runtime_data_type_pointer = Qnil; /* If your swig extension is to be run within an embedded ruby and has - director callbacks, you should set RUBY_EMBEDDED. This will reset - ruby's stack frame on each entry point from the main program the first - time a virtual director function is invoked (in a non-recursive way). - If this is not done, you run the risk of trashing the stack. + director callbacks, you should set -DRUBY_EMBEDDED during compilation. + This will reset ruby's stack frame on each entry point from the main + program the first time a virtual director function is invoked (in a + non-recursive way). + If this is not done, you run the risk of Ruby trashing the stack. */ -#ifndef RUBY_INIT_STACK - extern void Init_stack(VALUE* addr); -# define RUBY_INIT_STACK \ - VALUE variable_in_this_stack_frame; \ - Init_stack(&variable_in_this_stack_frame); -#endif - - #ifdef RUBY_EMBEDDED # define SWIG_INIT_STACK \