[#413] Should we check alloca ret val? — Michal Rokos <m.rokos@...>
Hi,
7 messages
2002/09/03
[#441] Patch to add a Module#const_missing method — JanArne.Petersen@... (Jan Arne Petersen)
Hi,
11 messages
2002/09/05
[#443] Re: Patch to add a Module#const_missing method
— matz@... (Yukihiro Matsumoto)
2002/09/06
Hi,
[#444] io_write()/fwrite() and EINTR on Solaris — Jos Backus <jos@...>
I am encountering a problem similar to the one mentioned here,
19 messages
2002/09/06
[#453] Re: io_write()/fwrite() and EINTR on Solaris
— nobu.nokada@...
2002/09/08
Hi,
[#454] Re: io_write()/fwrite() and EINTR on Solaris
— matz@... (Yukihiro Matsumoto)
2002/09/09
Hi
[#469] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/09/09
On Mon, Sep 09, 2002 at 03:55:13PM +0900, Yukihiro Matsumoto wrote:
[#479] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/09/10
On Tue, Sep 10, 2002 at 01:04:10AM +0900, Jos Backus wrote:
[#492] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/09/21
On Wed, Sep 11, 2002 at 02:23:33AM +0900, Jos Backus wrote:
[#495] Re: io_write()/fwrite() and EINTR on Solaris
— nobu.nokada@...
2002/09/21
Hi,
[#496] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/09/21
Hello,
[#564] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/11/06
On Sun, Sep 22, 2002 at 04:24:31AM +0900, Jos Backus wrote:
[#566] Re: io_write()/fwrite() and EINTR on Solaris
— nobu.nokada@...
2002/11/07
Hi,
[#567] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/11/07
On Thu, Nov 07, 2002 at 01:43:03PM +0900, nobu.nokada@softhome.net wrote:
[#568] Re: io_write()/fwrite() and EINTR on Solaris
— nobu.nokada@...
2002/11/07
Hi,
[#569] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/11/07
On Thu, Nov 07, 2002 at 03:49:51PM +0900, nobu.nokada@softhome.net wrote:
[#449] ruby.h, string.c — Michal Rokos <m.rokos@...>
Hello,
7 messages
2002/09/06
[#459] Parse.y — Michal Rokos <m.rokos@...>
Hi,
6 messages
2002/09/09
[#461] Related to [Memleak] in sprintf.c — Michal Rokos <m.rokos@...>
Hi,
5 messages
2002/09/09
[#508] can java applications invoke ruby scripts?? — "John Davis" <javaccnews@...>
I want to know if Java applications can invoke ruby scripts?? In other
8 messages
2002/09/26
Patch to add a Module#const_missing method
From:
JanArne.Petersen@... (Jan Arne Petersen)
Date:
2002-09-05 23:51:03 UTC
List:
ruby-core #441
Hi, I wrote a patch to add a Module#const_missing method like the Object#method_missing method to Ruby. Regards Jan Arne Petersen
Attachments (2)
variable.diff
(678 Bytes, text/x-diff)
Index: variable.c
===================================================================
RCS file: /src/ruby/variable.c,v
retrieving revision 1.69
diff -u -r1.69 variable.c
--- variable.c 2002/09/05 09:42:56 1.69
+++ variable.c 2002/09/05 23:41:24
@@ -1177,10 +1177,8 @@
}
/* Uninitialized constant */
- if (klass && klass != rb_cObject) {
- rb_name_error(id, "uninitialized constant %s at %s",
- rb_id2name(id),
- RSTRING(rb_class_path(klass))->ptr);
+ if (klass) {
+ return rb_funcall(klass, rb_intern("const_missing"), 1, ID2SYM(id));
}
else { /* global_uninitialized */
rb_name_error(id, "uninitialized constant %s",rb_id2name(id));
eval.diff
(1.33 KB, text/x-diff)
Index: eval.c
===================================================================
RCS file: /src/ruby/eval.c,v
retrieving revision 1.324
diff -u -r1.324 eval.c
--- eval.c 2002/09/05 04:15:50 1.324
+++ eval.c 2002/09/05 23:41:14
@@ -4391,6 +4391,27 @@
return rb_funcall2(obj, missing, argc+1, nargv);
}
+VALUE
+rb_mod_const_missing(klass, name)
+ VALUE klass, name;
+{
+ ID id = rb_to_id(name);
+
+ PUSH_FRAME(); /* fake frame */
+ *ruby_frame = *_frame.prev->prev;
+ if (klass && klass != rb_cObject) {
+ rb_name_error(id, "uninitialized constant %s at %s",
+ rb_id2name(id),
+ RSTRING(rb_class_path(klass))->ptr);
+ }
+ else { /* global_uninitialized */
+ rb_name_error(id, "uninitialized constant %s",rb_id2name(id));
+ }
+ POP_FRAME();
+
+ return Qnil; /* not reached */
+}
+
static VALUE
call_cfunc(func, recv, len, argc, argv)
VALUE (*func)();
@@ -6146,6 +6167,8 @@
rb_define_singleton_method(rb_cModule, "nesting", rb_mod_nesting, 0);
rb_define_singleton_method(rb_cModule, "constants", rb_mod_s_constants, 0);
+
+ rb_define_method(rb_cModule, "const_missing", rb_mod_const_missing, 1);
rb_define_singleton_method(ruby_top_self, "include", top_include, -1);
rb_define_singleton_method(ruby_top_self, "public", top_public, -1);