]> Shamusworld >> Repos - rmac/blobdiff - direct.c
Added .opt directive with similar syntax to command line. Example syntax: '.opt ...
[rmac] / direct.c
index 70f4469602278ad708811706181f5a37146a2c3f..7010e4616980714d6fdd3242a63a047581c56330 100644 (file)
--- a/direct.c
+++ b/direct.c
@@ -88,6 +88,7 @@ int (*dirtab[])() = {
        d_nojpad,                       // 55 .nojpad (deprecated)
        d_gpumain,                      // 56 .gpumain (deprecated)
        d_prgflags,                     // 57 .prgflags
+       d_opt,                          // 58 .opt
 };
 
 
@@ -1589,3 +1590,28 @@ int d_gpumain(void)
        return error("What the hell? Do you think we adhere to the Goof standard?");
 }
 
+//
+// .opt - turn a specific (or all) optimisation on or off
+//
+int d_opt(void)
+{
+       char * tmpstr;
+
+       while (*tok != EOL)
+       {
+               if (*tok == STRING)
+               {
+                       tok++;
+                       tmpstr = string[*tok++];
+
+                       if (ParseOptimization(tmpstr) != OK)
+                       {
+                               char temperr[256];
+                               sprintf(temperr, "unknown optimisation flag '%s'.", tmpstr);
+                               return error(temperr);
+                       }
+               }
+               else
+                       return error(".opt directive needs every switch enclosed inside quotation marks.");
+       }
+}
\ No newline at end of file