aboutsummaryrefslogtreecommitdiffstats
path: root/myctype.h
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:18:09 +0000
committerTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:18:09 +0000
commit5f8e0f8ef9a422691dd72e8a953a42a41478fcb4 (patch)
tree4b2df4796a534793648b3c4fc532fc36bd0cd525 /myctype.h
parentReleasing debian version 0.3-2.4 (diff)
downloadw3m-7867af0e1dc0477b9fdc08cf6e3aee68f03ae9f1.tar.gz
w3m-7867af0e1dc0477b9fdc08cf6e3aee68f03ae9f1.zip
Releasing debian version 0.5.1-1debian/0.5.1-1
Diffstat (limited to 'myctype.h')
-rw-r--r--myctype.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/myctype.h b/myctype.h
new file mode 100644
index 0000000..97e2105
--- /dev/null
+++ b/myctype.h
@@ -0,0 +1,35 @@
+/* $Id: myctype.h,v 1.6 2003/09/22 21:02:20 ukai Exp $ */
+#ifndef _MYCTYPE_H
+#define _MYCTYPE_H
+
+#define MYCTYPE_CNTRL 1
+#define MYCTYPE_SPACE 2
+#define MYCTYPE_ALPHA 4
+#define MYCTYPE_DIGIT 8
+#define MYCTYPE_PRINT 16
+#define MYCTYPE_HEX 32
+#define MYCTYPE_INTSPACE 64
+#define MYCTYPE_ASCII (MYCTYPE_CNTRL|MYCTYPE_PRINT)
+#define MYCTYPE_ALNUM (MYCTYPE_ALPHA|MYCTYPE_DIGIT)
+#define MYCTYPE_XDIGIT (MYCTYPE_HEX|MYCTYPE_DIGIT)
+
+#define GET_MYCTYPE(x) (MYCTYPE_MAP[(int)(unsigned char)(x)])
+#define GET_MYCDIGIT(x) (MYCTYPE_DIGITMAP[(int)(unsigned char)(x)])
+
+#define IS_CNTRL(x) (GET_MYCTYPE(x) & MYCTYPE_CNTRL)
+#define IS_SPACE(x) (GET_MYCTYPE(x) & MYCTYPE_SPACE)
+#define IS_ALPHA(x) (GET_MYCTYPE(x) & MYCTYPE_ALPHA)
+#define IS_DIGIT(x) (GET_MYCTYPE(x) & MYCTYPE_DIGIT)
+#define IS_PRINT(x) (GET_MYCTYPE(x) & MYCTYPE_PRINT)
+#define IS_ASCII(x) (GET_MYCTYPE(x) & MYCTYPE_ASCII)
+#define IS_ALNUM(x) (GET_MYCTYPE(x) & MYCTYPE_ALNUM)
+#define IS_XDIGIT(x) (GET_MYCTYPE(x) & MYCTYPE_XDIGIT)
+#define IS_INTSPACE(x) (MYCTYPE_MAP[(unsigned char)(x)] & MYCTYPE_INTSPACE)
+
+extern unsigned char MYCTYPE_MAP[];
+extern unsigned char MYCTYPE_DIGITMAP[];
+
+#define TOLOWER(x) (IS_ALPHA(x) ? ((x)|0x20) : (x))
+#define TOUPPER(x) (IS_ALPHA(x) ? ((x)&~0x20) : (x))
+
+#endif