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 | f610abc0a6e2ac60f6bcb7756a42e755db48a260 (patch) | |
tree | c49f3385095fa52561a198b5eebf24c155514e39 | |
parent | 74dd31fadfdc3b0b399d6bf0350a34e381e3de9c (diff) |
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@14808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | goruby.c | 23 | ||||
-rw-r--r-- | main.c | 3 |
3 files changed, 29 insertions, 4 deletions
@@ -1,3 +1,10 @@ +Mon Dec 31 07:39:31 2007 Nobuyoshi Nakada <[email protected]> + + * 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. + Mon Dec 31 06:50:38 2007 Nobuyoshi Nakada <[email protected]> * trunk/common.mk: not use -I$(srcdir)/lib with $(MINIRUBY) for cross @@ -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); +} @@ -33,9 +33,6 @@ main(int argc, char **argv, char **envp) { RUBY_INIT_STACK; ruby_init(); -#ifdef RUBY_MAIN_INIT - RUBY_MAIN_INIT(); -#endif return ruby_run_node(ruby_options(argc, argv)); } } |