X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_string.h;fp=palacios%2Finclude%2Fpalacios%2Fvmm_string.h;h=2e57bf97db0fcb52263266b2e51de6abe064167d;hb=94eb64dbd7ce27642db449e49cb86d04b11c427d;hp=776ef8ec0e4d18e1d19feb55a364a1a765cd9484;hpb=3dd047dc0f70231ea93e5b3b40a9142a391bf507;p=palacios.git diff --git a/palacios/include/palacios/vmm_string.h b/palacios/include/palacios/vmm_string.h index 776ef8e..2e57bf9 100644 --- a/palacios/include/palacios/vmm_string.h +++ b/palacios/include/palacios/vmm_string.h @@ -34,7 +34,7 @@ #ifdef __V3VEE__ -#include +#include void* memset(void* s, int c, size_t n); @@ -57,12 +57,21 @@ char *strpbrk(const char *s, const char *accept); -#define in_range(c, lo, up) ((uint8_t)c >= lo && (uint8_t)c <= up) -#define isprint(c) in_range(c, 0x20, 0x7f) -#define isdigit(c) in_range(c, '0', '9') -#define isxdigit(c) (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F')) -#define islower(c) in_range(c, 'a', 'z') + + #define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v') +#define isascii(c) (((c) & ~0x7f) == 0) +#define isupper(c) ((c) >= 'A' && (c) <= 'Z') +#define islower(c) ((c) >= 'a' && (c) <= 'z') +#define isalpha(c) (isupper(c) || islower(c)) +#define isdigit(c) ((c) >= '0' && (c) <= '9') +#define isxdigit(c) (isdigit(c) \ + || ((c) >= 'A' && (c) <= 'F') \ + || ((c) >= 'a' && (c) <= 'f')) +#define isprint(c) ((c) >= ' ' && (c) <= '~') + +#define toupper(c) ((c) - 0x20 * (((c) >= 'a') && ((c) <= 'z'))) +#define tolower(c) ((c) + 0x20 * (((c) >= 'A') && ((c) <= 'Z'))) #endif // !__V3VEE__