Annotation of researchv10no/cmd/ap/apkeys/plex.c, revision 1.1

1.1     ! root        1: # include "stdio.h"
        !             2: # define U(x) x
        !             3: # define NLSTATE yyprevious=YYNEWLINE
        !             4: # define BEGIN yybgin = yysvec + 1 +
        !             5: # define INITIAL 0
        !             6: # define YYLERR yysvec
        !             7: # define YYSTATE (yyestate-yysvec-1)
        !             8: # define YYOPTIM 1
        !             9: # define YYLMAX 200
        !            10: # define output(c) putc(c,yyout)
        !            11: # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
        !            12: # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
        !            13: # define yymore() (yymorfg=1)
        !            14: # define ECHO fprintf(yyout, "%s",yytext)
        !            15: # define REJECT { nstr = yyreject(); goto yyfussy;}
        !            16: int yyleng; extern char yytext[];
        !            17: int yymorfg;
        !            18: extern char *yysptr, yysbuf[];
        !            19: int yytchar;
        !            20: FILE *yyin ={stdin}, *yyout ={stdout};
        !            21: extern int yylineno;
        !            22: struct yysvf { 
        !            23:        struct yywork *yystoff;
        !            24:        struct yysvf *yyother;
        !            25:        int *yystops;};
        !            26: struct yysvf *yyestate;
        !            27: extern struct yysvf yysvec[], *yybgin;
        !            28: # define WORD 1
        !            29: # define DOT 2
        !            30: extern char *yylval, *sufstr();
        !            31: char *svc();
        !            32: # include "assert.h"
        !            33: # include "ctype.h"
        !            34: # define YYNEWLINE 10
        !            35: yylex(){
        !            36: int nstr; extern int yyprevious;
        !            37: while((nstr = yylook()) >= 0)
        !            38: yyfussy: switch(nstr){
        !            39: case 0:
        !            40: if(yywrap()) return(0); break;
        !            41: case 1:
        !            42: {lcase(yytext); cfree(yylval);
        !            43:                yylval=svc(sufstr(yytext)); return(WORD);}
        !            44: break;
        !            45: case 2:
        !            46: return(DOT);
        !            47: break;
        !            48: case 3:
        !            49: return(DOT);
        !            50: break;
        !            51: case 4:
        !            52: return(DOT);
        !            53: break;
        !            54: case 5:
        !            55: ;
        !            56: break;
        !            57: case 6:
        !            58: ;
        !            59: break;
        !            60: case -1:
        !            61: break;
        !            62: default:
        !            63: fprintf(yyout,"bad switch yylook %d",nstr);
        !            64: } return(0); }
        !            65: /* end of yylex */
        !            66: yywrap()
        !            67: {
        !            68: return(1); /* always stop on eof */
        !            69: }
        !            70: char *
        !            71: svc(s)
        !            72:        char *s;
        !            73: {
        !            74: char *p, *calloc();
        !            75: p = calloc(strlen(s)+1,1);
        !            76: assert(p!=0);
        !            77: strcpy(p,s);
        !            78: return(p);
        !            79: }
        !            80: trimnl(s)
        !            81:        char *s;
        !            82: {
        !            83: while (*s)s++;
        !            84: if (*--s=='\n') *s=0;
        !            85: }
        !            86: lcase(s)
        !            87:        register char *s;
        !            88: {
        !            89: register int c;
        !            90: register char *p;
        !            91: if (*s==0) return;
        !            92: for(p=s+1; c= *p; p++)
        !            93:        if (isupper(c))
        !            94:                return;
        !            95: if (isupper(c = *s))
        !            96:        *s= tolower(c);
        !            97: }
        !            98: int yyvstop[] ={
        !            99: 0,
        !           100: 
        !           101: 5,
        !           102: 0,
        !           103: 
        !           104: 6,
        !           105: 0,
        !           106: 
        !           107: 3,
        !           108: 5,
        !           109: 0,
        !           110: 
        !           111: 1,
        !           112: 5,
        !           113: 0,
        !           114: 
        !           115: 2,
        !           116: 5,
        !           117: 0,
        !           118: 
        !           119: 4,
        !           120: 5,
        !           121: 0,
        !           122: 
        !           123: 1,
        !           124: 0,
        !           125: 0};
        !           126: # define YYTYPE char
        !           127: struct yywork { YYTYPE verify, advance; } yycrank[] ={
        !           128: 0,0,   0,0,    1,3,    0,0,    
        !           129: 0,0,   0,0,    0,0,    0,0,    
        !           130: 0,0,   0,0,    0,0,    1,4,    
        !           131: 0,0,   0,0,    0,0,    0,0,    
        !           132: 0,0,   0,0,    0,0,    0,0,    
        !           133: 0,0,   0,0,    0,0,    0,0,    
        !           134: 0,0,   0,0,    0,0,    0,0,    
        !           135: 0,0,   0,0,    0,0,    0,0,    
        !           136: 0,0,   0,0,    1,5,    2,5,    
        !           137: 1,6,   0,0,    0,0,    0,0,    
        !           138: 0,0,   0,0,    0,0,    0,0,    
        !           139: 0,0,   0,0,    0,0,    1,7,    
        !           140: 2,7,   0,0,    0,0,    0,0,    
        !           141: 0,0,   0,0,    0,0,    0,0,    
        !           142: 0,0,   0,0,    0,0,    0,0,    
        !           143: 0,0,   0,0,    0,0,    0,0,    
        !           144: 1,8,   2,8,    6,0,    6,0,    
        !           145: 6,0,   6,0,    6,0,    6,0,    
        !           146: 6,0,   6,0,    6,0,    6,0,    
        !           147: 6,0,   6,0,    6,0,    6,0,    
        !           148: 6,0,   6,0,    6,0,    6,0,    
        !           149: 6,0,   6,0,    6,0,    6,0,    
        !           150: 6,0,   6,0,    6,0,    6,0,    
        !           151: 6,0,   6,0,    6,0,    6,0,    
        !           152: 6,0,   6,0,    6,0,    6,0,    
        !           153: 6,9,   6,0,    6,0,    6,0,    
        !           154: 0,0,   6,0,    6,0,    6,0,    
        !           155: 6,0,   6,0,    0,0,    6,0,    
        !           156: 6,0,   0,0,    0,0,    0,0,    
        !           157: 0,0,   0,0,    0,0,    0,0,    
        !           158: 0,0,   0,0,    0,0,    6,0,    
        !           159: 6,0,   6,0,    6,0,    6,0,    
        !           160: 6,0,   6,0,    0,0,    0,0,    
        !           161: 0,0,   0,0,    0,0,    0,0,    
        !           162: 0,0,   0,0,    0,0,    0,0,    
        !           163: 0,0,   0,0,    0,0,    0,0,    
        !           164: 0,0,   0,0,    0,0,    0,0,    
        !           165: 0,0,   0,0,    0,0,    0,0,    
        !           166: 0,0,   0,0,    0,0,    0,0,    
        !           167: 6,0,   6,0,    6,0,    6,0,    
        !           168: 6,0,   6,0,    0,0,    0,0,    
        !           169: 0,0,   0,0,    0,0,    0,0,    
        !           170: 0,0,   0,0,    0,0,    0,0,    
        !           171: 0,0,   0,0,    0,0,    0,0,    
        !           172: 0,0,   0,0,    0,0,    0,0,    
        !           173: 0,0,   0,0,    0,0,    0,0,    
        !           174: 0,0,   0,0,    0,0,    0,0,    
        !           175: 6,0,   6,0,    6,0,    6,0,    
        !           176: 6,0,   9,0,    9,0,    9,0,    
        !           177: 9,0,   9,0,    9,0,    9,0,    
        !           178: 9,0,   9,0,    9,0,    9,0,    
        !           179: 9,0,   9,0,    9,0,    9,0,    
        !           180: 9,0,   9,0,    9,0,    9,0,    
        !           181: 9,0,   9,0,    9,0,    9,0,    
        !           182: 9,0,   9,0,    9,0,    9,0,    
        !           183: 9,0,   9,0,    9,0,    9,0,    
        !           184: 9,0,   9,0,    9,0,    0,0,    
        !           185: 9,0,   9,0,    9,0,    0,0,    
        !           186: 9,0,   9,0,    9,0,    9,0,    
        !           187: 9,0,   0,0,    9,0,    9,0,    
        !           188: 0,0,   0,0,    0,0,    0,0,    
        !           189: 0,0,   0,0,    0,0,    0,0,    
        !           190: 0,0,   0,0,    9,0,    9,0,    
        !           191: 9,0,   9,0,    9,0,    9,0,    
        !           192: 9,0,   0,0,    0,0,    0,0,    
        !           193: 0,0,   0,0,    0,0,    0,0,    
        !           194: 0,0,   0,0,    0,0,    0,0,    
        !           195: 0,0,   0,0,    0,0,    0,0,    
        !           196: 0,0,   0,0,    0,0,    0,0,    
        !           197: 0,0,   0,0,    0,0,    0,0,    
        !           198: 0,0,   0,0,    0,0,    9,0,    
        !           199: 9,0,   9,0,    9,0,    9,0,    
        !           200: 9,0,   0,0,    0,0,    0,0,    
        !           201: 0,0,   0,0,    0,0,    0,0,    
        !           202: 0,0,   0,0,    0,0,    0,0,    
        !           203: 0,0,   0,0,    0,0,    0,0,    
        !           204: 0,0,   0,0,    0,0,    0,0,    
        !           205: 0,0,   0,0,    0,0,    0,0,    
        !           206: 0,0,   0,0,    0,0,    9,0,    
        !           207: 9,0,   9,0,    9,0,    9,0,    
        !           208: 0,0};
        !           209: struct yysvf yysvec[] ={
        !           210: 0,     0,      0,
        !           211: yycrank+-1,    0,              0,      
        !           212: yycrank+-2,    yysvec+1,       0,      
        !           213: yycrank+0,     0,              yyvstop+1,
        !           214: yycrank+0,     0,              yyvstop+3,
        !           215: yycrank+0,     0,              yyvstop+5,
        !           216: yycrank+-65,   0,              yyvstop+8,
        !           217: yycrank+0,     0,              yyvstop+11,
        !           218: yycrank+0,     0,              yyvstop+14,
        !           219: yycrank+-192,  yysvec+6,       yyvstop+17,
        !           220: 0,     0,      0};
        !           221: struct yywork *yytop = yycrank+319;
        !           222: struct yysvf *yybgin = yysvec+1;
        !           223: char yymatch[] ={
        !           224: 00  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
        !           225: 01  ,01  ,012 ,01  ,01  ,01  ,01  ,01  ,
        !           226: 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
        !           227: 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
        !           228: 01  ,01  ,01  ,'#' ,01  ,01  ,01  ,'#' ,
        !           229: 01  ,01  ,01  ,01  ,01  ,'#' ,01  ,01  ,
        !           230: '#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
        !           231: '#' ,'#' ,01  ,01  ,01  ,01  ,01  ,01  ,
        !           232: 01  ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
        !           233: '#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
        !           234: '#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
        !           235: '#' ,'#' ,'#' ,01  ,01  ,01  ,01  ,01  ,
        !           236: 01  ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
        !           237: '#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
        !           238: '#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
        !           239: '#' ,'#' ,'#' ,01  ,01  ,01  ,01  ,01  ,
        !           240: 0};
        !           241: char yyextra[] ={
        !           242: 0,0,0,0,0,0,0,0,
        !           243: 0};
        !           244: int yylineno =1;
        !           245: # define YYU(x) x
        !           246: # define NLSTATE yyprevious=YYNEWLINE
        !           247: char yytext[YYLMAX];
        !           248: struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
        !           249: char yysbuf[YYLMAX];
        !           250: char *yysptr = yysbuf;
        !           251: int *yyfnd;
        !           252: extern struct yysvf *yyestate;
        !           253: int yyprevious = YYNEWLINE;
        !           254: yylook(){
        !           255:        register struct yysvf *yystate, **lsp;
        !           256:        register struct yywork *yyt;
        !           257:        struct yysvf *yyz;
        !           258:        int yych;
        !           259:        struct yywork *yyr;
        !           260: # ifdef LEXDEBUG
        !           261:        int debug;
        !           262: # endif
        !           263:        char *yylastch;
        !           264:        /* start off machines */
        !           265: # ifdef LEXDEBUG
        !           266:        debug = 0;
        !           267: # endif
        !           268:        if (!yymorfg)
        !           269:                yylastch = yytext;
        !           270:        else {
        !           271:                yymorfg=0;
        !           272:                yylastch = yytext+yyleng;
        !           273:                }
        !           274:        for(;;){
        !           275:                lsp = yylstate;
        !           276:                yyestate = yystate = yybgin;
        !           277:                if (yyprevious==YYNEWLINE) yystate++;
        !           278:                for (;;){
        !           279: # ifdef LEXDEBUG
        !           280:                        if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
        !           281: # endif
        !           282:                        yyt = yystate->yystoff;
        !           283:                        if(yyt == yycrank){             /* may not be any transitions */
        !           284:                                yyz = yystate->yyother;
        !           285:                                if(yyz == 0)break;
        !           286:                                if(yyz->yystoff == yycrank)break;
        !           287:                                }
        !           288:                        *yylastch++ = yych = input();
        !           289:                tryagain:
        !           290: # ifdef LEXDEBUG
        !           291:                        if(debug){
        !           292:                                fprintf(yyout,"char ");
        !           293:                                allprint(yych);
        !           294:                                putchar('\n');
        !           295:                                }
        !           296: # endif
        !           297:                        yyr = yyt;
        !           298:                        if ( (int)yyt > (int)yycrank){
        !           299:                                yyt = yyr + yych;
        !           300:                                if (yyt <= yytop && yyt->verify+yysvec == yystate){
        !           301:                                        if(yyt->advance+yysvec == YYLERR)       /* error transitions */
        !           302:                                                {unput(*--yylastch);break;}
        !           303:                                        *lsp++ = yystate = yyt->advance+yysvec;
        !           304:                                        goto contin;
        !           305:                                        }
        !           306:                                }
        !           307: # ifdef YYOPTIM
        !           308:                        else if((int)yyt < (int)yycrank) {              /* r < yycrank */
        !           309:                                yyt = yyr = yycrank+(yycrank-yyt);
        !           310: # ifdef LEXDEBUG
        !           311:                                if(debug)fprintf(yyout,"compressed state\n");
        !           312: # endif
        !           313:                                yyt = yyt + yych;
        !           314:                                if(yyt <= yytop && yyt->verify+yysvec == yystate){
        !           315:                                        if(yyt->advance+yysvec == YYLERR)       /* error transitions */
        !           316:                                                {unput(*--yylastch);break;}
        !           317:                                        *lsp++ = yystate = yyt->advance+yysvec;
        !           318:                                        goto contin;
        !           319:                                        }
        !           320:                                yyt = yyr + YYU(yymatch[yych]);
        !           321: # ifdef LEXDEBUG
        !           322:                                if(debug){
        !           323:                                        fprintf(yyout,"try fall back character ");
        !           324:                                        allprint(YYU(yymatch[yych]));
        !           325:                                        putchar('\n');
        !           326:                                        }
        !           327: # endif
        !           328:                                if(yyt <= yytop && yyt->verify+yysvec == yystate){
        !           329:                                        if(yyt->advance+yysvec == YYLERR)       /* error transition */
        !           330:                                                {unput(*--yylastch);break;}
        !           331:                                        *lsp++ = yystate = yyt->advance+yysvec;
        !           332:                                        goto contin;
        !           333:                                        }
        !           334:                                }
        !           335:                        if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
        !           336: # ifdef LEXDEBUG
        !           337:                                if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
        !           338: # endif
        !           339:                                goto tryagain;
        !           340:                                }
        !           341: # endif
        !           342:                        else
        !           343:                                {unput(*--yylastch);break;}
        !           344:                contin:
        !           345: # ifdef LEXDEBUG
        !           346:                        if(debug){
        !           347:                                fprintf(yyout,"state %d char ",yystate-yysvec-1);
        !           348:                                allprint(yych);
        !           349:                                putchar('\n');
        !           350:                                }
        !           351: # endif
        !           352:                        ;
        !           353:                        }
        !           354: # ifdef LEXDEBUG
        !           355:                if(debug){
        !           356:                        fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
        !           357:                        allprint(yych);
        !           358:                        putchar('\n');
        !           359:                        }
        !           360: # endif
        !           361:                while (lsp-- > yylstate){
        !           362:                        *yylastch-- = 0;
        !           363:                        if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
        !           364:                                yyolsp = lsp;
        !           365:                                if(yyextra[*yyfnd]){            /* must backup */
        !           366:                                        while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
        !           367:                                                lsp--;
        !           368:                                                unput(*yylastch--);
        !           369:                                                }
        !           370:                                        }
        !           371:                                yyprevious = YYU(*yylastch);
        !           372:                                yylsp = lsp;
        !           373:                                yyleng = yylastch-yytext+1;
        !           374:                                yytext[yyleng] = 0;
        !           375: # ifdef LEXDEBUG
        !           376:                                if(debug){
        !           377:                                        fprintf(yyout,"\nmatch ");
        !           378:                                        sprint(yytext);
        !           379:                                        fprintf(yyout," action %d\n",*yyfnd);
        !           380:                                        }
        !           381: # endif
        !           382:                                return(*yyfnd++);
        !           383:                                }
        !           384:                        unput(*yylastch);
        !           385:                        }
        !           386:                if (yytext[0] == 0  /* && feof(yyin) */)
        !           387:                        {
        !           388:                        yysptr=yysbuf;
        !           389:                        return(0);
        !           390:                        }
        !           391:                yyprevious = yytext[0] = input();
        !           392:                if (yyprevious>0)
        !           393:                        output(yyprevious);
        !           394:                yylastch=yytext;
        !           395: # ifdef LEXDEBUG
        !           396:                if(debug)putchar('\n');
        !           397: # endif
        !           398:                }
        !           399:        }
        !           400: yyback(p, m)
        !           401:        int *p;
        !           402: {
        !           403: if (p==0) return(0);
        !           404: while (*p)
        !           405:        {
        !           406:        if (*p++ == m)
        !           407:                return(1);
        !           408:        }
        !           409: return(0);
        !           410: }
        !           411:        /* the following are only used in the lex library */
        !           412: yyinput(){
        !           413:        return(input());
        !           414:        }
        !           415: yyoutput(c)
        !           416:   int c; {
        !           417:        output(c);
        !           418:        }
        !           419: yyunput(c)
        !           420:    int c; {
        !           421:        unput(c);
        !           422:        }

unix.superglobalmegacorp.com

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