]> git.sur5r.net Git - cc65/blobdiff - src/cc65/main.c
Allow any number of optional braces around all initializers as required by the standard
[cc65] / src / cc65 / main.c
index c79f52acf325d09102b4c7b28e0712dd99032f45..19fb4db413c812b3d8473a40996fecfbdcb472bc 100644 (file)
 #include "abend.h"
 #include "chartype.h"
 #include "cmdline.h"
+#include "debugflag.h"
 #include "fname.h"
 #include "print.h"
+#include "segnames.h"
 #include "target.h"
 #include "tgttrans.h"
 #include "version.h"
@@ -113,6 +115,7 @@ static void Usage (void)
             "  --help\t\tHelp (this text)\n"
                     "  --include-dir dir\tSet an include directory search path\n"
             "  --list-opt-steps\tList all optimizer steps and exit\n"
+             "  --register-space b\tSet space available for register variables\n"
              "  --register-vars\tEnable register variables\n"
                     "  --rodata-name seg\tSet the name of the RODATA segment\n"
                     "  --signed-chars\tDefault characters are signed\n"
@@ -399,10 +402,10 @@ static void OptDataName (const char* Opt attribute ((unused)), const char* Arg)
 
 
 static void OptDebug (const char* Opt attribute ((unused)),
-                     const char* Arg attribute ((unused)))
+                     const char* Arg attribute ((unused)))
 /* Compiler debug mode */
 {
-    Debug = 1;
+    ++Debug;
 }
 
 
@@ -530,7 +533,18 @@ static void OptListOptSteps (const char* Opt attribute ((unused)),
 
 
 
-static void OptRegisterVars (const char* Opt attribute ((unused)), 
+static void OptRegisterSpace (const char* Opt, const char* Arg)
+/* Handle the --register-space option */
+{
+    /* Numeric argument expected */
+    if (sscanf (Arg, "%u", &RegisterSpace) != 1 || RegisterSpace > 256) {
+               AbEnd ("Argument for option %s is invalid", Opt);
+    }
+}
+
+
+
+static void OptRegisterVars (const char* Opt attribute ((unused)),
                              const char* Arg attribute ((unused)))
 /* Handle the --register-vars option */
 {
@@ -618,6 +632,7 @@ int main (int argc, char* argv[])
        { "--help",             0,      OptHelp                 },
        { "--include-dir",      1,      OptIncludeDir           },
        { "--list-opt-steps",   0,      OptListOptSteps         },
+        { "--register-space",   1,      OptRegisterSpace        },
         { "--register-vars",    0,      OptRegisterVars         },
        { "--rodata-name",      1,      OptRodataName           },
        { "--signed-chars",     0,      OptSignedChars          },