Add par_alloc_object to the major collector function table.
[mono.git] / mono / mini / main.c
index 3dd4100571877d6a3a0bf7ccd86e34b99eb232c1..808dda0c2fa3cc7811cb561cce25921abc1d1ed6 100644 (file)
@@ -1,8 +1,12 @@
 #include <config.h>
 #include "mini.h"
 #ifndef HOST_WIN32
+#ifdef HAVE_SGEN_GC
+#include "buildver-sgen.h"
+#else
 #include "buildver.h"
 #endif
+#endif
 
 /*
  * If the MONO_ENV_OPTIONS environment variable is set, it uses this as a
@@ -18,13 +22,19 @@ mono_main_with_options (int argc, char *argv [])
                GString *buffer = g_string_new ("");
                const char *p;
                int i;
+               gboolean in_quotes = FALSE;
+               char quote_char = '\0';
 
                for (p = env_options; *p; p++){
                        switch (*p){
                        case ' ': case '\t':
-                               if (buffer->len != 0){
-                                       g_ptr_array_add (array, g_strdup (buffer->str));
-                                       g_string_truncate (buffer, 0);
+                               if (!in_quotes) {
+                                       if (buffer->len != 0){
+                                               g_ptr_array_add (array, g_strdup (buffer->str));
+                                               g_string_truncate (buffer, 0);
+                                       }
+                               } else {
+                                       g_string_append_c (buffer, *p);
                                }
                                break;
                        case '\\':
@@ -33,11 +43,28 @@ mono_main_with_options (int argc, char *argv [])
                                        p++;
                                }
                                break;
+                       case '\'':
+                       case '"':
+                               if (in_quotes) {
+                                       if (quote_char == *p)
+                                               in_quotes = FALSE;
+                                       else
+                                               g_string_append_c (buffer, *p);
+                               } else {
+                                       in_quotes = TRUE;
+                                       quote_char = *p;
+                               }
+                               break;
                        default:
                                g_string_append_c (buffer, *p);
                                break;
                        }
                }
+               if (in_quotes) {
+                       fprintf (stderr, "Unmatched quotes in value of MONO_ENV_OPTIONS: [%s]\n", env_options);
+                       exit (1);
+               }
+                       
                if (buffer->len != 0)
                        g_ptr_array_add (array, g_strdup (buffer->str));
                g_string_free (buffer, TRUE);
@@ -63,7 +90,7 @@ mono_main_with_options (int argc, char *argv [])
                g_ptr_array_free (array, TRUE);
        }
 
-       mono_main (argc, argv);
+       return mono_main (argc, argv);
 }
 
 #ifdef HOST_WIN32