1: #include "defs.h"
   2: 
   3:     MSG BADEQ;
   4:     MSG NOMATCH;
   5:     MSG BADVAR;
   6:     MSG BADCOM;
   7:     MAP txtmap;
   8:     MAP datmap;
   9: 
  10:     char    symov, lastsymov, curov;
  11:     int executing;
  12:     char    *lp;
  13:     int fcor;
  14:     int fsym;
  15:     int mkfault;
  16:     char    *errflg;
  17:     char    lastc;
  18:     char    eqformat[512] = "o";
  19:     char    stformat[512] = "o\"= \"^i";
  20:     u_int   corhdr[], *uar0;
  21:     long    dot;
  22:     long    ditto;
  23:     int dotinc;
  24:     int lastcom = '=';
  25:     long    var[];
  26:     long    locval;
  27:     long    locmsk;
  28:     int pid;
  29:     long    expv;
  30:     long    adrval;
  31:     int adrflg;
  32:     long    cntval;
  33:     int cntflg;
  34: extern  char    *myname;
  35: 
  36: /* command decoding */
  37: 
  38: command(buf,defcom)
  39:     char    *buf;
  40:     char    defcom;
  41: {
  42:     int itype, ptype, modifier, regptr;
  43:     char    longpr, eqcom;
  44:     char    wformat[1];
  45:     char    savc;
  46:     long    w, savdot;
  47:     char    *savlp=lp;
  48: 
  49:     IF buf
  50:     THEN IF *buf==EOR
  51:          THEN return(FALSE);
  52:          ELSE lp=buf;
  53:          FI
  54:     FI
  55: 
  56:     REP
  57:     IF adrflg=expr(0)
  58:     THEN dot=expv; ditto=dot; symov=lastsymov;
  59:     FI
  60:     adrval=dot;
  61:     IF rdc()==',' ANDF expr(0)
  62:     THEN cntflg=TRUE; cntval=expv;
  63:     ELSE cntflg=FALSE; cntval=1; lp--;
  64:     FI
  65: 
  66:     IF !eol(rdc())
  67:     THEN lastcom=lastc;
  68:     ELSE IF adrflg==0 THEN dot=inkdot(dotinc); FI
  69:          lp--; lastcom=defcom;
  70:     FI
  71: 
  72:     switch(lastcom&STRIP) {
  73: 
  74:         case '/':
  75:         itype=DSP; ptype=DSYM;
  76:         goto trystar;
  77: 
  78:         case '=':
  79:         itype=NSP; ptype=ASYM;
  80:         goto trypr;
  81: 
  82:         case '?':
  83:         itype=ISP; ptype=ISYM;
  84:         goto trystar;
  85: 
  86:         trystar:
  87:         IF rdc()=='*' THEN lastcom |= QUOTE; ELSE lp--; FI
  88:         IF lastcom&QUOTE
  89:         THEN itype |= STAR; ptype = (DSYM+ISYM)-ptype;
  90:         FI
  91: 
  92:         trypr:
  93:         longpr=FALSE; eqcom=lastcom=='=';
  94:         switch (rdc()) {
  95: 
  96:             case 'm':
  97:                 {/*reset map data*/
  98:                 int     fcount;
  99:                 MAPPTR  smap;
 100:                 long    *mp;
 101: 
 102:                 IF eqcom THEN error(BADEQ); FI
 103:                 smap=(itype&DSP?&datmap:&txtmap);
 104:                 fcount=3;
 105:                 IF itype&STAR
 106:                 THEN mp = &(smap->b2);
 107:                 ELSE mp = &(smap->b1);
 108:                 FI
 109:                 WHILE fcount-- ANDF expr(0)
 110:                 DO *(mp)++ = expv; OD
 111:                 IF rdc()=='?' THEN smap->ufd=fsym;
 112:                 ELIF lastc == '/' THEN smap->ufd=fcor;
 113:                 ELSE lp--;
 114:                 FI
 115:                 }
 116:                 break;
 117: 
 118:             case 'L':
 119:                 longpr=TRUE;
 120:             case 'l':
 121:                 /*search for exp*/
 122:                 IF eqcom THEN error(BADEQ); FI
 123:                 dotinc=2; savdot=dot;
 124:                 expr(1); locval=expv;
 125:                 IF expr(0) THEN locmsk=expv; ELSE locmsk = -1L; FI
 126:                 LOOP w=leng(get(dot,itype));
 127:                  IF longpr
 128:                  THEN w=itol(w,get(inkdot(2),itype));
 129:                  FI
 130:                  IF errflg ORF mkfault ORF (w&locmsk)==locval THEN break; FI
 131:                  dot=inkdot(dotinc);
 132:                 POOL
 133:                 IF errflg
 134:                 THEN dot=savdot; errflg=NOMATCH;
 135:                 FI
 136:                 psymoff(dot,ptype,"");
 137:                 break;
 138: 
 139:             case 'W':
 140:                 longpr=TRUE;
 141:             case 'w':
 142:                 IF eqcom THEN error(BADEQ); FI
 143:                 wformat[0]=lastc; expr(1);
 144:                 REP  savdot=dot; psymoff(dot,ptype,":%16t"); exform(1,wformat,itype,ptype);
 145:                  errflg=0; dot=savdot;
 146:                  IF longpr
 147:                  THEN put(dot,itype,expv);
 148:                  FI
 149:                  put((longpr?inkdot(2):dot),itype,shorten(expv));
 150:                  savdot=dot;
 151:                  printf("=%8t"); exform(1,wformat,itype,ptype);
 152:                  printc(EOR);
 153:                 PER  expr(0) ANDF errflg==0 DONE
 154:                 dot=savdot;
 155:                 chkerr();
 156:                 break;
 157: 
 158:             default:
 159:                 lp--;
 160:                 getformat(eqcom ? eqformat : stformat);
 161:                 IF !eqcom
 162:                 THEN IF symov ANDF symov!=curov ANDF
 163:                 ptype == ISYM ANDF dot>=txtmap.bo
 164:                  THEN setovmap(symov);
 165:                       var[VARC]=symov;
 166:                  FI
 167:                  IF *stformat!='a'
 168:                  THEN psymoff(dot,ptype,":%16t");
 169:                  FI
 170:                 FI
 171:                 scanform(cntval,(eqcom?eqformat:stformat),itype,ptype);
 172:         }
 173:         break;
 174: 
 175:         case '>':
 176:         lastcom=0; savc=rdc();
 177:         IF (regptr=getreg(savc)) != NOREG
 178:         THEN uar0[regptr]=shorten(dot);
 179:              ptrace(PT_WRITE_U,pid,(int)&uar0[regptr]-(int)&corhdr,
 180:             uar0[regptr]);
 181:              IF (uar0+regptr) == &(((U*)corhdr)->u_ovdata.uo_curov)
 182:              THEN var[VARC]=dot; setovmap((char)dot); FI
 183:         ELIF (modifier=varchk(savc)) != -1
 184:         THEN    var[modifier]=dot;
 185:             IF modifier == VARC THEN setovmap((char)dot); FI
 186:         ELSE    error(BADVAR);
 187:         FI
 188:         break;
 189: 
 190:         case '!':
 191:         lastcom=0;
 192:         unox(); break;
 193: 
 194:         case '$':
 195:         lastcom=0;
 196:         printtrace(nextchar()); break;
 197: 
 198:         case ':':
 199:         IF !executing
 200:         THEN executing=TRUE;
 201:              subpcs(nextchar());
 202:              executing=FALSE;
 203:              lastcom=0;
 204:         FI
 205:         break;
 206: 
 207:         case 0:
 208:         printf("%s\n", myname);
 209:         break;
 210: 
 211:         default: error(BADCOM);
 212:     }
 213: 
 214:     flushbuf();
 215:     PER rdc()==';' DONE
 216:     IF buf THEN lp=savlp; ELSE lp--; FI
 217:     return(adrflg ANDF dot!=0);
 218: }

Defined functions

command defined in line 38; used 2 times

Defined variables

BADCOM defined in line 6; used 1 times
BADEQ defined in line 3; used 3 times
BADVAR defined in line 5; used 1 times
NOMATCH defined in line 4; used 1 times
adrflg defined in line 31; used 3 times
adrval defined in line 30; used 1 times
  • in line 60
cntflg defined in line 33; used 2 times
cntval defined in line 32; used 3 times
corhdr defined in line 20; used 2 times
curov defined in line 10; used 1 times
datmap defined in line 8; used 1 times
ditto defined in line 22; used 1 times
  • in line 58
dot defined in line 21; used 24 times
dotinc defined in line 23; used 3 times
eqformat defined in line 18; used 2 times
errflg defined in line 16; used 5 times
executing defined in line 11; used 3 times
expv defined in line 29; used 7 times
fcor defined in line 13; used 1 times
fsym defined in line 14; used 1 times
lastc defined in line 17; used 3 times
lastcom defined in line 24; used 10 times
lastsymov defined in line 10; used 1 times
  • in line 58
locmsk defined in line 27; used 3 times
locval defined in line 26; used 2 times
lp defined in line 12; used 9 times
mkfault defined in line 15; used 1 times
pid defined in line 28; used 1 times
stformat defined in line 19; used 3 times
symov defined in line 10; used 5 times
txtmap defined in line 7; used 2 times
uar0 defined in line 20; used 4 times
var defined in line 25; used 3 times
Last modified: 1998-04-22
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3691
Valid CSS Valid XHTML 1.0 Strict