diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-30 22:39:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-30 22:39:34 +0000 |
commit | 7f6018a42342111573f259fd6eb5e404a4b147cd (patch) | |
tree | c49f3385095fa52561a198b5eebf24c155514e39 /goruby.c | |
parent | ce4c111b5420be18be3c740f6a10435556ddb606 (diff) | |
download | ruby-7f6018a42342111573f259fd6eb5e404a4b147cd.tar.gz ruby-7f6018a42342111573f259fd6eb5e404a4b147cd.tar.xz ruby-7f6018a42342111573f259fd6eb5e404a4b147cd.zip |
* main.c, goruby.c (RUBY_MAIN_INIT): removed.
* goruby.c (goruby_run_node): run after ruby_init_loadpath() so that
require works, and protect the call.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'goruby.c')
-rw-r--r-- | goruby.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -1,3 +1,24 @@ void Init_golf(void); -#define RUBY_MAIN_INIT() Init_golf() +#define ruby_run_node goruby_run_node #include "main.c" +#undef ruby_run_node + +RUBY_EXTERN int ruby_run_node(void*); +RUBY_EXTERN void ruby_init_ext(const char *name, void (*init)(void)); + +static VALUE +init_golf(VALUE arg) +{ + ruby_init_ext("golf", Init_golf); + return arg; +} + +int +goruby_run_node(void *arg) +{ + int state; + if (NIL_P(rb_protect(init_golf, Qtrue, &state))) { + return state == EXIT_SUCCESS ? EXIT_FAILURE : state; + } + return ruby_run_node(arg); +} |