home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Graphics / graphics-16000.iso / msdos / raytrace / vort / vort / text3d / lex.c < prev    next >
C/C++ Source or Header  |  1991-02-11  |  16KB  |  916 lines

  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 BUFSIZ
  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. #include <math.h>
  29. #include "text3d.h"
  30. #include "gram.h"
  31.  
  32. extern int    linecount;
  33. extern double    atof();
  34.  
  35. # define YYNEWLINE 10
  36. yylex(){
  37. int nstr; extern int yyprevious;
  38. while((nstr = yylook()) >= 0)
  39. yyfussy: switch(nstr){
  40. case 0:
  41. if(yywrap()) return(0); break;
  42. case 1:
  43.     return(OUTPUT);
  44. break;
  45. case 2:
  46.     return(DRAWSTR);
  47. break;
  48. case 3:
  49.     return(COLOUR);
  50. break;
  51. case 4:
  52.     return(COLOUR);
  53. break;
  54. case 5:
  55. return(TEXTSIZE);
  56. break;
  57. case 6:
  58.     return(AMBIENT);
  59. break;
  60. case 7:
  61. return(REFLECTANCE);
  62. break;
  63. case 8:
  64. return(TRANSPARENCY);
  65. break;
  66. case 9:
  67. return(MATERIAL);
  68. break;
  69. case 10:
  70. return(TEXTRADIUS);
  71. break;
  72. case 11:
  73. return(FIXEDWIDTH);
  74. break;
  75. case 12:
  76. return(CENTERTEXT);
  77. break;
  78. case 13:
  79. return(CENTERTEXT);
  80. break;
  81. case 14:
  82.     return(TEXTANG);
  83. break;
  84. case 15:
  85.     return(FONT);
  86. break;
  87. case 16:
  88. return(DRAWCHAR);
  89. break;
  90. case 17:
  91.     return(BOXFIT);
  92. break;
  93. case 18:
  94.     return(BOXTEXT);
  95. break;
  96. case 19:
  97.     return(MOVE);
  98. break;
  99. case 20:
  100.     return(SCALE);
  101. break;
  102. case 21:
  103. return(TRANSLATE);
  104. break;
  105. case 22:
  106.     return(ROTATE);
  107. break;
  108. case 23:
  109. return(FIXEDWIDTH);
  110. break;
  111. case 24:
  112. return(CENTERTEXT);
  113. break;
  114. case 25:
  115.     return(TRUE);
  116. break;
  117. case 26:
  118.     return(FALSE);
  119. break;
  120. case 27:
  121.     return(CYL_SPH);
  122. break;
  123. case 28:
  124.     return(BOX_CYL);
  125. break;
  126. case 29:
  127. {
  128.             yylval.y_int = atoi(yytext);
  129.             return(INTEGER);
  130.         }
  131. break;
  132. case 30:
  133. {
  134.             yylval.y_flt = atof(yytext);
  135.             return(FLOAT);
  136.         }
  137. break;
  138. case 31:
  139.     {
  140.             int    braces = 1, c;
  141.             while ((c = getchar()) != '{')
  142.                 if (c == '\n')
  143.                     linecount++;
  144.  
  145.             while (braces) {
  146.                 c = getchar();
  147.                 if (c == '\n')
  148.                     linecount++;
  149.  
  150.                 if (c == '\\') {
  151.                     c = getchar();
  152.                     putchar(c);
  153.                     if (c == '\n')
  154.                         linecount++;
  155.                 } else {
  156.                     
  157.                     if (c == '{')
  158.                         braces++;
  159.                     if (c == '}')
  160.                         braces--;
  161.  
  162.                     if (c == EOF) {
  163.                         fprintf(stderr, "Unterminated copy\n");
  164.                         exit(1);
  165.                     }
  166.  
  167.                     if (braces)
  168.                         putchar(c);
  169.                 }
  170.             }
  171.             while ((c = getchar()) == '\n' || c == ' ' || c == '\t' )
  172.                 if (c == '\n')
  173.                     linecount++;
  174.  
  175.             ungetc(c, stdin);
  176.             putchar('\n');
  177.         }
  178. break;
  179. case 32:
  180.     return(PLUS);
  181. break;
  182. case 33:
  183.     return(MINUS);
  184. break;
  185. case 34:
  186.     return(DIV);
  187. break;
  188. case 35:
  189.     return(MULT);
  190. break;
  191. case 36:
  192.     return(PCENT);
  193. break;
  194. case 37:
  195.     return(POWER);
  196. break;
  197. case 38:
  198.     return(COMMA);
  199. break;
  200. case 39:
  201.     return(LP);
  202. break;
  203. case 40:
  204.     return(RP);
  205. break;
  206. case 41:
  207.     return(EQUALS);
  208. break;
  209. case 42:
  210.     {
  211.             int    c1, c2;
  212.  
  213.             c1 = getchar();
  214.  
  215.             if (c1 == '\\')
  216.                 c1 = getchar();
  217.  
  218.             if (c1 == '\n' || c1 == EOF)
  219.                 yyerror("syntax error");
  220.  
  221.             while((c2 = getchar()) != '\'')
  222.                 if (c2 == '\n' || c2 == EOF)
  223.                     yyerror("syntax error");
  224.                     
  225.              
  226.             yylval.y_int = c1;
  227.             return(INTEGER);
  228.         }
  229. break;
  230. case 43:
  231.     {
  232.             char    buf[BUFSIZ], *p;
  233.             
  234.             for (p = buf; (*p = getchar()) != '"'; p++) {
  235.                 if (*p == '\n' || *p == EOF) {
  236.                     sprintf(buf, "syntax error\n", linecount);
  237.                     yyerror(buf);
  238.                 }
  239.                     
  240.  
  241.                 if (*p == '\\') 
  242.                     *p = getchar();
  243.             }
  244.  
  245.             *p = 0;
  246.  
  247.             yylval.y_str = (char *)malloc(strlen(buf) + 1);
  248.             strcpy(yylval.y_str, buf);
  249.  
  250.             return(STRING);
  251.         }
  252. break;
  253. case 44:
  254.     {
  255.             return(LBRACE);
  256.         }
  257. break;
  258. case 45:
  259.     {
  260.             return(RBRACE);
  261.         }
  262. break;
  263. case 46:
  264.     {
  265.             linecount++;
  266.         }
  267. break;
  268. case 47:
  269.     {
  270.             ;
  271.         }
  272. break;
  273. case 48:
  274.     {
  275.             int    c1, c2;
  276.             int    comline, incomment = 1;
  277.             char    buf[BUFSIZ];
  278.  
  279.             comline = linecount;
  280.  
  281.             do {
  282.                 while ((c1 = getchar()) != '*' && c1 != '/' && c1 != EOF)
  283.                     if (c1 == '\n')
  284.                         linecount++;
  285.  
  286.                 c2 = getchar();
  287.                 if (c2 == '\n')
  288.                     linecount++;
  289.  
  290.                 if (c1 == '*' && c2 == '/')
  291.                     incomment--;
  292.  
  293.                 if (c1 == '/' && c2 == '*') {
  294.                     incomment++;
  295.                     comline = linecount;
  296.                 }
  297.  
  298.             } while (incomment && c2 != EOF);
  299.  
  300.             if (c1 == EOF || c2 == EOF) {
  301.                 fprintf(stderr, "text3d: unterminated comment - started line %d.\n", comline);
  302.                 exit(1);
  303.             }
  304.         }
  305. break;
  306. case -1:
  307. break;
  308. default:
  309. fprintf(yyout,"bad switch yylook %d",nstr);
  310. } return(0); }
  311. /* end of yylex */
  312. int yyvstop[] = {
  313. 0,
  314.  
  315. 29,
  316. 0,
  317.  
  318. 29,
  319. 0,
  320.  
  321. 47,
  322. 0,
  323.  
  324. 46,
  325. 0,
  326.  
  327. 43,
  328. 0,
  329.  
  330. 36,
  331. 0,
  332.  
  333. 42,
  334. 0,
  335.  
  336. 39,
  337. 0,
  338.  
  339. 40,
  340. 0,
  341.  
  342. 35,
  343. 0,
  344.  
  345. 32,
  346. 0,
  347.  
  348. 38,
  349. 0,
  350.  
  351. 33,
  352. 0,
  353.  
  354. 30,
  355. 0,
  356.  
  357. 34,
  358. 0,
  359.  
  360. 29,
  361. 0,
  362.  
  363. 41,
  364. 0,
  365.  
  366. 37,
  367. 0,
  368.  
  369. 44,
  370. 0,
  371.  
  372. 45,
  373. 0,
  374.  
  375. 48,
  376. 0,
  377.  
  378. 31,
  379. 0,
  380.  
  381. 15,
  382. 0,
  383.  
  384. 19,
  385. 0,
  386.  
  387. 25,
  388. 0,
  389.  
  390. 4,
  391. 0,
  392.  
  393. 26,
  394. 0,
  395.  
  396. 20,
  397. 0,
  398.  
  399. 17,
  400. 0,
  401.  
  402. 3,
  403. 0,
  404.  
  405. 1,
  406. 0,
  407.  
  408. 22,
  409. 0,
  410.  
  411. 6,
  412. 0,
  413.  
  414. 28,
  415. 0,
  416.  
  417. 18,
  418. 0,
  419.  
  420. 27,
  421. 0,
  422.  
  423. 2,
  424. 0,
  425.  
  426. 14,
  427. 0,
  428.  
  429. 16,
  430. 0,
  431.  
  432. 9,
  433. 0,
  434.  
  435. 5,
  436. 0,
  437.  
  438. 21,
  439. 0,
  440.  
  441. 12,
  442. 24,
  443. 0,
  444.  
  445. 13,
  446. 0,
  447.  
  448. 11,
  449. 23,
  450. 0,
  451.  
  452. 10,
  453. 0,
  454.  
  455. 7,
  456. 0,
  457.  
  458. 8,
  459. 0,
  460. 0};
  461. # define YYTYPE int
  462. struct yywork { YYTYPE verify, advance; } yycrank[] = {
  463. 0,0,    0,0,    0,0,    0,0,    
  464. 0,0,    0,0,    0,0,    0,0,    
  465. 0,0,    0,0,    1,3,    1,4,    
  466. 0,0,    0,0,    0,0,    0,0,    
  467. 0,0,    0,0,    0,0,    0,0,    
  468. 0,0,    0,0,    0,0,    0,0,    
  469. 0,0,    0,0,    0,0,    0,0,    
  470. 0,0,    0,0,    0,0,    0,0,    
  471. 0,0,    1,3,    0,0,    1,5,    
  472. 0,0,    0,0,    1,6,    0,0,    
  473. 1,7,    1,8,    1,9,    1,10,    
  474. 1,11,    1,12,    1,13,    1,14,    
  475. 1,15,    1,16,    1,16,    1,16,    
  476. 1,16,    1,16,    1,16,    1,16,    
  477. 1,16,    1,16,    1,16,    15,31,    
  478. 0,0,    0,0,    1,17,    14,14,    
  479. 14,14,    14,14,    14,14,    14,14,    
  480. 14,14,    14,14,    14,14,    14,14,    
  481. 14,14,    16,14,    0,0,    16,16,    
  482. 16,16,    16,16,    16,16,    16,16,    
  483. 16,16,    16,16,    16,16,    16,16,    
  484. 16,16,    0,0,    0,0,    0,0,    
  485. 0,0,    0,0,    0,0,    0,0,    
  486. 0,0,    0,0,    0,0,    1,18,    
  487. 0,0,    0,0,    1,19,    1,20,    
  488. 1,21,    1,22,    27,46,    1,23,    
  489. 32,49,    37,55,    23,38,    24,41,    
  490. 21,34,    0,0,    1,24,    19,32,    
  491. 1,25,    20,33,    23,39,    1,26,    
  492. 1,27,    1,28,    21,35,    22,37,    
  493. 23,40,    24,42,    25,43,    26,44,    
  494. 1,29,    28,47,    1,30,    33,50,    
  495. 21,36,    34,51,    35,52,    36,54,    
  496. 38,56,    26,45,    35,53,    39,57,    
  497. 40,58,    41,59,    28,48,    42,60,    
  498. 43,61,    44,62,    45,63,    46,64,    
  499. 47,65,    48,66,    49,68,    50,69,    
  500. 51,72,    52,73,    53,74,    54,75,    
  501. 55,76,    56,77,    50,70,    57,78,    
  502. 58,79,    59,80,    60,81,    61,82,    
  503. 62,83,    63,84,    64,85,    65,86,    
  504. 66,87,    48,67,    67,88,    68,89,    
  505. 50,71,    69,90,    70,91,    71,92,    
  506. 72,93,    73,95,    75,97,    76,98,    
  507. 73,96,    77,100,    78,101,    80,102,    
  508. 82,103,    83,104,    84,105,    85,106,    
  509. 86,107,    72,94,    87,110,    89,111,    
  510. 90,112,    91,113,    92,114,    76,99,    
  511. 93,115,    94,116,    96,117,    97,118,    
  512. 98,119,    99,120,    101,121,    102,122,    
  513. 103,123,    86,108,    86,109,    104,124,    
  514. 105,125,    107,126,    108,127,    109,128,    
  515. 110,129,    111,131,    112,132,    114,133,    
  516. 110,130,    115,134,    116,135,    118,136,    
  517. 119,137,    120,138,    121,139,    122,140,    
  518. 124,141,    126,142,    127,143,    128,144,    
  519. 129,145,    130,146,    134,147,    135,148,    
  520. 137,149,    139,150,    140,151,    141,152,    
  521. 143,153,    144,154,    145,155,    146,156,    
  522. 147,157,    148,158,    150,159,    152,160,    
  523. 153,161,    155,162,    156,163,    157,164,    
  524. 158,165,    159,166,    160,167,    161,168,    
  525. 163,169,    167,170,    169,171,    171,172,    
  526. 0,0};
  527. struct yysvf yysvec[] = {
  528. 0,    0,    0,
  529. yycrank+1,    0,        yyvstop+1,
  530. yycrank+0,    yysvec+1,    yyvstop+3,
  531. yycrank+0,    0,        yyvstop+5,
  532. yycrank+0,    0,        yyvstop+7,
  533. yycrank+0,    0,        yyvstop+9,
  534. yycrank+0,    0,        yyvstop+11,
  535. yycrank+0,    0,        yyvstop+13,
  536. yycrank+0,    0,        yyvstop+15,
  537. yycrank+0,    0,        yyvstop+17,
  538. yycrank+0,    0,        yyvstop+19,
  539. yycrank+0,    0,        yyvstop+21,
  540. yycrank+0,    0,        yyvstop+23,
  541. yycrank+0,    0,        yyvstop+25,
  542. yycrank+15,    0,        yyvstop+27,
  543. yycrank+17,    0,        yyvstop+29,
  544. yycrank+27,    0,        yyvstop+31,
  545. yycrank+0,    0,        yyvstop+33,
  546. yycrank+0,    0,        yyvstop+35,
  547. yycrank+2,    0,        0,    
  548. yycrank+2,    0,        0,    
  549. yycrank+7,    0,        0,    
  550. yycrank+5,    0,        0,    
  551. yycrank+9,    0,        0,    
  552. yycrank+10,    0,        0,    
  553. yycrank+5,    0,        0,    
  554. yycrank+22,    0,        0,    
  555. yycrank+3,    0,        0,    
  556. yycrank+24,    0,        0,    
  557. yycrank+0,    0,        yyvstop+37,
  558. yycrank+0,    0,        yyvstop+39,
  559. yycrank+0,    0,        yyvstop+41,
  560. yycrank+6,    0,        0,    
  561. yycrank+7,    0,        0,    
  562. yycrank+19,    0,        0,    
  563. yycrank+22,    0,        0,    
  564. yycrank+23,    0,        0,    
  565. yycrank+8,    0,        0,    
  566. yycrank+24,    0,        0,    
  567. yycrank+15,    0,        0,    
  568. yycrank+26,    0,        0,    
  569. yycrank+21,    0,        0,    
  570. yycrank+21,    0,        0,    
  571. yycrank+24,    0,        0,    
  572. yycrank+39,    0,        0,    
  573. yycrank+26,    0,        0,    
  574. yycrank+46,    0,        0,    
  575. yycrank+24,    0,        0,    
  576. yycrank+48,    0,        0,    
  577. yycrank+41,    0,        0,    
  578. yycrank+52,    0,        0,    
  579. yycrank+32,    0,        0,    
  580. yycrank+38,    0,        0,    
  581. yycrank+29,    0,        0,    
  582. yycrank+56,    0,        0,    
  583. yycrank+33,    0,        0,    
  584. yycrank+38,    0,        0,    
  585. yycrank+54,    0,        0,    
  586. yycrank+40,    0,        0,    
  587. yycrank+56,    0,        0,    
  588. yycrank+57,    0,        0,    
  589. yycrank+47,    0,        0,    
  590. yycrank+52,    0,        0,    
  591. yycrank+64,    0,        0,    
  592. yycrank+54,    0,        0,    
  593. yycrank+47,    0,        0,    
  594. yycrank+54,    0,        0,    
  595. yycrank+65,    0,        0,    
  596. yycrank+66,    0,        0,    
  597. yycrank+70,    0,        0,    
  598. yycrank+65,    0,        0,    
  599. yycrank+70,    0,        0,    
  600. yycrank+71,    0,        0,    
  601. yycrank+59,    0,        0,    
  602. yycrank+0,    0,        yyvstop+43,
  603. yycrank+59,    0,        0,    
  604. yycrank+76,    0,        0,    
  605. yycrank+76,    0,        0,    
  606. yycrank+78,    0,        0,    
  607. yycrank+0,    0,        yyvstop+45,
  608. yycrank+65,    0,        0,    
  609. yycrank+0,    0,        yyvstop+47,
  610. yycrank+63,    0,        0,    
  611. yycrank+80,    0,        0,    
  612. yycrank+66,    0,        0,    
  613. yycrank+82,    0,        0,    
  614. yycrank+87,    0,        0,    
  615. yycrank+71,    0,        0,    
  616. yycrank+0,    0,        yyvstop+49,
  617. yycrank+77,    0,        0,    
  618. yycrank+67,    0,        0,    
  619. yycrank+73,    0,        0,    
  620. yycrank+70,    0,        0,    
  621. yycrank+78,    0,        0,    
  622. yycrank+92,    0,        0,    
  623. yycrank+0,    0,        yyvstop+51,
  624. yycrank+80,    0,        0,    
  625. yycrank+83,    0,        0,    
  626. yycrank+92,    0,        0,    
  627. yycrank+81,    0,        0,    
  628. yycrank+0,    0,        yyvstop+53,
  629. yycrank+79,    0,        0,    
  630. yycrank+94,    0,        0,    
  631. yycrank+84,    0,        0,    
  632. yycrank+104,    0,        0,    
  633. yycrank+103,    0,        0,    
  634. yycrank+0,    0,        yyvstop+55,
  635. yycrank+95,    0,        0,    
  636. yycrank+109,    0,        0,    
  637. yycrank+102,    0,        0,    
  638. yycrank+100,    0,        0,    
  639. yycrank+93,    0,        0,    
  640. yycrank+102,    0,        0,    
  641. yycrank+0,    0,        yyvstop+57,
  642. yycrank+95,    0,        0,    
  643. yycrank+97,    0,        0,    
  644. yycrank+98,    0,        0,    
  645. yycrank+0,    0,        yyvstop+59,
  646. yycrank+111,    0,        0,    
  647. yycrank+119,    0,        0,    
  648. yycrank+103,    0,        0,    
  649. yycrank+113,    0,        0,    
  650. yycrank+122,    0,        0,    
  651. yycrank+0,    0,        yyvstop+61,
  652. yycrank+104,    0,        0,    
  653. yycrank+0,    0,        yyvstop+63,
  654. yycrank+118,    0,        0,    
  655. yycrank+122,    0,        0,    
  656. yycrank+101,    0,        0,    
  657. yycrank+127,    0,        0,    
  658. yycrank+128,    0,        0,    
  659. yycrank+0,    0,        yyvstop+65,
  660. yycrank+0,    0,        yyvstop+67,
  661. yycrank+0,    0,        yyvstop+69,
  662. yycrank+125,    0,        0,    
  663. yycrank+126,    0,        0,    
  664. yycrank+0,    0,        yyvstop+71,
  665. yycrank+114,    0,        0,    
  666. yycrank+0,    0,        yyvstop+73,
  667. yycrank+129,    0,        0,    
  668. yycrank+122,    0,        0,    
  669. yycrank+134,    0,        0,    
  670. yycrank+0,    0,        yyvstop+75,
  671. yycrank+127,    0,        0,    
  672. yycrank+132,    0,        0,    
  673. yycrank+118,    0,        0,    
  674. yycrank+121,    0,        0,    
  675. yycrank+116,    0,        0,    
  676. yycrank+117,    0,        0,    
  677. yycrank+0,    0,        yyvstop+77,
  678. yycrank+122,    0,        0,    
  679. yycrank+0,    0,        yyvstop+79,
  680. yycrank+129,    0,        0,    
  681. yycrank+123,    0,        0,    
  682. yycrank+0,    0,        yyvstop+81,
  683. yycrank+140,    0,        0,    
  684. yycrank+141,    0,        0,    
  685. yycrank+127,    0,        0,    
  686. yycrank+128,    0,        0,    
  687. yycrank+141,    0,        0,    
  688. yycrank+147,    0,        0,    
  689. yycrank+132,    0,        0,    
  690. yycrank+0,    0,        yyvstop+83,
  691. yycrank+138,    0,        0,    
  692. yycrank+0,    0,        yyvstop+85,
  693. yycrank+0,    0,        yyvstop+88,
  694. yycrank+0,    0,        yyvstop+90,
  695. yycrank+148,    0,        0,    
  696. yycrank+0,    0,        yyvstop+93,
  697. yycrank+151,    0,        0,    
  698. yycrank+0,    0,        yyvstop+95,
  699. yycrank+130,    0,        0,    
  700. yycrank+0,    0,        yyvstop+97,
  701. 0,    0,    0};
  702. struct yywork *yytop = yycrank+251;
  703. struct yysvf *yybgin = yysvec+1;
  704. char yymatch[] = {
  705. 00  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  706. 01  ,011 ,01  ,01  ,01  ,01  ,01  ,01  ,
  707. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  708. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  709. 011 ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  710. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  711. '0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,
  712. '0' ,'0' ,01  ,01  ,01  ,01  ,01  ,01  ,
  713. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  714. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  715. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  716. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  717. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  718. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  719. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  720. 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
  721. 0};
  722. char yyextra[] = {
  723. 0,0,0,0,0,0,0,0,
  724. 0,0,0,0,0,0,0,0,
  725. 0,0,0,0,0,0,0,0,
  726. 0,0,0,0,0,0,0,0,
  727. 0,0,0,0,0,0,0,0,
  728. 0,0,0,0,0,0,0,0,
  729. 0,0,0,0,0,0,0,0,
  730. 0};
  731. #ifndef lint
  732. static    char ncform_sccsid[] = "@(#)ncform 1.6 88/02/08 SMI"; /* from S5R2 1.2 */
  733. #endif
  734.  
  735. int yylineno =1;
  736. # define YYU(x) x
  737. # define NLSTATE yyprevious=YYNEWLINE
  738. char yytext[YYLMAX];
  739. struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
  740. char yysbuf[YYLMAX];
  741. char *yysptr = yysbuf;
  742. int *yyfnd;
  743. extern struct yysvf *yyestate;
  744. int yyprevious = YYNEWLINE;
  745. yylook(){
  746.     register struct yysvf *yystate, **lsp;
  747.     register struct yywork *yyt;
  748.     struct yysvf *yyz;
  749.     int yych, yyfirst;
  750.     struct yywork *yyr;
  751. # ifdef LEXDEBUG
  752.     int debug;
  753. # endif
  754.     char *yylastch;
  755.     /* start off machines */
  756. # ifdef LEXDEBUG
  757.     debug = 0;
  758. # endif
  759.     yyfirst=1;
  760.     if (!yymorfg)
  761.         yylastch = yytext;
  762.     else {
  763.         yymorfg=0;
  764.         yylastch = yytext+yyleng;
  765.         }
  766.     for(;;){
  767.         lsp = yylstate;
  768.         yyestate = yystate = yybgin;
  769.         if (yyprevious==YYNEWLINE) yystate++;
  770.         for (;;){
  771. # ifdef LEXDEBUG
  772.             if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
  773. # endif
  774.             yyt = yystate->yystoff;
  775.             if(yyt == yycrank && !yyfirst){  /* may not be any transitions */
  776.                 yyz = yystate->yyother;
  777.                 if(yyz == 0)break;
  778.                 if(yyz->yystoff == yycrank)break;
  779.                 }
  780.             *yylastch++ = yych = input();
  781.             yyfirst=0;
  782.         tryagain:
  783. # ifdef LEXDEBUG
  784.             if(debug){
  785.                 fprintf(yyout,"char ");
  786.                 allprint(yych);
  787.                 putchar('\n');
  788.                 }
  789. # endif
  790.             yyr = yyt;
  791.             if ( (int)yyt > (int)yycrank){
  792.                 yyt = yyr + yych;
  793.                 if (yyt <= yytop && yyt->verify+yysvec == yystate){
  794.                     if(yyt->advance+yysvec == YYLERR)    /* error transitions */
  795.                         {unput(*--yylastch);break;}
  796.                     *lsp++ = yystate = yyt->advance+yysvec;
  797.                     goto contin;
  798.                     }
  799.                 }
  800. # ifdef YYOPTIM
  801.             else if((int)yyt < (int)yycrank) {        /* r < yycrank */
  802.                 yyt = yyr = yycrank+(yycrank-yyt);
  803. # ifdef LEXDEBUG
  804.                 if(debug)fprintf(yyout,"compressed state\n");
  805. # endif
  806.                 yyt = yyt + yych;
  807.                 if(yyt <= yytop && yyt->verify+yysvec == yystate){
  808.                     if(yyt->advance+yysvec == YYLERR)    /* error transitions */
  809.                         {unput(*--yylastch);break;}
  810.                     *lsp++ = yystate = yyt->advance+yysvec;
  811.                     goto contin;
  812.                     }
  813.                 yyt = yyr + YYU(yymatch[yych]);
  814. # ifdef LEXDEBUG
  815.                 if(debug){
  816.                     fprintf(yyout,"try fall back character ");
  817.                     allprint(YYU(yymatch[yych]));
  818.                     putchar('\n');
  819.                     }
  820. # endif
  821.                 if(yyt <= yytop && yyt->verify+yysvec == yystate){
  822.                     if(yyt->advance+yysvec == YYLERR)    /* error transition */
  823.                         {unput(*--yylastch);break;}
  824.                     *lsp++ = yystate = yyt->advance+yysvec;
  825.                     goto contin;
  826.                     }
  827.                 }
  828.             if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
  829. # ifdef LEXDEBUG
  830.                 if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
  831. # endif
  832.                 goto tryagain;
  833.                 }
  834. # endif
  835.             else
  836.                 {unput(*--yylastch);break;}
  837.         contin:
  838. # ifdef LEXDEBUG
  839.             if(debug){
  840.                 fprintf(yyout,"state %d char ",yystate-yysvec-1);
  841.                 allprint(yych);
  842.                 putchar('\n');
  843.                 }
  844. # endif
  845.             ;
  846.             }
  847. # ifdef LEXDEBUG
  848.         if(debug){
  849.             fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
  850.             allprint(yych);
  851.             putchar('\n');
  852.             }
  853. # endif
  854.         while (lsp-- > yylstate){
  855.             *yylastch-- = 0;
  856.             if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
  857.                 yyolsp = lsp;
  858.                 if(yyextra[*yyfnd]){        /* must backup */
  859.                     while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
  860.                         lsp--;
  861.                         unput(*yylastch--);
  862.                         }
  863.                     }
  864.                 yyprevious = YYU(*yylastch);
  865.                 yylsp = lsp;
  866.                 yyleng = yylastch-yytext+1;
  867.                 yytext[yyleng] = 0;
  868. # ifdef LEXDEBUG
  869.                 if(debug){
  870.                     fprintf(yyout,"\nmatch ");
  871.                     sprint(yytext);
  872.                     fprintf(yyout," action %d\n",*yyfnd);
  873.                     }
  874. # endif
  875.                 return(*yyfnd++);
  876.                 }
  877.             unput(*yylastch);
  878.             }
  879.         if (yytext[0] == 0  /* && feof(yyin) */)
  880.             {
  881.             yysptr=yysbuf;
  882.             return(0);
  883.             }
  884.         yyprevious = yytext[0] = input();
  885.         if (yyprevious>0)
  886.             output(yyprevious);
  887.         yylastch=yytext;
  888. # ifdef LEXDEBUG
  889.         if(debug)putchar('\n');
  890. # endif
  891.         }
  892.     }
  893. yyback(p, m)
  894.     int *p;
  895. {
  896. if (p==0) return(0);
  897. while (*p)
  898.     {
  899.     if (*p++ == m)
  900.         return(1);
  901.     }
  902. return(0);
  903. }
  904.     /* the following are only used in the lex library */
  905. yyinput(){
  906.     return(input());
  907.     }
  908. yyoutput(c)
  909.   int c; {
  910.     output(c);
  911.     }
  912. yyunput(c)
  913.    int c; {
  914.     unput(c);
  915.     }
  916.