1: #include "defs"
   2: 
   3: 
   4: cleanst()
   5: {
   6: register ptr p, q;
   7: ptr pjunk;
   8: int i;
   9: register struct stentry *s;
  10: struct stentry **hp;
  11: 
  12: TEST fprintf(diagfile, "\n");
  13: 
  14: clcomm();
  15: 
  16: for(hp = hashtab ; hp<hashend ; ++hp)
  17:     while( s = *hp )
  18:     {
  19:     if( q = s->varp )
  20:         {
  21:         if( q->blklevel > 0 )
  22:             {
  23:             TEST fprintf(diagfile, "remove %s from st\n", s->namep);
  24:             switch(q->tag)
  25:                 {
  26:                 case TNAME:
  27:                     frvar(q);
  28:                     break;
  29: 
  30:                 case TSTRUCT:
  31:                     frtype(q);
  32:                     break;
  33: 
  34:                 case TDEFINE:
  35:                     frdef(q);
  36:                     break;
  37: 
  38:                 case TLABEL:
  39:                     cfree(q);
  40:                     break;
  41: 
  42:                 default:
  43:                     sprintf(msg, "cleanst: illegal entry tag %d, ptr %o, name %s.",
  44:                         q->tag, q, s->namep);
  45:                     fatal(msg);
  46:                 }
  47:             }
  48:         else if( q->tag == TNAME )
  49:             {
  50:             q->vdcldone = 0;
  51:             q->vnamedone = 0;
  52:             q->vextbase = 0;
  53:             for(i = 0 ; i<NFTNTYPES ; ++i)
  54:                 q->vbase[i] = 0;
  55:             }
  56:         }
  57:     if(s->blklevel > 0)
  58:         name(s->namep,-1);
  59:     else    break;
  60:     }
  61: 
  62: for(p = gonelist ; p ; p = p->nextp)
  63:     frvar(p->datap);
  64: frchain(&gonelist);
  65: 
  66: if(hidlist) fatal("cleanst: hidlist not empty");
  67: for(p = hidlist ; p ; p = p->nextp)
  68:     frvar(p->datap);
  69: frchain(&hidlist);
  70: 
  71: for(p = tempvarlist ; p ; p = p->nextp)
  72:     frvar(p->datap);
  73: frchain(&tempvarlist);
  74: 
  75: for(p = temptypelist ; p ; p = p->nextp)
  76:     if(p->datap->blklevel > 0)
  77:         frtype(p->datap);
  78: frchain(&temptypelist);
  79: 
  80: q = &arrays;
  81: for(p = arrays ; p ; p = q->nextp)
  82:     if(p->datap == 0)
  83:         {
  84:         q->nextp = p->nextp;
  85:         p->nextp = 0;
  86:         pjunk = p;
  87:         frchain(&pjunk);
  88:         }
  89:     else    q = p;
  90: }
  91: 
  92: 
  93: 
  94: frvar(p)
  95: register ptr p;
  96: {
  97: register ptr q, qn;
  98: 
  99: if(p==0) return;
 100: 
 101: switch(p->tag)
 102:     {
 103:     case TSTRUCT:
 104:         frtype(p);
 105:         return;
 106: 
 107:     case TDEFINE:
 108:         frdef(p);
 109:         return;
 110: 
 111:     case TNAME:
 112:     case TTEMP:
 113:         if(q = p->vdim)
 114:             for(q = q->datap ; q ; q = qn)
 115:             {
 116:             if(q->lowerb) frexpr(q->lowerb);
 117:             frexpr(q->upperb);
 118:             qn = q->nextp;
 119:             cfree(q);
 120:             }
 121: 
 122:         if(p->vdim)
 123:             p->vdim->datap = 0;
 124:         if(p->vtype == TYCHAR)
 125:             frexpr(p->vtypep);
 126:         frexpblock(p);
 127:         return;
 128: 
 129:     default:
 130:         badtag("frvar",p->tag);
 131:     }
 132: }
 133: 
 134: 
 135: frtype(p)
 136: register ptr p;
 137: {
 138: register ptr q;
 139: 
 140: if(p==0 || p->tag!=TSTRUCT)
 141:     fatal("frtype: bad argument");
 142: for(q = p->strdesc ; q; q = q->nextp)
 143:     frvar(q->datap);
 144: frchain( &(p->strdesc) );
 145: cfree(p);
 146: }
 147: 
 148: 
 149: 
 150: frdef(p)
 151: ptr p;
 152: {
 153: cfree(p->valp);
 154: cfree(p);
 155: }
 156: 
 157: 
 158: 
 159: frexpr(p)
 160: register ptr p;
 161: {
 162: register ptr q;
 163: 
 164: if(p == 0) return;
 165: 
 166: switch(p->tag)
 167:     {
 168:     case TAROP:
 169:     case TRELOP:
 170:     case TLOGOP:
 171:     case TASGNOP:
 172:     case TREPOP:
 173:     case TCALL:
 174:         frexpr(p->rightp);
 175: 
 176: 
 177:     case TNOTOP:
 178:     case TNEGOP:
 179:         frexpr(p->leftp);
 180:         break;
 181: 
 182:     case TCONST:
 183:         cfree(p->leftp);
 184:         if(p->vtype == TYCHAR)
 185:             frexpr(p->vtypep);
 186:         if(p->rightp)
 187:             cfree(p->rightp);
 188:         break;
 189: 
 190:     case TLIST:
 191:         for(q = p->leftp ; q ; q = q->nextp)
 192:             frexpr(q->datap);
 193:         frchain( &(p->leftp) );
 194:         break;
 195: 
 196:     case TTEMP:
 197:     case TNAME:
 198:     case TFTNBLOCK:
 199:         if(p->vsubs)
 200:             frexpr(p->vsubs);
 201:         if(p->voffset)
 202:             frexpr(p->voffset);
 203: 
 204:     case TERROR:
 205: /*debug*/ case TIOSTAT:
 206:         break;
 207: 
 208:     default:
 209:         badtag("frexpr", p->tag);
 210:     }
 211: frexpblock(p);
 212: }
 213: 
 214: 
 215: 
 216: 
 217: clcomm()    /* clean up common lists */
 218: {
 219: ptr p, oldp, q;
 220: 
 221: for(oldp = &commonlist ; p = oldp->nextp ;  )
 222:     {
 223:     q = p->datap;
 224: 
 225:     if(q->blklevel > 0)
 226:         {
 227:         frchain( &(q->comchain) );
 228:         cfree(q);
 229:         oldp->nextp = p->nextp;
 230:         cfree(p);
 231:         }
 232:     else   oldp = p;
 233:     }
 234: }

Defined functions

clcomm defined in line 217; used 1 times
  • in line 14
cleanst defined in line 4; used 2 times
frdef defined in line 150; used 3 times
frtype defined in line 135; used 3 times
frvar defined in line 94; used 5 times
Last modified: 1982-06-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1218
Valid CSS Valid XHTML 1.0 Strict