* as/mcs51/asnoice.c, as/hc08/asnoice.c: fixed bug #1447412:
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 14 Jan 2007 19:47:28 +0000 (19:47 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 14 Jan 2007 19:47:28 +0000 (19:47 +0000)
  Cannot debug files that contain spaces in the path name
  by converting spaces in asm file name to underscores

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4572 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
as/hc08/asnoice.c
as/mcs51/asnoice.c

index d0fcbf3cac11a2cce79ea07978acc7c2cc31aacc..854ab9b18cad1ca5246e77bf94a8e7a4e3f7877a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,8 @@
 2007-01-14 Borut Razem <borut.razem AT siol.net>
 
-       * as/mcs51/asnoice.c: fixed bug #1447412:
+       * as/mcs51/asnoice.c, as/hc08/asnoice.c: fixed bug #1447412:
          Cannot debug files that contain spaces in the path name
-         by converting spaces in asm file mane to underscores
+         by converting spaces in asm file name to underscores
 
 2007-01-13 Borut Razem <borut.razem AT siol.net>
 
index 38d3233f5b95c14969c9cd8f1dae34432d2d47db..2220d3a65ed7465e65a532a5d8432ce3521577e6 100644 (file)
@@ -9,12 +9,13 @@
 #include <stdio.h>
 #include <setjmp.h>
 #include <string.h>
+#include <ctype.h>
 #include "asm.h"
 
-/* Return basic file name without path or extension */
-static char* BaseFileName( int fileNumber );
+/* Return basic file name without path or extension.
+   If spacesToUnderscores != 0 then spaces are converted to underscores */
 
-char* BaseFileName( int fileNumber )
+char* BaseFileName( int fileNumber, int spacesToUnderscores )
 {
        static int prevFile = -1;
         static char baseName[ PATH_MAX ];
@@ -42,6 +43,14 @@ char* BaseFileName( int fileNumber )
                if (p2 != NULL) *p2 = 0;
                /* SD comment this out since not a ANSI Function */
                 /* strupr( baseName ); */
+
+                if (spacesToUnderscores)
+                {
+                  /* Convert spaces to underscores */
+                  for (p1 = baseName; *p1; ++p1)
+                    if (isspace(*p1))
+                      *p1 = '_';
+                }
        }
        return baseName;
 }
@@ -53,7 +62,7 @@ void DefineNoICE_Line()
         struct sym *pSym;
 
        /* symbol is FILE.nnn */
-        sprintf( name, "%s.%u", BaseFileName( cfile ), srcline[ cfile ] );
+        sprintf( name, "%s.%u", BaseFileName( cfile, 0 ), srcline[ cfile ] );
 
         pSym = lookup( name );
         pSym->s_type = S_USER;
@@ -69,7 +78,7 @@ void DefineCDB_Line()
         struct sym *pSym;
 
        /* symbol is FILE.nnn */
-        sprintf( name, "A$%s$%u", BaseFileName( cfile ), srcline[ cfile ] );
+        sprintf( name, "A$%s$%u", BaseFileName( cfile, 1 ), srcline[ cfile ] );
 
         pSym = lookup( name );
         pSym->s_type = S_USER;
index a18b1f15d10056dddacffc57a2ae64e9848cc29d..2220d3a65ed7465e65a532a5d8432ce3521577e6 100644 (file)
@@ -51,7 +51,6 @@ char* BaseFileName( int fileNumber, int spacesToUnderscores )
                     if (isspace(*p1))
                       *p1 = '_';
                 }
-
        }
        return baseName;
 }