Author: lupus
Date: 2006-09-19 13:00:46 -0400 (Tue, 19 Sep 2006)
New Revision: 65675

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/mono-config.c
Log:


Tue Sep 19 18:57:38 CEST 2006 Paolo Molaro <[EMAIL PROTECTED]>

        * mono-config.c: make the os/cpu specification more flexible,
        allowing lists and negation.



Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2006-09-19 16:49:20 UTC (rev 65674)
+++ trunk/mono/mono/metadata/ChangeLog  2006-09-19 17:00:46 UTC (rev 65675)
@@ -1,3 +1,9 @@
+
+Tue Sep 19 18:57:38 CEST 2006 Paolo Molaro <[EMAIL PROTECTED]>
+
+       * mono-config.c: make the os/cpu specification more flexible,
+       allowing lists and negation.
+
 2006-09-18  Jonathan Chambers  <[EMAIL PROTECTED]>
 
        * marshal.c: COM Interop fixes. Handle case where method->klass.

Modified: trunk/mono/mono/metadata/mono-config.c
===================================================================
--- trunk/mono/mono/metadata/mono-config.c      2006-09-19 16:49:20 UTC (rev 
65674)
+++ trunk/mono/mono/metadata/mono-config.c      2006-09-19 17:00:46 UTC (rev 
65675)
@@ -188,6 +188,25 @@
 {
 }
 
+static int
+arch_matches (const char* arch, const char *value)
+{
+       char **splitted, **p;
+       int found = FALSE;
+       if (value [0] == '!')
+               return !arch_matches (arch, value + 1);
+       p = splitted = g_strsplit (value, ",", 0);
+       while (*p) {
+               if (strcmp (arch, *p) == 0) {
+                       found = TRUE;
+                       break;
+               }
+               p++;
+       }
+       g_strfreev (splitted);
+       return found;
+}
+
 typedef struct {
        char *dll;
        char *target;
@@ -221,9 +240,9 @@
                                info->dll = g_strdup (attribute_values [i]);
                        else if (strcmp (attribute_names [i], "target") == 0)
                                info->target = g_strdup (attribute_values [i]);
-                       else if (strcmp (attribute_names [i], "os") == 0 && 
strcmp (CONFIG_OS, attribute_values [i]))
+                       else if (strcmp (attribute_names [i], "os") == 0 && 
!arch_matches (CONFIG_OS, attribute_values [i]))
                                info->ignore = TRUE;
-                       else if (strcmp (attribute_names [i], "cpu") == 0 && 
strcmp (CONFIG_CPU, attribute_values [i]))
+                       else if (strcmp (attribute_names [i], "cpu") == 0 && 
!arch_matches (CONFIG_CPU, attribute_values [i]))
                                info->ignore = TRUE;
                }
                if (!info->ignore)
@@ -238,9 +257,9 @@
                                target = attribute_values [i];
                        else if (strcmp (attribute_names [i], "name") == 0)
                                name = attribute_values [i];
-                       else if (strcmp (attribute_names [i], "os") == 0 && 
strcmp (CONFIG_OS, attribute_values [i]))
+                       else if (strcmp (attribute_names [i], "os") == 0 && 
!arch_matches (CONFIG_OS, attribute_values [i]))
                                ignore = TRUE;
-                       else if (strcmp (attribute_names [i], "cpu") == 0 && 
strcmp (CONFIG_CPU, attribute_values [i]))
+                       else if (strcmp (attribute_names [i], "cpu") == 0 && 
!arch_matches (CONFIG_CPU, attribute_values [i]))
                                ignore = TRUE;
                }
                if (!dll)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to