]> git.sur5r.net Git - cc65/blobdiff - src/cc65/main.c
Fix
[cc65] / src / cc65 / main.c
index 0e7a4d05dc9b088cbbe2ea7910049278e0f735f3..b0c9261fe3b8f3505e6995268765580ec26df447 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2013, Ullrich von Bassewitz                                      */
+/* (C) 2000-2015, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -104,6 +104,7 @@ static void Usage (void)
             "\n"
             "Long options:\n"
             "  --add-source\t\t\tInclude source as comment\n"
+            "  --all-cdecl\t\t\tMake functions default to __cdecl__\n"
             "  --bss-name seg\t\tSet the name of the BSS segment\n"
             "  --check-stack\t\t\tGenerate stack overflow checks\n"
             "  --code-name seg\t\tSet the name of the CODE segment\n"
@@ -160,6 +161,10 @@ static void SetSys (const char* Sys)
             AbEnd ("Cannot use `module' as a target for the compiler");
             break;
 
+        case TGT_ATARI5200:
+            DefineNumericMacro ("__ATARI5200__", 1);
+            break;
+
         case TGT_ATARI:
             DefineNumericMacro ("__ATARI__", 1);
             break;
@@ -202,6 +207,10 @@ static void SetSys (const char* Sys)
             cbmsys ("__PET__");
             break;
 
+        case TGT_BBC:
+            DefineNumericMacro ("__BBC__", 1);
+            break;
+
         case TGT_APPLE2:
             DefineNumericMacro ("__APPLE2__", 1);
             break;
@@ -211,16 +220,14 @@ static void SetSys (const char* Sys)
             DefineNumericMacro ("__APPLE2ENH__", 1);
             break;
 
-        case TGT_ATMOS:
-            DefineNumericMacro ("__ATMOS__", 1);
-            break;
-
-        case TGT_BBC:
-            DefineNumericMacro ("__BBC__", 1);
+        case TGT_GAMATE:
+            DefineNumericMacro ("__GAMATE__", 1);
             break;
 
-        case TGT_CREATIVISION:
-            DefineNumericMacro ("__CREATIVISION__", 1);
+        case TGT_GEOS_CBM:
+            /* Do not handle as a CBM system */
+            DefineNumericMacro ("__GEOS__", 1);
+            DefineNumericMacro ("__GEOS_CBM__", 1);
             break;
 
         case TGT_GEOS_APPLE:
@@ -228,24 +235,34 @@ static void SetSys (const char* Sys)
             DefineNumericMacro ("__GEOS_APPLE__", 1);
             break;
 
-        case TGT_GEOS_CBM:
-            /* Do not handle as a CBM system */
-            DefineNumericMacro ("__GEOS__", 1);
-            DefineNumericMacro ("__GEOS_CBM__", 1);
-            break;
-
         case TGT_LUNIX:
             DefineNumericMacro ("__LUNIX__", 1);
             break;
 
-        case TGT_LYNX:
-            DefineNumericMacro ("__LYNX__", 1);
+        case TGT_ATMOS:
+            DefineNumericMacro ("__ATMOS__", 1);
+            break;
+
+        case TGT_TELEMON24:
+            DefineNumericMacro ("__TELEMON24__", 1);
+            break;
+                                
+        case TGT_TELEMON30:
+            DefineNumericMacro ("__TELEMON30__", 1);
             break;
 
         case TGT_NES:
             DefineNumericMacro ("__NES__", 1);
             break;
 
+        case TGT_SUPERVISION:
+            DefineNumericMacro ("__SUPERVISION__", 1);
+            break;
+
+        case TGT_LYNX:
+            DefineNumericMacro ("__LYNX__", 1);
+            break;
+
         case TGT_SIM6502:
             DefineNumericMacro ("__SIM6502__", 1);
             break;
@@ -254,8 +271,12 @@ static void SetSys (const char* Sys)
             DefineNumericMacro ("__SIM65C02__", 1);
             break;
 
-        case TGT_SUPERVISION:
-            DefineNumericMacro ("__SUPERVISION__", 1);
+        case TGT_OSIC1P:
+            DefineNumericMacro ("__OSIC1P__", 1);
+            break;
+
+        case TGT_PCENGINE:
+            DefineNumericMacro ("__PCE__", 1);
             break;
 
         default:
@@ -306,9 +327,9 @@ static void DefineSym (const char* Def)
         DefineNumericMacro (Def, 1);
     } else {
         /* We have a value, P points to the '=' character. Since the argument
-         * is const, create a copy and replace the '=' in the copy by a zero
-         * terminator.
-         */
+        ** is const, create a copy and replace the '=' in the copy by a zero
+        ** terminator.
+        */
         char* Q;
         unsigned Len = strlen (Def)+1;
         char* S = (char*) xmalloc (Len);
@@ -346,6 +367,15 @@ static void OptAddSource (const char* Opt attribute ((unused)),
 
 
 
+static void OptAllCDecl (const char* Opt attribute ((unused)),
+                         const char* Arg attribute ((unused)))
+/* Make functions default to cdecl instead of fastcall. */
+{
+    AutoCDecl = 1;
+}
+
+
+
 static void OptBssName (const char* Opt attribute ((unused)), const char* Arg)
 /* Handle the --bss-name option */
 {
@@ -468,13 +498,13 @@ static void OptDebugOpt (const char* Opt attribute ((unused)), const char* Arg)
     }
 
     /* Read line by line, ignore empty lines and switch optimization
-     * steps on/off.
-     */
+    ** steps on/off.
+    */
     while (fgets (Buf, sizeof (Buf), F) != 0) {
 
         /* Remove trailing control chars. This will also remove the
-         * trailing newline.
-         */
+        ** trailing newline.
+        */
         unsigned Len = strlen (Buf);
         while (Len > 0 && IsControl (Buf[Len-1])) {
             --Len;
@@ -488,8 +518,8 @@ static void OptDebugOpt (const char* Opt attribute ((unused)), const char* Arg)
         }
 
         /* Check the first character and enable/disable the step or
-         * ignore the line
-         */
+        ** ignore the line
+        */
         switch (*Line) {
 
             case '\0':
@@ -515,8 +545,8 @@ static void OptDebugOpt (const char* Opt attribute ((unused)), const char* Arg)
     }
 
     /* Close the file, no error check here since we were just reading and
-     * this is only a debug function.
-     */
+    ** this is only a debug function.
+    */
     (void) fclose (F);
 }
 
@@ -720,7 +750,7 @@ static void OptVersion (const char* Opt attribute ((unused)),
                         const char* Arg attribute ((unused)))
 /* Print the compiler version */
 {
-    fprintf (stderr, "cc65 V%s\n", GetVersionAsString ());
+    fprintf (stderr, "%s V%s\n", ProgName, GetVersionAsString ());
     exit (EXIT_SUCCESS);
 }
 
@@ -786,6 +816,7 @@ int main (int argc, char* argv[])
     /* Program long options */
     static const LongOpt OptTab[] = {
         { "--add-source",       0,      OptAddSource            },
+        { "--all-cdecl",        0,      OptAllCDecl             },
         { "--bss-name",         1,      OptBssName              },
         { "--check-stack",      0,      OptCheckStack           },
         { "--code-name",        1,      OptCodeName             },
@@ -1016,6 +1047,3 @@ int main (int argc, char* argv[])
     /* Return an apropriate exit code */
     return (ErrorCount > 0)? EXIT_FAILURE : EXIT_SUCCESS;
 }
-
-
-