summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-08-14 03:56:28 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-08-14 03:56:28 +0000
commit39ac1d7c22072f2d520738098692bdbce2f380df (patch)
tree97866a3781af260ce47912f61a6190b9d72270f4
parentc086e784e200dc555e3f6d0ddb2edfdffd4f166d (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--array.c6
-rw-r--r--eval.c6
-rw-r--r--lib/debug.rb5
-rw-r--r--lib/e2mmap.rb14
-rw-r--r--lib/matrix.rb8
-rw-r--r--missing/snprintf.c5
-rw-r--r--sample/rbc.rb29
8 files changed, 51 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index b97350b743c..58cbacb61fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Fri Aug 14 11:01:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (call_trace_func): save __FILE__, __LINE__ before
+ executing trace_func, since trace function should not corrupt
+ line number information.
+
+Thu Aug 13 15:09:02 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (ary_s_new): was marking unallocated region on GC.
+
Tue Aug 11 11:57:35 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* version 1.1c2 released.
diff --git a/array.c b/array.c
index 983ce9b9517..6150d862dd3 100644
--- a/array.c
+++ b/array.c
@@ -167,6 +167,7 @@ ary_s_new(argc, argv, klass)
VALUE *argv;
VALUE klass;
{
+ int len = 0;
VALUE size, val;
NEWOBJ(ary, struct RArray);
OBJSETUP(ary, klass, T_ARRAY);
@@ -186,10 +187,11 @@ ary_s_new(argc, argv, klass)
ArgError("array size too big");
}
ary->capa = capa;
- ary->len = capa;
+ len = capa;
}
ary->ptr = ALLOC_N(VALUE, ary->capa);
- memfill(ary->ptr, ary->len, val);
+ memfill(ary->ptr, len, val);
+ ary->len = len;
obj_call_init((VALUE)ary);
return (VALUE)ary;
diff --git a/eval.c b/eval.c
index 9e30dc3b998..114dd2079ac 100644
--- a/eval.c
+++ b/eval.c
@@ -1554,6 +1554,8 @@ call_trace_func(event, file, line, self, id)
int state;
volatile VALUE trace;
struct FRAME *prev;
+ char *file_save = sourcefile;
+ int line_save = sourceline;
if (!trace_func) return;
@@ -1585,6 +1587,8 @@ call_trace_func(event, file, line, self, id)
thread_critical--;
#endif
if (!trace_func) trace_func = trace;
+ sourceline = line_save;
+ sourcefile = file_save;
if (state) JUMP_TAG(state);
}
@@ -2780,7 +2784,7 @@ rb_longjmp(tag, mesg)
errinfo = mesg;
}
- if (debug && !NIL_P(errinfo)) {
+ if (debug && !NIL_P(errinfo) && !obj_is_kind_of(errinfo, eSystemExit)) {
fprintf(stderr, "Exception `%s' at %s:%d\n",
rb_class2name(CLASS_OF(errinfo)),
sourcefile, sourceline);
diff --git a/lib/debug.rb b/lib/debug.rb
index 2e3a29aa9e1..90270a3fe7b 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -176,7 +176,7 @@ class DEBUGGER__
printf "no sourcefile available for %s\n", file
end
when /^p\s+/
- p debug_eval($', binding)
+ p debug_eval($', binding) #'
else
v = debug_eval(input, binding)
p v unless v == nil
@@ -194,10 +194,13 @@ class DEBUGGER__
return "\n" unless line
return line
end
+ save = $DEBUG
begin
+ $DEBUG = FALSE
f = open(file)
lines = @scripts[file] = f.readlines
rescue
+ $DEBUG = save
@scripts[file] = TRUE
return "\n"
end
diff --git a/lib/e2mmap.rb b/lib/e2mmap.rb
index 307b07dfbe5..fa10d485d8c 100644
--- a/lib/e2mmap.rb
+++ b/lib/e2mmap.rb
@@ -22,13 +22,13 @@ else
cl.bind(self)
end
- # 以前との互換性のために残してある.
+ # backward compatibility
def E2MM.extend_to(b)
c = eval("self", b)
c.extend(self)
end
-# public :fail
+ # public :fail
# alias e2mm_fail fail
def fail(err = nil, *rest)
@@ -39,8 +39,8 @@ else
self.module_eval %q^
E2MM_ErrorMSG = {} unless self.const_defined?(:E2MM_ErrorMSG)
# fail(err, *rest)
- # err: 例外
- # rest: メッセージに渡すパラメータ
+ # err: Exception
+ # rest: Parameter accompanied with the exception
#
def self.fail(err = nil, *rest)
if form = E2MM_ErrorMSG[err]
@@ -63,7 +63,6 @@ else
# def_exception(c, m)
# c: exception
# m: message_form
- # 例外cのメッセージをmとする.
#
def self.def_e2message(c, m)
E2MM_ErrorMSG[c] = m
@@ -72,8 +71,8 @@ else
# def_exception(c, m)
# n: exception_name
# m: message_form
- # s: 例外スーパークラス(デフォルト: Exception)
- # 例外名``c''をもつ例外を定義し, そのメッセージをmとする.
+ # s: superclass_of_exception (default: Exception)
+ # defines excaption named ``c'', whose message is ``m''.
#
#def def_exception(n, m)
def self.def_exception(n, m, s = nil)
@@ -99,4 +98,3 @@ else
def_exception(:ErrNotRegisteredException, "not registerd exception(%s)")
end
end
-
diff --git a/lib/matrix.rb b/lib/matrix.rb
index 99f44857a37..fcb0b29eb50 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -17,17 +17,15 @@
# :
# rown]
#
-# column: 列
-# row: 行
#
# module ExceptionForMatrix::
# Exceptions:
# ErrDimensionMismatch
-# 行または列数が一致していない.
+# number of column/row do not match
# ErrNotRegular
-# 正則行列でない.
+# not a regular matrix
# ErrOperationNotDefined
-# その演算子はまだ定義されていない.
+# specified operator is not defined (yet)
#
# class Matrix
# include ExceptionForMatrix
diff --git a/missing/snprintf.c b/missing/snprintf.c
index 69b9c3c33de..804fb1bd8bd 100644
--- a/missing/snprintf.c
+++ b/missing/snprintf.c
@@ -60,11 +60,14 @@
#include <sys/types.h>
+# undef __P
#if defined(__STDC__)
+# define __P(x) x
# include <stdarg.h>
#else
# undef __P
# define __P(x) ()
+# define const
# include <varargs.h>
#endif
#ifndef _BSD_VA_LIST_
@@ -347,7 +350,9 @@ err:
#define u_int unsigned int
#include <limits.h>
+#if !defined(__CYGWIN32__)
#include <stdlib.h>
+#endif
#include <string.h>
#if defined(__STDC__)
diff --git a/sample/rbc.rb b/sample/rbc.rb
index 5dd2cf230d6..83796255cc7 100644
--- a/sample/rbc.rb
+++ b/sample/rbc.rb
@@ -11,22 +11,21 @@
#
# rbc.rb [options] file_name opts
# options:
-# -d デバッグモード(利用しない方が良いでしょう)
-# -f ~/.irbrc を読み込まない.
-# -m bcモード(分数, 行列の計算ができます)
-# -r load-module ruby -r と同じ.
-# --inspect 結果出力にinspectを用いる(bcモード以外はデ
-# フォルト).
-# --noinspect 結果出力にinspectを用いない.
-# --noreadline readlineライブラリを利用しない(デフォルト
-# ではreadlineライブラリを利用しようとする).
+# -d debug mode (not recommended)
+# -f does not read ~/.irbrc
+# -m bc mode (rational/matrix calc)
+# -r load-module same as `ruby -r'
+# --inspect use inspect for result output
+# (default for non-bc mode)
+# --noinspect does not use inspect for result output
+# --noreadline does not use readline library
+# (default: try to use readline)
#
-# 追加 private method:
-# exit, quit 終了する.
-# inspect_mode(sw = nil) インスペクトモードのトグル
-# trace_load(sw = nil) load/require時にrbcのfile読み込み機能を用
-# いるモードのスイッチ(デフォルトはトレース
-# モード)
+# additional private method (as function):
+# exit, quit terminate the interpreter
+# inspect_mode(sw = nil) toggle inspect mode
+# trace_load(sw = nil) change trace mode for file loading using
+# load/require. (default: trace-mode on)
#
require "e2mmap.rb"