From: pjs Date: Sun, 9 Sep 2001 17:25:27 +0000 (+0000) Subject: Changed _xdata, _near, etc and removed _generic from library files X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=cb7d8a8cab26fa0c173006da313fcc3e0bbb8d33;p=fw%2Fsdcc Changed _xdata, _near, etc and removed _generic from library files git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1249 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/device/include/malloc.h b/device/include/malloc.h index 91bfb32f..060ed857 100644 --- a/device/include/malloc.h +++ b/device/include/malloc.h @@ -29,8 +29,8 @@ MEMHEADER { - MEMHEADER _xdata * next; - MEMHEADER _xdata * prev; + MEMHEADER xdata * next; + MEMHEADER xdata * prev; unsigned int len; unsigned char mem[1]; }; diff --git a/device/include/setjmp.h b/device/include/setjmp.h index 29c86a98..6742bb89 100644 --- a/device/include/setjmp.h +++ b/device/include/setjmp.h @@ -27,7 +27,7 @@ typedef unsigned char jmp_buf[3]; -int setjmp (unsigned char _generic *); -int longjmp(unsigned char _generic *,int); +int setjmp (unsigned char *); +int longjmp(unsigned char *, int); #endif diff --git a/device/include/stdarg.h b/device/include/stdarg.h index f4ba9da4..cbedce87 100644 --- a/device/include/stdarg.h +++ b/device/include/stdarg.h @@ -20,14 +20,14 @@ typedef unsigned char * va_list ; #elif defined(SDCC_USE_XSTACK) typedef unsigned char _pdata * va_list ; -#define va_arg(marker,type) *((type _data *)(marker -= sizeof(type))) +#define va_arg(marker,type) *((type data *)(marker -= sizeof(type))) #define va_start(marker,first) { marker = (va_list)((char _pdata *)&first); } #else -typedef unsigned char _data * va_list ; -#define va_arg(marker,type) *((type _data * )(marker -= sizeof(type))) -#define va_start(marker,first) { marker = (va_list) ((char _data * )&first); } +typedef unsigned char data * va_list ; +#define va_arg(marker,type) *((type data * )(marker -= sizeof(type))) +#define va_start(marker,first) { marker = (va_list) ((char data * )&first); } #endif diff --git a/device/include/string.h b/device/include/string.h index ca84ef22..fb84dd49 100644 --- a/device/include/string.h +++ b/device/include/string.h @@ -27,7 +27,6 @@ #define __SDC51_STRING_H 1 #ifndef SDCC_mcs51 -#define _generic #define reentrant #endif @@ -38,46 +37,46 @@ #warning Make sure you recompiled _str*.c and _mem*.c library functions as 'reentrant' #endif -extern char _generic *strcpy (char _generic *, char _generic *) reentrant ; -extern char _generic *strncpy(char _generic *, char _generic *,int ) reentrant ; -extern char _generic *strcat (char _generic *, char _generic *) reentrant ; -extern char _generic *strncat(char _generic *, char _generic *,int ) reentrant ; -extern int strcmp (char _generic *, char _generic *) reentrant ; -extern int strncmp(char _generic *, char _generic *,int ) reentrant ; -extern char _generic *strchr (char _generic *, char ) reentrant ; -extern char _generic *strrchr(char _generic *, char ) reentrant ; -extern int strspn (char _generic *, char _generic *) reentrant ; -extern int strcspn(char _generic *, char _generic *) reentrant ; -extern char _generic *strpbrk(char _generic *, char _generic *) reentrant ; -extern char _generic *strstr (char _generic *, char _generic *) reentrant ; -extern int strlen (char _generic * ) reentrant ; -extern char _generic *strtok (char _generic *, char _generic *) reentrant ; -extern void _generic *memcpy (void _generic *, void _generic *, int ) reentrant ; -extern int memcmp (void _generic *, void _generic *, int ) reentrant ; -extern void _generic *memset (void _generic *, unsigned char , int ) reentrant ; +extern char *strcpy (char *, char *) reentrant ; +extern char *strncpy(char *, char *,int ) reentrant ; +extern char *strcat (char *, char *) reentrant ; +extern char *strncat(char *, char *,int ) reentrant ; +extern int strcmp (char *, char *) reentrant ; +extern int strncmp(char *, char *,int ) reentrant ; +extern char *strchr (char *, char ) reentrant ; +extern char *strrchr(char *, char ) reentrant ; +extern int strspn (char *, char *) reentrant ; +extern int strcspn(char *, char *) reentrant ; +extern char *strpbrk(char *, char *) reentrant ; +extern char *strstr (char *, char *) reentrant ; +extern int strlen (char * ) reentrant ; +extern char *strtok (char *, char *) reentrant ; +extern void *memcpy (void *, void *, int ) reentrant ; +extern int memcmp (void *, void *, int ) reentrant ; +extern void *memset (void *, unsigned char , int ) reentrant ; #else -extern char _generic *strcpy (char _generic *, char _generic *) ; -extern char _generic *strncpy(char _generic *, char _generic *,int ) ; -extern char _generic *strcat (char _generic *, char _generic *) ; -extern char _generic *strncat(char _generic *, char _generic *,int ) ; -extern int strcmp (char _generic *, char _generic *) ; -extern int strncmp(char _generic *, char _generic *,int ) ; -extern char _generic *strchr (char _generic *, char ) ; -extern char _generic *strrchr(char _generic *, char ) ; -extern int strspn (char _generic *, char _generic *) ; -extern int strcspn(char _generic *, char _generic *) ; -extern char _generic *strpbrk(char _generic *, char _generic *) ; -extern char _generic *strstr (char _generic *, char _generic *) ; -extern int strlen (char _generic * ) ; -extern char _generic *strtok (char _generic *, char _generic *) ; -extern void _generic *memcpy (void _generic *, void _generic *, int ) ; -extern int memcmp (void _generic *, void _generic *, int ) ; -extern void _generic *memset (void _generic *, unsigned char , int ) ; +extern char *strcpy (char *, char *) ; +extern char *strncpy(char *, char *,int ) ; +extern char *strcat (char *, char *) ; +extern char *strncat(char *, char *,int ) ; +extern int strcmp (char *, char *) ; +extern int strncmp(char *, char *,int ) ; +extern char *strchr (char *, char ) ; +extern char *strrchr(char *, char ) ; +extern int strspn (char *, char *) ; +extern int strcspn(char *, char *) ; +extern char *strpbrk(char *, char *) ; +extern char *strstr (char *, char *) ; +extern int strlen (char * ) ; +extern char *strtok (char *, char *) ; +extern void *memcpy (void *, void *, int ) ; +extern int memcmp (void *, void *, int ) ; +extern void *memset (void *, unsigned char , int ) ; #if SDCC_ds390 -extern void _xdata *memcpyx(void _xdata *, void _xdata *, int) _naked; +extern void xdata * memcpyx(void xdata *, void xdata *, int) _naked; #endif #endif diff --git a/device/lib/_memcmp.c b/device/lib/_memcmp.c index c9164086..19d555f9 100644 --- a/device/lib/_memcmp.c +++ b/device/lib/_memcmp.c @@ -25,18 +25,18 @@ #define NULL (void *)0 int memcmp ( - void _generic * buf1, - void _generic * buf2, + void * buf1, + void * buf2, int count ) { if (!count) return(0); - while ( --count && *((char _generic *)buf1) == *((char _generic *)buf2) ) { - buf1 = (char _generic *)buf1 + 1; - buf2 = (char _generic *)buf2 + 1; + while ( --count && *((char *)buf1) == *((char *)buf2) ) { + buf1 = (char *)buf1 + 1; + buf2 = (char *)buf2 + 1; } - return( *((unsigned char _generic *)buf1) - *((unsigned char _generic *)buf2) ); + return( *((unsigned char *)buf1) - *((unsigned char *)buf2) ); } diff --git a/device/lib/_memcpy.c b/device/lib/_memcpy.c index 9211c09e..d5ddf9e7 100644 --- a/device/lib/_memcpy.c +++ b/device/lib/_memcpy.c @@ -28,9 +28,9 @@ #define NULL (void *)0 -void _generic * memcpy ( - void _generic * dst, - void _generic * src, +void * memcpy ( + void * dst, + void * src, int acount ) { @@ -38,8 +38,8 @@ void _generic * memcpy ( #pragma NOINDUCTION - char _generic * d = dst; - char _generic * s = src; + char * d = dst; + char * s = src; int count = -acount; count /= 4; @@ -61,9 +61,9 @@ void _generic * memcpy ( } return dst; #else - void _generic * ret = dst; - char _generic * d = dst; - char _generic * s = src; + void * ret = dst; + char * d = dst; + char * s = src; /* * copy from lower addresses to higher addresses diff --git a/device/lib/_memset.c b/device/lib/_memset.c index 5df9af8e..a42be818 100644 --- a/device/lib/_memset.c +++ b/device/lib/_memset.c @@ -24,17 +24,16 @@ #include "string.h" #define NULL (void *)0 -void _generic *memset ( - void _generic * buf, - unsigned char ch , - int count - ) +void * memset ( + void * buf, + unsigned char ch , + int count) { - register unsigned char _generic *ret = buf; + register unsigned char * ret = buf; while (count--) { - *(unsigned char _generic *) ret = ch; - ret = ((unsigned char _generic *) ret) + 1; + *(unsigned char *) ret = ch; + ret = ((unsigned char *) ret) + 1; } return buf ; diff --git a/device/lib/_mulint.c b/device/lib/_mulint.c index 44a363da..fa184408 100644 --- a/device/lib/_mulint.c +++ b/device/lib/_mulint.c @@ -207,11 +207,11 @@ unsigned int _muluint (unsigned int a, unsigned int b) // in future: _mulint { #ifdef SDCC_MODEL_LARGE // still needed for large + stack-auto - union uu _xdata *x; - union uu _xdata *y; + union uu xdata *x; + union uu xdata *y; union uu t; - x = (union uu _xdata *)&a; - y = (union uu _xdata *)&b; + x = (union uu xdata *)&a; + y = (union uu xdata *)&b; #else register union uu *x; register union uu *y; diff --git a/device/lib/_mullong.c b/device/lib/_mullong.c index de42c9b0..8ced7e57 100644 --- a/device/lib/_mullong.c +++ b/device/lib/_mullong.c @@ -476,11 +476,11 @@ union bil { struct { unsigned char b0; unsigned int i12; unsigned char b3;} bi; } ; #if defined(SDCC_MODEL_LARGE) || defined (SDCC_ds390) -#define bcast(x) ((union bil _xdata *)&(x)) +#define bcast(x) ((union bil xdata *)&(x)) #elif defined(__z80) || defined(__gbz80) #define bcast(x) ((union bil *)&(x)) #else -#define bcast(x) ((union bil _near *)&(x)) +#define bcast(x) ((union bil near *)&(x)) #endif /* diff --git a/device/lib/_mululong.c b/device/lib/_mululong.c index 0428133b..c7c249d2 100644 --- a/device/lib/_mululong.c +++ b/device/lib/_mululong.c @@ -33,11 +33,11 @@ union bil { struct { unsigned char b0; unsigned int i12; unsigned char b3;} bi; } ; #if defined(SDCC_MODEL_LARGE) || defined (SDCC_ds390) -#define bcast(x) ((union bil _xdata *)&(x)) +#define bcast(x) ((union bil xdata *)&(x)) #elif defined(__z80) || defined(__gbz80) #define bcast(x) ((union bil *)&(x)) #else -#define bcast(x) ((union bil _near *)&(x)) +#define bcast(x) ((union bil near *)&(x)) #endif /* diff --git a/device/lib/_setjmp.c b/device/lib/_setjmp.c index d8beecb2..fb064a22 100644 --- a/device/lib/_setjmp.c +++ b/device/lib/_setjmp.c @@ -25,7 +25,7 @@ -int longjmp (unsigned char _generic *bp, int rv) +int longjmp (unsigned char *bp, int rv) { unsigned char lsp; lsp = *(bp+2); @@ -35,8 +35,8 @@ int longjmp (unsigned char _generic *bp, int rv) return rv; } -int setjmp( unsigned char _generic *bp) { - +int setjmp (unsigned char *bp) +{ /* registers would have been saved on the stack anyway so we need to save SP and the return address */ @@ -44,5 +44,4 @@ int setjmp( unsigned char _generic *bp) { *bp++ = *((unsigned char data *)SP - 1); *bp = SP; return 0; - } diff --git a/device/lib/_strcat.c b/device/lib/_strcat.c index 57a054fc..f4cb9631 100644 --- a/device/lib/_strcat.c +++ b/device/lib/_strcat.c @@ -23,12 +23,12 @@ -------------------------------------------------------------------------*/ #include "string.h" #define NULL (void *)0 -char _generic * strcat ( - char _generic * dst, - char _generic * src +char * strcat ( + char * dst, + char * src ) { - char _generic * cp = dst; + char * cp = dst; while( *cp ) cp++; /* find end of dst */ diff --git a/device/lib/_strchr.c b/device/lib/_strchr.c index 1b53b4a4..ce9c0908 100644 --- a/device/lib/_strchr.c +++ b/device/lib/_strchr.c @@ -24,8 +24,8 @@ #include "string.h" #define NULL (void *)0 -char _generic * strchr ( - char _generic * string, +char * strchr ( + char * string, char ch ) { diff --git a/device/lib/_strcmp.c b/device/lib/_strcmp.c index 571f6961..47681961 100644 --- a/device/lib/_strcmp.c +++ b/device/lib/_strcmp.c @@ -29,16 +29,16 @@ #define NULL (void *)0 int strcmp ( - char _generic *asrc, - char _generic *adst + char * asrc, + char * adst ) { #if _SDCC_Z80_STYLE_LIB_OPT #pragma NOINDUCTION char ret = 0 ; - char _generic *src = asrc; - char _generic *dst = adst; + char * src = asrc; + char * dst = adst; while( ! (*src - *dst) && *dst) ++src, ++dst; diff --git a/device/lib/_strcpy.c b/device/lib/_strcpy.c index 6c2f9434..5e7c1cdb 100644 --- a/device/lib/_strcpy.c +++ b/device/lib/_strcpy.c @@ -28,19 +28,19 @@ #define NULL (void *)0 -char _generic *strcpy ( - char _generic *d, - char _generic *s) +char * strcpy ( + char * d, + char * s) { #if _SDCC_Z80_STYLE_LIB_OPT - register char _generic *to = d; - register char _generic *from = s; + register char * to = d; + register char * from = s; while (*to++ = *from++) ; return d; #else - register char _generic *d1 = d; + register char * d1 = d; while (*d1++ = *s++) ; diff --git a/device/lib/_strcspn.c b/device/lib/_strcspn.c index c5b82eb4..b011e1b8 100644 --- a/device/lib/_strcspn.c +++ b/device/lib/_strcspn.c @@ -25,8 +25,8 @@ #define NULL (void *)0 int strcspn ( - char _generic * string , - char _generic * control + char * string , + char * control ) { register int count = 0 ; diff --git a/device/lib/_strlen.c b/device/lib/_strlen.c index 4172d1a3..d9c546cc 100644 --- a/device/lib/_strlen.c +++ b/device/lib/_strlen.c @@ -24,7 +24,7 @@ #include "string.h" #define NULL (void *)0 -int strlen ( char _generic *str ) +int strlen ( char * str ) { register int i = 0 ; diff --git a/device/lib/_strncat.c b/device/lib/_strncat.c index 6fae2a41..ec28bf44 100644 --- a/device/lib/_strncat.c +++ b/device/lib/_strncat.c @@ -24,13 +24,13 @@ #include "string.h" #define NULL (void *)0 -char _generic * strncat ( - char _generic * front, - char _generic * back, +char * strncat ( + char * front, + char * back, int count ) { - char _generic *start = front; + char *start = front; while (*front++); diff --git a/device/lib/_strncmp.c b/device/lib/_strncmp.c index 597a1ec7..2b7e9904 100644 --- a/device/lib/_strncmp.c +++ b/device/lib/_strncmp.c @@ -25,8 +25,8 @@ #define NULL (void *)0 int strncmp ( - char _generic * first, - char _generic * last, + char * first, + char * last, int count ) { diff --git a/device/lib/_strncpy.c b/device/lib/_strncpy.c index 5baf5881..1fe12f6f 100644 --- a/device/lib/_strncpy.c +++ b/device/lib/_strncpy.c @@ -24,12 +24,12 @@ #include "string.h" #define NULL (void *)0 -char _generic *strncpy ( - char _generic *d , - char _generic *s , - int n ) +char *strncpy ( + char * d, + char * s, + int n ) { - register char _generic *d1 = d; + register char * d1 = d; while ( n-- ) *d++ = *s++ ; diff --git a/device/lib/_strpbrk.c b/device/lib/_strpbrk.c index 9ed6aebc..9938438a 100644 --- a/device/lib/_strpbrk.c +++ b/device/lib/_strpbrk.c @@ -24,9 +24,9 @@ #include "string.h" #define NULL (void *)0 -char _generic *strpbrk ( - char _generic *string , - char _generic *control +char * strpbrk ( + char * string , + char * control ) { register char ch ; diff --git a/device/lib/_strrchr.c b/device/lib/_strrchr.c index f1cacd3d..3ed636e4 100644 --- a/device/lib/_strrchr.c +++ b/device/lib/_strrchr.c @@ -24,12 +24,12 @@ #include "string.h" #define NULL (void *)0 -char _generic * strrchr ( - char _generic * string, +char * strrchr ( + char * string, char ch ) { - char _generic *start = string; + char * start = string; while (*string++) /* find end of string */ ; @@ -38,7 +38,7 @@ char _generic * strrchr ( ; if (*string == ch) /* char found ? */ - return( (char _generic *)string ); + return( (char *)string ); return (NULL) ; } diff --git a/device/lib/_strspn.c b/device/lib/_strspn.c index 274b49e6..377aeed9 100644 --- a/device/lib/_strspn.c +++ b/device/lib/_strspn.c @@ -25,8 +25,8 @@ #define NULL (void *)0 int strspn ( - char _generic * string, - char _generic * control + char * string, + char * control ) { register int count = 0; diff --git a/device/lib/_strstr.c b/device/lib/_strstr.c index 9969f318..13d36e5c 100644 --- a/device/lib/_strstr.c +++ b/device/lib/_strstr.c @@ -24,14 +24,14 @@ #include "string.h" #define NULL (void *)0 -char _generic * strstr ( - char _generic * str1, - char _generic * str2 +char * strstr ( + char * str1, + char * str2 ) { - char _generic *cp = str1; - char _generic *s1; - char _generic *s2; + char * cp = str1; + char * s1; + char * s2; if ( !*str2 ) return str1; diff --git a/device/lib/_strtok.c b/device/lib/_strtok.c index 786317ea..7f00370a 100644 --- a/device/lib/_strtok.c +++ b/device/lib/_strtok.c @@ -29,13 +29,12 @@ #pragma NOINVARIANT #endif -char _generic *strtok ( - char _generic *str , - char _generic *control - ) +char * strtok ( + char * str, + char * control ) { - static char _generic *s ; - register char _generic *s1 ; + static char * s; + register char * s1; if ( str ) s = str ; diff --git a/device/lib/ds390/memcpyx.c b/device/lib/ds390/memcpyx.c index d8c4df1f..56e5e3a9 100644 --- a/device/lib/ds390/memcpyx.c +++ b/device/lib/ds390/memcpyx.c @@ -1,8 +1,8 @@ #include -void _xdata * memcpyx ( - void _xdata * dst, - void _xdata * src, +void xdata * memcpyx ( + void xdata * dst, + void xdata * src, int count ) _naked { diff --git a/device/lib/malloc.c b/device/lib/malloc.c index e9a67e11..18987901 100644 --- a/device/lib/malloc.c +++ b/device/lib/malloc.c @@ -16,19 +16,19 @@ MEMHEADER { - MEMHEADER _xdata * next; - MEMHEADER _xdata * prev; + MEMHEADER xdata * next; + MEMHEADER xdata * prev; unsigned int len; unsigned char mem[1]; }; #define HEADER_SIZE (sizeof(MEMHEADER)-1) - #define NULL (void _xdata * ) 0 + #define NULL (void xdata * ) 0 //Static here means: can be accessed from this module only - static MEMHEADER _xdata * FIRST_MEMORY_HEADER_PTR; - void init_dynamic_memory(MEMHEADER _xdata * array, unsigned int size) + static MEMHEADER xdata * FIRST_MEMORY_HEADER_PTR; + void init_dynamic_memory(MEMHEADER xdata * array, unsigned int size) { //This function MUST be called after the RESET. @@ -52,21 +52,21 @@ if ( !array ) /*Reserved memory starts on 0x0000 but it's NULL...*/ { //So, we lost one byte! - array = (MEMHEADER _xdata * )((char _xdata * ) array + 1) ; + array = (MEMHEADER xdata * )((char xdata * ) array + 1) ; size --; } FIRST_MEMORY_HEADER_PTR = array; //Reserve a mem for last header - array->next = (MEMHEADER _xdata * )(((char _xdata * ) array) + size - HEADER_SIZE); + array->next = (MEMHEADER xdata * )(((char xdata * ) array) + size - HEADER_SIZE); array->next->next = NULL; //And mark it as last array->prev = NULL; //and mark first as first array->len = 0; //Empty and ready. } - void _xdata * malloc (unsigned int size) + void xdata * malloc (unsigned int size) { - register MEMHEADER _xdata * current_header; - register MEMHEADER _xdata * new_header; + register MEMHEADER xdata * current_header; + register MEMHEADER xdata * new_header; if (size>(0xFFFF-HEADER_SIZE)) return NULL; //To prevent overflow in next line size += HEADER_SIZE; //We need a memory for header too @@ -92,7 +92,7 @@ current_header->len = size; //for first allocation return (current_header->mem); } //else create new header at the begin of spare - new_header = (MEMHEADER _xdata * )((char _xdata *)current_header + current_header->len); + new_header = (MEMHEADER xdata * )((char xdata *)current_header + current_header->len); new_header->next = current_header->next; //and plug it into the chain new_header->prev = current_header; current_header->next = new_header; @@ -101,12 +101,12 @@ return (new_header->mem); } - void free (MEMHEADER _xdata * p) + void free (MEMHEADER xdata * p) { - register MEMHEADER _xdata * prev_header; + register MEMHEADER xdata * prev_header; if ( p ) //For allocated pointers only! { - p = (MEMHEADER _xdata * )((char _xdata *) p - HEADER_SIZE); //to start of header + p = (MEMHEADER xdata * )((char xdata *) p - HEADER_SIZE); //to start of header if ( p->prev ) // For the regular header { prev_header = p->prev; diff --git a/device/lib/printf_fast.c b/device/lib/printf_fast.c index 15a0b078..fc067d18 100644 --- a/device/lib/printf_fast.c +++ b/device/lib/printf_fast.c @@ -149,12 +149,12 @@ printf_eot: /* print a string... just grab each byte with __gptrget */ - /* the user much pass a 24 bit _generic pointer */ + /* the user much pass a 24 bit generic pointer */ printf_string: push dph // save addr in fmt onto stack push dpl - mov b, @r0 // b has type of address (_generic *) + mov b, @r0 // b has type of address (generic *) dec r0 mov dph, @r0 dec r0 diff --git a/device/lib/printfl.c b/device/lib/printfl.c index 121914bb..0754fb79 100644 --- a/device/lib/printfl.c +++ b/device/lib/printfl.c @@ -37,7 +37,7 @@ %lo octal long %ho octal char %c character char - %s character _generic pointer + %s character generic pointer */ #include @@ -143,7 +143,7 @@ void printf_small (char * fmt, ... ) reentrant } if (string_flag) { - str = va_arg(ap, char _generic *); + str = va_arg(ap, char *); while (*str) putchar(*str++); continue ; } diff --git a/device/lib/vprintf.c b/device/lib/vprintf.c index 28b81d6c..77bd361f 100644 --- a/device/lib/vprintf.c +++ b/device/lib/vprintf.c @@ -49,7 +49,7 @@ /****************************************************************************/ -typedef char _generic *ptr_t; +typedef char * ptr_t; #ifdef toupper #undef toupper @@ -64,7 +64,7 @@ typedef union long l; unsigned long ul; float f; - char _generic *p; + char *p; } value_t;