[macruby-changes] [432] MacRuby/branches/lrz_unstable

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 13 01:31:00 PDT 2008


Revision: 432
          http://trac.macosforge.org/projects/ruby/changeset/432
Author:   lsansonetti at apple.com
Date:     2008-08-13 01:30:59 -0700 (Wed, 13 Aug 2008)
Log Message:
-----------
wip

Modified Paths:
--------------
    MacRuby/branches/lrz_unstable/lib/delegate.rb
    MacRuby/branches/lrz_unstable/objc.m

Modified: MacRuby/branches/lrz_unstable/lib/delegate.rb
===================================================================
--- MacRuby/branches/lrz_unstable/lib/delegate.rb	2008-08-13 06:05:57 UTC (rev 431)
+++ MacRuby/branches/lrz_unstable/lib/delegate.rb	2008-08-13 08:30:59 UTC (rev 432)
@@ -279,6 +279,7 @@
     :clone, :dup, :marshal_dump, :marshal_load, :instance_eval, :instance_exec,
     :extend,
   ]
+  methods -= NSObject.methods
   klass.module_eval {
     include Delegator::MethodDelegation
     def __getobj__  # :nodoc:

Modified: MacRuby/branches/lrz_unstable/objc.m
===================================================================
--- MacRuby/branches/lrz_unstable/objc.m	2008-08-13 06:05:57 UTC (rev 431)
+++ MacRuby/branches/lrz_unstable/objc.m	2008-08-13 08:30:59 UTC (rev 432)
@@ -1142,17 +1142,26 @@
 
     method = class_getInstanceMethod((Class)klass, def_sel);
     if (method == NULL) {
-	if (def_str[strlen(def_str) - 1] != ':') {
-	    char buf[512];
-	    strlcpy(buf, def_str, sizeof buf);
-	    strlcat(buf, ":", sizeof buf);
+	size_t len = strlen(def_str);
+	if (def_str[len - 1] != ':') {
+	    char buf[100];
+
+	    if (def_str[len - 1] == '=' && isalpha(def_str[len - 2])) {
+		snprintf(buf, sizeof buf, "set%s", def_str);
+		buf[3] = toupper(buf[3]);
+		buf[len + 2] = ':';
+	    }
+	    else {
+		snprintf(buf, sizeof buf, "%s:", def_str);
+	    }
 	    def_sel = sel_registerName(buf);
 	    method = class_getInstanceMethod((Class)klass, def_sel);
-	    if (method == NULL)
+	    if (method == NULL) {
 		rb_print_undef(klass, def, 0);
-	    if (name_str[strlen(name_str) - 1] != ':') {
-		strlcpy(buf, name_str, sizeof buf);
-		strlcat(buf, ":", sizeof buf);
+	    }
+	    len = strlen(name_str);
+	    if (name_str[len - 1] != ':') {
+		snprintf(buf, sizeof buf, "%s:", name_str);
 		name_sel = sel_registerName(buf);
 	    }
 	}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080813/dc3e7a32/attachment-0001.html 


More information about the macruby-changes mailing list