Annotation of 43BSDReno/contrib/mh/zotnet/tws/t, revision 1.1

1.1     ! root        1: *** lexstring.c        Tue Jun  3 06:29:37 1986
        !             2: --- /usr/tmp/mh-6.5/zotnet/tws/lexstring.c     Wed Feb 12 12:04:27 1986
        !             3: ***************
        !             4: *** 19,53 ****
        !             5:   extern int yyvstop[];
        !             6:   extern struct yywork yycrank[];
        !             7:   extern struct yysvf yysvec[];
        !             8:   extern char yymatch[];
        !             9:   extern char yyextra[];
        !            10:   
        !            11: ! #ifdef ONECASE
        !            12: ! static char case_map[] = {
        !            13: !      0,   1,   2,   3,   4,   5,   6,   7,   8,   9,
        !            14: !     10,  11,  12,  13,  14,  15,  16,  17,  18,  19,
        !            15: !     20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
        !            16: !     30,  31,  32,  33,  34,  35,  36,  37,  38,  39,
        !            17: !     40,  41,  42,  43,  44,  45,  46,  47,  48,  49,
        !            18: !     50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
        !            19: !     60,  61,  62,  63,  64,  97,  98,  99, 100, 101,
        !            20: !    102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
        !            21: !    112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
        !            22: !    122,  91,  92,  93,  94,  95,  96,  97,  98,  99,
        !            23: !    100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
        !            24: !    110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
        !            25: !    120, 121, 122, 123, 124, 125, 126, 127,
        !            26: !    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        !            27: !    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        !            28: !    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        !            29: !    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        !            30: !    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        !            31: !    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        !            32: !    0, 0, 0, 0, 0, 0, 0, 0
        !            33: ! };
        !            34: ! #endif ONECASE
        !            35:   
        !            36: - 
        !            37:   lex_string( strptr, start_cond)
        !            38:        char    **strptr;
        !            39:        int     start_cond;
        !            40: --- 19,32 ----
        !            41:   extern int yyvstop[];
        !            42:   extern struct yywork yycrank[];
        !            43:   extern struct yysvf yysvec[];
        !            44: + extern struct yywork *yytop;
        !            45:   extern char yymatch[];
        !            46:   extern char yyextra[];
        !            47:   
        !            48: ! #ifdef LEXDEBUG
        !            49: ! static int debug = 0;
        !            50: ! #endif LEXDEBUG
        !            51:   
        !            52:   lex_string( strptr, start_cond)
        !            53:        char    **strptr;
        !            54:        int     start_cond;
        !            55: ***************
        !            56: *** 54,60 ****
        !            57:   {
        !            58:        register struct yysvf *state, **lsp;
        !            59:        register struct yywork *tran;
        !            60: -      register int statenum;
        !            61:        register int ch;
        !            62:        register char   *cp = *strptr;
        !            63:        register int    *found;
        !            64: --- 33,38 ----
        !            65: ***************
        !            66: *** 62,72 ****
        !            67:   
        !            68:        /* start off machines */
        !            69:        lsp = yylstate;
        !            70: !      statenum = 1 + start_cond;
        !            71: !      state = yysvec + statenum;
        !            72:        for (;;){
        !            73:   # ifdef LEXDEBUG
        !            74: !              fprintf(stdout,"%d ",statenum - 1);
        !            75:   # endif
        !            76:                tran = state->yystoff;
        !            77:                if(tran == yycrank)
        !            78: --- 40,50 ----
        !            79:   
        !            80:        /* start off machines */
        !            81:        lsp = yylstate;
        !            82: !      state = yysvec+1+start_cond;
        !            83:        for (;;){
        !            84:   # ifdef LEXDEBUG
        !            85: !              if(debug)
        !            86: !                      fprintf(stderr,"state %d\n",state-yysvec-1);
        !            87:   # endif
        !            88:                tran = state->yystoff;
        !            89:                if(tran == yycrank)
        !            90: ***************
        !            91: *** 75,140 ****
        !            92:                            state->yyother->yystoff == yycrank)
        !            93:                                break;
        !            94:   
        !            95: - #ifdef ONECASE
        !            96: -              ch = case_map[*cp++];
        !            97: - #else  not ONECASE
        !            98:                ch = *cp++;
        !            99:   #endif ONECASE
        !           100:   # ifdef LEXDEBUG
        !           101: !              fprintf(stdout,"(");
        !           102: !              allprint(ch);
        !           103: !              fprintf(stdout, ")");
        !           104:   # endif
        !           105: - tryagain:
        !           106:                if ( tran > yycrank){
        !           107:                        tran += ch;
        !           108: !                      if (tran->verify == statenum){
        !           109: !                              if ((statenum = tran->advance) == 0){
        !           110:                                        /* error transitions */
        !           111:                                        --cp;
        !           112:                                        break;
        !           113:                                }
        !           114: -                              state = statenum + yysvec;
        !           115:                                *lsp++ = state;
        !           116:                                goto contin;
        !           117:                        }
        !           118:   
        !           119:                } else if(tran < yycrank) {
        !           120:                        tran = yycrank+(yycrank-tran) + ch;
        !           121:   # ifdef LEXDEBUG
        !           122: !                      fprintf(stdout," compressed");
        !           123:   # endif
        !           124: !                      if (tran->verify == statenum){
        !           125: !                              if ((statenum = tran->advance) == 0)
        !           126:                                        /* error transitions */
        !           127:                                        break;
        !           128:   
        !           129: -                              state = statenum + yysvec;
        !           130:                                *lsp++ = state;
        !           131:                                goto contin;
        !           132:                        }
        !           133:                        tran += (yymatch[ch] - ch);
        !           134:   # ifdef LEXDEBUG
        !           135: !                      fprintf(stdout,"(fb ");
        !           136: !                      allprint(yymatch[ch]);
        !           137: !                      fprintf(stdout,")");
        !           138:   # endif
        !           139: !                      if (tran->verify == statenum){
        !           140: !                              if((statenum = tran->advance) == 0)
        !           141:                                        /* error transition */
        !           142:                                        break;
        !           143:   
        !           144: !                              state = statenum + yysvec;
        !           145: !                              *lsp++ = state;
        !           146:                                goto contin;
        !           147:                        }
        !           148:                }
        !           149:                if ((state = state->yyother) &&
        !           150:                    (tran = state->yystoff) != yycrank){
        !           151: -                      statenum = state - yysvec;
        !           152:   # ifdef LEXDEBUG
        !           153: !                      fprintf(stdout,"fb %d",
        !           154: !                              statenum - 1);
        !           155:   # endif
        !           156:                        goto tryagain;
        !           157:                } else
        !           158: --- 53,121 ----
        !           159:                            state->yyother->yystoff == yycrank)
        !           160:                                break;
        !           161:   
        !           162:                ch = *cp++;
        !           163: + #ifdef ONECASE
        !           164: +              if (isupper(ch) )
        !           165: +                      ch = tolower(ch);
        !           166:   #endif ONECASE
        !           167: + tryagain:
        !           168:   # ifdef LEXDEBUG
        !           169: !              if(debug){
        !           170: !                      fprintf(stderr,"char ");
        !           171: !                      allprint(ch);
        !           172: !                      putchar('\n');
        !           173: !              }
        !           174:   # endif
        !           175:                if ( tran > yycrank){
        !           176:                        tran += ch;
        !           177: !                      if (tran <= yytop && tran->verify+yysvec == state){
        !           178: !                              if ((state = tran->advance+yysvec) == YYLERR){
        !           179:                                        /* error transitions */
        !           180:                                        --cp;
        !           181:                                        break;
        !           182:                                }
        !           183:                                *lsp++ = state;
        !           184:                                goto contin;
        !           185:                        }
        !           186:   
        !           187:                } else if(tran < yycrank) {
        !           188: +                      /* r < yycrank */
        !           189:                        tran = yycrank+(yycrank-tran) + ch;
        !           190:   # ifdef LEXDEBUG
        !           191: !                      if (debug)
        !           192: !                              fprintf(stderr,"compressed state\n");
        !           193:   # endif
        !           194: !                      if(tran <= yytop && tran->verify+yysvec == state){
        !           195: !                              if ((state = tran->advance+yysvec) == YYLERR)
        !           196:                                        /* error transitions */
        !           197:                                        break;
        !           198:   
        !           199:                                *lsp++ = state;
        !           200:                                goto contin;
        !           201:                        }
        !           202:                        tran += (yymatch[ch] - ch);
        !           203:   # ifdef LEXDEBUG
        !           204: !                      if(debug){
        !           205: !                              fprintf(stderr,"try fall back character ");
        !           206: !                              allprint(yymatch[ch]);
        !           207: !                              putchar('\n');
        !           208: !                      }
        !           209:   # endif
        !           210: !                      if(tran <= yytop && tran->verify+yysvec == state){
        !           211: !                              if(tran->advance+yysvec == YYLERR)
        !           212:                                        /* error transition */
        !           213:                                        break;
        !           214:   
        !           215: !                              *lsp++ = state = tran->advance+yysvec;
        !           216:                                goto contin;
        !           217:                        }
        !           218:                }
        !           219:                if ((state = state->yyother) &&
        !           220:                    (tran = state->yystoff) != yycrank){
        !           221:   # ifdef LEXDEBUG
        !           222: !                      if(debug)
        !           223: !                              fprintf(stderr,"fall back to state %d\n",
        !           224: !                                      state-yysvec-1);
        !           225:   # endif
        !           226:                        goto tryagain;
        !           227:                } else
        !           228: ***************
        !           229: *** 142,155 ****
        !           230:   
        !           231:   contin:
        !           232:   # ifdef LEXDEBUG
        !           233: !              fprintf(stdout,">");
        !           234:   # endif
        !           235:                ;
        !           236:        }
        !           237:   # ifdef LEXDEBUG
        !           238: !      fprintf(stdout,"\nStopped in state %d (",*(lsp-1)-yysvec-1);
        !           239: !      allprint(ch);
        !           240: !      fprintf(stdout, ") ");
        !           241:   # endif
        !           242:        while (lsp-- > yylstate){
        !           243:                if (*lsp != 0 && (found= (*lsp)->yystops) && *found > 0){
        !           244: --- 123,142 ----
        !           245:   
        !           246:   contin:
        !           247:   # ifdef LEXDEBUG
        !           248: !              if(debug){
        !           249: !                      fprintf(stderr,"state %d char ",state-yysvec-1);
        !           250: !                      allprint(ch);
        !           251: !                      putchar('\n');
        !           252: !              }
        !           253:   # endif
        !           254:                ;
        !           255:        }
        !           256:   # ifdef LEXDEBUG
        !           257: !      if(debug){
        !           258: !              fprintf(stderr,"stopped at %d with ",*(lsp-1)-yysvec-1);
        !           259: !              allprint(ch);
        !           260: !              putchar('\n');
        !           261: !      }
        !           262:   # endif
        !           263:        while (lsp-- > yylstate){
        !           264:                if (*lsp != 0 && (found= (*lsp)->yystops) && *found > 0){
        !           265: ***************
        !           266: *** 163,174 ****
        !           267:                                          (found = (*--lsp)->yystops));
        !           268:                        }
        !           269:   # ifdef LEXDEBUG
        !           270: !                      fprintf(stdout," Match \"");
        !           271: !                      for ( cp = *strptr;
        !           272: !                            cp <= ((*strptr)+(lsp-yylstate));
        !           273: !                            cp++)
        !           274: !                              allprint( *cp );
        !           275: !                      fprintf(stdout,"\" action %d\n",*found);
        !           276:   # endif
        !           277:                        *strptr += (lsp - yylstate + 1);
        !           278:                        return(*found);
        !           279: --- 150,163 ----
        !           280:                                          (found = (*--lsp)->yystops));
        !           281:                        }
        !           282:   # ifdef LEXDEBUG
        !           283: !                      if(debug){
        !           284: !                              fprintf(stderr,"\nmatch ");
        !           285: !                              for ( cp = *strptr;
        !           286: !                                    cp <= ((*strptr)+(lsp-yylstate));
        !           287: !                                    cp++)
        !           288: !                                      allprint( *cp );
        !           289: !                              fprintf(stderr," action %d\n",*found);
        !           290: !                      }
        !           291:   # endif
        !           292:                        *strptr += (lsp - yylstate + 1);
        !           293:                        return(*found);
        !           294: ***************
        !           295: *** 179,185 ****
        !           296:         * and return -1.
        !           297:         */
        !           298:   # ifdef LEXDEBUG
        !           299: !      fprintf(stdout," No match\n");
        !           300:   #endif LEXDEBUG
        !           301:        if ( **strptr ) {
        !           302:                (*strptr)++;
        !           303: --- 168,175 ----
        !           304:         * and return -1.
        !           305:         */
        !           306:   # ifdef LEXDEBUG
        !           307: !      if(debug)
        !           308: !              fprintf(stderr,"\nno match\n");
        !           309:   #endif LEXDEBUG
        !           310:        if ( **strptr ) {
        !           311:                (*strptr)++;
        !           312: ***************
        !           313: *** 193,204 ****
        !           314:        char c;
        !           315:   {
        !           316:        if ( c < 32 ) {
        !           317: !          putc( '^', stdout );
        !           318:            c += 32;
        !           319:        } else if ( c == 127 ) {
        !           320: !          putc( '^', stdout );
        !           321:            c = '?';
        !           322:        }
        !           323: !      putc( c, stdout );
        !           324:   }
        !           325:   #endif LEXDEBUG
        !           326: --- 183,194 ----
        !           327:        char c;
        !           328:   {
        !           329:        if ( c < 32 ) {
        !           330: !          putc( '^', stderr );
        !           331:            c += 32;
        !           332:        } else if ( c == 127 ) {
        !           333: !          putc( '^', stderr );
        !           334:            c = '?';
        !           335:        }
        !           336: !      putc( c, stderr );
        !           337:   }
        !           338:   #endif LEXDEBUG

unix.superglobalmegacorp.com

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