123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- #ifndef __SDCC_STRING_H
- #define __SDCC_STRING_H 1
- #ifndef NULL
- # define NULL (void *)0
- #endif
- #ifndef __SIZE_T_DEFINED
- # define __SIZE_T_DEFINED
- typedef unsigned int size_t;
- #endif
- #if defined (__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__
- #ifndef __RSIZE_T_DEFINED
- #define __RSIZE_T_DEFINED
- typedef size_t rsize_t;
- #endif
- #ifndef __ERRNO_T_DEFINED
- #define __ERRNO_T_DEFINED
- typedef int errno_t;
- #endif
- #endif
- #if defined(__SDCC_mcs51) || defined(__SDCC_hc08) || defined(__SDCC_ds390) || defined(__SDCC_pic14) || defined(__SDCC_pic16)
- #define __SDCC_BROKEN_STRING_FUNCTIONS
- #endif
- extern void *memcpy (void * dest, const void * src, size_t n);
- extern void *memmove (void *dest, const void *src, size_t n);
- extern char *strcpy (char * dest, const char * src);
- extern char *strncpy(char * dest, const char * src, size_t n);
- extern char *strcat (char * dest, const char * src);
- extern char *strncat(char * dest, const char * src, size_t n);
- extern int memcmp (const void *s1, const void *s2, size_t n);
- extern int strcmp (const char *s1, const char *s2);
- #define strcoll(s1, s2) strcmp(s1, s2)
- extern int strncmp(const char *s1, const char *s2, size_t n);
- extern size_t strxfrm(char *dest, const char *src, size_t n);
- extern void *memchr (const void *s, int c, size_t n);
- #ifdef __SDCC_BROKEN_STRING_FUNCTIONS
- extern char *strchr (const char *s, char c);
- #else
- extern char *strchr (const char *s, int c);
- #endif
- extern size_t strcspn(const char *s, const char *reject);
- extern char *strpbrk(const char *s, const char *accept);
- #ifdef __SDCC_BROKEN_STRING_FUNCTIONS
- extern char *strrchr(const char *s, char c);
- #else
- extern char *strrchr(const char *s, int c);
- #endif
- extern size_t strspn (const char *s, const char *accept);
- extern char *strstr (const char *haystack, const char *needle);
- extern char *strtok (char * str, const char * delim);
- #ifdef __SDCC_BROKEN_STRING_FUNCTIONS
- extern void *memset (void *s, unsigned char c, size_t n);
- #else
- extern void *memset (void *s, int c, size_t n);
- #endif
- extern size_t strlen (const char *s);
- #ifdef __SDCC_ds390
- extern void __xdata * memcpyx(void __xdata *, void __xdata *, int) __naked;
- #endif
- #if defined(__SDCC_z80) || defined(__SDCC_z180) || defined(__SDCC_r2k) || defined(__SDCC_r3ka)
- #define memcpy(dst, src, n) __builtin_memcpy(dst, src, n)
- #define strcpy(dst, src) __builtin_strcpy(dst, src)
- #define strncpy(dst, src, n) __builtin_strncpy(dst, src, n)
- #define strchr(s, c) __builtin_strchr(s, c)
- #define memset(dst, c, n) __builtin_memset(dst, c, n)
- #endif
- #endif
|