1: /* $Header: /home/hyperion/mu/christos/src/sys/tcsh-6.00/RCS/sh.char.c,v 3.0 1991/07/04 21:49:28 christos Exp $ */ 2: /* 3: * sh.char.c: Character classification tables 4: */ 5: /*- 6: * Copyright (c) 1980, 1991 The Regents of the University of California. 7: * All rights reserved. 8: * 9: * Redistribution and use in source and binary forms, with or without 10: * modification, are permitted provided that the following conditions 11: * are met: 12: * 1. Redistributions of source code must retain the above copyright 13: * notice, this list of conditions and the following disclaimer. 14: * 2. Redistributions in binary form must reproduce the above copyright 15: * notice, this list of conditions and the following disclaimer in the 16: * documentation and/or other materials provided with the distribution. 17: * 3. All advertising materials mentioning features or use of this software 18: * must display the following acknowledgement: 19: * This product includes software developed by the University of 20: * California, Berkeley and its contributors. 21: * 4. Neither the name of the University nor the names of its contributors 22: * may be used to endorse or promote products derived from this software 23: * without specific prior written permission. 24: * 25: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35: * SUCH DAMAGE. 36: */ 37: #include "config.h" 38: #if !defined(lint) && !defined(pdp11) 39: static char *rcsid() 40: { return "$Id: sh.char.c,v 3.0 1991/07/04 21:49:28 christos Exp $"; } 41: #endif 42: 43: #include "sh.char.h" 44: 45: unsigned short _cmap[256] = { 46: /* nul soh stx etx */ 47: _CTR, _CTR, _CTR, _CTR, 48: 49: /* eot enq ack bel */ 50: _CTR, _CTR, _CTR, _CTR, 51: 52: /* bs ht nl vt */ 53: _CTR, _CTR|_SP|_META, _CTR|_NL|_META, _CTR, 54: 55: /* np cr so si */ 56: _CTR, _CTR, _CTR, _CTR, 57: 58: /* dle dc1 dc2 dc3 */ 59: _CTR, _CTR, _CTR, _CTR, 60: 61: /* dc4 nak syn etb */ 62: _CTR, _CTR, _CTR, _CTR, 63: 64: /* can em sub esc */ 65: _CTR, _CTR, _CTR, _CTR, 66: 67: /* fs gs rs us */ 68: _CTR, _CTR, _CTR, _CTR, 69: 70: /* sp ! " # */ 71: _SP|_META, 0, _Q, _META, 72: 73: /* $ % & ' */ 74: _DOL, 0, _META|_CMD, _Q, 75: 76: /* ( ) * + */ 77: _META|_CMD, _META, _GLOB, 0, 78: 79: /* , - . / */ 80: 0, 0, 0, 0, 81: 82: /* 0 1 2 3 */ 83: _DIG|_XD, _DIG|_XD, _DIG|_XD, _DIG|_XD, 84: 85: /* 4 5 6 7 */ 86: _DIG|_XD, _DIG|_XD, _DIG|_XD, _DIG|_XD, 87: 88: /* 8 9 : ; */ 89: _DIG|_XD, _DIG|_XD, 0, _META|_CMD, 90: 91: /* < = > ? */ 92: _META, 0, _META, _GLOB, 93: 94: /* @ A B C */ 95: 0, _LET|_UP|_XD, _LET|_UP|_XD, _LET|_UP|_XD, 96: 97: /* D E F G */ 98: _LET|_UP|_XD, _LET|_UP|_XD, _LET|_UP|_XD, _LET|_UP, 99: 100: /* H I J K */ 101: _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP, 102: 103: /* L M N O */ 104: _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP, 105: 106: /* P Q R S */ 107: _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP, 108: 109: /* T U V W */ 110: _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP, 111: 112: /* X Y Z [ */ 113: _LET|_UP, _LET|_UP, _LET|_UP, _GLOB, 114: 115: /* \ ] ^ _ */ 116: _ESC, 0, 0, 0, 117: 118: /* ` a b c */ 119: _Q1|_GLOB|_CMD|_META, _LET|_LOW|_XD, _LET|_LOW|_XD, _LET|_LOW|_XD, 120: 121: /* d e f g */ 122: _LET|_LOW|_XD, _LET|_LOW|_XD, _LET|_LOW|_XD, _LET|_LOW, 123: 124: /* h i j k */ 125: _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW, 126: 127: /* l m n o */ 128: _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW, 129: 130: /* p q r s */ 131: _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW, 132: 133: /* t u v w */ 134: _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW, 135: 136: /* x y z { */ 137: _LET|_LOW, _LET|_LOW, _LET|_LOW, _GLOB, 138: 139: /* | } ~ del */ 140: _META|_CMD, 0, 0, _CTR, 141: 142: #if defined(SHORT_STRINGS) && !defined(KANJI) 143: /****************************************************************/ 144: /* 128 - 255 The below is supposedly ISO 8859/1 */ 145: /****************************************************************/ 146: /* (undef) (undef) (undef) (undef) */ 147: _CTR, _CTR, _CTR, _CTR, 148: 149: /* (undef) (undef) (undef) (undef) */ 150: _CTR, _CTR, _CTR, _CTR, 151: 152: /* (undef) (undef) (undef) (undef) */ 153: _CTR, _CTR, _CTR, _CTR, 154: 155: /* (undef) (undef) (undef) (undef) */ 156: _CTR, _CTR, _CTR, _CTR, 157: 158: /* (undef) (undef) (undef) (undef) */ 159: _CTR, _CTR, _CTR, _CTR, 160: 161: /* (undef) (undef) (undef) (undef) */ 162: _CTR, _CTR, _CTR, _CTR, 163: 164: /* (undef) (undef) (undef) (undef) */ 165: _CTR, _CTR, _CTR, _CTR, 166: 167: /* (undef) (undef) (undef) (undef) */ 168: _CTR, _CTR, _CTR, _CTR, 169: 170: /* nobreakspace exclamdown cent sterling */ 171: _SP, 0, 0, 0, 172: 173: /* currency yen brokenbar section */ 174: 0, 0, 0, 0, 175: 176: /* diaeresis copyright ordfeminine guillemotleft */ 177: 0, 0, 0, 0, 178: 179: /* notsign hyphen registered macron */ 180: 0, 0, 0, 0, 181: 182: /* degree plusminus twosuperior threesuperior */ 183: 0, 0, 0, 0, 184: 185: /* acute mu paragraph periodcentered */ 186: 0, 0, 0, 0, 187: 188: /* cedilla onesuperior masculine guillemotright */ 189: 0, 0, 0, 0, 190: 191: /* onequarter onehalf threequarters questiondown */ 192: 0, 0, 0, 0, 193: 194: /* Agrave Aacute Acircumflex Atilde */ 195: _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP, 196: 197: /* Adiaeresis Aring AE Ccedilla */ 198: _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP, 199: 200: /* Egrave Eacute Ecircumflex Ediaeresis */ 201: _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP, 202: 203: /* Igrave Iacute Icircumflex Idiaeresis */ 204: _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP, 205: 206: /* ETH Ntilde Ograve Oacute */ 207: _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP, 208: 209: /* Ocircumflex Otilde Odiaeresis multiply */ 210: _LET|_UP, _LET|_UP, _LET|_UP, 0, 211: 212: /* Ooblique Ugrave Uacute Ucircumflex */ 213: _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP, 214: 215: /* Udiaeresis Yacute THORN ssharp */ 216: _LET|_UP, _LET|_UP, _LET|_UP, _LET|_LOW, 217: 218: /* agrave aacute acircumflex atilde */ 219: _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW, 220: 221: /* adiaeresis aring ae ccedilla */ 222: _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW, 223: 224: /* egrave eacute ecircumflex ediaeresis */ 225: _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW, 226: 227: /* igrave iacute icircumflex idiaeresis */ 228: _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW, 229: 230: /* eth ntilde ograve oacute */ 231: _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW, 232: 233: /* ocircumflex otilde odiaeresis division */ 234: _LET|_LOW, _LET|_LOW, _LET|_LOW, 0, 235: 236: /* oslash ugrave uacute ucircumflex */ 237: _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW, 238: 239: /* udiaeresis yacute thorn ydiaeresis */ 240: _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW, 241: #endif /* SHORT_STRINGS && !KANJI */ 242: }; 243: 244: #ifndef NLS 245: /* _cmap_lower, _cmap_upper for ISO 8859/1 */ 246: 247: unsigned char _cmap_lower[256] = { 248: 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 249: 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017, 250: 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027, 251: 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037, 252: 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047, 253: 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057, 254: 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, 255: 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077, 256: 0100, 0141, 0142, 0143, 0144, 0145, 0146, 0147, 257: 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157, 258: 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 259: 0170, 0171, 0172, 0133, 0134, 0135, 0136, 0137, 260: 0140, 0141, 0142, 0143, 0144, 0145, 0146, 0147, 261: 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157, 262: 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 263: 0170, 0171, 0172, 0173, 0174, 0175, 0176, 0177, 264: 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207, 265: 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217, 266: 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227, 267: 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237, 268: 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247, 269: 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257, 270: 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, 271: 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, 272: 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347, 273: 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357, 274: 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0327, 275: 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0337, 276: 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347, 277: 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357, 278: 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, 279: 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377, 280: }; 281: 282: unsigned char _cmap_upper[256] = { 283: 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 284: 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017, 285: 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027, 286: 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037, 287: 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047, 288: 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057, 289: 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, 290: 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077, 291: 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 292: 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, 293: 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 294: 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137, 295: 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 296: 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, 297: 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 298: 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177, 299: 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207, 300: 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217, 301: 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227, 302: 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237, 303: 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247, 304: 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257, 305: 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, 306: 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, 307: 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307, 308: 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317, 309: 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327, 310: 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337, 311: 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307, 312: 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317, 313: 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0367, 314: 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0377, 315: }; 316: #endif /* NLS */