[#14206] undef_method :method_missing — Kenichi Komiya <kom@...1.accsnet.ne.jp>

154 messages 2001/08/04
[#14207] Re: undef_method :method_missing — nobu.nakada@... 2001/08/04

なかだです。

[#14208] Re: undef_method :method_missing — nobu.nakada@... 2001/08/05

なかだです。

[#14209] Virtual Machine — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。

[#14210] Re: Virtual Machine — Kenta MURATA <muraken2@...> 2001/08/05

むらけんです.

[#14212] Re: Virtual Machine — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。

[#14214] Re: Virtual Machine — SHIROYAMA Takayuki <psi@...> 2001/08/05

[#14220] Re: Virtual Machine — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。

[#14211] Common GUI framework(Re: Virtual Machine) — nobu.nakada@... 2001/08/05

なかだです。

[#14213] RE: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。どもっ。

[#14215] Re: Common GUI framework(Re: Virtual Machine) — akira yamada / やまだあきら <akira@...> 2001/08/05

[#14221] Re: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。

[#14235] Re: Common GUI framework(Re: Virtual Machine) — IWATSUKI Hiroyuki <don@...> 2001/08/05

岩月と申します。

[#14237] Re: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。どもっ。

[#14239] Re: Common GUI framework(Re: Virtual Machine) — ARIMA Yasuhiro <fit0298@...> 2001/08/05

有馬です。

[#14241] Re: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。

[#14244] Re: Common GUI framework(Re: Virtual Machine) — ARIMA Yasuhiro <fit0298@...> 2001/08/05

有馬です。

[#14247] Re: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。どもっ。

[#14263] Re: Common GUI framework(Re: Virtual Machine) — とみたまさひろ <tommy@...> 2001/08/05

とみたです。

[#14266] Re: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。

[#14269] Re: Common GUI framework(Re: Virtual Machine) — とみたまさひろ <tommy@...> 2001/08/05

とみたです。

[#14275] Re: Common GUI framework(Re: Virtual Machine) — ARIMA Yasuhiro <fit0298@...> 2001/08/05

有馬です。

[#14294] Re: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。

[#14317] Re: Common GUI framework(Re: Virtual Machine) — ARIMA Yasuhiro <fit0298@...> 2001/08/06

有馬です。

[#14321] Re: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/06

金光です。どもっ。

[#14332] Re: Common GUI framework(Re: Virtual Machine) — ARIMA Yasuhiro <fit0298@...> 2001/08/06

有馬です。

[#14335] Re: Common GUI framework(Re: Virtual Machine) — Kenta MURATA <muraken2@...> 2001/08/06

むらけんです.

[#14346] Re: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/06

金光です。どもっ。

[#14356] Re: Common GUI framework(Re: Virtual Machine) — ARIMA Yasuhiro <fit0298@...> 2001/08/06

有馬です。

[#14357] Re: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/06

金光です。どもどもっ。

[#14243] Re: Common GUI framework(Re: Virtual Machine) — IWATSUKI Hiroyuki <don@...> 2001/08/05

岩月と申します。

[#14258] Re: Common GUI framework(Re: Virtual Machine) — akira yamada / やまだあきら <akira@...> 2001/08/05

[#14260] Re: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。FOXとかもあるのかぁ。すげぇなぁ。

[#14277] Re: Common GUI framework(Re: Virtual Machine) — matz@... (Yukihiro Matsumoto) 2001/08/05

まつもと ゆきひろです

[#14295] Re: Common GUI framework(Re: Virtual Machine) — "KANEMITSU Masao" <masao-k@...> 2001/08/05

金光です。御大、待ってましたっ。

[#14390] [Patch] pp.rb and debug.rb — "NAKAMURA, Hiroshi" <nakahiro@...>

なひです。

113 messages 2001/08/09
[#14391] Re: [Patch] pp.rb and debug.rb — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/08/09

なひです。書き忘れ。

[#14392] Re: [Patch] pp.rb and debug.rb — nobu.nakada@... 2001/08/09

なかだです。

[#14435] Re: [Patch] pp.rb and debug.rb — "K.Kosako" <kosako@...> 2001/08/13

nobu.nakada@nifty.ne.jpさんの

[#14437] Re: [Patch] pp.rb and debug.rb — nobu.nakada@... 2001/08/13

なかだです。

[#14449] Re: [Patch] pp.rb and debug.rb — Tanaka Akira <akr@...17n.org> 2001/08/14

In article <DJEGJLCFNEIMKDNMLFPHMEAHCBAA.nakahiro@sarion.co.jp>,

[#14450] Re: [Patch] pp.rb and debug.rb — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/08/14

なひです。

[#14452] Re: [Patch] pp.rb and debug.rb — Tanaka Akira <akr@...17n.org> 2001/08/14

In article <DJEGJLCFNEIMKDNMLFPHEEAICBAA.nakahiro@sarion.co.jp>,

[#14453] Re: [Patch] pp.rb and debug.rb — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/08/14

なひです。

[#14454] Re: [Patch] pp.rb and debug.rb — matz@... (Yukihiro Matsumoto) 2001/08/14

まつもと ゆきひろです

[#14455] Re: [Patch] pp.rb and debug.rb — Tanaka Akira <akr@...17n.org> 2001/08/14

In article <997774251.527258.14423.nullmailer@ev.netlab.jp>,

[#14474] Re: [Patch] pp.rb and debug.rb — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/08/15

なひです。

[#14498] Re: [Patch] pp.rb and debug.rb — Tanaka Akira <akr@...17n.org> 2001/08/16

In article <DJEGJLCFNEIMKDNMLFPHEEALCBAA.nakahiro@sarion.co.jp>,

[#14499] Re: [Patch] pp.rb and debug.rb — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/08/16

なひです。

[#14504] Re: [Patch] pp.rb and debug.rb — Tanaka Akira <akr@...17n.org> 2001/08/16

In article <DJEGJLCFNEIMKDNMLFPHEEAPCBAA.nakahiro@sarion.co.jp>,

[#14507] marshal API (was Re: [Patch] pp.rb and debug.rb) — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/08/16

なひです。

[#14510] Re: marshal API (was Re: [Patch] pp.rb and debug.rb) — Tanaka Akira <akr@...17n.org> 2001/08/16

In article <DJEGJLCFNEIMKDNMLFPHMEBACBAA.nakahiro@sarion.co.jp>,

[#14511] Re: marshal API (was Re: [Patch] pp.rb and debug.rb) — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/08/16

なひです。

[#14519] custom marshal (Re: Re: marshal API (was Re: [Patch] pp.rb and debug.rb)) — Tanaka Akira <akr@...17n.org> 2001/08/17

In article <DJEGJLCFNEIMKDNMLFPHIEBBCBAA.nakahiro@sarion.co.jp>,

[#14520] Re: marshal API (was Re: [Patch] pp.rb and debug.rb) — Tanaka Akira <akr@...17n.org> 2001/08/17

うぅむ。ぼーっとしてたら意味もなく Subject を変えてしまった。

[#14549] Re: custom marshal (Re: Re: marshal API (was Re: [Patch] pp.rb and debug.rb)) — Tanaka Akira <akr@...17n.org> 2001/08/22

In article <hvo66bnxe4b.fsf_-_@flux.etl.go.jp>,

[#14832] Re: custom marshal — GOTO Kentaro <gotoken@...> 2001/09/29

古い話題で恐縮ですが…

[#14833] Re: custom marshal — nobu.nakada@... 2001/09/29

なかだです。

[#14834] Re: custom marshal — Tanaka Akira <akr@...17n.org> 2001/10/01

In article <200109290948.f8T9mbh12942@sharui.nakada.kanuma.tochigi.jp>,

[#14835] Re: custom marshal — nobu.nakada@... 2001/10/01

なかだです。

[#14836] Re: custom marshal — matz@... (Yukihiro Matsumoto) 2001/10/01

まつもと ゆきひろです

[#14837] Re: custom marshal — Tanaka Akira <akr@...17n.org> 2001/10/02

In article <1001945748.240863.24023.nullmailer@ev.netlab.jp>,

[#14838] Re: custom marshal — nobu.nakada@... 2001/10/02

なかだです。

[#14839] Re: custom marshal — Tanaka Akira <akr@...17n.org> 2001/10/02

In article <200110020334.f923YLb08299@sharui.nakada.kanuma.tochigi.jp>,

[#14842] Re: custom marshal — nobu.nakada@... 2001/10/02

なかだです。

[#14843] Re: custom marshal — Tanaka Akira <akr@...17n.org> 2001/10/02

In article <200110021010.f92AAIb13474@sharui.nakada.kanuma.tochigi.jp>,

[#14844] Re: custom marshal — nobu.nakada@... 2001/10/02

なかだです。

[#14845] Re: custom marshal — matz@... (Yukihiro Matsumoto) 2001/10/02

まつもと ゆきひろです

[#14847] Re: custom marshal — matz@... (Yukihiro Matsumoto) 2001/10/02

まつもと ゆきひろです

[#14848] Re: custom marshal — nobu.nakada@... 2001/10/03

なかだです。

[#14852] Re: custom marshal — matz@... (Yukihiro Matsumoto) 2001/10/03

まつもと ゆきひろです

[#14465] Ruby/Bsearch — akira yamada / やまだあきら <akira@...>

16 messages 2001/08/14
[#14472] Re: Ruby/Bsearch — matz@... (Yukihiro Matsumoto) 2001/08/15

まつもと ゆきひろです

[#14595] SEGV at `$0 = "long long string"' — nobu.nakada@...

なかだです。

14 messages 2001/08/28

[ruby-dev:14563] Re: marshal API (was Re: [Patch] pp.rb and debug.rb)

From: nobu.nakada@...
Date: 2001-08-23 18:35:08 UTC
List: ruby-dev #14563
なかだです。

At Tue, 21 Aug 2001 22:13:34 +0900,
Tanaka Akira <akr@m17n.org> wrote:
> もはやあっちは inspect とはほとんど関係ない話なので、こっちはこっちで
> やればいいとおもいます。ruby-dev:14437 の案はいいと思います。ただ、API
> なんで、作者の意向次第ですかねぇ。

 参考までに[ruby-dev:14437]と[ruby-dev:14449]の実装案。Arrayの
かわりにHashを使うようになってます。あんまりグローバルにしたく
なかったこともあって、array.cからobject.cにまるごと引っ越してま
す。たぶんこっちの方が自然に思えるのですが。


Index: object.c
===================================================================
RCS file: /cvs/ruby/src/ruby/object.c,v
retrieving revision 1.57
diff -u -2 -p -r1.57 object.c
--- object.c	2001/08/20 04:29:56	1.57
+++ object.c	2001/08/20 06:19:52
@@ -221,5 +221,155 @@ rb_obj_inspect(obj)
 }
 
+static VALUE inspect_key;
+
+struct inspect_arg {
+    VALUE (*func)();
+    VALUE arg1, arg2;
+};
+
+static VALUE
+inspect_call(arg)
+    struct inspect_arg *arg;
+{
+    return (*arg->func)(arg->arg1, arg->arg2);
+}
+
+#define HASH_FOR_INSPECTION
+#ifdef HASH_FOR_INSPECTION
+#define INSPECT_NEW()		rb_hash_new3(Qfalse)
+#define INSPECT_BEGIN(tbl, id)	rb_hash_aset(inspect_tbl, id, Qtrue)
+#define INSPECT_END(tbl, id)	rb_hash_delete(tbl, id)
+#define INSPECTING_P(tbl, id)	rb_hash_aref(tbl, id)
+static inline VALUE
+rb_hash_new3(ifnone)
+    VALUE ifnone;
+{
+    VALUE hash = rb_hash_new();
+    RHASH(hash)->ifnone = ifnone;
+    return hash;
+}
+#else
+#define INSPECT_NEW()		rb_ary_new()
+#define INSPECT_BEGIN(tbl, id)	rb_ary_push(tbl, id)
+#define INSPECT_END(tbl, id)	rb_ary_pop(tbl)
+#define INSPECTING_P(tbl, id)	rb_ary_includes(tbl, id)
+#endif
+
+#define INSPECT_TABLE() rb_hash_aref(inspect_key, rb_thread_current())
+#define INSPECT_TABLE_NEW() \
+    rb_hash_aset(inspect_key, rb_thread_current(), INSPECT_NEW())
+
+static void
+inspect_key_init()
+{
+    rb_gc_register_address(&inspect_key);
+    inspect_key = rb_hash_new();
+}
+
+static VALUE
+inspect_ensure(id)
+    VALUE id;
+{
+    INSPECT_END(INSPECT_TABLE(), id);
+    return 0;
+}
+
+VALUE
+rb_protect_inspect(func, obj, arg)
+    VALUE (*func)();
+    VALUE obj, arg;
+{
+    struct inspect_arg iarg;
+    VALUE inspect_tbl;
+    VALUE id;
+
+    id = rb_obj_id(obj);
+    if (inspect_key ? NIL_P(inspect_tbl = INSPECT_TABLE())
+		    : (inspect_key_init(), Qtrue)) {
+	inspect_tbl = INSPECT_TABLE_NEW();
+    }
+    else if (INSPECTING_P(inspect_tbl, id)) {
+	return (*func)(obj, arg);
+    }
+
+    INSPECT_BEGIN(inspect_tbl, id);
+    iarg.func = func;
+    iarg.arg1 = obj;
+    iarg.arg2 = arg;
+
+    return rb_ensure(inspect_call, (VALUE)&iarg, inspect_ensure, id);
+}
+
+VALUE
+rb_inspecting_p(obj)
+    VALUE obj;
+{
+    VALUE inspect_tbl;
+
+    if (!inspect_key) return Qfalse;
+    inspect_tbl = INSPECT_TABLE();
+    if (NIL_P(inspect_tbl)) return Qfalse;
+    return INSPECTING_P(inspect_tbl, rb_obj_id(obj));
+}
+
+static VALUE
+rb_inspection(obj)
+    VALUE obj;
+{
+    VALUE inspect_tbl;
+    VALUE id = rb_obj_id(obj);
+
+    if (inspect_key ? NIL_P(inspect_tbl = INSPECT_TABLE())
+		    : (inspect_key_init(), Qtrue)) {
+	inspect_tbl = INSPECT_TABLE_NEW();
+    }
+    else if (INSPECTING_P(inspect_tbl, id)) {
+	return rb_yield(Qtrue);
+    }
+
+    INSPECT_BEGIN(inspect_tbl, id);
+
+    return rb_ensure(rb_yield, Qfalse, inspect_ensure, id);
+}
+
+static VALUE
+remove_inspect_tbl(inspect_tbl)
+    VALUE inspect_tbl;
+{
+    rb_hash_delete(inspect_key, rb_thread_current());
+    return 0;
+}
+
+static VALUE
+restore_inspect_tbl(inspect_tbl)
+    VALUE inspect_tbl;
+{
+    rb_hash_aset(inspect_key, rb_thread_current(), inspect_tbl);
+    return 0;
+}
+
 VALUE
+rb_new_inspection()
+{
+    if (inspect_key) {
+	VALUE inspect_tbl = rb_hash_delete(inspect_key, rb_thread_current());
+	if (!NIL_P(inspect_tbl)) {
+	    return rb_ensure(rb_yield, Qnil, restore_inspect_tbl, inspect_tbl);
+	}
+    }
+    else {
+	inspect_key_init();
+    }
+    return rb_ensure(rb_yield, Qnil, remove_inspect_tbl, Qnil);
+}
+
+static VALUE
+rb_inspect_start(obj)
+    VALUE obj;
+{
+    return rb_protect_inspect(rb_yield, obj, Qnil);
+}
+
+VALUE
 rb_obj_is_instance_of(obj, c)
     VALUE obj, c;
@@ -1171,4 +1321,7 @@ Init_Object()
     rb_define_method(rb_mKernel, "to_s", rb_any_to_s, 0);
     rb_define_method(rb_mKernel, "inspect", rb_obj_inspect, 0);
+    rb_define_method(rb_mKernel, "inspecting?", rb_inspecting_p, 0);
+    rb_define_method(rb_mKernel, "inspection", rb_inspection, 0);
+    rb_define_method(rb_mKernel, "inspect_start", rb_inspect_start, 0);
     rb_define_method(rb_mKernel, "methods", rb_obj_methods, 0);
     rb_define_method(rb_mKernel, "public_methods", rb_obj_methods, 0);
@@ -1196,4 +1349,6 @@ Init_Object()
     rb_define_global_function("String", rb_f_string, 1);
     rb_define_global_function("Array", rb_f_array, 1);
+
+    rb_define_global_function("new_inspection", rb_new_inspection, 0);
 
     rb_cNilClass = rb_define_class("NilClass", rb_cObject);


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread