* device/lib/gets.c: fixed bug 1568829,thanks Philipp Krause
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 1 Oct 2006 21:17:07 +0000 (21:17 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 1 Oct 2006 21:17:07 +0000 (21:17 +0000)
* device/lib/pic16/libc/string/memcpypgm2ram.c,
* device/lib/pic16/libc/string/memcpyram2ram.c: fixed bug 1568836, thanks
  Philipp Krause
* as/mcs51/asmain.c (asmbl, newdot): fixed problems with absolute areas
* as/link/mcs51/lkmem.c (summary2): reverted, do do count abs segments

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

ChangeLog
as/link/mcs51/lkmem.c
as/mcs51/asmain.c
device/lib/gets.c
device/lib/pic16/libc/string/memcpypgm2ram.c
device/lib/pic16/libc/string/memcpyram2ram.c

index 80e5d4cf98207c80f3a32ef7139a71a92495d926..6fde20b6d426be7c279075b1562e4f11de2899b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@
 
        * src/pic16/glue.c (pic16emitMaps),
        * src/pic/glue.c (pic14emitMaps): hopefully fixed bug 1568779
 
        * src/pic16/glue.c (pic16emitMaps),
        * src/pic/glue.c (pic14emitMaps): hopefully fixed bug 1568779
+       * device/lib/gets.c: fixed bug 1568829,thanks Philipp Krause
+       * device/lib/pic16/libc/string/memcpypgm2ram.c,
+       * device/lib/pic16/libc/string/memcpyram2ram.c: fixed bug 1568836, thanks
+         Philipp Krause
+       * as/mcs51/asmain.c (asmbl, newdot): fixed problems with absolute areas
+       * as/link/mcs51/lkmem.c (summary2): reverted, do do count abs segments
 
 2006-09-30 Jesus Calvino-Fraga <jesusc at ece.ubc.ca>
 
 
 2006-09-30 Jesus Calvino-Fraga <jesusc at ece.ubc.ca>
 
index 140565f98d507e8a5775fd0c705549ca497cf415..1769f8c9ee78e69635b7f18602aa6243b24d1445 100644 (file)
@@ -435,7 +435,7 @@ int summary2(struct area * areap)
     xp=areap;
     while (xp)
     {
     xp=areap;
     while (xp)
     {
-        if((xp->a_flag & A_CODE) && !(xp->a_flag & A_ABS))
+        if (xp->a_flag & A_CODE)
         {
             if(xp->a_size)
             {
         {
             if(xp->a_size)
             {
@@ -475,7 +475,7 @@ int summary2(struct area * areap)
                 Paged.End = xp->a_addr + xp->a_size;
         }
 
                 Paged.End = xp->a_addr + xp->a_size;
         }
 
-        else if((xp->a_flag & A_XDATA) && !(xp->a_flag & A_ABS))
+        else if (xp->a_flag & A_XDATA)
         {
             if(xp->a_size)
             {
         {
             if(xp->a_size)
             {
index 0f40fe8461ebac26dbdbb0318c40cf5da7fb5220..86d0da26690eced7f019a28a75d2355a081c1008 100644 (file)
@@ -811,7 +811,7 @@ loop:
                lmode = SLIST;
                break;
 
                lmode = SLIST;
                break;
 
-    case S_OPTSDCC:
+       case S_OPTSDCC:
                p = optsdcc;
                if ((c = getnb()) != 0) {
                        do {
                p = optsdcc;
                if ((c = getnb()) != 0) {
                        do {
@@ -836,7 +836,7 @@ loop:
                break;
 
        case S_DAREA:
                break;
 
        case S_DAREA:
-               getid(id, -1);
+               getid(id, -1);
                uaf = 0;
                uf  = A_CON|A_REL;
                if ((c = getnb()) == '(') {
                uaf = 0;
                uf  = A_CON|A_REL;
                if ((c = getnb()) == '(') {
@@ -875,6 +875,7 @@ loop:
        case S_ORG:
                if (dot.s_area->a_flag & A_ABS) {
                        outall();
        case S_ORG:
                if (dot.s_area->a_flag & A_ABS) {
                        outall();
+                       dot.s_area->a_size += dot.s_addr - dot.s_org;
                        laddr = dot.s_addr = dot.s_org = absexpr();
                } else {
                        err('o');
                        laddr = dot.s_addr = dot.s_org = absexpr();
                } else {
                        err('o');
@@ -1135,7 +1136,8 @@ register struct area *nap;
          }
        } else if (oap->a_flag & A_ABS) {
          oap->a_addr = dot.s_org;
          }
        } else if (oap->a_flag & A_ABS) {
          oap->a_addr = dot.s_org;
-         oap->a_size = dot.s_addr - dot.s_org;
+         oap->a_size += dot.s_addr - dot.s_org;
+         dot.s_addr = dot.s_org = 0;
        } else {
          oap->a_addr = 0;
          oap->a_size = dot.s_addr;
        } else {
          oap->a_addr = 0;
          oap->a_size = dot.s_addr;
@@ -1144,6 +1146,10 @@ register struct area *nap;
          // a new overlay starts at 0, no fuzz
          dot.s_addr = 0;
          fuzz = 0;
          // a new overlay starts at 0, no fuzz
          dot.s_addr = 0;
          fuzz = 0;
+       } else if (nap->a_flag & A_ABS) {
+         // a new absolute starts at org, no fuzz
+         dot.s_addr = dot.s_org;
+         fuzz = 0;
        } else {
          dot.s_addr = nap->a_size;
          fuzz = nap->a_fuzz;
        } else {
          dot.s_addr = nap->a_size;
          fuzz = nap->a_fuzz;
index 005a2a073132360f56fb5b888bb01aaad46440cf..be5ee730dfce84e01531fb15cc1824f4014de08d 100755 (executable)
@@ -1,7 +1,6 @@
 #include <stdio.h>
 
 #include <stdio.h>
 
-char * gets(const char *str) {
-  char *s=str;
+char * gets(char *s) {
   char c;
   unsigned int count=0;
   
   char c;
   unsigned int count=0;
   
@@ -22,7 +21,7 @@ char * gets(const char *str) {
       putchar('\r');
       putchar('\n');
       *s=0;
       putchar('\r');
       putchar('\n');
       *s=0;
-      return str;
+      return s;
     default:
       *s++=c;
       count++;
     default:
       *s++=c;
       count++;
index d4b0c49b35b27cfd65d1f5953377c33ac23504c9..b27a881d69a6089f9c91bef72d6a9c779152279f 100644 (file)
@@ -7,28 +7,27 @@
    under the terms of the GNU Library General Public License as published by the
    Free Software Foundation; either version 2, or (at your option) any
    later version.
    under the terms of the GNU Library General Public License as published by the
    Free Software Foundation; either version 2, or (at your option) any
    later version.
-   
+
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Library General Public License for more details.
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Library General Public License for more details.
-   
+
    You should have received a copy of the GNU Library General Public License
    along with this program; if not, write to the Free Software
    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    You should have received a copy of the GNU Library General Public License
    along with this program; if not, write to the Free Software
    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-   
+
    In other words, you are welcome to use, share and improve this program.
    You are forbidden to forbid anyone else to use, share and improve
    In other words, you are welcome to use, share and improve this program.
    You are forbidden to forbid anyone else to use, share and improve
-   what you give them.   Help stamp out software-hoarding!  
+   what you give them.   Help stamp out software-hoarding!
 -------------------------------------------------------------------------*/
 #include <string.h>
 
 -------------------------------------------------------------------------*/
 #include <string.h>
 
-__data void *memcpypgm2ram (__data void *dst, void __code *src, size_t acount) 
+__data void *memcpypgm2ram (__data void *dst, __code void *src, size_t acount)
 {
 {
-  void *ret = dst;     /* perhaps ret should be removed, use dst instead */
   char __data *d = dst;
   char __data *d = dst;
-  char *s = src;
-       
+  char __code *s = src;
+
     /*
      * copy from lower addresses to higher addresses
      */
     /*
      * copy from lower addresses to higher addresses
      */
@@ -36,5 +35,5 @@ __data void *memcpypgm2ram (__data void *dst, void __code *src, size_t acount)
       *d++ = *s++;
     }
 
       *d++ = *s++;
     }
 
-  return(ret);
+  return(dst);
 }
 }
index 1335a5c1d5755532485d540407e55a2c16036344..c237e438c96c7af2be7e565cc736029c56652c4a 100644 (file)
@@ -1,5 +1,5 @@
 /*-------------------------------------------------------------------------
 /*-------------------------------------------------------------------------
-   memcpypgm2ram.c - part of string library functions
+   memcpyram2ram.c - part of string library functions
 
              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1999)
 
 
              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1999)
 
@@ -7,28 +7,27 @@
    under the terms of the GNU Library General Public License as published by the
    Free Software Foundation; either version 2, or (at your option) any
    later version.
    under the terms of the GNU Library General Public License as published by the
    Free Software Foundation; either version 2, or (at your option) any
    later version.
-   
+
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Library General Public License for more details.
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Library General Public License for more details.
-   
+
    You should have received a copy of the GNU Library General Public License
    along with this program; if not, write to the Free Software
    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    You should have received a copy of the GNU Library General Public License
    along with this program; if not, write to the Free Software
    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-   
+
    In other words, you are welcome to use, share and improve this program.
    You are forbidden to forbid anyone else to use, share and improve
    In other words, you are welcome to use, share and improve this program.
    You are forbidden to forbid anyone else to use, share and improve
-   what you give them.   Help stamp out software-hoarding!  
+   what you give them.   Help stamp out software-hoarding!
 -------------------------------------------------------------------------*/
 #include <string.h>
 
 -------------------------------------------------------------------------*/
 #include <string.h>
 
-__data void *memcpyram2ram (__data void *dst, __data void *src, size_t acount) 
+__data void *memcpyram2ram (__data void *dst, __data void *src, size_t acount)
 {
 {
-  void __data *ret = dst;      /* perhaps ret should be removed, use dst instead */
   char __data *d = dst;
   char __data *s = src;
   char __data *d = dst;
   char __data *s = src;
-       
+
     /*
      * copy from lower addresses to higher addresses
      */
     /*
      * copy from lower addresses to higher addresses
      */
@@ -36,5 +35,5 @@ __data void *memcpyram2ram (__data void *dst, __data void *src, size_t acount)
       *d++ = *s++;
     }
 
       *d++ = *s++;
     }
 
-  return(ret);
+  return(dst);
 }
 }