Annotation of 43BSD/contrib/icon/tran/char.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Initialization for arrays used to classify characters.
                      3:  */
                      4: 
                      5: #include "char.h"
                      6: 
                      7: /*
                      8:  * chrtype - classifies each ASCII character as space (_S),
                      9:  * upper-case letter (_U), lower-case letter (_L), or
                     10:  * digit (_N), or other alphabetic (_A, e.g. "_").
                     11:  */
                     12: 
                     13: char chrtype[] = {
                     14:   0,   0,      0,      0,      0,      0,      0,      0,      /* NUL-BEL */
                     15:   0,   _S,     _S,     _S,     _S,     _S,     0,      0,      /* BS -SI */
                     16:   0,   0,      0,      0,      0,      0,      0,      0,      /* DLE-ETB */
                     17:   0,   0,      0,      0,      0,      0,      0,      0,      /* CAN-US */
                     18:   _S,  0,      0,      0,      0,      0,      0,      0,      /* !"#$%&' */
                     19:   0,   0,      0,      0,      0,      0,      0,      0,      /* ()*+,-./ */
                     20:   _N,  _N,     _N,     _N,     _N,     _N,     _N,     _N,     /* 01234567 */
                     21:   _N,  _N,     0,      0,      0,      0,      0,      0,      /* 89:;<=>? */
                     22:   0,   _U,     _U,     _U,     _U,     _U,     _U,     _U,     /* @ABCDEFG */
                     23:   _U,  _U,     _U,     _U,     _U,     _U,     _U,     _U,     /* HIJKLMNO */
                     24:   _U,  _U,     _U,     _U,     _U,     _U,     _U,     _U,     /* PQRSTUVW */
                     25:   _U,  _U,     _U,     0,      0,      0,      0,      _A,     /* XYZ[\]^_ */
                     26:   0,   _L,     _L,     _L,     _L,     _L,     _L,     _L,     /* `abcdefg */
                     27:   _L,  _L,     _L,     _L,     _L,     _L,     _L,     _L,     /* hijklmno */
                     28:   _L,  _L,     _L,     _L,     _L,     _L,     _L,     _L,     /* pqrstuvw */
                     29:   _L,  _L,     _L,     0,      0,      0,      0,      0       /* xyz{|}~ */
                     30:   };
                     31: 
                     32: /*
                     33:  * ctran - translation table for all input except in string literals.
                     34:  */
                     35: 
                     36: char ctran[] = {
                     37:   000, 001,    002,    003,    004,    005,    006,    007,    /* NUL-BEL */
                     38:   010, 011,    012,    013,    014,    015,    016,    017,    /* BS -SI */
                     39:   020, 021,    022,    023,    024,    025,    026,    027,    /* DLE-ETB */
                     40:   030, 031,    032,    033,    034,    035,    036,    037,    /* CAN-US */
                     41:   ' ', '!',    '"',    '#',    '$',    '%',    '&',    '\'',   /* !"#$%&' */
                     42:   '(', ')',    '*',    '+',    ',',    '-',    '.',    '/',    /* ()*+,-./ */
                     43:   '0', '1',    '2',    '3',    '4',    '5',    '6',    '7',    /* 01234567 */
                     44:   '8', '9',    ':',    ';',    '<',    '=',    '>',    '?',    /* 89:;<=>? */
                     45:   '@', 'A',    'B',    'C',    'D',    'E',    'F',    'G',    /* @ABCDEFG */
                     46:   'H', 'I',    'J',    'K',    'L',    'M',    'N',    'O',    /* HIJKLMNO */
                     47:   'P', 'Q',    'R',    'S',    'T',    'U',    'V',    'W',    /* PQRSTUVW */
                     48:   'X', 'Y',    'Z',    '[',    '\\',   ']',    '^',    '_',    /* XYZ[\]^_ */
                     49:   '`', 'a',    'b',    'c',    'd',    'e',    'f',    'g',    /* `abcdefg */
                     50:   'h', 'i',    'j',    'k',    'l',    'm',    'n',    'o',    /* hijklmno */
                     51:   'p', 'q',    'r',    's',    't',    'u',    'v',    'w',    /* pqrstuvw */
                     52:   'x', 'y',    'z',    '{',    '|',    '}',    '~',    0177,   /* xyz{|}~ */
                     53:   };
                     54: 
                     55: /*
                     56:  * esctab - translates single-character escapes in string literals.
                     57:  */
                     58: 
                     59: char esctab[] = {
                     60:   000, 001,    002,    003,    004,    005,    006,    007,    /* NUL-BEL */
                     61:   010, 011,    012,    013,    014,    015,    016,    017,    /* BS -SI */
                     62:   020, 021,    022,    023,    024,    025,    026,    027,    /* DLE-ETB */
                     63:   030, 031,    032,    033,    034,    035,    036,    037,    /* CAN-US */
                     64:   ' ', '!',    '"',    '#',    '$',    '%',    '&',    '\'',   /* !"#$%&' */
                     65:   '(', ')',    '*',    '+',    ',',    '-',    '.',    '/',    /* ()*+,-./ */
                     66:   000, 001,    002,    003,    004,    005,    006,    007,    /* 01234567 */
                     67:   010, 011,    ':',    ';',    '<',    '=',    '>',    '?',    /* 89:;<=>? */
                     68:   '@', 'A',    '\b',   'C',    0177,   033,    014,    'G',    /* @ABCDEFG */
                     69:   'H', 'I',    'J',    'K',    '\n',   'M',    '\n',   'O',    /* HIJKLMNO */
                     70:   'P', 'Q',    '\r',   'S',    '\t',   'U',    013,    'W',    /* PQRSTUVW */
                     71:   'X', 'Y',    'Z',    '[',    '\\',   ']',    '^',    '_',    /* XYZ[\]^_ */
                     72:   '`', 'a',    '\b',   'c',    0177,   033,    014,    'g',    /* `abcdefg */
                     73:   'h', 'i',    'j',    'k',    '\n',   'm',    '\n',   'o',    /* hijklmno */
                     74:   'p', 'q',    '\r',   's',    '\t',   'u',    013,    'w',    /* pqrstuvw */
                     75:   'x', 'y',    'z',    '{',    '|',    '}',    '~',    0177,   /* xyz{|}~ */
                     76:   };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.