]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - main.c
Introduce an ast_store rather than splitting ast_binary
[xonotic/gmqcc.git] / main.c
diff --git a/main.c b/main.c
index 4828f26fd850bb91fcd4927d68a303ab60d099e1..89090ba22246f6e00292e3c1e4089c8b49b5a93f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -26,9 +26,11 @@ typedef struct { char *name, type; } argitem;
 VECTOR_MAKE(argitem, items);
 
 /* global options */
-int opts_debug    = 0;
-int opts_memchk   = 0;
-int opts_compiler = COMPILER_GMQCC;
+bool opts_debug                     = false;
+bool opts_memchk                    = false;
+bool opts_darkplaces_stringtablebug = false;
+bool opts_omit_nullcode             = false;
+int  opts_compiler                  = COMPILER_GMQCC;
 
 static const int usage(const char *const app) {
     printf("usage:\n");
@@ -47,6 +49,9 @@ static const int usage(const char *const app) {
     printf("            -std=ftqecc  -- fteqcc QuakeC\n");
     printf("            -std=qccx    -- qccx QuakeC\n");
     printf("            -std=gmqcc   -- this compiler QuakeC (default selection)\n");
+    printf("    codegen flags:\n");
+    printf("        -fdarkplaces-string-table-bug -- patches the string table to work with bugged versions of darkplaces\n");
+    printf("        -fomit-nullcode               -- omits the generation of null code (will break everywhere see propsal.txt)\n");
     return -1;
 }
 
@@ -68,8 +73,8 @@ int main(int argc, char **argv) {
             case 'a': items_add((argitem){util_strdup(&argv[1][2]), 1}); break; /* assemble */
             case 'i': items_add((argitem){util_strdup(&argv[1][2]), 2}); break; /* includes */
             default:
-                if (!strncmp(&argv[1][1], "debug" , 5)) { opts_debug  = 1; break; }
-                if (!strncmp(&argv[1][1], "memchk", 6)) { opts_memchk = 1; break; }
+                if (!strncmp(&argv[1][1], "debug" , 5)) { opts_debug  = true; break; }
+                if (!strncmp(&argv[1][1], "memchk", 6)) { opts_memchk = true; break; }
                 if (!strncmp(&argv[1][1], "help",   4)) {
                     return usage(app);
                     break;
@@ -87,6 +92,16 @@ int main(int argc, char **argv) {
                     printf("    -std=gmqcc   -- this compiler QuakeC (default selection)\n");
                     return 0;
                 }
+
+                /* code specific switches */
+                if (!strcmp(&argv[1][1], "fdarkplaces-stringtablebug")) {
+                    opts_darkplaces_stringtablebug = true;
+                    break;
+                }
+                if (!strcmp(&argv[1][1], "fomit-nullcode")) {
+                    opts_omit_nullcode = true;
+                    break;
+                }
                 return usage(app);
                 
         }