--- /dev/null
+/*
+ * Acess2 Kernel
+ * - By John Hodge (thePowersGang)
+ *
+ * ctype.h
+ * -
+ */
+#ifndef _ACESS__CTYPE_H_
+#define _ACESS__CTYPE_H_
+
+extern int isalnum(int c);
+extern int isalpha(int c);
+extern int isascii(int c);
+extern int isblank(int c);
+extern int iscntrl(int c);
+extern int isdigit(int c);
+extern int isgraph(int c);
+extern int islower(int c);
+extern int isprint(int c);
+extern int ispunct(int c);
+extern int isspace(int c);
+extern int isupper(int c);
+extern int isxdigit(int c);
+
+extern int toupper(int c);
+extern int tolower(int c);
+
+#endif
+
int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args);
int snprintf(char *__s, size_t __n, const char *__format, ...);
int sprintf(char *__s, const char *__format, ...);
-#endif
- int tolower(int c);
-#if 0
int strucmp(const char *Str1, const char *Str2);
char *strchr(const char *__s, int __c);
int strpos(const char *Str, char Ch);
EXPORT(snprintf);
EXPORT(sprintf);
EXPORT(tolower);
+
EXPORT(strucmp);
EXPORT(strchr);
EXPORT(strpos);
return ret;
}
-/**
- * \fn int tolower(int c)
- * \brief Converts a character to lower case
+/*
+ * ==================
+ * ctype.h
+ * ==================
*/
+int isalnum(int c)
+{
+ return isalpha(c) || isdigit(c);
+}
+int isalpha(int c)
+{
+ return isupper(c) || islower(c);
+}
+int isascii(int c)
+{
+ return (0 <= c && c < 128);
+}
+int isblank(int c)
+{
+ if(c == '\t') return 1;
+ if(c == ' ') return 1;
+ return 0;
+}
+int iscntrl(int c)
+{
+ // TODO: Check iscntrl
+ if(c < ' ') return 1;
+ return 0;
+}
+int isdigit(int c)
+{
+ return ('0' <= c && c <= '9');
+}
+int isgraph(int c)
+{
+ // TODO: Check isgraph
+ return 0;
+}
+int islower(int c)
+{
+ return ('a' <= c && c <= 'z');
+}
+int isprint(int c)
+{
+ if( ' ' <= c && c <= 0x7F ) return 1;
+ return 0;
+}
+int ispunct(int c)
+{
+ switch(c)
+ {
+ case '.': case ',':
+ case '?': case '!':
+ return 1;
+ default:
+ return 0;
+ }
+}
+int isspace(int c)
+{
+ if(c == ' ') return 1;
+ if(c == '\t') return 1;
+ if(c == '\v') return 1;
+ if(c == '\n') return 1;
+ if(c == '\r') return 1;
+ return 0;
+}
+int isupper(int c)
+{
+ return ('a' <= c && c <= 'z');
+}
+int isxdigit(int c)
+{
+ return isdigit(c) || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F');
+}
+
+int toupper(int c)
+{
+ if( islower(c) )
+ return c - 0x20;
+ else
+ return c;
+}
int tolower(int c)
{
- if('A' <= c && c <= 'Z')
- return c - 'A' + 'a';
- return c;
+ if( isupper(c) )
+ return c + 0x20;
+ else
+ return c;
}
/**