Annotation of researchv10no/cmd/lcc/etc/keywords.c, revision 1.1.1.1

1.1       root        1: #include <stdio.h>
                      2: #include <ctype.h>
                      3: 
                      4: char *keyword[] = {
                      5:        "auto", "break", "case", "*char", "const", "continue",
                      6:        "default", "*double", "do", "else", "enum", "extern", "*float", "for",
                      7:        "goto", "if", "*int", "*long", "register", "return", "*short",
                      8:        "signed", "sizeof", "static", "struct", "switch", "typedef", "union",
                      9:        "unsigned", "*void", "volatile", "while"
                     10: };
                     11: 
                     12: main() {
                     13:        char *k, *lastk = 0;
                     14:        int i;
                     15: 
                     16:        for (i = 0; i < sizeof keyword/sizeof keyword[0]; i++) {
                     17:                k = keyword[i];
                     18:                if (*k == '*')
                     19:                        k++;
                     20:                if (lastk && *lastk != *k)
                     21:                        printf("\tgoto id;\n");
                     22:                if (lastk == 0 || *lastk != *k)
                     23:                        printf("case '%c':\n", *k);
                     24:                lastk = k;
                     25:                printf("\tif (rcp[0] == '%c'\n", *++k);
                     26:                while (*++k && *k != '*')
                     27:                        printf("\t&&  rcp[%d] == '%c'\n", k - lastk - 1, *k);
                     28:                printf("\t&& !(map[rcp[%d]]&(DIGIT|LETTER))) {\n", k - lastk - 1);
                     29:                printf("\t\tcp = rcp + %d;\n", k - lastk - 1);
                     30:                if (*keyword[i] == '*')
                     31:                        printf("\t\ttsym = %stype->u.sym;\n", lastk);
                     32:                printf("\t\treturn ");
                     33:                for (k = lastk; *k; k++)
                     34:                        putchar(toupper(*k));
                     35:                printf(";\n");
                     36:                printf("\t}\n");
                     37:        }
                     38:        for (k = "hjkmnopqxyzABCDEFGHIJKMNOPQRSTUVWXYZ_"; *k; k++)
                     39:                printf("case '%c':\n", *k);
                     40:        return 0;
                     41: }

unix.superglobalmegacorp.com

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