some minor --stack-auto improvements
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 2 Sep 2001 14:42:42 +0000 (14:42 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 2 Sep 2001 14:42:42 +0000 (14:42 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1217 4a8a32a2-be11-0410-ad9d-d568d2c75423

device/lib/_divuint.c
device/lib/_mululong.c
device/lib/ser_ir_cts_rts.c
device/lib/vprintf.c

index bba3abf8d2620f0cb263e96c899d0cae97f44ee0..bc3a5b15a029b12eee350c173b1ad0ff043fd344 100644 (file)
@@ -29,7 +29,11 @@ unsigned int _divuint (unsigned int a, unsigned int b)
 {
        unsigned int reste = 0  ;
        unsigned char count = 16;
+#ifdef SDCC_STACK_AUTO
+       unsigned char c;
+#else
        bit c;
+#endif
 
        do{
                // reste:a <- 0;
index 77eb82df582663c7ff1792548615cf07a5c1fcb7..0428133bd0be56f086c8238de6fa31016499b9dd 100644 (file)
@@ -65,7 +65,6 @@ unsigned long _mululong (unsigned long a, unsigned long b)
 
         t.i.hi = bcast(a)->b.b0 * bcast(b)->b.b2;       // A
         t.i.lo = bcast(a)->b.b0 * bcast(b)->b.b0;       // A
-       _asm ;johan _endasm;
         t.b.b3 += bcast(a)->b.b3 *
                                   bcast(b)->b.b0;       // G
         t.b.b3 += bcast(a)->b.b2 *
index 9be6d7204764311ced5ba5d705e09039b9c74f94..5b127c586d1b895493eb82ff1784cf92c22e631c 100755 (executable)
@@ -169,7 +169,7 @@ void ser_puts(unsigned char *s)
 {
   unsigned char c;
   while (c= *s++) {
-    if (c == LF) ser_putc(CR);
+    if (c == '\n') ser_putc('\r');
     ser_putc (c);
   }
 }
@@ -182,9 +182,9 @@ void ser_gets(unsigned char *s, unsigned char len)
   pos = 0;
   while (pos <= len) {
     c = ser_getc();
-    if (c == CR) continue;        // discard CR's
+    if (c == '\r') continue;        // discard CR's
     s[pos++] = c;
-    if (c == LF) break;           // NL terminates
+    if (c == '\n') break;           // NL terminates
   }
   s[pos] = '\0';                  // terminate string
 }
@@ -197,4 +197,4 @@ unsigned char ser_can_xmt(void)
 unsigned char ser_can_rcv(void)
 {
   return rxcnt;
-}
\ No newline at end of file
+}
index ba7dd88600d486356eed756f7216808fe4fae517..28b81d6c7ff7c9908da59356cbdd74d57714be55 100644 (file)
    You are forbidden to forbid anyone else to use, share and improve
    what you give them.   Help stamp out software-hoarding!  
 -------------------------------------------------------------------------*/
+
+/* this module uses some global variables instead function parameters, so: */
+#ifdef SDCC_STACK_AUTO
+#warning "this module cannot yet be use as a reentrant one"
+#endif
+
 #ifdef __ds390
 #define USE_FLOATS 1
 #endif
@@ -252,14 +258,14 @@ static void output_float (float f, unsigned char reqWidth,
 
 int vsprintf (const char *buf, const char *format, va_list ap)
 {
-  bit            left_justify;
-  bit            zero_padding;
-  bit            prefix_sign;
-  bit            prefix_space;
-  bit            signed_argument;
-  bit            char_argument;
-  bit            long_argument;
-  bit            float_argument;
+  static bit            left_justify;
+  static bit            zero_padding;
+  static bit            prefix_sign;
+  static bit            prefix_space;
+  static bit            signed_argument;
+  static bit            char_argument;
+  static bit            long_argument;
+  static bit            float_argument;
 
   unsigned char  width;
   signed char decimals;