[macruby-changes] [1699] MacRuby/branches/experimental
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jun 2 14:44:42 PDT 2009
Revision: 1699
http://trac.macosforge.org/projects/ruby/changeset/1699
Author: lsansonetti at apple.com
Date: 2009-06-02 14:44:41 -0700 (Tue, 02 Jun 2009)
Log Message:
-----------
some 10.6 work to make sure the macruby specs are now green
Modified Paths:
--------------
MacRuby/branches/experimental/array.c
MacRuby/branches/experimental/hash.c
MacRuby/branches/experimental/include/ruby/ruby.h
MacRuby/branches/experimental/spec/macruby/core/array_spec.rb
MacRuby/branches/experimental/spec/macruby/core/hash_spec.rb
MacRuby/branches/experimental/vm.cpp
Modified: MacRuby/branches/experimental/array.c
===================================================================
--- MacRuby/branches/experimental/array.c 2009-06-02 02:11:27 UTC (rev 1698)
+++ MacRuby/branches/experimental/array.c 2009-06-02 21:44:41 UTC (rev 1699)
@@ -19,6 +19,9 @@
VALUE rb_cArray;
VALUE rb_cCFArray;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+VALUE rb_cNSArray0;
+#endif
VALUE rb_cNSArray;
VALUE rb_cNSMutableArray;
@@ -3540,6 +3543,9 @@
Init_Array(void)
{
rb_cCFArray = (VALUE)objc_getClass("NSCFArray");
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+ rb_cNSArray0 = (VALUE)objc_getClass("__NSArray0");
+#endif
rb_const_set(rb_cObject, rb_intern("NSCFArray"), rb_cCFArray);
rb_cArray = rb_cNSArray = (VALUE)objc_getClass("NSArray");
rb_cNSMutableArray = (VALUE)objc_getClass("NSMutableArray");
Modified: MacRuby/branches/experimental/hash.c
===================================================================
--- MacRuby/branches/experimental/hash.c 2009-06-02 02:11:27 UTC (rev 1698)
+++ MacRuby/branches/experimental/hash.c 2009-06-02 21:44:41 UTC (rev 1699)
@@ -30,6 +30,9 @@
VALUE rb_cHash;
VALUE rb_cCFHash;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+VALUE rb_cNSHash0;
+#endif
VALUE rb_cNSHash;
VALUE rb_cNSMutableHash;
@@ -2468,6 +2471,9 @@
id_default = rb_intern("default");
rb_cCFHash = (VALUE)objc_getClass("NSCFDictionary");
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+ rb_cNSHash0 = (VALUE)objc_getClass("__NSDictionary0");
+#endif
rb_const_set(rb_cObject, rb_intern("NSCFDictionary"), rb_cCFHash);
rb_cHash = rb_cNSHash = (VALUE)objc_getClass("NSDictionary");
rb_cNSMutableHash = (VALUE)objc_getClass("NSMutableDictionary");
Modified: MacRuby/branches/experimental/include/ruby/ruby.h
===================================================================
--- MacRuby/branches/experimental/include/ruby/ruby.h 2009-06-02 02:11:27 UTC (rev 1698)
+++ MacRuby/branches/experimental/include/ruby/ruby.h 2009-06-02 21:44:41 UTC (rev 1699)
@@ -1055,9 +1055,15 @@
RUBY_EXTERN VALUE rb_cNSString;
RUBY_EXTERN VALUE rb_cNSMutableString;
RUBY_EXTERN VALUE rb_cCFArray;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+RUBY_EXTERN VALUE rb_cNSArray0;
+#endif
RUBY_EXTERN VALUE rb_cNSArray;
RUBY_EXTERN VALUE rb_cNSMutableArray;
RUBY_EXTERN VALUE rb_cCFHash;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+RUBY_EXTERN VALUE rb_cNSHash0;
+#endif
RUBY_EXTERN VALUE rb_cNSHash;
RUBY_EXTERN VALUE rb_cNSMutableHash;
RUBY_EXTERN VALUE rb_cCFSet;
@@ -1069,12 +1075,24 @@
RUBY_EXTERN VALUE rb_cTopLevel;
bool _CFArrayIsMutable(void *);
-#define RARRAY_IMMUTABLE(o) \
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+# define RARRAY_IMMUTABLE(o) \
+ (*(VALUE *)o == rb_cCFArray \
+ ? !_CFArrayIsMutable((void *)o) : *(VALUE *)o == rb_cNSArray0)
+#else
+# define RARRAY_IMMUTABLE(o) \
(*(VALUE *)o == rb_cCFArray ? !_CFArrayIsMutable((void *)o) : false)
+#endif
bool _CFDictionaryIsMutable(void *);
-#define RHASH_IMMUTABLE(o) \
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+# define RHASH_IMMUTABLE(o) \
+ (*(VALUE *)o == rb_cCFHash \
+ ? !_CFDictionaryIsMutable((void *)o) : *(VALUE *)o == rb_cNSHash0)
+#else
+# define RHASH_IMMUTABLE(o) \
(*(VALUE *)o == rb_cCFHash ? !_CFDictionaryIsMutable((void *)o) : false)
+#endif
bool __CFStringIsMutable(void *);
#define RSTRING_IMMUTABLE(o) \
Modified: MacRuby/branches/experimental/spec/macruby/core/array_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/macruby/core/array_spec.rb 2009-06-02 02:11:27 UTC (rev 1698)
+++ MacRuby/branches/experimental/spec/macruby/core/array_spec.rb 2009-06-02 21:44:41 UTC (rev 1699)
@@ -50,6 +50,8 @@
it "is an instance of the NSArray class" do
a = NSArray.array
a.class.should == NSArray
+ a = NSArray.arrayWithObject(42)
+ a.class.should == NSArray
end
it "is immutable" do
Modified: MacRuby/branches/experimental/spec/macruby/core/hash_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/macruby/core/hash_spec.rb 2009-06-02 02:11:27 UTC (rev 1698)
+++ MacRuby/branches/experimental/spec/macruby/core/hash_spec.rb 2009-06-02 21:44:41 UTC (rev 1699)
@@ -50,6 +50,8 @@
it "is an instance of the NSDictionary class" do
a = NSDictionary.dictionary
a.class.should == NSDictionary
+ a = NSDictionary.dictionaryWithObject(42, forKey:42)
+ a.class.should == NSDictionary
end
it "is immutable" do
Modified: MacRuby/branches/experimental/vm.cpp
===================================================================
--- MacRuby/branches/experimental/vm.cpp 2009-06-02 02:11:27 UTC (rev 1698)
+++ MacRuby/branches/experimental/vm.cpp 2009-06-02 21:44:41 UTC (rev 1699)
@@ -2363,11 +2363,19 @@
return RSTRING_IMMUTABLE(self)
? rb_cNSString : rb_cNSMutableString;
}
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+ if (klass == (Class)rb_cCFArray || klass == (Class)rb_cNSArray0) {
+#else
if (klass == (Class)rb_cCFArray) {
+#endif
return RARRAY_IMMUTABLE(self)
? rb_cNSArray : rb_cNSMutableArray;
}
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+ if (klass == (Class)rb_cCFHash || klass == (Class)rb_cNSHash0) {
+#else
if (klass == (Class)rb_cCFHash) {
+#endif
return RHASH_IMMUTABLE(self)
? rb_cNSHash : rb_cNSMutableHash;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090602/ced329d3/attachment.html>
More information about the macruby-changes
mailing list