Explorar o código

LibC: Add support for isblank()

Gunnar Beutner %!s(int64=4) %!d(string=hai) anos
pai
achega
3df7f868e8
Modificáronse 2 ficheiros con 13 adicións e 0 borrados
  1. 6 0
      Userland/Libraries/LibC/ctype.cpp
  2. 7 0
      Userland/Libraries/LibC/ctype.h

+ 6 - 0
Userland/Libraries/LibC/ctype.cpp

@@ -119,6 +119,12 @@ int isascii(int c)
     return ((unsigned)c <= 127);
     return ((unsigned)c <= 127);
 }
 }
 
 
+#undef isblank
+int isblank(int c)
+{
+    return __inline_isblank(c);
+}
+
 #undef toascii
 #undef toascii
 int toascii(int c)
 int toascii(int c)
 {
 {

+ 7 - 0
Userland/Libraries/LibC/ctype.h

@@ -102,6 +102,11 @@ static inline int __inline_isupper(int c)
     return _ctype_[(unsigned char)(c)] & (_U);
     return _ctype_[(unsigned char)(c)] & (_U);
 }
 }
 
 
+static inline int __inline_isblank(int c)
+{
+    return _ctype_[(unsigned char)(c)] & (_B) || (c == '\t');
+}
+
 static inline int __inline_toascii(int c)
 static inline int __inline_toascii(int c)
 {
 {
     return c & 127;
     return c & 127;
@@ -137,6 +142,7 @@ int isprint(int c);
 int isgraph(int c);
 int isgraph(int c);
 int islower(int c);
 int islower(int c);
 int isupper(int c);
 int isupper(int c);
+int isblank(int c);
 int toascii(int c);
 int toascii(int c);
 int tolower(int c);
 int tolower(int c);
 int toupper(int c);
 int toupper(int c);
@@ -156,6 +162,7 @@ int toupper(int c);
 #define isgraph __inline_isgraph
 #define isgraph __inline_isgraph
 #define islower __inline_islower
 #define islower __inline_islower
 #define isupper __inline_isupper
 #define isupper __inline_isupper
+#define isblank __inline_isblank
 #define toascii __inline_toascii
 #define toascii __inline_toascii
 #define tolower __inline_tolower
 #define tolower __inline_tolower
 #define toupper __inline_toupper
 #define toupper __inline_toupper