1: /*************************************************************************** 2: * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne. JOVE * 3: * is provided to you without charge, and with no warranty. You may give * 4: * away copies of JOVE, including sources, provided that this notice is * 5: * included in all the files. * 6: ***************************************************************************/ 7: 8: #include "jove.h" 9: #include "ctype.h" 10: 11: int SyntaxTable = FUNDAMENTAL; /* Current table to use. */ 12: 13: char CharTable[NMAJORS][NCHARS] = { 14: { 15: _C, _C, _C, _C, _C, _C, _C, _C, 16: _C, _C, _C, _C, _C, _C, _C, _C, 17: _C, _C, _C, _C, _C, _C, _C, _C, 18: _C, _C, _C, _C, _C, _C, _C, _C, 19: _P, _P, _P, _P, _P, _P, _P, _P, 20: _Op|_P, _Cl|_P, _P, _P, _P, _P, _P, _P, 21: _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, 22: _W|_N, _W|_N, _P, _P, _P, _P, _P, _P, 23: _P, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 24: _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 25: _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 26: _W|_U, _W|_U, _W|_U, _Op|_P, _P, _Cl|_P, _P, _P, 27: _P, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 28: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 29: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 30: _W|_L, _W|_L, _W|_L, _Op|_P, _P, _Cl|_P, _P, _C, 31: #ifdef IBMPC 32: 0, _W|_L, 0, 0, _W|_L, 0, 0, 0, 0, 0, 0, 0, 0, 0, _W|_U, 0, 33: 0, 0, 0, 0, _W|_L, 0, 0, 0, 0, _W|_U, _W|_U, 0, 0, 0, 0, 0, 34: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40: #endif /* IBMPC */ 41: #ifdef MAC /* See Inside Macintosh Vol One p. 247 */ 42: _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_L, 43: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 44: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 45: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 46: _P, _P, _P, _P, _P, _P, _P, _P, 47: _P, _P, _P, _P, _P, _P, _W|_U, _W|_U, 48: _P, _P, _P, _P, _P, _W|_U, _W|_L, _W|_U, 49: _W|_U, _W|_L, _P, _P, _P, _W|_U, _W|_L, _W|_L, 50: _P, _P, _P, _P, _P, _P, _W|_U, _P, 51: _P, _P, _P, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 52: _P, _P, _P, _P, _P, _P, _P, _P, 53: _W|_U, 0, 0, 0, 0, 0, 0, 0, 54: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56: #endif /* MAC */ 57: }, 58: 59: { 60: _C, _C, _C, _C, _C, _C, _C, _C, 61: _C, _C, _C, _C, _C, _C, _C, _C, 62: _C, _C, _C, _C, _C, _C, _C, _C, 63: _C, _C, _C, _C, _C, _C, _C, _C, 64: _P, _P, _P, _P, _P, _P, _P, _P|_W, 65: _Op|_P, _Cl|_P, _P, _P, _P, _P, _P, _P, 66: _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, 67: _W|_N, _W|_N, _P, _P, _P, _P, _P, _P, 68: _P, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 69: _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 70: _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 71: _W|_U, _W|_U, _W|_U, _Op|_P, _P, _Cl|_P, _P, _P, 72: _P, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 73: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 74: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 75: _W|_L, _W|_L, _W|_L, _Op|_P, _P, _Cl|_P, _P, _C, 76: #ifdef IBMPC 77: 0, _W|_L, 0, 0, _W|_L, 0, 0, 0, 0, 0, 0, 0, 0, 0, _W|_U, 0, 78: 0, 0, 0, 0, _W|_L, 0, 0, 0, 0, _W|_U, _W|_U, 0, 0, 0, 0, 0, 79: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85: #endif /* IBMPC */ 86: #ifdef MAC /* See Inside Macintosh Vol One p. 247 */ 87: _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_L, 88: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 89: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 90: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 91: _P, _P, _P, _P, _P, _P, _P, _P, 92: _P, _P, _P, _P, _P, _P, _W|_U, _W|_U, 93: _P, _P, _P, _P, _P, _W|_U, _W|_L, _W|_U, 94: _W|_U, _W|_L, _P, _P, _P, _W|_U, _W|_L, _W|_L, 95: _P, _P, _P, _P, _P, _P, _W|_U, _P, 96: _P, _P, _P, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 97: _P, _P, _P, _P, _P, _P, _P, _P, 98: _W|_U, 0, 0, 0, 0, 0, 0, 0, 99: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101: #endif /* MAC */ 102: }, 103: 104: { 105: _C, _C, _C, _C, _C, _C, _C, _C, 106: _C, _C, _C, _C, _C, _C, _C, _C, 107: _C, _C, _C, _C, _C, _C, _C, _C, 108: _C, _C, _C, _C, _C, _C, _C, _C, 109: _P, _P, _P, _P, _P|_W, _P, _P, _P, 110: _Op|_P, _Cl|_P, _P, _P, _P, _P, _P, _P, 111: _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, 112: _W|_N, _W|_N, _P, _P, _P, _P, _P, _P, 113: _P, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 114: _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 115: _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 116: _W|_U, _W|_U, _W|_U, _Op|_P, _P, _Cl|_P, _P, _P|_W, 117: _P, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 118: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 119: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 120: _W|_L, _W|_L, _W|_L, _Op|_P, _P, _Cl|_P, _P, _C, 121: #ifndef ASCII 122: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 125: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 130: #endif /* ASCII */ 131: }, 132: 133: #ifdef LISP 134: { 135: _C, _C, _C, _C, _C, _C, _C, _C, 136: _C, _C, _C, _C, _C, _C, _C, _C, 137: _C, _C, _C, _C, _C, _C, _C, _C, 138: _C, _C, _C, _C, _C, _C, _C, _C, 139: _P, _W|_P, _P, _P, _W|_P, _W|_P, _W|_P, _P, 140: _Op|_P, _Cl|_P, _W|_P, _W|_P, _P, _W|_P, _P, _W, 141: _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, _W|_N, 142: _W|_N, _W|_N, _W|_P, _P, _W|_P, _W|_P, _W|_P, _W|_P, 143: _W|_P, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 144: _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 145: _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, _W|_U, 146: _W|_U, _W|_U, _W|_U, _Op|_P, _P, _Cl|_P, _W|_P, _W|_P, 147: _P, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 148: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 149: _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, _W|_L, 150: _W|_L, _W|_L, _W|_L, _Op|_W|_P, _W|_P, _Cl|_W|_P, _W|_P, _W|_C, 151: #ifndef ASCII 152: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 153: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 154: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 155: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 157: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 158: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 159: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 160: #endif /* ASCII */ 161: }, 162: #endif /* LISP */ 163: }; 164: 165: int 166: ismword(c) 167: { 168: return ((CharTable[curbuf->b_major])[c]&(_W)); 169: } 170: 171: #ifdef IBMPC 172: char CaseEquiv[NCHARS] = { 173: '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', 174: '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', 175: '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', 176: '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', 177: '\040', '!', '"', '#', '$', '%', '&', '\'', 178: '(', ')', '*', '+', ',', '-', '.', '/', 179: '0', '1', '2', '3', '4', '5', '6', '7', 180: '8', '9', ':', ';', '<', '=', '>', '?', 181: '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 182: 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 183: 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 184: 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', 185: '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 186: 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 187: 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 188: 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', 189: 128, 154, 130, 131, 142, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 190: 144, 145, 146, 147, 153, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 191: 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 192: 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 193: 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 194: 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 195: 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 196: 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 197: }; 198: #endif /* IBMPC */ 199: 200: #ifdef MAC 201: char CaseEquiv[NCHARS] = { 202: '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', 203: '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', 204: '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', 205: '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', 206: '\040', '!', '"', '#', '$', '%', '&', '\'', 207: '(', ')', '*', '+', ',', '-', '.', '/', 208: '0', '1', '2', '3', '4', '5', '6', '7', 209: '8', '9', ':', ';', '<', '=', '>', '?', 210: '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 211: 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 212: 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 213: 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', 214: '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 215: 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 216: 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 217: 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', 218: 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 219: 0xCB, 0x89, 0x80, 0xCC, 0x81, 0x82, 0x83, 0x8F, 220: 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x84, 0x97, 221: 0x98, 0x99, 0x85, 0xCD, 0x9C, 0x9D, 0x9E, 0x86, 222: 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 223: 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 224: 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xC6, 0xB7, 225: 0xB8, 0xB8, 0xBA, 0xBB, 0xBC, 0xBD, 0xAE, 0xAF, 226: 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 227: 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCE, 228: 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 229: 0xD8, 0, 0, 0, 0, 0, 0, 0, 230: 0, 0, 0, 0, 0, 0, 0, 0, 231: 0, 0, 0, 0, 0, 0, 0, 0, 232: 0, 0, 0, 0, 0, 0, 0, 0, 233: 0, 0, 0, 0, 0, 0, 0, 0 234: }; 235: #endif /* MAC */ 236: 237: #ifdef ASCII 238: char CaseEquiv[] = { 239: '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', 240: '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', 241: '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', 242: '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', 243: '\040', '!', '"', '#', '$', '%', '&', '\'', 244: '(', ')', '*', '+', ',', '-', '.', '/', 245: '0', '1', '2', '3', '4', '5', '6', '7', 246: '8', '9', ':', ';', '<', '=', '>', '?', 247: '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 248: 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 249: 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 250: 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', 251: '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 252: 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 253: 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 254: 'X', 'Y', 'Z', '{', '|', '}', '~', '\177' 255: }; 256: #endif /* ASCII */