PSP2SDK  dirty-f9e4f2d
The free SDK for PSP2
include/string.h
00001 /*
00002  * Copyright (C) 2015 PSP2SDK Project
00003  *
00004  * This Source Code Form is subject to the terms of the Mozilla Public
00005  * License, v. 2.0. If a copy of the MPL was not distributed with this
00006  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00007  *
00008  * Modified for PSP2 by PSP2SDK Team
00009  *
00010  * string.h
00011  *
00012  * Definitions for memory and string functions.
00013  */
00014 
00015 #ifndef _STRING_H_
00016 #define _STRING_H_
00017 
00018 #include "_ansi.h"
00019 #include <sys/cdefs.h>
00020 #include <sys/features.h>
00021 
00022 #define __need_size_t
00023 #define __need_NULL
00024 #include <stddef.h>
00025 
00026 _BEGIN_STD_C
00027 
00028 _PTR     _EXFUN(memchr,(const _PTR, int, size_t));
00029 int      _EXFUN(memcmp,(const _PTR, const _PTR, size_t));
00030 _PTR     _EXFUN(memcpy,(_PTR __restrict, const _PTR __restrict, size_t));
00031 _PTR     _EXFUN(memmove,(_PTR, const _PTR, size_t));
00032 _PTR     _EXFUN(memset,(_PTR, int, size_t));
00033 char    *_EXFUN(strcat,(char *__restrict, const char *__restrict));
00034 char    *_EXFUN(strchr,(const char *, int));
00035 int  _EXFUN(strcmp,(const char *, const char *));
00036 int  _EXFUN(strcoll,(const char *, const char *));
00037 char    *_EXFUN(strcpy,(char *__restrict, const char *__restrict));
00038 size_t   _EXFUN(strcspn,(const char *, const char *));
00039 char    *_EXFUN(strerror,(int));
00040 size_t   _EXFUN(strlen,(const char *));
00041 char    *_EXFUN(strncat,(char *__restrict, const char *__restrict, size_t));
00042 int  _EXFUN(strncmp,(const char *, const char *, size_t));
00043 char    *_EXFUN(strncpy,(char *__restrict, const char *__restrict, size_t));
00044 char    *_EXFUN(strpbrk,(const char *, const char *));
00045 char    *_EXFUN(strrchr,(const char *, int));
00046 size_t   _EXFUN(strspn,(const char *, const char *));
00047 char    *_EXFUN(strstr,(const char *, const char *));
00048 #ifndef _REENT_ONLY
00049 char    *_EXFUN(strtok,(char *__restrict, const char *__restrict));
00050 #endif
00051 size_t   _EXFUN(strxfrm,(char *__restrict, const char *__restrict, size_t));
00052 
00053 #if __POSIX_VISIBLE
00054 char    *_EXFUN(strtok_r,(char *__restrict, const char *__restrict, char **__restrict));
00055 #endif
00056 #if __BSD_VISIBLE
00057 int  _EXFUN(bcmp,(const void *, const void *, size_t));
00058 void     _EXFUN(bcopy,(const void *, void *, size_t));
00059 void     _EXFUN(bzero,(void *, size_t));
00060 int  _EXFUN(ffs,(int));
00061 char    *_EXFUN(index,(const char *, int));
00062 #endif
00063 #if __BSD_VISIBLE || __XSI_VISIBLE
00064 _PTR     _EXFUN(memccpy,(_PTR __restrict, const _PTR __restrict, int, size_t));
00065 #endif
00066 #if __GNU_VISIBLE
00067 _PTR     _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
00068 _PTR     _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
00069 #endif
00070 _PTR     _EXFUN(memrchr,(const _PTR, int, size_t));
00071 #if __GNU_VISIBLE
00072 _PTR     _EXFUN(rawmemchr,(const _PTR, int));
00073 #endif
00074 #if __BSD_VISIBLE
00075 char    *_EXFUN(rindex,(const char *, int));
00076 #endif
00077 char    *_EXFUN(stpcpy,(char *__restrict, const char *__restrict));
00078 char    *_EXFUN(stpncpy,(char *__restrict, const char *__restrict, size_t));
00079 #if __BSD_VISIBLE || __POSIX_VISIBLE
00080 int  _EXFUN(strcasecmp,(const char *, const char *));
00081 #endif
00082 #if __GNU_VISIBLE
00083 char    *_EXFUN(strcasestr,(const char *, const char *));
00084 char    *_EXFUN(strchrnul,(const char *, int));
00085 #endif
00086 #if __XSI_VISIBLE >= 500
00087 char    *_EXFUN(strdup,(const char *));
00088 #endif
00089 #if __XSI_VISIBLE >= 700
00090 char    *_EXFUN(strndup,(const char *, size_t));
00091 #endif
00092 
00093 #if __GNU_VISIBLE
00094 int  _EXFUN(ffsl,(long));
00095 int  _EXFUN(ffsll, (long long));
00096 #endif
00097 
00098 /* There are two common strerror_r variants.  If you request
00099    _GNU_SOURCE, you get the GNU version; otherwise you get the POSIX
00100    version.  POSIX requires that #undef strerror_r will still let you
00101    invoke the underlying function, but that requires gcc support.  */
00102 #if __GNU_VISIBLE
00103 char    *_EXFUN(strerror_r,(int, char *, size_t));
00104 #else
00105 # ifdef __GNUC__
00106 int _EXFUN(strerror_r,(int, char *, size_t))
00107              __asm__ (__ASMNAME ("__xpg_strerror_r"));
00108 # else
00109 int _EXFUN(__xpg_strerror_r,(int, char *, size_t));
00110 #  define strerror_r __xpg_strerror_r
00111 # endif
00112 #endif
00113 
00114 #if __BSD_VISIBLE
00115 size_t  _EXFUN(strlcat,(char *, const char *, size_t));
00116 size_t  _EXFUN(strlcpy,(char *, const char *, size_t));
00117 #endif
00118 #if __BSD_VISIBLE || __POSIX_VISIBLE
00119 int _EXFUN(strncasecmp,(const char *, const char *, size_t));
00120 #endif
00121 #if !defined(__STRICT_ANSI__) || __POSIX_VISIBLE >= 200809 || \
00122     __XSI_VISIBLE >= 700
00123 size_t   _EXFUN(strnlen,(const char *, size_t));
00124 #endif
00125 #if __BSD_VISIBLE
00126 char    *_EXFUN(strsep,(char **, const char *));
00127 #endif
00128 
00129 /*
00130  * The origin of these is unknown to me so I am conditionalizing them
00131  * on __STRICT_ANSI__. Finetuning this is definitely needed. --joel
00132  */
00133 #if !defined(__STRICT_ANSI__)
00134 char    *_EXFUN(strlwr,(char *));
00135 char    *_EXFUN(strupr,(char *));
00136 #endif
00137 
00138 #ifndef DEFS_H  /* Kludge to work around problem compiling in gdb */
00139 char    *_EXFUN(strsignal, (int __signo));
00140 #endif
00141 
00142 #ifdef __CYGWIN__
00143 int _EXFUN(strtosigno, (const char *__name));
00144 #endif
00145 
00146 #if defined _GNU_SOURCE && defined __GNUC__
00147 #define strdupa(__s) \
00148     (__extension__ ({const char *__in = (__s); \
00149              size_t __len = strlen (__in) + 1; \
00150              char * __out = (char *) __builtin_alloca (__len); \
00151              (char *) memcpy (__out, __in, __len);}))
00152 #define strndupa(__s, __n) \
00153     (__extension__ ({const char *__in = (__s); \
00154              size_t __len = strnlen (__in, (__n)) + 1; \
00155              char *__out = (char *) __builtin_alloca (__len); \
00156              __out[__len-1] = '\0'; \
00157              (char *) memcpy (__out, __in, __len-1);}))
00158 #endif /* _GNU_SOURCE && __GNUC__ */
00159 
00160 #include <sys/string.h>
00161 
00162 _END_STD_C
00163 
00164 #endif /* _STRING_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines