* link/z80/lkmain.c (afile): allow periods in directory names
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 21 Apr 2004 06:35:32 +0000 (06:35 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 21 Apr 2004 06:35:32 +0000 (06:35 +0000)
* link/z80/lkmain.c (afile),
* as/mcs51/lkmain.c (afile),
* as/hc08/lkmain.c (afile): allow linker script file to have an
extension other than ".lnk"
* link/z80/lklex.c (getfid),
* link/z80/lkmain.c (parse),
* as/mcs51/lklex.c (getfid),
* as/mcs51/lkmain.c (parse),
* as/hc08/lklex.c (getfid),
* as/hc08/lkmain.c (parse): Support comments in the linker script
file on lines by themselves and after filenames

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

ChangeLog
as/hc08/lklex.c
as/hc08/lkmain.c
as/mcs51/lklex.c
as/mcs51/lkmain.c
link/z80/lklex.c
link/z80/lkmain.c

index 7a959a47d4d7f34acee3923919f078931a28bb66..f25a4c5d5441b36d99a09a0cdae826d990ff9e0a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2004-04-21 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+
+       * link/z80/lkmain.c (afile): allow periods in directory names
+       * link/z80/lkmain.c (afile),
+       * as/mcs51/lkmain.c (afile),
+       * as/hc08/lkmain.c (afile): allow linker script file to have an
+       extension other than ".lnk"
+       * link/z80/lklex.c (getfid),
+       * link/z80/lkmain.c (parse),
+       * as/mcs51/lklex.c (getfid),
+       * as/mcs51/lkmain.c (parse),
+       * as/hc08/lklex.c (getfid),
+       * as/hc08/lkmain.c (parse): Support comments in the linker script
+       file on lines by themselves and after filenames
+
 2004-04-20 Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
 
        * as/link_hc08.dsp: Added as/hc08/lkelf.c to project.
index daaa4f32c3dd16f132ca01f1b984f1852ef8ed8d..f7de6d3c2b45831e0476cbf30c3e76743475274e 100644 (file)
@@ -199,6 +199,9 @@ char *str;
                if (p < &str[PATH_MAX-1])
                        *p++ = c;
                c = get();
+               if (c == ';')
+                       while (c)
+                               c = get();
        } while (c);
        /* trim trailing spaces */
        --p;
index ae5aff2fa9000276cf832be2c3b93ce566ae4834..fd732aa869aa240a3ef9f20580a944f75819698f 100644 (file)
@@ -762,6 +762,8 @@ parse()
        char fid[NINPUT];
 
        while ((c = getnb()) != 0) {
+               if ( c == ';')
+                       return(0);
                if ( c == '-') {
                        while (ctype[c=get()] & LETTER) {
                                switch(c) {
@@ -877,6 +879,8 @@ parse()
                                        lkexit(1);
                                }
                        }
+                       if ( c == ';')
+                               return(0);
                } else
                if (ctype[c] & ILL) {
                        fprintf(stderr, "Invalid input");
@@ -1192,9 +1196,12 @@ char *ft;
        }
 
        /*Add the extension*/
-       strcat(fb, ".");
-       strcat(fb, strlen(ft)?ft:"rel");
-       
+       if (fb[i] != '.')
+       {
+               strcat(fb, ".");
+               strcat(fb, strlen(ft)?ft:"rel");
+       }
+               
        fp = fopen(fb, omode);
        if (fp==NULL)
        {
index daaa4f32c3dd16f132ca01f1b984f1852ef8ed8d..f7de6d3c2b45831e0476cbf30c3e76743475274e 100644 (file)
@@ -199,6 +199,9 @@ char *str;
                if (p < &str[PATH_MAX-1])
                        *p++ = c;
                c = get();
+               if (c == ';')
+                       while (c)
+                               c = get();
        } while (c);
        /* trim trailing spaces */
        --p;
index fd11cf39458126d69138259fdfa24751dfd407be..06d26aa582eb499b52e434b989a117523816c1c8 100644 (file)
@@ -800,6 +800,8 @@ parse()
        char fid[NINPUT];
 
        while ((c = getnb()) != 0) {
+               if ( c == ';')
+                       return(0);
                if ( c == '-') {
                        while (ctype[c=get()] & LETTER) {
                                switch(c) {
@@ -923,6 +925,8 @@ parse()
                                        lkexit(1);
                                }
                        }
+                       if ( c == ';')
+                               return(0);
                } else
                if (ctype[c] & ILL) {
                        fprintf(stderr, "Invalid input");
@@ -1228,8 +1232,11 @@ char *ft;
        }
 
        /*Add the extension*/
-       strcat(fb, ".");
-       strcat(fb, strlen(ft)?ft:"rel");
+       if (fb[i] != '.')
+       {
+               strcat(fb, ".");
+               strcat(fb, strlen(ft)?ft:"rel");
+       }
        
        fp = fopen(fb, omode);
        if (fp==NULL)
index 0fe342c330dc5c65d3739e52d887c7c6138f2546..7bc34fcaa34a6655e9fd0c1b8bfd414ba1a9f1d7 100644 (file)
@@ -144,6 +144,9 @@ char *str;
                if (p < &str[FILSPC-1])
                        *p++ = c;
                c = get();
+               if (c == ';')
+                       while (c)
+                               c = get();
 #ifdef SDK
        } while (c);
 #else /* SDK */
index c6cc8b29fcded57a27a26c7237271560c386cdad..624d4a793a0ff9ca4cc355eb85748e3b37c5ceb6 100644 (file)
@@ -911,6 +911,8 @@ parse()
        char fid[NINPUT];
 
        while ((c = getnb()) != 0) {
+               if (c == ';')
+                       return(0);
                if ( c == '-') {
                        while (ctype[c=get()] & LETTER) {
                                switch(c) {
@@ -1040,6 +1042,8 @@ parse()
                                        lkexit(1);
                                }
                        }
+                       if (c == ';')
+                               return(0);
                } else
                if (ctype[c] != ILL) {
                        if (linkp == NULL) {
@@ -1335,11 +1339,16 @@ afile(fn, ft, wf)
 char *fn;
 char *ft;
 {
+#if 0
        register char *p1, *p2, *p3;
        register int c;
+#else
+       int i;
+#endif 
        FILE *fp;
        char fb[FILSPC];
 
+#if 0  
        p1 = fn;
        p2 = fb;
        p3 = ft;
@@ -1364,6 +1373,32 @@ char *ft;
                        *p2++ = c;
        }
        *p2++ = 0;
+#else
+       /*Look backward the name path and get rid of the extension, if any*/
+       i=strlen(fn);
+       for(; (fn[i]!='.')&&(fn[i]!='\\')&&(fn[i]!='/')&&(i>=0); i--);
+       if( (fn[i]=='.') && *ft && strcmp(ft, "lnk") )
+       {
+               strncpy(fb, fn, i);
+               fb[i]=0;
+       }
+       else
+       {
+               strcpy(fb, fn);
+       }
+
+       /*Add the extension*/
+       if (fb[i] != '.')
+       {
+               strcat(fb, ".");
+#ifdef SDK
+               strcat(fb, strlen(ft)?ft:"rel");
+#else
+               strcat(fb, strlen(ft)?ft:"REL");
+#endif
+       }
+#endif
+
 #ifdef SDK
        if ((fp = fopen(fb, wf?(binary?"wb":"w"):(binary?"rb":"r"))) == NULL) {
 #else /* SDK */