* device/include/asm/ds390/features.h: fixed bug with ds390 & stack-auto
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 19 Jan 2008 15:42:51 +0000 (15:42 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 19 Jan 2008 15:42:51 +0000 (15:42 +0000)
* as/link/lklex.c,
* as/link/mcs51/lkmain.c: used LKDIRSEP, LKDIRSEPSTR and LKOBJEXT,
  cosmetic changes, brought more in sync, changed old K&R to ANSI

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

ChangeLog
as/link/lklex.c
as/link/mcs51/lkmain.c
device/include/asm/ds390/features.h

index 089faa18b65ac4bec4bedb635a16faf7006d79ee..b973a16b4397c2ec8761a4c69d3f8daab798f3a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
 
        * as/mcs51/asx8051.dsp: removed define SDK
        * as/mcs51/i51mch.c (machine): fixed bug 1865114
+       * device/include/asm/ds390/features.h: fixed bug with ds390 & stack-auto
+       * as/link/lklex.c,
+       * as/link/mcs51/lkmain.c: used LKDIRSEP, LKDIRSEPSTR and LKOBJEXT,
+         cosmetic changes, brought more in sync, changed old K&R to ANSI
 
 2008-01-13 Borut Razem <borut.razem AT siol.net>
 
index c29066edfc45fc4f4a17fb1a8d244fa49b3ab4bb..67c297a1dcda2df8661306ae00ae0007d2a312ef 100644 (file)
@@ -162,7 +162,7 @@ getSid (char *id)
  *     The function getfid() scans the current input text line from
  *     the current position copying the next string into the external
  *     string buffer (str).  The string ends when end of line is found.
- *     Trailing spacers are removed. The maximum number of characters
+ *     Trailing spaces are removed. The maximum number of characters
  *     copied is PATH_MAX. If the input string is larger than PATH_MAX
  *     characters then the string is truncated. The string is NULL
  *     terminated.
@@ -186,9 +186,7 @@ getSid (char *id)
  */
 
 VOID
-getfid(str, c)
-register int c;
-char *str;
+getfid(char *str, register int c)
 {
        register char *p;
 
@@ -261,8 +259,7 @@ getnb()
  */
 
 VOID
-skip(c)
-register int c;
+skip(register int c)
 {
        if (c < 0)
                c = getnb();
@@ -332,7 +329,7 @@ get()
  */
 
 VOID
-unget(c)
+unget(int c)
 {
        if (c != 0)
                --ip;
@@ -370,7 +367,7 @@ unget(c)
  */
 
 int
-getmap(d)
+getmap(int d)
 {
        register int c, n, v;
 
@@ -628,8 +625,7 @@ endline()
  */
 
 VOID
-chop_crlf(str)
-char *str;
+chop_crlf(char *str)
 {
        register int i;
 
index e470adb011340c9eb865c5a7dd2b6552ec8262a3..89ce6a18a2a024a03403f4b3234aaf9cfd31e1c3 100644 (file)
@@ -9,7 +9,7 @@
  * Kent, Ohio  44240
  *
  * 31-Oct-97 JLH:
- *           - add jflag and jfp to control NoICE output file genration
+ *           - add jflag and jfp to control NoICE output file generation
  *  3-Nov-97 JLH:
  *           - use a_type == 0 as "virgin area" flag: set == 1 if -b
  */
@@ -421,6 +421,8 @@ main(int argc, char *argv[])
 #endif
 
     lkexit(lkerr);
+
+    /* Never get here. */
     return 0;
 }
 
@@ -459,14 +461,6 @@ lkexit(int i)
     if (sfp != NULL) fclose(sfp);
     if (tfp != NULL) fclose(tfp);
     if (dfp != NULL) fclose(dfp);
-    /*if (dfp != NULL)
-        FILE *xfp = afile(linkp->f_idp,"cdb",1);
-        dfp = freopen("temp.cdb","r",dfp);
-        copyfile(xfp,dfp);
-        fclose(xfp);
-        fclose(dfp);
-        remove("temp.cdb");
-    }*/
     exit(i);
 }
 
@@ -603,7 +597,6 @@ link_main()
     }
 }
 
-
 /*)Function VOID    map()
  *
  *  The function map() opens the output map file and calls the various
@@ -853,6 +846,7 @@ parse()
                 case 'R':
                     rflag = 1;
                     break;
+
                 case 'x':
                 case 'X':
                     xflag = 0;
@@ -928,10 +922,10 @@ parse()
             if ( c == ';')
                 return(0);
         } else
-               if (ctype[c] & ILL) {
-                       fprintf(stderr, "Invalid input");
-                       lkexit(1);
-               } else {
+        if (ctype[c] & ILL) {
+            fprintf(stderr, "Invalid input");
+            lkexit(1);
+        } else {
             if (linkp == NULL) {
                 linkp = (struct lfile *)
                     new (sizeof (struct lfile));
@@ -1152,13 +1146,11 @@ setgbl()
             v = expr(0);
             sp = lkpsym(id, 0);
             if (sp == NULL) {
-                fprintf(stderr,
-                "No definition of symbol %s\n", id);
+                fprintf(stderr, "No definition of symbol %s\n", id);
                 lkerr++;
             } else {
                 if (sp->s_flag & S_DEF) {
-                    fprintf(stderr,
-                    "Redefinition of symbol %s\n", id);
+                    fprintf(stderr, "Redefinition of symbol %s\n", id);
                     lkerr++;
                     sp->s_axp = NULL;
                 }
@@ -1173,7 +1165,7 @@ setgbl()
     }
 }
 
-/*)Function FILE *  afile(fn,, ft, wf)
+/*)Function FILE *  afile(fn, ft, wf)
  *
  *      char *  fn      file specification string
  *      char *  ft      file type string
@@ -1213,13 +1205,23 @@ afile(char *fn, char *ft, int wf)
 {
     FILE *fp;
     char fb[PATH_MAX];
-    char *omode = (wf ? (wf == 2 ? "a" : "w") : "r");
+    char *omode;
     int i;
 
+    switch (wf) {
+        case 0: omode = "r"; break;
+        case 1: omode = "w"; break;
+        case 2: omode = "a"; break;
+        case 3: omode = "rb"; break;
+        case 4: omode = "wb"; break;
+        case 5: omode = "ab"; break;
+        default: omode = "r"; break;
+    }
+
     /*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]=='.') && strcmp(ft, "lnk") )
+    for(; (fn[i]!=FSEPX)&&(fn[i]!=LKDIRSEP)&&(fn[i]!='/')&&(i>0); i--);
+    if( (fn[i]==FSEPX) && strcmp(ft, "lnk") )
     {
         strncpy(fb, fn, i);
         fb[i]=0;
@@ -1230,18 +1232,19 @@ afile(char *fn, char *ft, int wf)
     }
 
     /*Add the extension*/
-    if (fb[i] != '.')
+    if (fb[i] != FSEPX)
     {
-        strcat(fb, ".");
-        strcat(fb, strlen(ft)?ft:"rel");
+        fb[i] = FSEPX;
+        fb[i+1] = 0;
+        strcat(fb, strlen(ft)?ft:LKOBJEXT);
     }
 
     fp = fopen(fb, omode);
     if (fp==NULL)
     {
-        if (strcmp(ft,"adb"))/*Do not complaint for optional adb files*/
+        if (strcmp(ft,"adb"))/*Do not complain for optional adb files*/
         {
-            fprintf(stderr, "%s: cannot %s.\n", fb, wf?"create":"open");
+            fprintf(stderr, "%s: cannot %s.\n", fb, (wf%3)==1?"create":"open");
             lkerr++;
         }
     }
@@ -1433,8 +1436,7 @@ usage()
  *  side effects:
  *      none
  */
-VOID copyfile (dest,src)
-FILE *src,*dest ;
+VOID copyfile (FILE *dest, FILE *src)
 {
     int ch;
 
index 2d84124b99d3790ee4a34a13b18527e5023aaa07..6d4f4dad7fbe22f6512bdcf907c7e8f4aaabfe2c 100644 (file)
@@ -19,6 +19,8 @@
 #if defined(SDCC_STACK_AUTO)
   #if defined(SDCC_USE_XSTACK)
     #define _AUTOMEM __pdata
+  #elif defined(SDCC_STACK_TENBIT)
+    #define _AUTOMEM __xdata
   #else
     #define _AUTOMEM __idata
   #endif