date and time created 84/12/13 16:26:24 by edward
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Fri, 14 Dec 1984 08:26:24 +0000 (00:26 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Fri, 14 Dec 1984 08:26:24 +0000 (00:26 -0800)
SCCS-vsn: bin/csh/char.h 4.1

usr/src/bin/csh/char.h [new file with mode: 0644]

diff --git a/usr/src/bin/csh/char.h b/usr/src/bin/csh/char.h
new file mode 100644 (file)
index 0000000..60f7f89
--- /dev/null
@@ -0,0 +1,25 @@
+/* @(#)char.h  4.1 (Berkeley) %G% */
+
+/*
+ * Table for spotting special characters quickly
+ *
+ * Makes for very obscure but efficient coding.
+ */
+
+extern char _cmap[];
+
+#define _Q     0x01            /* '" */
+#define _Q1    0x02            /* ` */
+#define _SP    0x04            /* space and tab */
+#define _NL    0x08            /* \n */
+#define _META  0x10            /* lex meta characters, sp #'`";&<>()|\t\n */
+#define _GLOB  0x20            /* glob characters, *?{[` */
+#define _ESC   0x40            /* \ */
+#define _DOL   0x80            /* $ */
+
+#define cmap(c, bits)  (_cmap[(unsigned char)(c)] & (bits))
+
+#define isglob(c)      cmap(c, _GLOB)
+#define isspace(c)     cmap(c, _SP)
+#define isspnl(c)      cmap(c, _SP|_NL)
+#define ismeta(c)      cmap(c, _META)