More anony.
This commit is contained in:
parent
4bda94f9bd
commit
35d95baea2
1 changed files with 30 additions and 30 deletions
|
|
@ -42,7 +42,7 @@ typedef struct SEDCOM {
|
||||||
Reprog *re1; /* compiled R.E. */
|
Reprog *re1; /* compiled R.E. */
|
||||||
Rune *text; /* added text or file name */
|
Rune *text; /* added text or file name */
|
||||||
struct SEDCOM *lb1; /* destination command of branch */
|
struct SEDCOM *lb1; /* destination command of branch */
|
||||||
};
|
} u;
|
||||||
Rune *rhs; /* Right-hand side of substitution */
|
Rune *rhs; /* Right-hand side of substitution */
|
||||||
Biobuf* fcode; /* File ID for read and write */
|
Biobuf* fcode; /* File ID for read and write */
|
||||||
char command; /* command code -see below */
|
char command; /* command code -see below */
|
||||||
|
|
@ -318,7 +318,7 @@ swit:
|
||||||
case '{':
|
case '{':
|
||||||
rep->command = BCOM;
|
rep->command = BCOM;
|
||||||
rep->negfl = !(rep->negfl);
|
rep->negfl = !(rep->negfl);
|
||||||
cmpend[depth++] = &rep->lb1;
|
cmpend[depth++] = &rep->u.lb1;
|
||||||
if(++rep >= pend)
|
if(++rep >= pend)
|
||||||
quit("Too many commands: %S", (char *) linebuf);
|
quit("Too many commands: %S", (char *) linebuf);
|
||||||
if(*cp == '\0') continue;
|
if(*cp == '\0') continue;
|
||||||
|
|
@ -375,7 +375,7 @@ swit:
|
||||||
if(*cp == '\\') cp++;
|
if(*cp == '\\') cp++;
|
||||||
if(*cp++ != '\n')
|
if(*cp++ != '\n')
|
||||||
quit(CGMES, (char *) linebuf);
|
quit(CGMES, (char *) linebuf);
|
||||||
rep->text = p;
|
rep->u.text = p;
|
||||||
p = stext(p, addend);
|
p = stext(p, addend);
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
|
|
@ -383,7 +383,7 @@ swit:
|
||||||
if(*cp == '\\') cp++;
|
if(*cp == '\\') cp++;
|
||||||
if(*cp++ != '\n')
|
if(*cp++ != '\n')
|
||||||
quit(CGMES, (char *) linebuf);
|
quit(CGMES, (char *) linebuf);
|
||||||
rep->text = p;
|
rep->u.text = p;
|
||||||
p = stext(p, addend);
|
p = stext(p, addend);
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
|
|
@ -393,7 +393,7 @@ swit:
|
||||||
if(*cp == '\\') cp++;
|
if(*cp == '\\') cp++;
|
||||||
if(*cp++ != '\n')
|
if(*cp++ != '\n')
|
||||||
quit(CGMES, (char *) linebuf);
|
quit(CGMES, (char *) linebuf);
|
||||||
rep->text = p;
|
rep->u.text = p;
|
||||||
p = stext(p, addend);
|
p = stext(p, addend);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -423,9 +423,9 @@ jtcommon:
|
||||||
while(*cp == ' ')cp++;
|
while(*cp == ' ')cp++;
|
||||||
if(*cp == '\0') {
|
if(*cp == '\0') {
|
||||||
if(pt = ltab[0].chain) {
|
if(pt = ltab[0].chain) {
|
||||||
while(pt1 = pt->lb1)
|
while(pt1 = pt->u.lb1)
|
||||||
pt = pt1;
|
pt = pt1;
|
||||||
pt->lb1 = rep;
|
pt->u.lb1 = rep;
|
||||||
} else
|
} else
|
||||||
ltab[0].chain = rep;
|
ltab[0].chain = rep;
|
||||||
break;
|
break;
|
||||||
|
|
@ -439,12 +439,12 @@ jtcommon:
|
||||||
|
|
||||||
if(lpt = search(lab)) {
|
if(lpt = search(lab)) {
|
||||||
if(lpt->address) {
|
if(lpt->address) {
|
||||||
rep->lb1 = lpt->address;
|
rep->u.lb1 = lpt->address;
|
||||||
} else {
|
} else {
|
||||||
pt = lpt->chain;
|
pt = lpt->chain;
|
||||||
while(pt1 = pt->lb1)
|
while(pt1 = pt->u.lb1)
|
||||||
pt = pt1;
|
pt = pt1;
|
||||||
pt->lb1 = rep;
|
pt->u.lb1 = rep;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lab->chain = rep;
|
lab->chain = rep;
|
||||||
|
|
@ -477,7 +477,7 @@ jtcommon:
|
||||||
quit(AD1MES, (char *) linebuf);
|
quit(AD1MES, (char *) linebuf);
|
||||||
if(*cp++ != ' ')
|
if(*cp++ != ' ')
|
||||||
quit(CGMES, (char *) linebuf);
|
quit(CGMES, (char *) linebuf);
|
||||||
rep->text = p;
|
rep->u.text = p;
|
||||||
p = stext(p, addend);
|
p = stext(p, addend);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -487,7 +487,7 @@ jtcommon:
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
rep->command = CDCOM;
|
rep->command = CDCOM;
|
||||||
rep->lb1 = pspace;
|
rep->u.lb1 = pspace;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'q':
|
case 'q':
|
||||||
|
|
@ -503,10 +503,10 @@ jtcommon:
|
||||||
case 's':
|
case 's':
|
||||||
rep->command = SCOM;
|
rep->command = SCOM;
|
||||||
seof = *cp++;
|
seof = *cp++;
|
||||||
if ((rep->re1 = compile()) == 0) {
|
if ((rep->u.re1 = compile()) == 0) {
|
||||||
if(!lastre)
|
if(!lastre)
|
||||||
quit("First RE may not be null.", 0);
|
quit("First RE may not be null.", 0);
|
||||||
rep->re1 = lastre;
|
rep->u.re1 = lastre;
|
||||||
}
|
}
|
||||||
rep->rhs = p;
|
rep->rhs = p;
|
||||||
if((p = compsub(p, addend)) == 0)
|
if((p = compsub(p, addend)) == 0)
|
||||||
|
|
@ -842,11 +842,11 @@ dechain(void)
|
||||||
|
|
||||||
if(lptr->chain) {
|
if(lptr->chain) {
|
||||||
rptr = lptr->chain;
|
rptr = lptr->chain;
|
||||||
while(trptr = rptr->lb1) {
|
while(trptr = rptr->u.lb1) {
|
||||||
rptr->lb1 = lptr->address;
|
rptr->u.lb1 = lptr->address;
|
||||||
rptr = trptr;
|
rptr = trptr;
|
||||||
}
|
}
|
||||||
rptr->lb1 = lptr->address;
|
rptr->u.lb1 = lptr->address;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -868,7 +868,7 @@ ycomp(SedCom *r)
|
||||||
if (*tsp > highc) highc = *tsp;
|
if (*tsp > highc) highc = *tsp;
|
||||||
}
|
}
|
||||||
tsp++;
|
tsp++;
|
||||||
if ((rp = r->text = (Rune *) malloc(sizeof(Rune)*(highc+2))) == 0)
|
if ((rp = r->u.text = (Rune *) malloc(sizeof(Rune)*(highc+2))) == 0)
|
||||||
quit("Out of memory", 0);
|
quit("Out of memory", 0);
|
||||||
*rp++ = highc; /* save upper bound */
|
*rp++ = highc; /* save upper bound */
|
||||||
for (i = 0; i <= highc; i++)
|
for (i = 0; i <= highc; i++)
|
||||||
|
|
@ -884,14 +884,14 @@ ycomp(SedCom *r)
|
||||||
tsp++;
|
tsp++;
|
||||||
}
|
}
|
||||||
if(rp[c] == seof || rp[c] == '\0') {
|
if(rp[c] == seof || rp[c] == '\0') {
|
||||||
free(r->re1);
|
free(r->u.re1);
|
||||||
r->re1 = 0;
|
r->u.re1 = 0;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(*tsp != seof) {
|
if(*tsp != seof) {
|
||||||
free(r->re1);
|
free(r->u.re1);
|
||||||
r->re1 = 0;
|
r->u.re1 = 0;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
cp = tsp+1;
|
cp = tsp+1;
|
||||||
|
|
@ -915,7 +915,7 @@ execute(void)
|
||||||
break;
|
break;
|
||||||
if(jflag) {
|
if(jflag) {
|
||||||
jflag = 0;
|
jflag = 0;
|
||||||
if((ipc = ipc->lb1) == 0)
|
if((ipc = ipc->u.lb1) == 0)
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
ipc++;
|
ipc++;
|
||||||
|
|
@ -1004,7 +1004,7 @@ substitute(SedCom *ipc)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if(!match(ipc->re1, linebuf))
|
if(!match(ipc->u.re1, linebuf))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1025,7 +1025,7 @@ substitute(SedCom *ipc)
|
||||||
loc2++; /* bump over zero-length match */
|
loc2++; /* bump over zero-length match */
|
||||||
if(*loc2 == 0) /* end of string */
|
if(*loc2 == 0) /* end of string */
|
||||||
break;
|
break;
|
||||||
} while(match(ipc->re1, loc2));
|
} while(match(ipc->u.re1, loc2));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1131,7 +1131,7 @@ command(SedCom *ipc)
|
||||||
case CCOM:
|
case CCOM:
|
||||||
delflag = 1;
|
delflag = 1;
|
||||||
if(ipc->active == 1) {
|
if(ipc->active == 1) {
|
||||||
for(rp = ipc->text; *rp; rp++)
|
for(rp = ipc->u.text; *rp; rp++)
|
||||||
Bputrune(&fout, *rp);
|
Bputrune(&fout, *rp);
|
||||||
Bputc(&fout, '\n');
|
Bputc(&fout, '\n');
|
||||||
}
|
}
|
||||||
|
|
@ -1188,7 +1188,7 @@ command(SedCom *ipc)
|
||||||
hspend = p1-1;
|
hspend = p1-1;
|
||||||
break;
|
break;
|
||||||
case ICOM:
|
case ICOM:
|
||||||
for(rp = ipc->text; *rp; rp++)
|
for(rp = ipc->u.text; *rp; rp++)
|
||||||
Bputrune(&fout, *rp);
|
Bputrune(&fout, *rp);
|
||||||
Bputc(&fout, '\n');
|
Bputc(&fout, '\n');
|
||||||
break;
|
break;
|
||||||
|
|
@ -1300,7 +1300,7 @@ command(SedCom *ipc)
|
||||||
break;
|
break;
|
||||||
case YCOM:
|
case YCOM:
|
||||||
p1 = linebuf;
|
p1 = linebuf;
|
||||||
p2 = ipc->text;
|
p2 = ipc->u.text;
|
||||||
for (i = *p2++; *p1; p1++){
|
for (i = *p2++; *p1; p1++){
|
||||||
if (*p1 <= i) *p1 = p2[*p1];
|
if (*p1 <= i) *p1 = p2[*p1];
|
||||||
}
|
}
|
||||||
|
|
@ -1336,11 +1336,11 @@ arout(void)
|
||||||
|
|
||||||
for (aptr = abuf; *aptr; aptr++) {
|
for (aptr = abuf; *aptr; aptr++) {
|
||||||
if((*aptr)->command == ACOM) {
|
if((*aptr)->command == ACOM) {
|
||||||
for(p1 = (*aptr)->text; *p1; p1++ )
|
for(p1 = (*aptr)->u.text; *p1; p1++ )
|
||||||
Bputrune(&fout, *p1);
|
Bputrune(&fout, *p1);
|
||||||
Bputc(&fout, '\n');
|
Bputc(&fout, '\n');
|
||||||
} else {
|
} else {
|
||||||
for(s = buf, p1= (*aptr)->text; *p1; p1++)
|
for(s = buf, p1= (*aptr)->u.text; *p1; p1++)
|
||||||
s += runetochar(s, p1);
|
s += runetochar(s, p1);
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
if((fi = Bopen(buf, OREAD)) == 0)
|
if((fi = Bopen(buf, OREAD)) == 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue