home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / exampleCode / opengl / GLUT / lib / glut / strokelex.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-11  |  14.2 KB  |  672 lines

  1. # include "stdio.h"
  2. # define U(x) ((unsigned char)(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 2048
  10. # define output(c) (void)putc(c,yyout)
  11. #if defined(__cplusplus) || defined(__STDC__)
  12.  
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16.     int yylex(void);
  17.     int yyback(int *, int);
  18.     int yyinput(void);
  19.     int yylook(void);
  20.     void yyoutput(int);
  21.     int yyracc(int);
  22.     int yyreject(void);
  23.     void yyunput(int);
  24. #ifndef yyless
  25.     void yyless(long int);
  26. #endif
  27. #ifndef yywrap
  28.     int yywrap(void);
  29. #endif
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33.  
  34. #endif
  35.  
  36. # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
  37. # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
  38. # define yymore() (yymorfg=1)
  39. # define ECHO (void)fprintf(yyout, "%s",yytext)
  40. # define REJECT { nstr = yyreject(); goto yyfussy;}
  41. int yyleng; extern char yytext[];
  42. int yymorfg;
  43. extern char *yysptr, yysbuf[];
  44. int yytchar;
  45. FILE *yyin = {stdin}, *yyout = {stdout};
  46. extern int yylineno;
  47. struct yysvf { 
  48.     struct yywork *yystoff;
  49.     struct yysvf *yyother;
  50.     int *yystops;};
  51. struct yysvf *yyestate;
  52. extern struct yysvf yysvec[], *yybgin;
  53.  
  54. # line 2 "strokelex.l"
  55.  
  56. # line 3 "strokelex.l"
  57. /* $XConsortium: lex.l,v 5.4 91/08/26 10:55:26 gildea Exp $ */
  58.  
  59.  
  60. # line 5 "strokelex.l"
  61. /*****************************************************************
  62. Copyright (c) 1989,1990, 1991 by Sun Microsystems, Inc. and the X Consortium.
  63.  
  64.                         All Rights Reserved
  65.  
  66. Permission to use, copy, modify, and distribute this software and its 
  67. documentation for any purpose and without fee is hereby granted, 
  68. provided that the above copyright notice appear in all copies and that
  69. both that copyright notice and this permission notice appear in 
  70. supporting documentation, and that the names of Sun Microsystems,
  71. the X Consortium, and MIT not be used in advertising or publicity 
  72. pertaining to distribution of the software without specific, written 
  73. prior permission.  
  74.  
  75. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
  76. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT 
  77. SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
  78. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  79. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  80. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  81. SOFTWARE.
  82.  
  83. ******************************************************************/
  84.  
  85.  
  86. #include <stdlib.h>
  87. #include <ctype.h>
  88. #include <math.h>
  89. #include "strokegen.h"
  90.  
  91. #if defined(ISC) && defined(SYSV) && defined(SYSV386) && __STDC__
  92. extern double atof(char *);
  93. #endif
  94.  
  95. #ifdef FLEX_SCANNER
  96. int yylineno;
  97. #endif
  98.  
  99. # define YYNEWLINE 10
  100. yylex(void){
  101. int nstr; extern int yyprevious;
  102. while((nstr = yylook()) >= 0)
  103. yyfussy: switch(nstr){
  104. case 0:
  105. if(yywrap()) return(0); break;
  106. case 1:
  107.  
  108. # line 44 "strokelex.l"
  109. case 2:
  110.  
  111. # line 45 "strokelex.l"
  112.     return string(yytext, yyleng);
  113. break;
  114. case 3:
  115.  
  116. # line 46 "strokelex.l"
  117.         ;
  118. break;
  119. case 4:
  120.  
  121. # line 47 "strokelex.l"
  122.              /* natural dilimters */ ;
  123. break;
  124. case 5:
  125.  
  126. # line 49 "strokelex.l"
  127. {
  128.                 int    token;
  129.                 if (token = res_words(yytext))
  130.                     return token;
  131.                 return string(yytext, yyleng);
  132.              }
  133. break;
  134. case 6:
  135.  
  136. # line 56 "strokelex.l"
  137. case 7:
  138.  
  139. # line 57 "strokelex.l"
  140.     case 8:
  141.  
  142. # line 58 "strokelex.l"
  143.     {
  144.                                 yylval.dval = atof(yytext);
  145.                 return REAL;
  146.                         }
  147. break;
  148. case 9:
  149.  
  150. # line 62 "strokelex.l"
  151. {
  152.                 return INTEGER;
  153.             }
  154. break;
  155. case 10:
  156.  
  157. # line 65 "strokelex.l"
  158.     {
  159.                 yylval.ival = atoi(yytext);
  160.                 return INTEGER;
  161.             }
  162. break;
  163. case 11:
  164.  
  165. # line 69 "strokelex.l"
  166.         ;
  167. break;
  168. case -1:
  169. break;
  170. default:
  171. (void)fprintf(yyout,"bad switch yylook %d",nstr);
  172. } return(0); }
  173. /* end of yylex */
  174.  
  175. # line 71 "strokelex.l"
  176.  
  177. int
  178. res_words(str)
  179. char    str[];
  180. {
  181.     static    struct    res_strct {
  182.         char    *word;
  183.         int    token;
  184.         } res_table[] = {
  185.         {"BOTTOM",        BOTTOM},
  186.         {"CENTER",        CENTER},
  187.                 {"PROPERTIES",          PROPERTIES},
  188.         {"CLOSE",        CLOSE},
  189.         {"FONTNAME",        FONTNAME},
  190.         {"INDEX",        INDEX},
  191.         {"MAGIC",        MAGIC},
  192.         {"OPEN",        OPEN},
  193.         {"RIGHT",        RIGHT},
  194.         {"STROKE",        STROKE},
  195.         {"TOP",            TOP},
  196.         {"VERTICES",        VERTICES},
  197.         {"BEARING",        BEARING},
  198.         {"L_SPACE",        L_SPACE},
  199.         {"WIDTH",        WIDTH},
  200.         {"R_SPACE",        R_SPACE},
  201.         {"NUM_CH",        NUM_CH},
  202.         {0, 0}
  203.         };
  204.  
  205.         {
  206.             register struct res_strct *reserved;
  207.  
  208.             reserved = res_table;
  209.  
  210.             do
  211.                 if (!strcmp(str, reserved->word))
  212.                     break;
  213.             while ((++reserved)->word != 0);
  214.             return reserved->token;
  215.         }
  216. }
  217.  
  218. int
  219. string(str, n)
  220. char    *str;
  221. int    n;
  222. {
  223.     if (*str == '\"' || *str == '\'')
  224.     {
  225.         str++;
  226.         n -= 2;    /* one for EOL, one for end quote */
  227.     }
  228.     if ((yylval.cval = (char *)malloc(n+1)) != NULL)
  229.     {
  230.         strncpy(yylval.cval, str, n);
  231.         yylval.cval[n] = '\0';
  232.         return STRING;
  233.     }
  234.     else
  235.         return 0;
  236. }
  237. int yyvstop[] = {
  238. 0,
  239.  
  240. 4,
  241. 0,
  242.  
  243. 4,
  244. 0,
  245.  
  246. 4,
  247. 0,
  248.  
  249. 3,
  250. 0,
  251.  
  252. 11,
  253. 0,
  254.  
  255. 10,
  256. 0,
  257.  
  258. 5,
  259. 0,
  260.  
  261. 2,
  262. 0,
  263.  
  264. 1,
  265. 0,
  266.  
  267. 8,
  268. 0,
  269.  
  270. 7,
  271. 0,
  272.  
  273. 9,
  274. 0,
  275.  
  276. 6,
  277. 0,
  278. 0};
  279. # define YYTYPE unsigned char
  280. struct yywork { YYTYPE verify, advance; } yycrank[] = {
  281. 0,0,    0,0,    0,0,    0,0,    
  282. 0,0,    0,0,    0,0,    0,0,    
  283. 0,0,    0,0,    1,3,    1,3,    
  284. 0,0,    0,0,    0,0,    0,0,    
  285. 0,0,    0,0,    0,0,    0,0,    
  286. 0,0,    0,0,    0,0,    0,0,    
  287. 0,0,    0,0,    0,0,    0,0,    
  288. 0,0,    0,0,    0,0,    0,0,    
  289. 0,0,    1,3,    0,0,    1,4,    
  290. 1,5,    0,0,    0,0,    0,0,    
  291. 1,6,    1,7,    1,7,    0,0,    
  292. 1,8,    1,3,    1,8,    1,9,    
  293. 0,0,    1,10,    1,10,    1,10,    
  294. 1,10,    1,10,    1,10,    1,10,    
  295. 1,10,    1,10,    1,10,    0,0,    
  296. 1,3,    0,0,    0,0,    0,0,    
  297. 0,0,    0,0,    1,11,    1,11,    
  298. 1,11,    1,11,    1,11,    1,11,    
  299. 1,11,    1,11,    1,11,    1,11,    
  300. 1,11,    1,11,    1,11,    1,11,    
  301. 1,11,    1,11,    1,11,    1,11,    
  302. 1,11,    1,11,    1,11,    1,11,    
  303. 1,11,    1,11,    1,11,    1,11,    
  304. 0,0,    0,0,    0,0,    0,0,    
  305. 0,0,    0,0,    1,11,    1,11,    
  306. 1,11,    1,11,    1,11,    1,11,    
  307. 1,11,    1,11,    1,11,    1,11,    
  308. 1,11,    1,11,    1,11,    1,11,    
  309. 1,11,    1,11,    1,11,    1,11,    
  310. 1,11,    1,11,    1,11,    1,11,    
  311. 1,11,    1,11,    1,11,    1,11,    
  312. 3,3,    3,3,    0,0,    0,0,    
  313. 4,4,    0,0,    0,0,    0,0,    
  314. 0,0,    0,0,    10,15,    0,0,    
  315. 4,4,    4,4,    0,0,    0,0,    
  316. 0,0,    0,0,    0,0,    5,5,    
  317. 0,0,    10,16,    0,0,    3,3,    
  318. 0,0,    0,0,    0,0,    5,5,    
  319. 5,0,    0,0,    0,0,    0,0,    
  320. 6,6,    0,0,    0,0,    3,3,    
  321. 0,0,    4,12,    0,0,    0,0,    
  322. 6,6,    6,6,    4,4,    4,4,    
  323. 10,17,    0,0,    4,4,    0,0,    
  324. 0,0,    4,4,    3,3,    4,4,    
  325. 5,5,    0,0,    0,0,    0,0,    
  326. 0,0,    5,5,    5,5,    0,0,    
  327. 0,0,    5,5,    0,0,    0,0,    
  328. 5,5,    6,6,    5,5,    0,0,    
  329. 4,4,    0,0,    6,13,    6,6,    
  330. 4,4,    0,0,    6,6,    0,0,    
  331. 10,17,    6,6,    0,0,    6,6,    
  332. 0,0,    0,0,    0,0,    5,5,    
  333. 0,0,    0,0,    0,0,    5,5,    
  334. 0,0,    0,0,    0,0,    0,0,    
  335. 0,0,    0,0,    0,0,    0,0,    
  336. 6,6,    0,0,    0,0,    0,0,    
  337. 6,6,    8,10,    8,10,    8,10,    
  338. 8,10,    8,10,    8,10,    8,10,    
  339. 8,10,    8,10,    8,10,    9,14,    
  340. 9,14,    9,14,    9,14,    9,14,    
  341. 9,14,    9,14,    9,14,    9,14,    
  342. 9,14,    11,11,    0,0,    11,11,    
  343. 11,11,    11,11,    11,11,    11,11,    
  344. 11,11,    11,11,    11,11,    11,11,    
  345. 11,11,    0,0,    0,0,    0,0,    
  346. 0,0,    0,0,    0,0,    0,0,    
  347. 11,11,    11,11,    11,11,    11,11,    
  348. 11,11,    11,11,    11,11,    11,11,    
  349. 11,11,    11,11,    11,11,    11,11,    
  350. 11,11,    11,11,    11,11,    11,11,    
  351. 11,11,    11,11,    11,11,    11,11,    
  352. 11,11,    11,11,    11,11,    11,11,    
  353. 11,11,    11,11,    0,0,    0,0,    
  354. 0,0,    0,0,    11,11,    0,0,    
  355. 11,11,    11,11,    11,11,    11,11,    
  356. 11,11,    11,11,    11,11,    11,11,    
  357. 11,11,    11,11,    11,11,    11,11,    
  358. 11,11,    11,11,    11,11,    11,11,    
  359. 11,11,    11,11,    11,11,    11,11,    
  360. 11,11,    11,11,    11,11,    11,11,    
  361. 11,11,    11,11,    15,18,    15,18,    
  362. 15,18,    15,18,    15,18,    15,18,    
  363. 15,18,    15,18,    15,18,    15,18,    
  364. 16,16,    16,16,    16,16,    16,16,    
  365. 16,16,    16,16,    16,16,    16,16,    
  366. 16,16,    16,16,    0,0,    0,0,    
  367. 0,0,    0,0,    0,0,    0,0,    
  368. 0,0,    17,19,    0,0,    17,19,    
  369. 0,0,    16,17,    17,20,    17,20,    
  370. 17,20,    17,20,    17,20,    17,20,    
  371. 17,20,    17,20,    17,20,    17,20,    
  372. 19,20,    19,20,    19,20,    19,20,    
  373. 19,20,    19,20,    19,20,    19,20,    
  374. 19,20,    19,20,    0,0,    0,0,    
  375. 0,0,    0,0,    0,0,    0,0,    
  376. 0,0,    0,0,    0,0,    0,0,    
  377. 0,0,    16,17,    0,0,    0,0,    
  378. 0,0};
  379. struct yysvf yysvec[] = {
  380. 0,    0,    0,
  381. yycrank+1,    0,        yyvstop+1,
  382. yycrank+0,    yysvec+1,    yyvstop+3,
  383. yycrank+115,    0,        yyvstop+5,
  384. yycrank+-127,    0,        0,    
  385. yycrank+-142,    0,        yyvstop+7,
  386. yycrank+-155,    0,        0,    
  387. yycrank+0,    0,        yyvstop+9,
  388. yycrank+177,    0,        0,    
  389. yycrank+187,    0,        0,    
  390. yycrank+99,    yysvec+8,    yyvstop+11,
  391. yycrank+199,    0,        yyvstop+13,
  392. yycrank+0,    0,        yyvstop+15,
  393. yycrank+0,    0,        yyvstop+17,
  394. yycrank+0,    yysvec+9,    yyvstop+19,
  395. yycrank+274,    0,        0,    
  396. yycrank+284,    0,        yyvstop+21,
  397. yycrank+306,    0,        0,    
  398. yycrank+0,    yysvec+15,    yyvstop+23,
  399. yycrank+316,    0,        0,    
  400. yycrank+0,    yysvec+19,    yyvstop+25,
  401. 0,    0,    0};
  402. struct yywork *yytop = yycrank+385;
  403. struct yysvf *yybgin = yysvec+1;
  404. unsigned char yymatch[] = {
  405. 00  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  406. 01  ,011 ,012 ,01  ,01  ,01  ,01  ,01  ,
  407. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  408. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  409. 011 ,01  ,'"' ,01  ,01  ,01  ,01  ,047 ,
  410. '(' ,'(' ,01  ,'+' ,011 ,'+' ,'.' ,01  ,
  411. '0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,
  412. '0' ,'0' ,01  ,011 ,01  ,01  ,01  ,01  ,
  413. 01  ,'A' ,'A' ,'A' ,'A' ,'E' ,'A' ,'A' ,
  414. 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
  415. 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
  416. 'A' ,'A' ,'A' ,01  ,01  ,01  ,01  ,'.' ,
  417. 01  ,'A' ,'A' ,'A' ,'A' ,'E' ,'A' ,'A' ,
  418. 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
  419. 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
  420. 'A' ,'A' ,'A' ,01  ,01  ,01  ,01  ,01  ,
  421. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  422. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  423. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  424. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  425. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  426. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  427. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  428. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  429. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  430. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  431. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  432. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  433. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  434. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  435. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  436. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  437. 0};
  438. char yyextra[] = {
  439. 0,0,0,0,0,0,0,0,
  440. 0,0,0,0,0,0,0,0,
  441. 0};
  442. #ident    "$Revision: 1.9 $"
  443.  
  444. int yylineno =1;
  445. # define YYU(x) x
  446. # define NLSTATE yyprevious=YYNEWLINE
  447. char yytext[YYLMAX];
  448. struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
  449. char yysbuf[YYLMAX];
  450. char *yysptr = yysbuf;
  451. int *yyfnd;
  452. extern struct yysvf *yyestate;
  453. int yyprevious = YYNEWLINE;
  454. #if defined(__cplusplus) || defined(__STDC__)
  455. int yylook(void)
  456. #else
  457. yylook()
  458. #endif
  459. {
  460.     register struct yysvf *yystate, **lsp;
  461.     register struct yywork *yyt;
  462.     struct yysvf *yyz;
  463.     int yych, yyfirst;
  464.     struct yywork *yyr;
  465. # ifdef LEXDEBUG
  466.     int debug;
  467. # endif
  468.     char *yylastch;
  469.     /* start off machines */
  470. # ifdef LEXDEBUG
  471.     debug = 0;
  472. # endif
  473.     yyfirst=1;
  474.     if (!yymorfg)
  475.         yylastch = yytext;
  476.     else {
  477.         yymorfg=0;
  478.         yylastch = yytext+yyleng;
  479.         }
  480.     for(;;){
  481.         lsp = yylstate;
  482.         yyestate = yystate = yybgin;
  483.         if (yyprevious==YYNEWLINE) yystate++;
  484.         for (;;){
  485. # ifdef LEXDEBUG
  486.             if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
  487. # endif
  488.             yyt = yystate->yystoff;
  489.             if(yyt == yycrank && !yyfirst){  /* may not be any transitions */
  490.                 yyz = yystate->yyother;
  491.                 if(yyz == 0)break;
  492.                 if(yyz->yystoff == yycrank)break;
  493.                 }
  494.             *yylastch++ = yych = input();
  495. #ifndef LONGLINES
  496.             if(yylastch > &yytext[YYLMAX]) {
  497.                 fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
  498.                 exit(1);
  499.             }
  500. #endif
  501.             yyfirst=0;
  502.         tryagain:
  503. # ifdef LEXDEBUG
  504.             if(debug){
  505.                 fprintf(yyout,"char ");
  506.                 allprint(yych);
  507.                 putchar('\n');
  508.                 }
  509. # endif
  510.             yyr = yyt;
  511.             if ( (void *)yyt > (void *)yycrank){
  512.                 yyt = yyr + yych;
  513.                 if (yyt <= yytop && yyt->verify+yysvec == yystate){
  514.                     if(yyt->advance+yysvec == YYLERR)    /* error transitions */
  515.                         {unput(*--yylastch);break;}
  516.                     *lsp++ = yystate = yyt->advance+yysvec;
  517. #ifndef LONGLINES
  518.                     if(lsp > &yylstate[YYLMAX]) {
  519.                         fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
  520.                         exit(1);
  521.                     }
  522. #endif
  523.                     goto contin;
  524.                     }
  525.                 }
  526. # ifdef YYOPTIM
  527.             else if((void *)yyt < (void *)yycrank) {    /* r < yycrank */
  528.                 yyt = yyr = yycrank+(yycrank-yyt);
  529. # ifdef LEXDEBUG
  530.                 if(debug)fprintf(yyout,"compressed state\n");
  531. # endif
  532.                 yyt = yyt + yych;
  533.                 if(yyt <= yytop && yyt->verify+yysvec == yystate){
  534.                     if(yyt->advance+yysvec == YYLERR)    /* error transitions */
  535.                         {unput(*--yylastch);break;}
  536.                     *lsp++ = yystate = yyt->advance+yysvec;
  537. #ifndef LONGLINES
  538.                     if(lsp > &yylstate[YYLMAX]) {
  539.                         fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
  540.                         exit(1);
  541.                     }
  542. #endif
  543.                     goto contin;
  544.                     }
  545.                 yyt = yyr + YYU(yymatch[yych]);
  546. # ifdef LEXDEBUG
  547.                 if(debug){
  548.                     fprintf(yyout,"try fall back character ");
  549.                     allprint(YYU(yymatch[yych]));
  550.                     putchar('\n');
  551.                     }
  552. # endif
  553.                 if(yyt <= yytop && yyt->verify+yysvec == yystate){
  554.                     if(yyt->advance+yysvec == YYLERR)    /* error transition */
  555.                         {unput(*--yylastch);break;}
  556.                     *lsp++ = yystate = yyt->advance+yysvec;
  557. #ifndef LONGLINES
  558.                     if(lsp > &yylstate[YYLMAX]) {
  559.                         fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
  560.                         exit(1);
  561.                     }
  562. #endif
  563.                     goto contin;
  564.                     }
  565.                 }
  566.             if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
  567. # ifdef LEXDEBUG
  568.                 if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
  569. # endif
  570.                 goto tryagain;
  571.                 }
  572. # endif
  573.             else
  574.                 {unput(*--yylastch);break;}
  575.         contin:
  576. # ifdef LEXDEBUG
  577.             if(debug){
  578.                 fprintf(yyout,"state %d char ",yystate-yysvec-1);
  579.                 allprint(yych);
  580.                 putchar('\n');
  581.                 }
  582. # endif
  583.             ;
  584.             }
  585. # ifdef LEXDEBUG
  586.         if(debug){
  587.             fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
  588.             allprint(yych);
  589.             putchar('\n');
  590.             }
  591. # endif
  592.         while (lsp-- > yylstate){
  593.             *yylastch-- = 0;
  594.             if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
  595.                 yyolsp = lsp;
  596.                 if(yyextra[*yyfnd]){        /* must backup */
  597.                     while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
  598.                         lsp--;
  599.                         unput(*yylastch--);
  600.                         }
  601.                     }
  602.                 yyprevious = YYU(*yylastch);
  603.                 yylsp = lsp;
  604.                 yyleng = (int)(yylastch-yytext+1);
  605.                 yytext[yyleng] = 0;
  606. # ifdef LEXDEBUG
  607.                 if(debug){
  608.                     fprintf(yyout,"\nmatch ");
  609.                     sprint(yytext);
  610.                     fprintf(yyout," action %d\n",*yyfnd);
  611.                     }
  612. # endif
  613.                 return(*yyfnd++);
  614.                 }
  615.             unput(*yylastch);
  616.             }
  617.         if (yytext[0] == 0  /* && feof(yyin) */)
  618.             {
  619.             yysptr=yysbuf;
  620.             return(0);
  621.             }
  622.         yyprevious = yytext[0] = input();
  623.         if (yyprevious>0)
  624.             output(yyprevious);
  625.         yylastch=yytext;
  626. # ifdef LEXDEBUG
  627.         if(debug)putchar('\n');
  628. # endif
  629.         }
  630.     }
  631. #if defined(__cplusplus) || defined(__STDC__)
  632. int yyback(int *p, int m)
  633. #else
  634. yyback(p, m)
  635.     int *p;
  636. #endif
  637. {
  638.     if (p==0) return(0);
  639.     while (*p) {
  640.         if (*p++ == m)
  641.             return(1);
  642.     }
  643.     return(0);
  644. }
  645.     /* the following are only used in the lex library */
  646. #if defined(__cplusplus) || defined(__STDC__)
  647. int yyinput(void)
  648. #else
  649. yyinput()
  650. #endif
  651. {
  652.     return(input());
  653.     }
  654. #if defined(__cplusplus) || defined(__STDC__)
  655. void yyoutput(int c)
  656. #else
  657. yyoutput(c)
  658.   int c; 
  659. #endif
  660. {
  661.     output(c);
  662.     }
  663. #if defined(__cplusplus) || defined(__STDC__)
  664. void yyunput(int c)
  665. #else
  666. yyunput(c)
  667.    int c; 
  668. #endif
  669. {
  670.     unput(c);
  671.     }
  672.