included "SDCCset.h", added declaration of setParseWithComma()
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 30 Mar 2003 15:35:24 +0000 (15:35 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 30 Mar 2003 15:35:24 +0000 (15:35 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2436 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCglobl.h
src/SDCCglue.c

index 947156f9e0ff40fa169ef4339c721ab5414961ff..df1c7e5a874862b5d449f7796f45c7442438caa2 100644 (file)
@@ -1,12 +1,17 @@
 /* SDCCglobl.h - global macros etc required by all files */
+
 #ifndef SDCCGLOBL_H
 #define SDCCGLOBL_H
+
 #include <memory.h>
 #include <assert.h>
 #include <stdlib.h>
 #include <setjmp.h>
 #include <stdio.h>
 
+#include "SDCCset.h"
+
+
 /*
  * Define host port dependant constants etc.
  */
@@ -294,6 +299,7 @@ extern int nlibFiles;
 extern char *libPaths[128];
 extern int nlibPaths;
 
+void setParseWithComma (set **, char *);
 void parseWithComma (char **, char *);
 
 /** Creates a temporary file a'la tmpfile which avoids the bugs
index 5e1d084d98ccddca5d4fd5a8514aa787eaa36977..206d1d2b70e639b46f2cf01fae6ba9076c54df00 100644 (file)
@@ -45,7 +45,6 @@ set *externs = NULL;          /* Varibles that are declared as extern */
 unsigned maxInterrupts = 6;
 int allocInfo = 1;
 symbol *mainf;
-extern char *VersionString;
 set *pipeSet = NULL;            /* set of pipes */
 set *tmpfileSet = NULL;                /* set of tmp file created by the compiler */
 set *tmpfileNameSet = NULL;    /* All are unlinked at close. */
@@ -1331,7 +1330,7 @@ initialComments (FILE * afile)
   time_t t;
   time (&t);
   fprintf (afile, "%s", iComments1);
-  fprintf (afile, "; Version %s %s\n", VersionString, asctime (localtime (&t)));
+  fprintf (afile, "; Version " SDCC_VERSION_STR " %s\n", asctime (localtime (&t)));
   fprintf (afile, "%s", iComments2);
 }
 
@@ -1468,6 +1467,30 @@ emitOverlay (FILE * afile)
     }
 }
 
+
+/*-----------------------------------------------------------------*/
+/* spacesToUnderscores - replace spaces with underscores        */
+/*-----------------------------------------------------------------*/
+static char *
+spacesToUnderscores (char *dest, const char *src, size_t len)
+{
+  int i;
+  char *p;
+
+  assert(dest != NULL);
+  assert(src != NULL);
+  assert(len > 0);
+
+  --len;
+  for (p = dest, i = 0; *src != '\0' && i < len; ++src, ++i) {
+    *p++ = isspace(*src) ? '_' : *src;
+  }
+  *p = '\0';
+
+  return dest;
+}
+
+
 /*-----------------------------------------------------------------*/
 /* glue - the final glue that hold the whole thing together        */
 /*-----------------------------------------------------------------*/
@@ -1477,6 +1500,7 @@ glue (void)
   FILE *vFile;
   FILE *asmFile;
   FILE *ovrFile = tempfile ();
+  char moduleBuf[PATH_MAX];
 
   addSetHead (&tmpfileSet, ovrFile);
   /* print the global struct definitions */
@@ -1524,7 +1548,8 @@ glue (void)
   initialComments (asmFile);
 
   /* print module name */
-  tfprintf (asmFile, "\t!module\n", moduleName);
+  tfprintf (asmFile, "\t!module\n",
+    spacesToUnderscores (moduleBuf, moduleName, sizeof moduleBuf));
   tfprintf (asmFile, "\t!fileprelude\n");
 
   /* Let the port generate any global directives, etc. */