From 99fcafaaddfe9eb3de89d61bf643cecacbb8a9d4 Mon Sep 17 00:00:00 2001 From: johanknol Date: Sun, 2 Sep 2001 14:42:42 +0000 Subject: [PATCH] some minor --stack-auto improvements git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1217 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- device/lib/_divuint.c | 4 ++++ device/lib/_mululong.c | 1 - device/lib/ser_ir_cts_rts.c | 8 ++++---- device/lib/vprintf.c | 22 ++++++++++++++-------- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/device/lib/_divuint.c b/device/lib/_divuint.c index bba3abf8..bc3a5b15 100644 --- a/device/lib/_divuint.c +++ b/device/lib/_divuint.c @@ -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; diff --git a/device/lib/_mululong.c b/device/lib/_mululong.c index 77eb82df..0428133b 100644 --- a/device/lib/_mululong.c +++ b/device/lib/_mululong.c @@ -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 * diff --git a/device/lib/ser_ir_cts_rts.c b/device/lib/ser_ir_cts_rts.c index 9be6d720..5b127c58 100755 --- a/device/lib/ser_ir_cts_rts.c +++ b/device/lib/ser_ir_cts_rts.c @@ -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 +} diff --git a/device/lib/vprintf.c b/device/lib/vprintf.c index ba7dd886..28b81d6c 100644 --- a/device/lib/vprintf.c +++ b/device/lib/vprintf.c @@ -22,6 +22,12 @@ 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; -- 2.30.2