home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Distributions / ucb / spencer_2bsd.tar.gz / 2bsd.tar / src / pi0 / yymain.c < prev    next >
C/C++ Source or Header  |  1980-02-17  |  1KB  |  79 lines

  1. /* Copyright (c) 1979 Regents of the University of California */
  2. #
  3. /*
  4.  * pi - Pascal interpreter code translator
  5.  *
  6.  * Charles Haley, Bill Joy UCB
  7.  * Version 1.2 January 1979
  8.  */
  9.  
  10. #include "0.h"
  11. #include "yy.h"
  12.  
  13. int    line 1;
  14.  
  15. /*
  16.  * Yymain initializes each of the utility
  17.  * clusters and then starts the processing
  18.  * by calling yyparse.
  19.  */
  20. yymain()
  21. {
  22. #ifdef PI0
  23.     char strings[STRINC];
  24.     int trspace[ITREE];
  25.     int hshtab[HASHINC];
  26.  
  27. /*
  28.     clear(strings, sizeof strings);
  29.     clear(trspace, sizeof trspace);
  30. */
  31.     clear(hshtab, sizeof hshtab);
  32. #endif
  33.  
  34.     /*
  35.      * Initialize the scanner
  36.      */
  37.     if (getline() == -1) {
  38.         Perror(filename, "No lines in file");
  39.         pexit(NOSTART);
  40.     }
  41.  
  42.     /*
  43.      * Initialize the clusters
  44.      */
  45. #ifdef PI0
  46.     initstring(strings);
  47.     inithash(hshtab);
  48.     inittree(trspace);
  49.     send(RINIT);
  50. #else
  51.     initstring();
  52.  
  53.     inithash();
  54.     inittree();
  55. #endif
  56.     initnl();
  57.  
  58.     /*
  59.      * Process the input
  60.      */
  61.     yyparse();
  62. #ifdef DEBUG
  63.     dumpnl(0);
  64. #endif
  65.     send(RFINISH);
  66.     pexit(eflg ? ERRS : AOK);
  67. }
  68.  
  69. #ifdef PI0
  70. clear(cp, i)
  71.     register char *cp;
  72.     register int i;
  73. {
  74.     do
  75.         *cp++ = 0;
  76.     while (--i);
  77. }
  78. #endif
  79.