From: epetrich Date: Wed, 21 Apr 2004 06:35:32 +0000 (+0000) Subject: * link/z80/lkmain.c (afile): allow periods in directory names X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=96f2315747378d0bce89b7adc1f8f3f21844496f;p=fw%2Fsdcc * 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 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3295 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 7a959a47..f25a4c5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2004-04-21 Erik Petrich + + * 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 * as/link_hc08.dsp: Added as/hc08/lkelf.c to project. diff --git a/as/hc08/lklex.c b/as/hc08/lklex.c index daaa4f32..f7de6d3c 100644 --- a/as/hc08/lklex.c +++ b/as/hc08/lklex.c @@ -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; diff --git a/as/hc08/lkmain.c b/as/hc08/lkmain.c index ae5aff2f..fd732aa8 100644 --- a/as/hc08/lkmain.c +++ b/as/hc08/lkmain.c @@ -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) { diff --git a/as/mcs51/lklex.c b/as/mcs51/lklex.c index daaa4f32..f7de6d3c 100644 --- a/as/mcs51/lklex.c +++ b/as/mcs51/lklex.c @@ -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; diff --git a/as/mcs51/lkmain.c b/as/mcs51/lkmain.c index fd11cf39..06d26aa5 100644 --- a/as/mcs51/lkmain.c +++ b/as/mcs51/lkmain.c @@ -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) diff --git a/link/z80/lklex.c b/link/z80/lklex.c index 0fe342c3..7bc34fca 100644 --- a/link/z80/lklex.c +++ b/link/z80/lklex.c @@ -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 */ diff --git a/link/z80/lkmain.c b/link/z80/lkmain.c index c6cc8b29..624d4a79 100644 --- a/link/z80/lkmain.c +++ b/link/z80/lkmain.c @@ -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 */