Merge of the izt changes.
[fw/sdcc] / src / SDCCmain.c
index b316ad1a59c9d8ed0e0377bbf304d35435d50085..3c53bb8fb1ab67ee11a4150d4914632f60e1cc1b 100644 (file)
 // This is a bit messy because we define link ourself
 #if !defined(__BORLANDC__) && !defined(_MSC_VER)
 
-#if 0          // Wasn't this fixed already
-#define link NoLiNk
 #include <unistd.h>
-#undef link
-#endif
 
 #else
 // No unistd.h in Borland C++
 extern int access(const char *, int);
 #define X_OK 1
+
 #endif
 
 //REMOVE ME!!!
@@ -127,6 +124,7 @@ char    *preOutName;
 #define OPTION_NOSTDLIB     "-nostdlib"
 #define OPTION_NOSTDINC     "-nostdinc"
 #define OPTION_VERBOSE      "-verbose"
+#define OPTION_ANSIINT     "-ansiint"
 static const char *_preCmd[] = {
     "sdcpp", "-Wall", "-lang-c++", "-DSDCC=1", 
     "$l", "-I" SDCC_INCLUDE_DIR, "$1", "$2", NULL
@@ -153,6 +151,12 @@ static PORT *_ports[] = {
 #if !OPT_DISABLE_PIC
     &pic14_port,
 #endif
+#if !OPT_DISABLE_I186
+   &i186_port,
+#endif
+#if !OPT_DISABLE_TLCS900H
+   &tlcs900h_port,
+#endif
 };
 
 #define NUM_PORTS (sizeof(_ports)/sizeof(_ports[0]))
@@ -180,6 +184,17 @@ static int _setPort(const char *name)
     exit(1);
 }
 
+static void _validatePorts(void)
+{
+    int i;
+    for (i=0; i<NUM_PORTS; i++) {
+       if (_ports[i]->magic != PORT_MAGIC) {
+           printf("Error: port %s is incomplete.\n", _ports[i]->target);
+           wassert(0);
+       }
+    }
+}
+
 void buildCmdLine(char *into, char **args, const char **cmds, 
                          const char *p1, const char *p2, 
                          const char *p3, const char **list)
@@ -819,6 +834,11 @@ int   parseCmdLine ( int argc, char **argv )
                options.verbose=1;
                continue;
            }
+           
+           if (strcmp(&argv[i][1],OPTION_ANSIINT) == 0) {
+               options.ANSIint=1;
+               continue;
+           }       
 
            if (!port->parseOption(&argc, argv, &i))
            {
@@ -1358,6 +1378,8 @@ static int preProcess (char **envp)
 
 static void _findPort(int argc, char **argv)
 {
+    _validatePorts();
+
     argc--;
     while (argc) {
        if (!strncmp(*argv, "-m", 2)) {