home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / source / m6 / m62.c < prev    next >
Encoding:
C/C++ Source or Header  |  1975-07-17  |  1.3 KB  |  91 lines

  1. #
  2.  
  3. #include "m6.h"
  4.  
  5. control() {
  6.  
  7.     while(1) {
  8.         get();
  9.         if(c==0 && lg>0)  {
  10.             popget(); 
  11.             trash(); 
  12.             rescan = 1; 
  13.         }
  14.         else {
  15.             if(!rescan) put();
  16.             else if(lq>0) {
  17.                 if(c==lquote) {
  18.                     lq++; 
  19.                     put(); 
  20.                 }
  21.                 else if(c==rquote || c==0)  {
  22.                     lq--;
  23.                     if(lq>0 || l9>0) put (rquote); 
  24.                 }
  25.                 else put(); 
  26.             }
  27.             else if(l9>0) 
  28.                 if(c==colon||c==0||c==semi) 
  29.                     if(--l9<=0) endcall();
  30.                     else put();
  31.                 else {
  32.                     if(c==sharp) l9++;
  33.                     else if(c==lquote) lq++;
  34.                     put(); 
  35.                 }
  36.             else {
  37.                 if(c==sharp) begincall();
  38.                 else if(c==lquote) lq++;
  39.                 else if(lp>0) {
  40.                     if(c==colon||c==0||c==semi) endcall();
  41.                     else if(c==comma) newarg();
  42.                     else put(); 
  43.                 }
  44.                 else if(c==0) return;    /* lg=lp=lq=0 */
  45.                 else put(); 
  46.             } 
  47.         } 
  48.     } 
  49. }
  50.  
  51. endcall() {
  52.     char *pt, *p;
  53.     rescan = c!=semi;
  54.     newarg();
  55.     pushget();
  56.     pt = &pf->pa0;
  57.     ge = move(pt,&gf->ga0,pe-pt);
  58.     if(ge>gmax) diag("Call stack overflow");
  59.     if(traceflag) dotrace();
  60.     p = finddef(0);
  61.     setscan(p);
  62.     popput();
  63.     lp--;
  64.     function(p->dswitch); 
  65. }
  66.  
  67. begincall() {
  68.     lp++;
  69.     pushput();
  70.     pe = pf+pend;
  71.     pf->pan = pf->pa0 = 0;
  72. }
  73.  
  74. newarg() {
  75.     char *p;
  76.     if(++pf->pan>=9) if(c==comma) l9++;
  77.     *pe++ = 0;
  78.     pe = (pe+1)&0177776;
  79.     p = &pf->pa0;
  80.     while(p->word!=0) p =+ p->word;
  81.     p->word = pe - p;
  82.     *pe++ = *pe++ = 0; 
  83. }
  84.  
  85. setscan(p) 
  86. char *p;
  87. {
  88.     gf->mchar = (gf->mframe = p)->dtext;
  89.     gf->marg = 0; 
  90. }
  91.