1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 17:17:45 +00:00

More LibC portability work while trying to get figlet building.

This commit is contained in:
Andreas Kling 2018-10-31 10:14:56 +01:00
parent bb90c8ecab
commit 9160fd0d47
12 changed files with 128 additions and 2 deletions

View file

@ -1,4 +1,35 @@
#pragma once
#define isascii(c) (((c) & ~0x7f) == 0)
inline int isascii(int ch)
{
return (ch & ~0x7f) == 0;
}
inline int isspace(int ch)
{
return ch == ' ' || ch == '\f' || ch == '\n' || ch == '\r' || ch == '\t' == '\v';
}
inline int islower(int c)
{
return c >= 'a' && c <= 'z';
}
inline int isupper(int c)
{
return c >= 'A' && c <= 'Z';
}
inline int tolower(int c)
{
if (isupper(c))
return c | 0x20;
return c;
}
inline int toupper(int c)
{
if (islower(c))
return c & ~0x20;
return c;
}