1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:47:35 +00:00

LibC: A bunch of compat work towards porting GCC.

This commit is contained in:
Andreas Kling 2019-02-24 15:19:32 +01:00
parent 9fd4f4862b
commit 93c0dfd1d7
18 changed files with 166 additions and 13 deletions

View file

@ -70,6 +70,28 @@ ALWAYS_INLINE int __iscntrl(int c)
return (c >= 0 && c <= 0x1f) || c == 0x7f;
}
ALWAYS_INLINE int __isxdigit(int c)
{
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
}
#ifdef __cplusplus
#define __CTYPE_FUNC(name) static inline int name(int c) { return __ ## name(c); }
__CTYPE_FUNC(isascii)
__CTYPE_FUNC(isspace)
__CTYPE_FUNC(islower)
__CTYPE_FUNC(isupper)
__CTYPE_FUNC(tolower)
__CTYPE_FUNC(toupper)
__CTYPE_FUNC(isdigit)
__CTYPE_FUNC(ispunct)
__CTYPE_FUNC(isprint)
__CTYPE_FUNC(isalpha)
__CTYPE_FUNC(isalnum)
__CTYPE_FUNC(iscntrl)
__CTYPE_FUNC(isxdigit)
#else
#define isascii(c) __isascii(c)
#define isspace(c) __isspace(c)
#define islower(c) __islower(c)
@ -82,5 +104,7 @@ ALWAYS_INLINE int __iscntrl(int c)
#define isalpha(c) __isalpha(c)
#define isalnum(c) __isalnum(c)
#define iscntrl(c) __iscntrl(c)
#define isxdigit(c) __isxdigit(c)
#endif
__END_DECLS