ruby-changes:5536
From: nobu <ko1@a...>
Date: Mon, 9 Jun 2008 14:18:21 +0900 (JST)
Subject: [ruby-changes:5536] Ruby:r17039 (trunk): * vm_core.h (struct rb_vm_struct): moved ruby_debug, ruby_verbose, and
nobu 2008-06-09 14:18:03 +0900 (Mon, 09 Jun 2008) New Revision: 17039 Modified files: trunk/ChangeLog trunk/include/ruby/mvm.h trunk/include/ruby/ruby.h trunk/ruby.c trunk/vm.c trunk/vm_core.h Log: * vm_core.h (struct rb_vm_struct): moved ruby_debug, ruby_verbose, and rb_progname. * ruby.c (rb_argv0): no longer used. * vm.c: getters/setters for ruby_{debug,verbose}. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/ruby.h?r1=17039&r2=17038&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ruby.c?r1=17039&r2=17038&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17039&r2=17038&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/mvm.h?r1=17039&r2=17038&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm_core.h?r1=17039&r2=17038&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm.c?r1=17039&r2=17038&diff_format=u Index: include/ruby/mvm.h =================================================================== --- include/ruby/mvm.h (revision 17038) +++ include/ruby/mvm.h (revision 17039) @@ -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 */ Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 17038) +++ include/ruby/ruby.h (revision 17039) @@ -799,7 +799,10 @@ 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); Index: ChangeLog =================================================================== --- ChangeLog (revision 17038) +++ ChangeLog (revision 17039) @@ -1,7 +1,10 @@ -Mon Jun 9 13:20:04 2008 Nobuyoshi Nakada <nobu@r...> +Mon Jun 9 14:18:01 2008 Nobuyoshi Nakada <nobu@r...> - * 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 @@ * 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@r...> * include/ruby/intern.h (Init_stack): make to call ruby_init_stack. Index: vm_core.h =================================================================== --- vm_core.h (revision 17038) +++ vm_core.h (revision 17039) @@ -321,6 +321,8 @@ int src_encoding_index; + VALUE verbose, debug, progname; + #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE struct rb_objspace *objspace; #endif Index: vm.c =================================================================== --- vm.c (revision 17038) +++ vm.c (revision 17039) @@ -1777,3 +1777,26 @@ 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()); +} Index: ruby.c =================================================================== --- ruby.c (revision 17038) +++ ruby.c (revision 17039) @@ -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 @@ return i; } -VALUE rb_progname; -VALUE rb_argv0; +#define rb_progname (GET_VM()->progname) static VALUE process_options(VALUE arg) @@ -1473,7 +1469,6 @@ 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 @@ 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/