X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_string.h;h=776ef8ec0e4d18e1d19feb55a364a1a765cd9484;hb=a1d3e2f36e9ef64ca62c611c4f0aa050726e186b;hp=c5cf8b80493f21cd285041c402c84b0e0743a333;hpb=e70e95962c26832628d586e07f9cd1a2e1852d72;p=palacios.git diff --git a/palacios/include/palacios/vmm_string.h b/palacios/include/palacios/vmm_string.h index c5cf8b8..776ef8e 100644 --- a/palacios/include/palacios/vmm_string.h +++ b/palacios/include/palacios/vmm_string.h @@ -34,7 +34,8 @@ #ifdef __V3VEE__ -#include +#include + void* memset(void* s, int c, size_t n); void* memcpy(void *dst, const void* src, size_t n); @@ -45,6 +46,7 @@ size_t strnlen(const char *s, size_t maxlen); int strcmp(const char* s1, const char* s2); int strncmp(const char* s1, const char* s2, size_t limit); char *strcat(char *s1, const char *s2); +char *strncat(char *s1, const char *s2, size_t limit); char *strcpy(char *dest, const char *src); char *strncpy(char *dest, const char *src, size_t limit); char *strdup(const char *s1); @@ -54,7 +56,13 @@ char *strrchr(const char *s, int c); char *strpbrk(const char *s, const char *accept); -double ceil(double x); + +#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') #endif // !__V3VEE__