summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-28 06:16:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-28 06:16:08 +0000
commit47b32d286f779d48402b595984562edc102067ce (patch)
treecbf4c4a365e4116229f2e6dc8d3906b5ad0a4cbd
parent4cee02480155ac18d0ef2288e42424574141ce07 (diff)
1.1b9_16 pre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--README.EXT.jp5
-rw-r--r--eval.c36
3 files changed, 36 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 26abd38487..a3f20ef863 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Apr 28 00:07:38 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (obj_is_proc): type check predicate.
+
+ * eval.c (obj_is_block): ditto.
+
Mon Apr 27 16:59:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* ext/gtk/gtk.c (Init_gtk): use timeout, not idle to avoid
diff --git a/README.EXT.jp b/README.EXT.jp
index 197efa32df..1f7b1a7ce4 100644
--- a/README.EXT.jp
+++ b/README.EXT.jp
@@ -1037,7 +1037,8 @@ classの名前を返す(デバッグ用).classが名前を持たない時には,
objのインスタンス変数の値を得る.`@'で始まらないインスタンス
変数は rubyプログラムからアクセスできない「隠れた」インスタ
-ンス変数になる.
+ンス変数になる.定数は大文字の名前を持つクラス(またはモジュー
+ル)のインスタンス変数として実装されている.
VALUE rb_iv_set(VALUE obj, char *name, VALUE val)
@@ -1080,7 +1081,7 @@ RuntimeError例外を発生させる.引数はprintf()と同じ.
void Raise(VALUE exception, char *fmt, ...)
-exceptionで指定した例外を発生させる.引数はprintf()と同じ.
+exceptionで指定した例外を発生させる.fmt以下の引数はprintf()と同じ.
void Fatal(char *fmt, ...)
diff --git a/eval.c b/eval.c
index c3d4b1604b..131acd5005 100644
--- a/eval.c
+++ b/eval.c
@@ -1378,7 +1378,7 @@ is_defined(self, node, buf)
case NODE_LVAR:
return "local-variable";
case NODE_DVAR:
- return "local-variable(nested)";
+ return "local-variable(ephemeral)";
case NODE_GVAR:
if (rb_gvar_defined(node->nd_entry)) {
@@ -1450,6 +1450,26 @@ static int handle_rescue _((VALUE,NODE*));
static void blk_free();
static VALUE
+obj_is_block(block)
+ VALUE block;
+{
+ if (TYPE(block) == T_DATA && RDATA(block)->dfree == blk_free) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static VALUE
+obj_is_proc(proc)
+ VALUE proc;
+{
+ if (obj_is_block(proc) && obj_is_kind_of(proc, cProc)) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static VALUE
set_trace_func(obj, trace)
VALUE obj, trace;
{
@@ -1457,7 +1477,7 @@ set_trace_func(obj, trace)
trace_func = 0;
return Qnil;
}
- if (TYPE(trace) != T_DATA || RDATA(trace)->dfree != blk_free) {
+ if (!obj_is_proc(trace)) {
TypeError("trace_func needs to be Proc");
}
return trace_func = trace;
@@ -3750,7 +3770,7 @@ eval(self, src, scope, file, line)
line = sourceline;
}
if (!NIL_P(scope)) {
- if (TYPE(scope) != T_DATA || RDATA(scope)->dfree != blk_free) {
+ if (!obj_is_block(scope)) {
TypeError("wrong argument type %s (expected Proc/Binding)",
rb_class2name(CLASS_OF(scope)));
}
@@ -4731,7 +4751,7 @@ bind_clone(self)
VALUE bind;
Data_Get_Struct(self, struct BLOCK, orig);
- bind = Data_Make_Struct(self, struct BLOCK, blk_mark,blk_free,data);
+ bind = Data_Make_Struct(self,struct BLOCK,blk_mark,blk_free,data);
MEMCPY(data, orig, struct BLOCK, 1);
data->frame.argv = ALLOC_N(VALUE, orig->frame.argc);
MEMCPY(data->frame.argv, orig->frame.argv, VALUE, orig->frame.argc);
@@ -4754,7 +4774,7 @@ f_binding(self)
VALUE bind;
PUSH_BLOCK(0,0);
- bind = Data_Make_Struct(cBinding, struct BLOCK, blk_mark,blk_free,data);
+ bind = Data_Make_Struct(cBinding,struct BLOCK,blk_mark,blk_free,data);
MEMCPY(data, the_block, struct BLOCK, 1);
#ifdef THREAD
@@ -4958,9 +4978,7 @@ block_pass(self, node)
if (obj_is_kind_of(block, cMethod)) {
block = method_proc(block);
}
- else if (TYPE(block) != T_DATA
- || RDATA(block)->dfree != blk_free
- || !obj_is_kind_of(block, cProc)) {
+ else if (!obj_is_proc(block)) {
TypeError("wrong argument type %s (expected Proc)",
rb_class2name(CLASS_OF(block)));
}
@@ -5177,7 +5195,7 @@ static VALUE eThreadError;
int thread_pending = 0;
-static VALUE cThread;
+VALUE cThread;
#include <sys/types.h>
#ifdef HAVE_SYS_TIME_H