Revision
4466
Author
lsansonetti@apple.com
Date
2010-08-25 15:21:53 -0700 (Wed, 25 Aug 2010)

Log Message

fixed a bug in the BridgeSupport parser when dealing with circular dependencies + minor bug fixes

Modified Paths

Diff

Modified: MacRuby/trunk/bridgesupport.cpp (4465 => 4466)


--- MacRuby/trunk/bridgesupport.cpp	2010-08-25 20:56:08 UTC (rev 4465)
+++ MacRuby/trunk/bridgesupport.cpp	2010-08-25 22:21:53 UTC (rev 4466)
@@ -1007,8 +1007,8 @@
 			(const void *)name, NULL)) {
 
 		VALUE val = strchr(bs_enum->value, '.') != NULL
-		    ? rb_float_new(rb_cstr_to_dbl(bs_enum->value, 1))
-		    : rb_cstr_to_inum(bs_enum->value, 10, 1);
+		    ? rb_float_new(rb_cstr_to_dbl(bs_enum->value, 0))
+		    : rb_cstr_to_inum(bs_enum->value, 10, 0);
 		CFDictionarySetValue(rb_cObject_dict, (const void *)name, 
 			(const void *)val);
 	    }

Modified: MacRuby/trunk/bs.c (4465 => 4466)


--- MacRuby/trunk/bs.c	2010-08-25 20:56:08 UTC (rev 4465)
+++ MacRuby/trunk/bs.c	2010-08-25 22:21:53 UTC (rev 4466)
@@ -464,6 +464,8 @@
     }
   }
 
+  CFArrayAppendValue(parser->loaded_paths, cf_path);
+
   //printf("parsing %s\n", path);
 
 #define BAIL(fmt, args...)                      \
@@ -556,6 +558,8 @@
           
           depends_on_path = get_attribute(reader, "path");
           CHECK_ATTRIBUTE(depends_on_path, "path");
+
+//printf("depends of %s\n", depends_on_path);
           
           bs_path_found = bs_find_path(depends_on_path, bs_path, 
                                        sizeof bs_path);
@@ -734,7 +738,6 @@
           bs_element_cftype_t *bs_cftype;
           char *cftype_name;
           char *cftype_type;
-          char *cftype_gettypeid_func_name;
 
           cftype_name = get_attribute(reader, "name");
           CHECK_ATTRIBUTE(cftype_name, "name");
@@ -748,6 +751,11 @@
           bs_cftype->name = cftype_name;
           bs_cftype->type = cftype_type;
 
+#if 1
+          /* the type_id field isn't used in MacRuby */
+          bs_cftype->type_id = 0;
+#else
+          char *cftype_gettypeid_func_name;
           cftype_gettypeid_func_name = get_attribute(reader, "gettypeid_func");
           if (cftype_gettypeid_func_name != NULL) {
             void *sym;
@@ -765,6 +773,7 @@
           else {
             bs_cftype->type_id = 0;
           }
+#endif
 
           bs_cftype->tollfree = get_attribute(reader, "tollfree");
 
@@ -1249,8 +1258,16 @@
 
   xmlFreeTextReader(reader);
 
-  if (success) {
-    CFArrayAppendValue(parser->loaded_paths, cf_path);
+  if (!success) {
+      for (unsigned i = 0, count = CFArrayGetCount(parser->loaded_paths);
+	      i < count; i++) {
+	  CFStringRef s = CFArrayGetValueAtIndex(parser->loaded_paths, i);
+	  if (CFStringCompare(cf_path, s, kCFCompareCaseInsensitive)
+		  == kCFCompareEqualTo) {
+	      CFArrayRemoveValueAtIndex(parser->loaded_paths, i);
+	      break;
+	  }
+      }
   }
   CFRelease(cf_path);