git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-10-11 06:29:16 +00:00
Родитель a86f6a00df
Коммит 6c11709d4c
6 изменённых файлов: 47 добавлений и 19 удалений

Просмотреть файл

@ -4,6 +4,17 @@ Wed Oct 11 14:29:51 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/http.rb: code refining. * lib/net/http.rb: code refining.
Wed Oct 11 11:13:03 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (primary): setter method (e.g. foo=) should always be
public.
* eval.c (rb_thread_raise): should not raise SecurityError if
exception raised by the interpreter.
* eval.c (rb_thread_cleanup): skip all THREAD_KILLED threads
before FOREACH_THREAD.
Tue Oct 10 16:11:54 2000 WATANABE Hirofumi <eban@ruby-lang.org> Tue Oct 10 16:11:54 2000 WATANABE Hirofumi <eban@ruby-lang.org>
* dln.c (dln_load): remove unused code for cygwin. * dln.c (dln_load): remove unused code for cygwin.

35
eval.c
Просмотреть файл

@ -7723,7 +7723,7 @@ catch_timer(sig)
int rb_thread_tick = THREAD_TICK; int rb_thread_tick = THREAD_TICK;
#endif #endif
static VALUE rb_thread_raise _((int, VALUE*, VALUE)); static VALUE rb_thread_raise _((int, VALUE*, rb_thread_t));
#define SCOPE_SHARED FL_USER1 #define SCOPE_SHARED FL_USER1
@ -7806,13 +7806,13 @@ rb_thread_start_0(fn, arg, th)
} }
else if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) { else if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
/* delegate exception to main_thread */ /* delegate exception to main_thread */
rb_thread_raise(1, &ruby_errinfo, main_thread->thread); rb_thread_raise(1, &ruby_errinfo, main_thread);
} }
else if (thread_abort || th->abort || RTEST(ruby_debug)) { else if (thread_abort || th->abort || RTEST(ruby_debug)) {
VALUE err = rb_exc_new(rb_eSystemExit, 0, 0); VALUE err = rb_exc_new(rb_eSystemExit, 0, 0);
error_print(); error_print();
/* exit on main_thread */ /* exit on main_thread */
rb_thread_raise(1, &err, main_thread->thread); rb_thread_raise(1, &err, main_thread);
} }
else { else {
th->errinfo = ruby_errinfo; th->errinfo = ruby_errinfo;
@ -7948,7 +7948,7 @@ rb_thread_cleanup()
{ {
rb_thread_t th; rb_thread_t th;
if (curr_thread != curr_thread->next->prev) { while (curr_thread->status == THREAD_KILLED) {
curr_thread = curr_thread->prev; curr_thread = curr_thread->prev;
} }
@ -8049,23 +8049,18 @@ rb_thread_trap_eval(cmd, sig)
} }
static VALUE static VALUE
rb_thread_raise(argc, argv, thread) rb_thread_raise(argc, argv, th)
int argc; int argc;
VALUE *argv; VALUE *argv;
VALUE thread; rb_thread_t th;
{ {
rb_thread_t th = rb_thread_check(thread);
if (rb_thread_dead(th)) return Qnil; if (rb_thread_dead(th)) return Qnil;
if (curr_thread == th) { if (curr_thread == th) {
rb_f_raise(argc, argv); rb_f_raise(argc, argv);
} }
if (ruby_safe_level > th->safe) {
rb_secure(4);
}
if (THREAD_SAVE_CONTEXT(curr_thread)) { if (THREAD_SAVE_CONTEXT(curr_thread)) {
return thread; return th->thread;
} }
rb_scan_args(argc, argv, "11", &th_raise_argv[0], &th_raise_argv[1]); rb_scan_args(argc, argv, "11", &th_raise_argv[0], &th_raise_argv[1]);
@ -8079,6 +8074,20 @@ rb_thread_raise(argc, argv, thread)
return Qnil; /* not reached */ return Qnil; /* not reached */
} }
static VALUE
rb_thread_raise_m(argc, argv, thread)
int argc;
VALUE *argv;
VALUE thread;
{
rb_thread_t th = rb_thread_check(thread);
if (ruby_safe_level > th->safe) {
rb_secure(4);
}
rb_thread_raise(argc, argv, th);
}
VALUE VALUE
rb_thread_local_aref(thread, id) rb_thread_local_aref(thread, id)
VALUE thread; VALUE thread;
@ -8332,7 +8341,7 @@ Init_Thread()
rb_define_method(rb_cThread, "join", rb_thread_join, 0); rb_define_method(rb_cThread, "join", rb_thread_join, 0);
rb_define_method(rb_cThread, "alive?", rb_thread_alive_p, 0); rb_define_method(rb_cThread, "alive?", rb_thread_alive_p, 0);
rb_define_method(rb_cThread, "stop?", rb_thread_stop_p, 0); rb_define_method(rb_cThread, "stop?", rb_thread_stop_p, 0);
rb_define_method(rb_cThread, "raise", rb_thread_raise, -1); rb_define_method(rb_cThread, "raise", rb_thread_raise_m, -1);
rb_define_method(rb_cThread, "abort_on_exception", rb_thread_abort_exc, 0); rb_define_method(rb_cThread, "abort_on_exception", rb_thread_abort_exc, 0);
rb_define_method(rb_cThread, "abort_on_exception=", rb_thread_abort_exc_set, 1); rb_define_method(rb_cThread, "abort_on_exception=", rb_thread_abort_exc_set, 1);

Просмотреть файл

@ -108,6 +108,7 @@ class PStore
begin begin
file.rewind file.rewind
Marshal::dump(@table, file) Marshal::dump(@table, file)
file.truncate(file.pos)
rescue rescue
File::rename backup, @filename if File::exist?(backup) File::rename backup, @filename if File::exist?(backup)
raise raise

Просмотреть файл

@ -16,9 +16,11 @@
class Tracer class Tracer
@RCS_ID='-$Id: tracer.rb,v 1.8 1998/05/19 03:42:49 keiju Exp keiju $-' @RCS_ID='-$Id: tracer.rb,v 1.8 1998/05/19 03:42:49 keiju Exp keiju $-'
@stdout = STDOUT
class << self class << self
attr :verbose, true attr :verbose, true
alias verbose? verbose alias verbose? verbose
attr :stdout, true
end end
verbose = true verbose = true
@ -44,6 +46,10 @@ class Tracer
@filters = [] @filters = []
end end
def stdout
Tracer.stdout
end
def on def on
if block_given? if block_given?
on on
@ -56,13 +62,13 @@ class Tracer
set_trace_func proc{|event, file, line, id, binding, klass| set_trace_func proc{|event, file, line, id, binding, klass|
trace_func event, file, line, id, binding trace_func event, file, line, id, binding
} }
print "Trace on\n" if Tracer.verbose? stdout.print "Trace on\n" if Tracer.verbose?
end end
end end
def off def off
set_trace_func nil set_trace_func nil
print "Trace off\n" if Tracer.verbose? stdout.print "Trace off\n" if Tracer.verbose?
end end
def add_filter(p = proc) def add_filter(p = proc)
@ -79,7 +85,7 @@ class Tracer
end end
unless list = LINES__[file] unless list = LINES__[file]
# print file if $DEBUG # stdout.print file if $DEBUG
begin begin
f = open(file) f = open(file)
begin begin
@ -108,14 +114,14 @@ class Tracer
def trace_func(event, file, line, id, binding) def trace_func(event, file, line, id, binding)
return if file == MY_FILE_NAME return if file == MY_FILE_NAME
#printf "Th: %s\n", Thread.current.inspect #stdout.printf "Th: %s\n", Thread.current.inspect
for p in @filters for p in @filters
return unless p.call event, file, line, id, binding return unless p.call event, file, line, id, binding
end end
Thread.critical = true Thread.critical = true
printf("#%d:%s:%d:%s: %s", stdout.printf("#%d:%s:%d:%s: %s",
get_thread_no, get_thread_no,
file, file,
line, line,

Просмотреть файл

@ -512,7 +512,7 @@ The variable ruby-indent-level controls the amount of indentation.
(setq end (point)) (setq end (point))
(beginning-of-line) (beginning-of-line)
(if (re-search-forward "^\\s *#" end t) (if (re-search-forward "^\\s *#" end t)
(forward-line 1) (beginning-of-line)
(setq done t)))) (setq done t))))
(setq bol (point)) (setq bol (point))
(end-of-line) (end-of-line)

Просмотреть файл

@ -1271,6 +1271,7 @@ primary : literal
/* NOEX_PRIVATE for toplevel */ /* NOEX_PRIVATE for toplevel */
$$ = NEW_DEFN($2, $4, $5, class_nest?NOEX_PUBLIC:NOEX_PRIVATE); $$ = NEW_DEFN($2, $4, $5, class_nest?NOEX_PUBLIC:NOEX_PRIVATE);
if (is_attrset_id($2)) $$->nd_noex = NOEX_PUBLIC;
fixpos($$, $4); fixpos($$, $4);
local_pop(); local_pop();
cur_mid = 0; cur_mid = 0;