summaryrefslogtreecommitdiff
path: root/05/tcc-0.9.27/ctype.h
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-02-18 12:36:57 -0500
committerpommicket <pommicket@gmail.com>2022-02-18 12:36:57 -0500
commit826d1afd58c2e064a9c8fdb09eda1b08469de1a8 (patch)
treeb4fedc589a1944f6cf3f451a9db976b431e89b25 /05/tcc-0.9.27/ctype.h
parentc42c5d94b8944e19cd17a5b540e4c70013c62b92 (diff)
newer version of tcc almost working
Diffstat (limited to '05/tcc-0.9.27/ctype.h')
-rw-r--r--05/tcc-0.9.27/ctype.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/05/tcc-0.9.27/ctype.h b/05/tcc-0.9.27/ctype.h
new file mode 100644
index 0000000..ed6833d
--- /dev/null
+++ b/05/tcc-0.9.27/ctype.h
@@ -0,0 +1,92 @@
+#ifndef _CTYPE_H
+#define _CTYPE_H
+
+#include <stdc_common.h>
+
+int islower(int c) {
+ return c >= 'a' && c <= 'z';
+}
+
+int isupper(int c) {
+ return c >= 'A' && c <= 'Z';
+}
+
+int isalpha(int c) {
+ return isupper(c) || islower(c);
+}
+
+int isalnum(int c) {
+ return isalpha(c) || isdigit(c);
+}
+
+int isprint(int c) {
+ if (isalnum(c)) return 1;
+ switch (c) {
+ case '!': return 1;
+ case '@': return 1;
+ case '#': return 1;
+ case '$': return 1;
+ case '%': return 1;
+ case '^': return 1;
+ case '&': return 1;
+ case '*': return 1;
+ case '(': return 1;
+ case ')': return 1;
+ case '-': return 1;
+ case '=': return 1;
+ case '_': return 1;
+ case '+': return 1;
+ case '`': return 1;
+ case '~': return 1;
+ case '[': return 1;
+ case '{': return 1;
+ case ']': return 1;
+ case '}': return 1;
+ case '\\': return 1;
+ case '|': return 1;
+ case ';': return 1;
+ case ':': return 1;
+ case '\'': return 1;
+ case '"': return 1;
+ case ',': return 1;
+ case '<': return 1;
+ case '.': return 1;
+ case '>': return 1;
+ case '/': return 1;
+ case '?': return 1;
+ }
+ return 0;
+}
+
+int iscntrl(int c) {
+ return !isprint(c);
+}
+
+int isgraph(int c) {
+ return isprint(c) && c != ' ';
+}
+
+int ispunct(int c) {
+ return isprint(c) && c != ' ' && !isalnum(c);
+}
+
+int isxdigit(int c) {
+ if (isdigit(c)) return 1;
+ if (c >= 'a' && c <= 'f') return 1;
+ if (c >= 'A' && c <= 'F') return 1;
+ return 0;
+}
+
+int tolower(int c) {
+ if (c >= 'A' && c <= 'Z')
+ return c - 'A' + 'a';
+ return c;
+}
+
+int toupper(int c) {
+ if (c >= 'a' && c <= 'z')
+ return c - 'a' + 'A';
+ return c;
+}
+
+#endif // _CTYPE_H