[#8787] Literal inconsistency — Calamitas <calamitates@...>
Hi,
Calamitas <calamitates@gmail.com> writes:
On 9/4/06, Christian Neukirchen <chneukirchen@gmail.com> wrote:
[#8794] bignums — Ondrej Bilka <neleai@...>
I want ask how look integration of faster bignums.
[#8798] okay, threading & sandbox r70 -- the latest patch — why the lucky stiff <ruby-core@...>
We have previously talked about getting the sandbox to obey thread switching on
Hi,
[#8802] WEBrick::Cookie support for multiple cookies per set-cookie — Aaron Patterson <aaron_patterson@...>
WEBrick's cookie class has a method for parsing Set-Cookie headers, but
[#8813] ruby-1.8.5 loads fox16.so more than once — <noreply@...>
Bugs item #5701, was opened at 2006-09-08 20:59
[#8815] Segfault in libc strlen, via rb_str_new2 — "Sean E. Russell" <ser@...>
Howdy,
On Sep 8, 2006, at 10:10 PM, Sean E. Russell wrote:
On Saturday 09 September 2006 01:42, Eric Hodel wrote:
On Sep 9, 2006, at 7:16 PM, Sean E. Russell wrote:
On Sunday 10 September 2006 22:57, Eric Hodel wrote:
[#8826] OptionParser < Hash — "greg weber" <eegreg@...>
Hi,
[#8828] REXML fails to parse UTF-16 XML. — <noreply@...>
Bugs item #5711, was opened at 2006-09-11 01:25
Hi,
[#8861] new changes in strings+symbols — Mathieu Bouchard <matju@...>
On Wed, 13 Sep 2006, matz wrote:
[#8864] documentation of ruby internals — Deni George <denigeorge@...>
Hello
On Thursday 14 September 2006 11:30, Deni George wrote:
[#8885] numeric.c fails to build on 64-bit platforms (Fedora Core 5 x86_64 gcc 4.1.1) — <noreply@...>
Patches item #5774, was opened at 2006-09-16 12:19
Hi,
[#8897] Ruby's 'etc' module cannot handle the UID of OS X 'nobody' properly — <noreply@...>
Bugs item #5822, was opened at 2006-09-20 11:13
Hi,
[#8904] patch bignums — Ondrej Bilka <neleai@...>
I am so far with implementing faster bignums:
[#8920] rdoc capture output (help message) — "greg weber" <eegreg@...>
Hi,
The simplest command line would be
greg weber wrote:
It looks like you could seperate this out into a rake task, but then
On Sep 29, 2006, at 5:52 AM, greg weber wrote:
[#8929] Re: RDoc patch, possible bug in socket.c for TCPSocket.new — gwtmp01@...
[#8948] socket (and many others) not building on osx? — Ryan Davis <ryand-ruby@...>
I'm stumped. A brand new clean build doesn't build socket.
[#8954] The %? .. ? Operator — James Edward Gray II <james@...>
I'm needing to know the full list of characters that can (or cannot)
On Sep 29, 2006, at 9:56 AM, James Edward Gray II wrote:
constants (rcrs 178, 343,345)
I looked at my rcr 343 and 345. Could you give me some feedback?
First question is what ways of constant resolution would you use at rcr.
Add to source get_const where is constant expected?
Change parser that it search constants from called method's class too?
Write AI that recognizes to what class constant belongs?
Have somebody other idea?
How abreviate constants(FIXNUM_PROCESS_RLIMIT_CPU -> CPU)?
I use conversion that you strip prefix and add as new constant while it makes sense.
It is because you could specify what abbrevs do you want and what not. It producess enought spam warnings to encourage resolving abbrevation clashes.
Resolution abrevs could be done when get_const is called but I don't see any advantage of this and don't know how convert ID to char *.
This is my try. It shows way how modify other code(It will take long so
I would do it if it will me merged.)
Index: process.c
===================================================================
RCS file: /src/ruby/process.c,v
retrieving revision 1.156
diff -u -r1.156 process.c
--- process.c 4 Sep 2006 07:40:43 -0000 1.156
+++ process.c 12 Sep 2006 09:51:27 -0000
@@ -715,7 +715,7 @@
else {
pid = NUM2INT(vpid);
if (argc == 2 && !NIL_P(vflags)) {
- flags = NUM2UINT(vflags);
+ flags = NUM2UINT(rb_constantize(rb_mProcess,vflags));
}
}
if ((pid = rb_waitpid(pid, &status, flags)) < 0)
@@ -1852,7 +1852,7 @@
int prio, iwhich, iwho;
rb_secure(2);
- iwhich = NUM2INT(which);
+ iwhich = NUM2INT(rb_get_const(rb_mProcess,which));
iwho = NUM2INT(who);
errno = 0;
@@ -1884,7 +1884,7 @@
int iwhich, iwho, iprio;
rb_secure(2);
- iwhich = NUM2INT(which);
+ iwhich = NUM2INT(rb_get_const(rb_mProcess,which));
iwho = NUM2INT(who);
iprio = NUM2INT(prio);
@@ -1934,7 +1934,7 @@
rb_secure(2);
- if (getrlimit(NUM2INT(resource), &rlim) < 0) {
+ if (getrlimit(NUM2INT(rb_get_const(rb_mProcess,resource)), &rlim) < 0) {
rb_sys_fail("getrlimit");
}
return rb_assoc_new(RLIM2NUM(rlim.rlim_cur), RLIM2NUM(rlim.rlim_max));
@@ -1996,7 +1996,7 @@
rlim.rlim_cur = NUM2RLIM(rlim_cur);
rlim.rlim_max = NUM2RLIM(rlim_max);
- if (setrlimit(NUM2INT(resource), &rlim) < 0) {
+ if (setrlimit(NUM2INT(rb_get_const(rb_mProcess,resource)), &rlim) < 0) {
rb_sys_fail("setrlimit");
}
return Qnil;
@@ -3585,7 +3585,6 @@
VALUE rb_mProcGID;
VALUE rb_mProcID_Syscall;
-
/*
* The <code>Process</code> module is a collection of methods used to
* manipulate processes.
Index: variable.c
===================================================================
RCS file: /src/ruby/variable.c,v
retrieving revision 1.140
diff -u -r1.140 variable.c
--- variable.c 4 Sep 2006 05:46:47 -0000 1.140
+++ variable.c 12 Sep 2006 09:51:19 -0000
@@ -1340,6 +1340,54 @@
return rb_const_get_0(klass, id, Qfalse, Qtrue, fallback);
}
+VALUE rb_get_const_at(VALUE klass,VALUE name){
+ ID id;
+ switch (TYPE(name)) {
+ case T_STRING:
+ case T_SYMBOL:
+ id = rb_to_id(name);
+ if (!rb_is_const_id(id)) {
+ rb_name_error(id, "wrong constant name %s", rb_id2name(id));
+ }
+ return rb_const_get_at(klass, id);
+ break;
+ default:
+ return name;
+ }
+ return Qnil;/*dummy*/
+}
+VALUE rb_get_const(VALUE klass,VALUE name){
+ ID id;
+ switch (TYPE(name)) {
+ case T_STRING:
+ case T_SYMBOL:
+ id = rb_to_id(name);
+ if (!rb_is_const_id(id)) {
+ rb_name_error(id, "wrong constant name %s", rb_id2name(id));
+ }
+ return rb_const_get(klass, id);
+ break;
+ default:
+ return name;
+ }
+ return Qnil;/*dummy*/
+}
+VALUE
+rb_constantize(VALUE klass, VALUE name)
+{
+ if (rb_obj_is_kind_of(name,rb_cArray)){
+ long i;
+ long res=0;
+ for (i=0;i<RARRAY_LEN(name);i++){
+ res|=NUM2LONG(rb_get_const(klass,RARRAY_PTR(name)[i]));
+ }
+ return LONG2NUM(res);
+ }
+ else
+ return rb_get_const(klass,name);
+}
+
+
/*
* call-seq:
* remove_const(sym) => obj
@@ -1549,8 +1597,8 @@
mod_av_set(klass, id, val, Qtrue);
}
-void
-rb_define_const(VALUE klass, const char *name, VALUE val)
+static void
+rb_define_const_old(VALUE klass, const char *name, VALUE val)
{
ID id = rb_intern(name);
@@ -1563,6 +1611,20 @@
rb_const_set(klass, id, val);
}
+ /*same as rb_define const but strips only first strip prefixes*/
+void
+rb_define_const_n(VALUE klass, const char *name, VALUE val,int strip)
+{
+ int len=strlen(name),i;
+ rb_define_const_old(klass,name,val);
+ for (i=0;i<len;i++){
+ if (!strip--)return;
+ if(name[i]=='_') rb_define_const_old(klass,name+i+1,val);
+ }
+}
+void rb_define_const(VALUE klass, const char *name, VALUE val)
+{rb_define_const_n(klass,name,val,-1);}
+
void
rb_define_global_const(const char *name, VALUE val)
{
Index: file.c
===================================================================
RCS file: /src/ruby/file.c,v
retrieving revision 1.249
diff -u -r1.249 file.c
--- file.c 7 Sep 2006 14:27:20 -0000 1.249
+++ file.c 12 Sep 2006 09:51:36 -0000
@@ -4390,11 +4390,11 @@
rb_define_singleton_method(rb_cFile, "join", rb_file_s_join, -2);
#ifdef DOSISH
- rb_define_const(rb_cFile, "ALT_SEPARATOR", rb_obj_freeze(rb_str_new2("\\")));
+ rb_define_const_n(rb_cFile, "ALT_SEPARATOR", rb_obj_freeze(rb_str_new2("\\")),0);
#else
- rb_define_const(rb_cFile, "ALT_SEPARATOR", Qnil);
+ rb_define_const_n(rb_cFile, "ALT_SEPARATOR", Qnil,0);
#endif
- rb_define_const(rb_cFile, "PATH_SEPARATOR", rb_obj_freeze(rb_str_new2(PATH_SEP)));
+ rb_define_const_n(rb_cFile, "PATH_SEPARATOR", rb_obj_freeze(rb_str_new2(PATH_SEP)),0);
rb_define_method(rb_cIO, "stat", rb_io_stat, 0); /* this is IO's method */
rb_define_method(rb_cFile, "lstat", rb_file_lstat, 0);
Index: marshal.c
===================================================================
RCS file: /src/ruby/marshal.c,v
retrieving revision 1.129
diff -u -r1.129 marshal.c
--- marshal.c 2 Sep 2006 14:42:07 -0000 1.129
+++ marshal.c 12 Sep 2006 09:51:38 -0000
@@ -1412,8 +1412,8 @@
rb_define_module_function(rb_mMarshal, "load", marshal_load, -1);
rb_define_module_function(rb_mMarshal, "restore", marshal_load, -1);
- rb_define_const(rb_mMarshal, "MAJOR_VERSION", INT2FIX(MARSHAL_MAJOR));
- rb_define_const(rb_mMarshal, "MINOR_VERSION", INT2FIX(MARSHAL_MINOR));
+ rb_define_const_n(rb_mMarshal, "MAJOR_VERSION", INT2FIX(MARSHAL_MAJOR),0);
+ rb_define_const_n(rb_mMarshal, "MINOR_VERSION", INT2FIX(MARSHAL_MINOR),0);
}
VALUE
Index: object.c
===================================================================
RCS file: /src/ruby/object.c,v
retrieving revision 1.200
diff -u -r1.200 object.c
--- object.c 7 Sep 2006 16:11:28 -0000 1.200
+++ object.c 12 Sep 2006 09:51:15 -0000
@@ -1422,7 +1422,6 @@
rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
{
VALUE name, recur;
- ID id;
if (argc == 1) {
name = argv[0];
@@ -1431,11 +1430,7 @@
else {
rb_scan_args(argc, argv, "11", &name, &recur);
}
- id = rb_to_id(name);
- if (!rb_is_const_id(id)) {
- rb_name_error(id, "wrong constant name %s", rb_id2name(id));
- }
- return RTEST(recur) ? rb_const_get(mod, id) : rb_const_get_at(mod, id);
+ return RTEST(recur) ? rb_get_const(mod, name) : rb_get_const_at(mod, name);
}
/*