Annotation of 42BSD/ucb/lisp/franz/68k/first8.c, revision 1.1.1.1

1.1       root        1: #include <stdio.h>
                      2: char code[256];
                      3: #define FIRST 3
                      4: #define FOLLOW 2
                      5: #define ZERO 6
                      6: #define next() (((c = getc(si))==EOF)? exit(0):0)
                      7: #define copy() putc(c,so)
                      8: #define type() code[(unsigned char)c]
                      9: 
                     10: init() {
                     11:        doit(FIRST,"ABCDEFGHIJKLMNOPQRSTUVWXYZ_");
                     12:        doit(FIRST,"0abcdefghijklmnopqrstuvwxyz_");
                     13:        doit(FOLLOW,"123456789");
                     14: }
                     15: doit(act,list)
                     16: register unsigned char *list;
                     17: {
                     18:        while(*list) {code[*list++]=act;}
                     19: }
                     20: main( )
                     21: {
                     22:        register FILE *si = stdin, *so = stdout;
                     23:        register c, count;
                     24: 
                     25:        init();
                     26: copying:
                     27:        do { next(); copy();} while(type()!=FIRST);
                     28: hexnum:
                     29:        if(c=='0') {
                     30:                next();
                     31:                if(c=='X'||c=='x') {
                     32:                        do { copy(); next();}
                     33:                        while (index("0123456789abcdefABCDEF",c&0x7f)>0);
                     34:                }
                     35:                ungetc(c,si); goto copying;
                     36:        }
                     37: counting:
                     38:        for(count = 0; count < 7; count++) {
                     39:                next();
                     40:                copy();
                     41:                if(!(type()&FOLLOW)) goto copying;
                     42:        }
                     43: squelch:
                     44:        do { next(); } while (type()&FOLLOW);
                     45:        copy();
                     46:        goto copying;
                     47: }

unix.superglobalmegacorp.com

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