[macruby-changes] [438] MacRuby/branches/lrz_unstable
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 14 01:26:55 PDT 2008
Revision: 438
http://trac.macosforge.org/projects/ruby/changeset/438
Author: lsansonetti at apple.com
Date: 2008-08-14 01:26:54 -0700 (Thu, 14 Aug 2008)
Log Message:
-----------
wip
Modified Paths:
--------------
MacRuby/branches/lrz_unstable/class.c
MacRuby/branches/lrz_unstable/variable.c
Modified: MacRuby/branches/lrz_unstable/class.c
===================================================================
--- MacRuby/branches/lrz_unstable/class.c 2008-08-14 06:57:42 UTC (rev 437)
+++ MacRuby/branches/lrz_unstable/class.c 2008-08-14 08:26:54 UTC (rev 438)
@@ -929,6 +929,7 @@
SEL sel;
char *sel_name, *p;
VALUE sym;
+ ID mid;
method = methods[i];
@@ -945,13 +946,28 @@
p = strchr(sel_name, ':');
if (p != NULL && strchr(p + 1, ':') == NULL) {
size_t len = strlen(sel_name);
- p = alloca(len);
- strncpy(p, sel_name, len);
- p[len - 1] = '\0';
- sel_name = p;
+ char buf[100];
+
+ assert(len < sizeof(buf));
+
+ if (len > 4 && sel_name[0] == 's' && sel_name[1] == 'e'
+ && sel_name[2] == 't' && isupper(sel_name[3])) {
+ snprintf(buf, sizeof buf, "%s", &sel_name[3]);
+ buf[len - 4] = '=';
+ buf[0] = tolower(buf[0]);
+ }
+ else {
+ strncpy(buf, sel_name, len);
+ buf[len - 1] = '\0';
+ }
+
+ mid = rb_intern(buf);
}
+ else {
+ mid = rb_intern(sel_name);
+ }
- sym = ID2SYM(rb_intern(sel_name));
+ sym = ID2SYM(mid);
if (rb_ary_includes(ary, sym) == Qfalse)
rb_ary_push(ary, sym);
Modified: MacRuby/branches/lrz_unstable/variable.c
===================================================================
--- MacRuby/branches/lrz_unstable/variable.c 2008-08-14 06:57:42 UTC (rev 437)
+++ MacRuby/branches/lrz_unstable/variable.c 2008-08-14 08:26:54 UTC (rev 438)
@@ -1355,13 +1355,17 @@
if (new_ivar) {
if (len + 1 == RB_IVAR_ARY_MAX) {
CFMutableDictionaryRef tbl;
- tbl = CFDictionaryCreateMutable(NULL, 0, NULL, &rb_cfdictionary_value_cb);
+ tbl = CFDictionaryCreateMutable(NULL, 0, NULL,
+ &rb_cfdictionary_value_cb);
- for (i = 0; i < len; i++)
+ for (i = 0; i < len; i++)
CFDictionarySetValue(tbl,
(const void *)ROBJECT(obj)->ivars.as.ary[i].name,
(const void *)ROBJECT(obj)->ivars.as.ary[i].value);
+ CFDictionarySetValue(tbl, (const void *)id,
+ (const void *)val);
+
xfree(ROBJECT(obj)->ivars.as.ary);
GC_WB(&ROBJECT(obj)->ivars.as.tbl, tbl);
CFMakeCollectable(tbl);
@@ -1383,7 +1387,8 @@
}
case RB_IVAR_TBL:
- CFDictionarySetValue(ROBJECT(obj)->ivars.as.tbl, (const void *)id, (const void *)val);
+ CFDictionarySetValue(ROBJECT(obj)->ivars.as.tbl,
+ (const void *)id, (const void *)val);
break;
}
#else
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080814/f46cb5d2/attachment.html
More information about the macruby-changes
mailing list