ruby-changes:5941
From: matz <ko1@a...>
Date: Fri, 20 Jun 2008 02:22:53 +0900 (JST)
Subject: [ruby-changes:5941] Ruby:r17449 (ruby_1_8): * lib/mathn.rb (Rational::power2): typo fixed.
matz 2008-06-20 02:22:33 +0900 (Fri, 20 Jun 2008) New Revision: 17449 Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/ext/openssl/ossl.h branches/ruby_1_8/ext/stringio/stringio.c branches/ruby_1_8/ext/tk/extconf.rb branches/ruby_1_8/ext/tk/stubs.c branches/ruby_1_8/ext/tk/tcltklib.c branches/ruby_1_8/ext/tk/tkutil/extconf.rb branches/ruby_1_8/ext/tk/tkutil/tkutil.c branches/ruby_1_8/lib/mathn.rb branches/ruby_1_8/test/stringio/test_stringio.rb branches/ruby_1_8/version.h Log: * lib/mathn.rb (Rational::power2): typo fixed. [ruby-core:17293] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/test/stringio/test_stringio.rb?r1=17449&r2=17448&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/lib/mathn.rb?r1=17449&r2=17448&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/extconf.rb?r1=17449&r2=17448&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=17449&r2=17448&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/stringio/stringio.c?r1=17449&r2=17448&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/tkutil/extconf.rb?r1=17449&r2=17448&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/tcltklib.c?r1=17449&r2=17448&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/stubs.c?r1=17449&r2=17448&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/version.h?r1=17449&r2=17448&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/openssl/ossl.h?r1=17449&r2=17448&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/tkutil/tkutil.c?r1=17449&r2=17448&diff_format=u Index: ruby_1_8/ext/tk/stubs.c =================================================================== --- ruby_1_8/ext/tk/stubs.c (revision 17448) +++ ruby_1_8/ext/tk/stubs.c (revision 17449) @@ -92,7 +92,7 @@ static DL_HANDLE tk_dll = (DL_HANDLE)0; int -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM ruby_open_tcl_dll(char *appname) #else ruby_open_tcl_dll(appname) @@ -179,7 +179,7 @@ } int -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM ruby_open_tcltk_dll(char *appname) #else ruby_open_tcltk_dll(appname) @@ -203,7 +203,7 @@ Tcl_Interp * -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM ruby_tcl_create_ip_and_stubs_init(int *st) #else ruby_tcl_create_ip_and_stubs_init(st) @@ -290,7 +290,7 @@ } int -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM ruby_tk_stubs_init(Tcl_Interp *tcl_ip) #else ruby_tk_stubs_init(tcl_ip) @@ -330,7 +330,7 @@ } int -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM ruby_tk_stubs_safeinit(Tcl_Interp *tcl_ip) #else ruby_tk_stubs_safeinit(tcl_ip) @@ -421,7 +421,7 @@ static int call_tk_stubs_init = 0; int -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM ruby_open_tcl_dll(char *appname) #else ruby_open_tcl_dll(appname) @@ -450,7 +450,7 @@ } int -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM ruby_open_tcltk_dll(char *appname) #else ruby_open_tcltk_dll(appname) @@ -473,7 +473,7 @@ } Tcl_Interp * -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM ruby_tcl_create_ip_and_stubs_init(int *st) #else ruby_tcl_create_ip_and_stubs_init(st) @@ -506,7 +506,7 @@ } int -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM ruby_tk_stubs_init(Tcl_Interp *tcl_ip) #else ruby_tk_stubs_init(tcl_ip) @@ -527,7 +527,7 @@ } int -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM ruby_tk_stubs_safeinit(Tcl_Interp *tcl_ip) #else ruby_tk_stubs_safeinit(tcl_ip) Index: ruby_1_8/ext/tk/tcltklib.c =================================================================== --- ruby_1_8/ext/tk/tcltklib.c (revision 17448) +++ ruby_1_8/ext/tk/tcltklib.c (revision 17449) @@ -8,12 +8,10 @@ #include "ruby.h" -#ifdef HAVE_RUBY_RUBY_H +#ifdef RUBY_VM /* #include "ruby/ruby.h" */ #include "ruby/signal.h" -#ifdef HAVE_RUBY_ENCODING_H #include "ruby/encoding.h" -#endif #else /* #include "ruby.h" */ #include "rubysig.h" @@ -33,19 +31,6 @@ #include <tcl.h> #include <tk.h> -#ifndef HAVE_RUBY_NATIVE_THREAD_P -#define ruby_native_thread_p() is_ruby_native_thread() -#undef RUBY_USE_NATIVE_THREAD -#else -#define RUBY_USE_NATIVE_THREAD 1 -#endif -#ifndef HAVE_RB_ERRINFO -#define rb_errinfo() (ruby_errinfo+0) /* cannot be l-value */ -#endif -#ifndef HAVE_RB_SAFE_LEVEL -#define rb_safe_level() (ruby_safe_level+0) /* cannot be l-value */ -#endif - #include "stubs.h" #ifndef TCL_ALPHA_RELEASE @@ -125,7 +110,7 @@ static int at_exit = 0; -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM static VALUE cRubyEncoding; /* encoding */ @@ -210,7 +195,7 @@ /* safe Tcl_Eval and Tcl_GlobalEval */ static int -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM tcl_eval(Tcl_Interp *interp, const char *cmd) #else tcl_eval(interp, cmd) @@ -231,7 +216,7 @@ #define Tcl_Eval tcl_eval static int -#ifdef HAVE_PROTOTYPES +#ifdef RUBY_VM tcl_global_eval(Tcl_Interp *interp, const char *cmd) #else tcl_global_eval(interp, cmd) @@ -408,7 +393,7 @@ static VALUE eventloop_thread; -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM Tcl_ThreadId tk_eventloop_thread_id; /* native thread ID of Tcl interpreter */ #endif static VALUE eventloop_stack; @@ -439,14 +424,14 @@ * 'timer_tick' is a limit of one term of thread scheduling. * If 'timer_tick' == 0, then not use the timer for thread scheduling. */ -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM #define DEFAULT_EVENT_LOOP_MAX 800/*counts*/ #define DEFAULT_NO_EVENT_TICK 10/*counts*/ #define DEFAULT_NO_EVENT_WAIT 10/*milliseconds ( 1 -- 999 ) */ #define WATCHDOG_INTERVAL 10/*milliseconds ( 1 -- 999 ) */ #define DEFAULT_TIMER_TICK 0/*milliseconds ( 0 -- 999 ) */ #define NO_THREAD_INTERRUPT_TIME 100/*milliseconds ( 1 -- 999 ) */ -#else /* ! RUBY_USE_NATIVE_THREAD */ +#else /* ! RUBY_VM */ #define DEFAULT_EVENT_LOOP_MAX 800/*counts*/ #define DEFAULT_NO_EVENT_TICK 10/*counts*/ #define DEFAULT_NO_EVENT_WAIT 20/*milliseconds ( 1 -- 999 ) */ @@ -688,7 +673,7 @@ #if TCL_NAMESPACE_DEBUG Tcl_Namespace *default_ns; /* default namespace */ #endif -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM Tcl_ThreadId tk_thread_id; /* native thread ID of Tcl interpreter */ #endif int has_orig_exit; /* has original 'exit' command ? */ @@ -881,7 +866,7 @@ } #endif -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM ptr->tk_thread_id = Tcl_GetCurrentThread(); #endif @@ -1153,7 +1138,7 @@ /* tick_counter += event_loop_max; */ } -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM #if USE_TOGGLE_WINDOW_MODE_FOR_IDLE static int toggle_eventloop_window_mode_for_idle() @@ -1496,7 +1481,7 @@ lib_num_of_mainwindows(self) VALUE self; { -#ifdef RUBY_USE_NATIVE_THREAD /* Ruby 1.9+ !!! */ +#ifdef RUBY_VM /* Ruby 1.9+ !!! */ return tk_funcall(lib_num_of_mainwindows_core, 0, (VALUE*)NULL, self); #else return lib_num_of_mainwindows_core(self, 0, (VALUE*)NULL); @@ -1504,7 +1489,7 @@ } -#ifdef RUBY_USE_NATIVE_THREAD /* Ruby 1.9+ !!! */ +#ifdef RUBY_VM /* Ruby 1.9+ !!! */ static VALUE call_DoOneEvent_core(flag_val) VALUE flag_val; @@ -1553,24 +1538,36 @@ t.tv_usec = (time_t)(no_event_wait*1000.0); #ifdef HAVE_NATIVETHREAD -#ifndef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM +#if 0 if (!ruby_native_thread_p()) { rb_bug("cross-thread violation on eventloop_sleep()"); } #endif +#else + if (!is_ruby_native_thread()) { + rb_bug("cross-thread violation on eventloop_sleep()"); + } #endif +#endif DUMP2("eventloop_sleep: rb_thread_wait_for() at thread : %lx", rb_thread_current()); rb_thread_wait_for(t); DUMP2("eventloop_sleep: finish at thread : %lx", rb_thread_current()); #ifdef HAVE_NATIVETHREAD -#ifndef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM +#if 0 if (!ruby_native_thread_p()) { rb_bug("cross-thread violation on eventloop_sleep()"); } #endif +#else + if (!is_ruby_native_thread()) { + rb_bug("cross-thread violation on eventloop_sleep()"); + } #endif +#endif return Qnil; } @@ -1581,7 +1578,7 @@ static int get_thread_alone_check_flag() { -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM return 0; #else set_tcltk_version(); @@ -1693,11 +1690,19 @@ if (status) { switch (status) { case TAG_RAISE: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rbtk_pending_exception = rb_exc_new2(rb_eException, "unknown exception"); } else { +#ifdef RUBY_VM rbtk_pending_exception = rb_errinfo(); +#else + rbtk_pending_exception = ruby_errinfo; +#endif if (!NIL_P(rbtk_pending_exception)) { if (rbtk_eventloop_depth == 0) { @@ -1712,10 +1717,18 @@ break; case TAG_FATAL: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rb_exc_raise(rb_exc_new2(rb_eFatal, "FATAL")); } else { +#ifdef RUBY_VM rb_exc_raise(rb_errinfo()); +#else + rb_exc_raise(ruby_errinfo); +#endif } } } @@ -1806,7 +1819,7 @@ if (NIL_P(eventloop_thread) || current == eventloop_thread) { int st; int status; -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM if (update_flag) { st = RTEST(rb_protect(call_DoOneEvent, INT2FIX(event_flag), &status)); @@ -1842,12 +1855,20 @@ if (status) { switch (status) { case TAG_RAISE: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rbtk_pending_exception = rb_exc_new2(rb_eException, "unknown exception"); } else { +#ifdef RUBY_VM rbtk_pending_exception = rb_errinfo(); +#else + rbtk_pending_exception = ruby_errinfo; +#endif if (!NIL_P(rbtk_pending_exception)) { if (rbtk_eventloop_depth == 0) { @@ -1862,10 +1883,18 @@ break; case TAG_FATAL: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rb_exc_raise(rb_exc_new2(rb_eFatal, "FATAL")); } else { +#ifdef RUBY_VM rb_exc_raise(rb_errinfo()); +#else + rb_exc_raise(ruby_errinfo); +#endif } } } @@ -1915,12 +1944,20 @@ if (status) { switch (status) { case TAG_RAISE: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rbtk_pending_exception = rb_exc_new2(rb_eException, "unknown exception"); } else { +#ifdef RUBY_VM rbtk_pending_exception = rb_errinfo(); +#else + rbtk_pending_exception = ruby_errinfo; +#endif if (!NIL_P(rbtk_pending_exception)) { if (rbtk_eventloop_depth == 0) { @@ -1935,11 +1972,19 @@ break; case TAG_FATAL: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rb_exc_raise(rb_exc_new2(rb_eFatal, "FATAL")); } else { +#ifdef RUBY_VM rb_exc_raise(rb_errinfo()); +#else + rb_exc_raise(ruby_errinfo); +#endif } } } @@ -2000,7 +2045,7 @@ } DUMP1("trap check & thread scheduling"); -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM /* if (update_flag == 0) CHECK_INTS; */ /*XXXXXXXXXXXXX TODO !!!! */ #else if (update_flag == 0) CHECK_INTS; @@ -2051,19 +2096,35 @@ switch (status) { case TAG_RAISE: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rbtk_pending_exception = rb_exc_new2(rb_eException, "unknown exception"); } else { +#ifdef RUBY_VM rbtk_pending_exception = rb_errinfo(); +#else + rbtk_pending_exception = ruby_errinfo; +#endif } return Qnil; case TAG_FATAL: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rbtk_pending_exception = rb_exc_new2(rb_eFatal, "FATAL"); } else { +#ifdef RUBY_VM rbtk_pending_exception = rb_errinfo(); +#else + rbtk_pending_exception = ruby_errinfo; +#endif } return Qnil; } @@ -2118,7 +2179,7 @@ } } -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM if (NIL_P(eventloop_thread)) { tk_eventloop_thread_id = (Tcl_ThreadId) 0; } @@ -2147,7 +2208,7 @@ tcl_stubs_check(); eventloop_thread = rb_thread_current(); -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM tk_eventloop_thread_id = Tcl_GetCurrentThread(); #endif @@ -2300,7 +2361,7 @@ VALUE arg; { eventloop_thread = Qnil; /* stop eventloops */ -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM tk_eventloop_thread_id = (Tcl_ThreadId) 0; #endif return Qnil; @@ -2314,7 +2375,7 @@ { VALUE check_rootwidget; -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM rb_raise(rb_eNotImpError, "eventloop_watchdog is not implemented on Ruby VM."); #endif @@ -2442,10 +2503,17 @@ /* ckfree((char*)q); */ if (NIL_P(rbtk_pending_exception)) { +#ifdef RUBY_VM /* return rb_errinfo(); */ if (status) { rb_exc_raise(rb_errinfo()); } +#else + /* return ruby_errinfo; */ + if (status) { + rb_exc_raise(ruby_errinfo); + } +#endif } else { VALUE exc = rbtk_pending_exception; rbtk_pending_exception = Qnil; @@ -2660,50 +2728,94 @@ goto error; error: str = rb_str_new2("LocalJumpError: "); +#ifdef RUBY_VM rb_str_append(str, rb_obj_as_string(rb_errinfo())); +#else + rb_str_append(str, rb_obj_as_string(ruby_errinfo)); +#endif exc = rb_exc_new3(type, str); break; case TAG_RETRY: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif DUMP1("rb_protect: retry"); exc = rb_exc_new2(eTkCallbackRetry, "retry jump error"); } else { +#ifdef RUBY_VM exc = rb_errinfo(); +#else + exc = ruby_errinfo; +#endif } break; case TAG_REDO: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif DUMP1("rb_protect: redo"); exc = rb_exc_new2(eTkCallbackRedo, "redo jump error"); } else { +#ifdef RUBY_VM exc = rb_errinfo(); +#else + exc = ruby_errinfo; +#endif } break; case TAG_RAISE: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif exc = rb_exc_new2(rb_eException, "unknown exception"); } else { +#ifdef RUBY_VM exc = rb_errinfo(); +#else + exc = ruby_errinfo; +#endif } break; case TAG_FATAL: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif exc = rb_exc_new2(rb_eFatal, "FATAL"); } else { +#ifdef RUBY_VM exc = rb_errinfo(); +#else + exc = ruby_errinfo; +#endif } break; case TAG_THROW: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif DUMP1("rb_protect: throw"); exc = rb_exc_new2(eTkCallbackThrow, "throw jump error"); } else { +#ifdef RUBY_VM exc = rb_errinfo(); +#else + exc = ruby_errinfo; +#endif } break; @@ -2811,12 +2923,18 @@ int code; #ifdef HAVE_NATIVETHREAD -#ifndef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM +#if 0 if (!ruby_native_thread_p()) { rb_bug("cross-thread violation on tcl_protect()"); } #endif +#else + if (!is_ruby_native_thread()) { + rb_bug("cross-thread violation on tcl_protect()"); + } #endif +#endif rb_trap_immediate = 0; code = tcl_protect_core(interp, proc, data); @@ -3095,21 +3213,22 @@ /* get args */ args = rb_ary_new2(argc - 2); -#ifdef HAVE_STRUCT_RARRAY_LEN +#ifdef RUBY_VM +#else RARRAY(args)->len = 0; #endif for(i = 3; i < argc; i++) { #if TCL_MAJOR_VERSION >= 8 str = Tcl_GetStringFromObj(argv[i], &len); DUMP2("arg:%s",str); -#ifndef HAVE_STRUCT_RARRAY_LEN +#ifdef RUBY_VM rb_ary_push(args, rb_tainted_str_new(str, len)); #else RARRAY(args)->ptr[RARRAY(args)->len++] = rb_tainted_str_new(str, len); #endif #else /* TCL_MAJOR_VERSION < 8 */ DUMP2("arg:%s",argv[i]); -#ifndef HAVE_STRUCT_RARRAY_LEN +#ifdef RUBY_VM rb_ary_push(args, rb_tainted_str_new2(argv[i])); #else RARRAY(args)->ptr[RARRAY(args)->len++] = rb_tainted_str_new2(argv[i]); @@ -3310,12 +3429,18 @@ return TCL_ERROR; } #ifdef HAVE_NATIVETHREAD -#ifndef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM +#if 0 if (!ruby_native_thread_p()) { rb_bug("cross-thread violation on ip_ruby_eval()"); } #endif +#else + if (!is_ruby_native_thread()) { + rb_bug("cross-thread violation on ip_ruby_eval()"); + } #endif +#endif Tcl_ResetResult(interp); @@ -3461,12 +3586,18 @@ return TCL_ERROR; } #ifdef HAVE_NATIVETHREAD -#ifndef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM +#if 0 if (!ruby_native_thread_p()) { rb_bug("cross-thread violation on ip_rb_threadUpdateCommand()"); } #endif +#else + if (!is_ruby_native_thread()) { + rb_bug("cross-thread violation on ip_rb_threadUpdateCommand()"); + } #endif +#endif if (rb_thread_alone() || NIL_P(eventloop_thread) || eventloop_thread == current_thread) { @@ -3654,12 +3785,18 @@ Tcl_Preserve(interp); #ifdef HAVE_NATIVETHREAD -#ifndef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM +#if 0 if (!ruby_native_thread_p()) { rb_bug("cross-thread violation on ip_rbVwaitCommand()"); } #endif +#else + if (!is_ruby_native_thread()) { + rb_bug("cross-thread violation on ip_rbVwaitCommand()"); + } #endif +#endif Tcl_ResetResult(interp); @@ -5407,10 +5544,19 @@ Tk_Window mainWin = (Tk_Window)NULL; /* security check */ +#ifdef RUBY_VM if (rb_safe_level() >= 4) { +#else + if (ruby_safe_level >= 4) { +#endif rb_raise(rb_eSecurityError, "Cannot create a TclTkIp object at level %d", - rb_safe_level()); +#ifdef RUBY_VM + rb_safe_level() +#else + ruby_safe_level +#endif + ); } /* create object */ @@ -5418,7 +5564,7 @@ ptr = ALLOC(struct tcltkip); /* ptr = (struct tcltkip *)ckalloc(sizeof(struct tcltkip)); */ DATA_PTR(self) = ptr; -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM ptr->tk_thread_id = 0; #endif ptr->ref_count = 0; @@ -5528,7 +5674,7 @@ (Tcl_PackageInitProc *) NULL); #endif -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM /* set Tk thread ID */ ptr->tk_thread_id = Tcl_GetCurrentThread(); #endif @@ -5650,7 +5796,7 @@ #endif /* create slave-ip */ -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM /* slave->tk_thread_id = 0; */ slave->tk_thread_id = master->tk_thread_id; /* == current thread */ #endif @@ -6107,13 +6253,13 @@ #endif str = s ? rb_str_new(s, len) : rb_str_new2(""); if (binary) { -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM rb_enc_associate_index(str, ENCODING_INDEX_BINARY); #endif rb_ivar_set(str, ID_at_enc, ENCODING_NAME_BINARY); #if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1) } else { -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM rb_enc_associate_index(str, ENCODING_INDEX_UTF8); #endif rb_ivar_set(str, ID_at_enc, ENCODING_NAME_UTF8); @@ -6142,7 +6288,7 @@ /* text string */ return Tcl_NewStringObj(s, RSTRING_LEN(str)); } -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM } else if (rb_enc_get_index(str) == ENCODING_INDEX_BINARY) { /* binary string */ return Tcl_NewByteArrayObj(s, RSTRING_LEN(str)); @@ -6312,7 +6458,7 @@ ptr = (struct tcltkip *)NULL; } -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM if (ptr) { /* on Tcl interpreter */ is_tk_evloop_thread = (ptr->tk_thread_id == (Tcl_ThreadId) 0 @@ -6388,7 +6534,7 @@ /* add the handler to Tcl event queue */ DUMP1("add handler"); -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM if (ptr && ptr->tk_thread_id) { /* Tcl_ThreadQueueEvent(ptr->tk_thread_id, &(callq->ev), TCL_QUEUE_HEAD); */ @@ -6535,19 +6681,35 @@ ret = rb_protect(call_tcl_eval, (VALUE)&inf, &status); switch(status) { case TAG_RAISE: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rbtk_pending_exception = rb_exc_new2(rb_eException, "unknown exception"); } else { +#ifdef RUBY_VM rbtk_pending_exception = rb_errinfo(); +#else + rbtk_pending_exception = ruby_errinfo; +#endif } break; case TAG_FATAL: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rbtk_pending_exception = rb_exc_new2(rb_eFatal, "FATAL"); } else { +#ifdef RUBY_VM rbtk_pending_exception = rb_errinfo(); +#else + rbtk_pending_exception = ruby_errinfo; +#endif } } #endif @@ -6711,12 +6873,18 @@ /* check safe-level */ if (rb_safe_level() != q->safe_level) { #ifdef HAVE_NATIVETHREAD -#ifndef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM +#if 0 if (!ruby_native_thread_p()) { rb_bug("cross-thread violation on eval_queue_handler()"); } #endif +#else + if (!is_ruby_native_thread()) { + rb_bug("cross-thread violation on eval_queue_handler()"); + } #endif +#endif /* q_dat = Data_Wrap_Struct(rb_cData,0,-1,q); */ q_dat = Data_Wrap_Struct(rb_cData,eval_queue_mark,-1,q); ret = rb_funcall(rb_proc_new(evq_safelevel_handler, q_dat), @@ -6772,7 +6940,7 @@ VALUE str; { struct eval_queue *evq; -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM struct tcltkip *ptr; #endif char *eval_str; @@ -6789,12 +6957,12 @@ StringValue(str); rb_thread_critical = thr_crit_bup; -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM ptr = get_ip(ip_obj); #endif if ( -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM (ptr->tk_thread_id == 0 || ptr->tk_thread_id == Tcl_GetCurrentThread()) && #endif @@ -6857,7 +7025,7 @@ /* add the handler to Tcl event queue */ DUMP1("add handler"); -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM if (ptr->tk_thread_id) { /* Tcl_ThreadQueueEvent(ptr->tk_thread_id, &(evq->ev), position); */ Tcl_ThreadQueueEvent(ptr->tk_thread_id, (Tcl_Event*)evq, position); @@ -7079,7 +7247,7 @@ if (TYPE(str) == T_STRING) { volatile VALUE enc; -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM enc = rb_funcall(rb_obj_encoding(str), ID_to_s, 0, 0); #else enc = rb_attr_get(str, ID_at_enc); @@ -7109,7 +7277,7 @@ } else { StringValue(enc); if (strcmp(RSTRING_PTR(enc), "binary") == 0) { -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM rb_enc_associate_index(str, ENCODING_INDEX_BINARY); #endif rb_ivar_set(str, ID_at_enc, ENCODING_NAME_BINARY); @@ -7129,7 +7297,7 @@ } else { StringValue(encodename); if (strcmp(RSTRING_PTR(encodename), "binary") == 0) { -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM rb_enc_associate_index(str, ENCODING_INDEX_BINARY); #endif rb_ivar_set(str, ID_at_enc, ENCODING_NAME_BINARY); @@ -7166,7 +7334,7 @@ /* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */ /* str = rb_str_new2(Tcl_DStringValue(&dstr)); */ str = rb_str_new(Tcl_DStringValue(&dstr), Tcl_DStringLength(&dstr)); -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM rb_enc_associate_index(str, ENCODING_INDEX_UTF8); #endif rb_ivar_set(str, ID_at_enc, ENCODING_NAME_UTF8); @@ -7259,14 +7427,14 @@ if (!NIL_P(enc)) { StringValue(enc); if (strcmp(RSTRING_PTR(enc), "binary") == 0) { -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM rb_enc_associate_index(str, ENCODING_INDEX_BINARY); #endif rb_ivar_set(str, ID_at_enc, ENCODING_NAME_BINARY); rb_thread_critical = thr_crit_bup; return str; } -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM } else if (rb_enc_get_index(str) == ENCODING_INDEX_BINARY) { rb_enc_associate_index(str, ENCODING_INDEX_BINARY); rb_ivar_set(str, ID_at_enc, ENCODING_NAME_BINARY); @@ -7315,7 +7483,7 @@ str = rb_tainted_str_new(s, len); s = (char*)NULL; Tcl_DecrRefCount(tclstr); -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM rb_enc_associate_index(str, ENCODING_INDEX_BINARY); #endif rb_ivar_set(str, ID_at_enc, ENCODING_NAME_BINARY); @@ -7357,7 +7525,7 @@ /* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */ /* str = rb_str_new2(Tcl_DStringValue(&dstr)); */ str = rb_str_new(Tcl_DStringValue(&dstr), Tcl_DStringLength(&dstr)); -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM if (interp) { /* can access encoding_table of TclTkIp */ /* -> try to use encoding_table */ @@ -7466,7 +7634,7 @@ str = rb_str_new(dst_buf, dst_len); if (taint_flag) OBJ_TAINT(str); -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM rb_enc_associate_index(str, ENCODING_INDEX_UTF8); #endif rb_ivar_set(str, ID_at_enc, ENCODING_NAME_UTF8); @@ -7771,19 +7939,35 @@ ret = rb_protect(invoke_tcl_proc, (VALUE)&inf, &status); switch(status) { case TAG_RAISE: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rbtk_pending_exception = rb_exc_new2(rb_eException, "unknown exception"); } else { +#ifdef RUBY_VM rbtk_pending_exception = rb_errinfo(); +#else + rbtk_pending_exception = ruby_errinfo; +#endif } break; case TAG_FATAL: +#ifdef RUBY_VM if (NIL_P(rb_errinfo())) { +#else + if (NIL_P(ruby_errinfo)) { +#endif rbtk_pending_exception = rb_exc_new2(rb_eFatal, "FATAL"); } else { +#ifdef RUBY_VM rbtk_pending_exception = rb_errinfo(); +#else + rbtk_pending_exception = ruby_errinfo; +#endif } } @@ -8167,7 +8351,7 @@ Tcl_QueuePosition position; { struct invoke_queue *ivq; -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM struct tcltkip *ptr; #endif int *alloc_done; @@ -8187,7 +8371,7 @@ rb_raise(rb_eArgError, "command name missing"); } -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM ptr = get_ip(ip_obj); DUMP2("status: ptr->tk_thread_id %d", ptr->tk_thread_id); #endif @@ -8195,7 +8379,7 @@ DUMP2("status: eventloopt_thread %lx", eventloop_thread); if ( -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM (ptr->tk_thread_id == 0 || ptr->tk_thread_id == Tcl_GetCurrentThread()) && #endif @@ -8251,7 +8435,7 @@ /* add the handler to Tcl event queue */ DUMP1("add handler"); -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM if (ptr->tk_thread_id) { /* Tcl_ThreadQueueEvent(ptr->tk_thread_id, &(ivq->ev), position); */ Tcl_ThreadQueueEvent(ptr->tk_thread_id, (Tcl_Event*)ivq, position); @@ -8777,7 +8961,7 @@ volatile VALUE ary, elem; int idx; int taint_flag = OBJ_TAINTED(list_str); -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM int list_enc_idx; volatile VALUE list_ivar_enc; #endif @@ -8795,7 +8979,7 @@ } StringValue(list_str); -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM list_enc_idx = rb_enc_get_index(list_str); list_ivar_enc = rb_ivar_get(list_str, ID_at_enc); #endif @@ -8837,7 +9021,7 @@ for(idx = 0; idx < objc; idx++) { elem = get_str_from_obj(objv[idx]); -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM if (rb_enc_get_index(elem) == ENCODING_INDEX_BINARY) { rb_enc_associate_index(elem, ENCODING_INDEX_BINARY); rb_ivar_set(elem, ID_at_enc, ENCODING_NAME_BINARY); @@ -9170,7 +9354,7 @@ } #endif -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM if (RTEST(rb_define_dummy_encoding(RSTRING_PTR(name)))) { int idx = rb_enc_find_index(StringValueCStr(name)); return rb_enc_from_encoding(rb_enc_from_index(idx)); @@ -9195,7 +9379,7 @@ } -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM static int update_encoding_table(table, interp, error_mode) VALUE table; @@ -9369,7 +9553,7 @@ } } -#else /* ! HAVE_RUBY_ENCODING_H */ +#else /* ! RUBY_VM */ #if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1) static int update_encoding_table(table, interp, error_mode) @@ -9496,7 +9680,7 @@ return encoding_table_get_obj_core(table, enc, Qtrue); } -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM static VALUE create_encoding_table(interp) VALUE interp; @@ -9586,7 +9770,7 @@ return table; } -#else /* ! HAVE_RUBY_ENCODING_H */ +#else /* ! RUBY_VM */ #if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1) static VALUE create_encoding_table(interp) @@ -9819,9 +10003,9 @@ /* --------------------------------------------------------------- */ -#ifdef HAVE_RUBY_ENCODING_H +#ifdef RUBY_VM rb_global_variable(&cRubyEncoding); - cRubyEncoding = rb_path2class("Encoding"); + cRubyEncoding = rb_const_get(rb_cObject, rb_intern("Encoding")); ENCODING_INDEX_UTF8 = rb_enc_to_index(rb_utf8_encoding()); ENCODING_INDEX_BINARY = rb_enc_find_index("binary"); @@ -10077,7 +10261,11 @@ /* if ruby->nativethread-supprt and tcltklib->doen't, the following will cause link-error. */ +#ifdef RUBY_VM ruby_native_thread_p(); +#else + is_ruby_native_thread(); +#endif /* --------------------------------------------------------------- */ Index: ruby_1_8/ext/tk/extconf.rb =================================================================== --- ruby_1_8/ext/tk/extconf.rb (revision 17448) +++ ruby_1_8/ext/tk/extconf.rb (revision 17449) @@ -2,17 +2,10 @@ require 'mkmf' +#is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM) is_win32 = (/mswin|mingw|cygwin|bccwin|wince/ =~ RUBY_PLATFORM) #is_macosx = (/darwin/ =~ RUBY_PLATFORM) -have_header("ruby/ruby.h") -have_header("ruby/encoding.h") -have_func("ruby_native_thread_p", "ruby.h") -have_func("rb_errinfo", "ruby.h") -have_func("rb_safe_level", "ruby.h") -have_struct_member("struct RArray", "ptr", "ruby.h") -have_struct_member("struct RArray", "len", "ruby.h") - def find_framework(tcl_hdr, tk_hdr) if framework_dir = with_config("tcltk-framework") paths = [framework_dir] Index: ruby_1_8/ext/tk/tkutil/extconf.rb =================================================================== --- ruby_1_8/ext/tk/tkutil/extconf.rb (revision 17448) +++ ruby_1_8/ext/tk/tkutil/extconf.rb (revision 17449) @@ -7,9 +7,7 @@ if has_tk require 'mkmf' - have_header("ruby/ruby.h") have_func("rb_obj_instance_exec", "ruby.h") - have_func("rb_sym_to_s", "ruby.h") have_func("strndup", "string.h") create_makefile('tkutil') end Index: ruby_1_8/ext/tk/tkutil/tkutil.c =================================================================== --- ruby_1_8/ext/tk/tkutil/tkutil.c (revision 17448) +++ ruby_1_8/ext/tk/tkutil/tkutil.c (revision 17449) @@ -11,7 +11,7 @@ #include "ruby.h" -#ifdef HAVE_RUBY_RUBY_H +#ifdef RUBY_VM /* Ruby 1.9 */ /* #include "ruby/ruby.h" */ #include "ruby/signal.h" #include "ruby/st.h" @@ -117,8 +117,8 @@ ID_call, argc - 1, argv + 1); } -static const char cmd_id_head[] = "ruby_cmd TkUtil callback "; -static const char cmd_id_prefix[] = "cmd"; +static char *cmd_id_head = "ruby_cmd TkUtil callback "; +static char *cmd_id_prefix = "cmd"; static VALUE tk_install_cmd_core(cmd) @@ -791,7 +791,7 @@ return fromDefaultEnc_toUTF8(rb_str_new2(rb_id2name(SYM2ID(obj))), self); } } else { -#ifdef HAVE_RB_SYM_TO_S +#ifdef RUBY_VM return rb_sym_to_s(obj); #else return rb_str_new2(rb_id2name(SYM2ID(obj))); Index: ruby_1_8/ext/openssl/ossl.h =================================================================== --- ruby_1_8/ext/openssl/ossl.h (revision 17448) +++ ruby_1_8/ext/openssl/ossl.h (revision 17449) @@ -46,11 +46,7 @@ #if defined(_WIN32) # define OSSL_NO_CONF_API 1 -# ifdef USE_WINSOCK2 -# include <winsock2.h> -# else -# include <winsock.h> -# endif +# include <winsock2.h> #endif #include <errno.h> #include <openssl/err.h> Index: ruby_1_8/ext/stringio/stringio.c =================================================================== --- ruby_1_8/ext/stringio/stringio.c (revision 17448) +++ ruby_1_8/ext/stringio/stringio.c (revision 17449) @@ -269,8 +269,6 @@ break; } ptr->string = string; - ptr->pos = 0; - ptr->lineno = 0; } static VALUE Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 17448) +++ ruby_1_8/ChangeLog (revision 17449) @@ -1,3 +1,7 @@ +Fri Jun 20 02:16:43 2008 Yukihiro Matsumoto <matz@r...> + + * lib/mathn.rb (Rational::power2): typo fixed. [ruby-core:17293] + Thu Jun 19 21:38:08 2008 Nobuyoshi Nakada <nobu@r...> * ext/extmk.rb (extmake): check if compile before showing message. Index: ruby_1_8/version.h =================================================================== --- ruby_1_8/version.h (revision 17448) +++ ruby_1_8/version.h (revision 17449) @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.8.7" -#define RUBY_RELEASE_DATE "2008-06-19" +#define RUBY_RELEASE_DATE "2008-06-20" #define RUBY_VERSION_CODE 187 -#define RUBY_RELEASE_CODE 20080619 +#define RUBY_RELEASE_CODE 20080620 #define RUBY_PATCHLEVEL 5000 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 7 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 19 +#define RUBY_RELEASE_DAY 20 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; Index: ruby_1_8/lib/mathn.rb =================================================================== --- ruby_1_8/lib/mathn.rb (revision 17448) +++ ruby_1_8/lib/mathn.rb (revision 17449) @@ -201,7 +201,7 @@ neard = self.denominator.to_f ** (1.0/other.denominator.to_f) loop do if (neard**other.denominator == self.denominator) - dem = neaed + dem = neard break end end Index: ruby_1_8/test/stringio/test_stringio.rb =================================================================== --- ruby_1_8/test/stringio/test_stringio.rb (revision 17448) +++ ruby_1_8/test/stringio/test_stringio.rb (revision 17449) @@ -40,17 +40,4 @@ end assert_equal("hacker\nother ruby\n", stringio.string) end - - def test_reopen - f = StringIO.new("foo\nbar\nbaz\n") - assert_equal("foo\n", f.gets) - f.reopen("qux\nquux\nquuux\n") - assert_equal("qux\n", f.gets) - - f2 = StringIO.new("") - f2.reopen(f) - assert_equal("quux\n", f2.gets) - ensure - f.close unless f.closed? - end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/