summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--eval.c39
-rw-r--r--lib/complex.rb2
-rw-r--r--lib/debug.rb1
-rw-r--r--lib/ping.rb2
-rw-r--r--lib/weakref.rb4
-rw-r--r--parse.y2
-rw-r--r--sample/cal.rb9
-rw-r--r--sample/goodfriday.rb8
9 files changed, 39 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index 50dd71eddf..35a1bea350 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Jul 18 14:58:30 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (ruby_options): should treat SystemExit etc. properly.
+
+ * parse.y (yycompile): should check compile_for_eval, not
+ ruby_in_eval.
+
Mon Jul 17 04:29:50 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/mkmf.rb: converts extention of $objs into $OBJEXT.
diff --git a/eval.c b/eval.c
index 70051cab9c..24a7298387 100644
--- a/eval.c
+++ b/eval.c
@@ -1002,26 +1002,6 @@ ruby_init()
ruby_scope = top_scope;
}
-void
-ruby_options(argc, argv)
- int argc;
- char **argv;
-{
- int state;
-
- PUSH_TAG(PROT_NONE)
- if ((state = EXEC_TAG()) == 0) {
- ruby_process_options(argc, argv);
- }
- POP_TAG();
- if (state) {
- trace_func = 0;
- tracing = 0;
- error_print();
- exit(1);
- }
-}
-
static VALUE
eval_node(self)
VALUE self;
@@ -1100,6 +1080,25 @@ error_handle(ex)
}
void
+ruby_options(argc, argv)
+ int argc;
+ char **argv;
+{
+ int state;
+
+ PUSH_TAG(PROT_NONE)
+ if ((state = EXEC_TAG()) == 0) {
+ ruby_process_options(argc, argv);
+ }
+ POP_TAG();
+ if (state) {
+ trace_func = 0;
+ tracing = 0;
+ exit(error_handle(state));
+ }
+}
+
+void
ruby_run()
{
int state;
diff --git a/lib/complex.rb b/lib/complex.rb
index 56dd040ac1..733e4530e3 100644
--- a/lib/complex.rb
+++ b/lib/complex.rb
@@ -500,5 +500,3 @@ module Math
module_function :atanh!
end
-
-
diff --git a/lib/debug.rb b/lib/debug.rb
index d20d1ebbfc..71fe830475 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -578,6 +578,7 @@ EOHELP
end
def excn_handle(file, line, id, binding)
+ p $!
if $!.type <= SystemExit
set_trace_func nil
exit
diff --git a/lib/ping.rb b/lib/ping.rb
index 065b1d2303..48657818cc 100644
--- a/lib/ping.rb
+++ b/lib/ping.rb
@@ -38,9 +38,9 @@
#=end
require 'timeout'
+require "socket"
module Ping
- require "socket"
def pingecho(host, timeout=5, service="echo")
begin
timeout(timeout) do
diff --git a/lib/weakref.rb b/lib/weakref.rb
index 3307a2e5aa..9e510d6f1c 100644
--- a/lib/weakref.rb
+++ b/lib/weakref.rb
@@ -43,8 +43,8 @@ class WeakRef<Delegator
def initialize(orig)
super
@__id = orig.__id__
- ObjectSpace.define_finalizer orig, @@final
- ObjectSpace.defin_finalizer self, @@final
+ ObjectSpace.define_finalizer orig, @@final
+ ObjectSpace.define_finalizer self, @@final
ID_MAP[@__id] = [] unless ID_MAP[@__id]
ID_MAP[@__id].push self.__id__
ID_REV_MAP[self.id] = @__id
diff --git a/parse.y b/parse.y
index e6f2cff3ab..edc745b3db 100644
--- a/parse.y
+++ b/parse.y
@@ -1859,7 +1859,7 @@ yycompile(f, line)
{
int n;
- if (!ruby_in_eval && rb_safe_level() == 0 &&
+ if (!compile_for_eval && rb_safe_level() == 0 &&
rb_const_defined(rb_cObject, rb_intern("SCRIPT_LINES__"))) {
VALUE hash, fname;
diff --git a/sample/cal.rb b/sample/cal.rb
index f256a01a39..4e0d416f06 100644
--- a/sample/cal.rb
+++ b/sample/cal.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby
# cal.rb: Written by Tadayoshi Funaba 1998-2000
-# $Id: cal.rb,v 1.10 2000/05/20 02:09:47 tadf Exp $
+# $Id: cal.rb,v 1.11 2000-07-16 10:28:50+09 tadf Exp $
require 'date2'
require 'getopts'
@@ -38,7 +38,7 @@ end
def pict(y, m, sg)
d = (1..31).detect{|d| Date.exist?(y, m, d, sg)}
- fi = Date.new3(y, m, d, sg)
+ fi = Date.new(y, m, d, sg)
fi -= (fi.jd - $k + 1) % 7
ve = (fi..fi + 6).collect{|cu|
@@ -54,9 +54,8 @@ def pict(y, m, sg)
gr = trans(gr) if $OPT_t
ta = gr.collect{|xs| xs.join(' ')}
- ca = %w(January February March April
- May June July August
- September October November December)[m - 1]
+ ca = %w(January February March April May June July
+ August September October November December)[m - 1]
ca = ca + ' ' + y.to_s if not $OPT_y
ca = ca.center($mw)
diff --git a/sample/goodfriday.rb b/sample/goodfriday.rb
index f0027ec5dd..1c48f55d96 100644
--- a/sample/goodfriday.rb
+++ b/sample/goodfriday.rb
@@ -1,7 +1,7 @@
-#! /usr/local/bin/ruby
+#! /usr/bin/env ruby
-# goodfriday.rb: Written by Tadayoshi Funaba 1998
-# $Id: goodfriday.rb,v 1.1 1998/03/08 09:44:44 tadf Exp $
+# goodfriday.rb: Written by Tadayoshi Funaba 1998, 2000
+# $Id: goodfriday.rb,v 1.1.1.1 2000-07-16 10:25:30+09 tadf Exp $
require 'date2'
@@ -19,7 +19,7 @@ def easter(y)
if n <= 31 then [y, 3, n] else [y, 4, n - 31] end
end
-es = Date.new3(*easter(Time.now.year))
+es = Date.new(*easter(Time.now.year))
[[-9*7, 'Septuagesima Sunday'],
[-8*7, 'Sexagesima Sunday'],
[-7*7, 'Quinquagesima Sunday (Shrove Sunday)'],