summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--include/ruby/mvm.h3
-rw-r--r--include/ruby/ruby.h5
-rw-r--r--ruby.c8
-rw-r--r--vm.c23
-rw-r--r--vm_core.h2
6 files changed, 40 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index a7229609a8..1379022f12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
-Mon Jun 9 13:20:04 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 9 14:18:01 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_core.h (struct rb_vm_struct): moved src_encoding_index.
+ * vm_core.h (struct rb_vm_struct): moved src_encoding_index,
+ ruby_debug, ruby_verbose, and rb_progname.
+
+ * ruby.c (rb_argv0): no longer used.
* ruby.c (struct cmdline_options): moved setids and req_list, and the
latter is now an array, to prevent memory leak.
@@ -12,6 +15,8 @@ Mon Jun 9 13:20:04 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm.c (vm_init2): initialize src_encoding_index.
+ * vm.c: getters/setters for ruby_{debug,verbose}.
+
Mon Jun 9 09:54:13 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/intern.h (Init_stack): make to call ruby_init_stack.
diff --git a/include/ruby/mvm.h b/include/ruby/mvm.h
index 6b6a2f5232..24b8cb3fb4 100644
--- a/include/ruby/mvm.h
+++ b/include/ruby/mvm.h
@@ -15,4 +15,7 @@
typedef struct rb_vm_struct rb_vm_t;
typedef struct rb_thread_struct rb_thread_t;
+VALUE *ruby_vm_verbose_ptr(rb_vm_t *);
+VALUE *ruby_vm_debug_ptr(rb_vm_t *);
+
#endif /* RUBY_MVM_H */
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index db6f98023a..614a6145b3 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -799,7 +799,10 @@ VALUE rb_iv_set(VALUE, const char*, VALUE);
VALUE rb_equal(VALUE,VALUE);
-RUBY_EXTERN VALUE ruby_verbose, ruby_debug;
+VALUE *rb_ruby_verbose_ptr(void);
+VALUE *rb_ruby_debug_ptr(void);
+#define ruby_verbose (*rb_ruby_verbose_ptr())
+#define ruby_debug (*rb_ruby_debug_ptr())
PRINTF_ARGS(NORETURN(void rb_raise(VALUE, const char*, ...)), 2, 3);
PRINTF_ARGS(NORETURN(void rb_fatal(const char*, ...)), 1, 2);
diff --git a/ruby.c b/ruby.c
index 5544dc2b75..121ddc6432 100644
--- a/ruby.c
+++ b/ruby.c
@@ -57,9 +57,6 @@
char *getenv();
#endif
-/* TODO: move to VM */
-VALUE ruby_debug = Qfalse;
-VALUE ruby_verbose = Qfalse;
VALUE rb_parser_get_yydebug(VALUE);
VALUE rb_parser_set_yydebug(VALUE, VALUE);
@@ -956,8 +953,7 @@ opt_enc_index(VALUE enc_name)
return i;
}
-VALUE rb_progname;
-VALUE rb_argv0;
+#define rb_progname (GET_VM()->progname)
static VALUE
process_options(VALUE arg)
@@ -1473,7 +1469,6 @@ ruby_prog_init(void)
rb_define_hooked_variable("$PROGRAM_NAME", &rb_progname, 0, set_arg0);
rb_define_global_const("ARGV", rb_argv);
- rb_global_variable(&rb_argv0);
#ifdef MSDOS
/*
@@ -1529,7 +1524,6 @@ ruby_process_options(int argc, char **argv)
NODE *tree;
ruby_script(argv[0]); /* for the time being */
- rb_argv0 = rb_progname;
args.argc = argc;
args.argv = argv;
args.opt = cmdline_options_init(&opt);
diff --git a/vm.c b/vm.c
index 8efc6cdb9c..a62392c3c0 100644
--- a/vm.c
+++ b/vm.c
@@ -1777,3 +1777,26 @@ Init_top_self(void)
vm->top_self = rb_obj_alloc(rb_cObject);
rb_define_singleton_method(rb_vm_top_self(), "to_s", main_to_s, 0);
}
+
+VALUE *
+ruby_vm_verbose_ptr(rb_vm_t *vm)
+{
+ return &vm->verbose;
+}
+
+VALUE *
+ruby_vm_debug_ptr(rb_vm_t *vm)
+{
+ return &vm->debug;
+}
+
+VALUE *
+rb_ruby_verbose_ptr(void)
+{
+ return ruby_vm_verbose_ptr(GET_VM());
+}
+
+VALUE *rb_ruby_debug_ptr(void)
+{
+ return ruby_vm_debug_ptr(GET_VM());
+}
diff --git a/vm_core.h b/vm_core.h
index d68419346d..8d3ca8ab20 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -321,6 +321,8 @@ struct rb_vm_struct
int src_encoding_index;
+ VALUE verbose, debug, progname;
+
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
struct rb_objspace *objspace;
#endif