blokp=bloktop;
bloktop=bloktop->word=BLK(Rcheat(bloktop)+reqd);
bloktop->word=BLK(ADR(end)+1);
- BEGIN
+ {
REG STKPTR stakadr=STK(bloktop+2);
staktop=movstr(stakbot,stakadr);
stakbas=stakbot=stakadr;
- END
+ }
}
void free(void *ap)
SWITCH wdval IN
case CASYM:
- BEGIN
+ {
t=(TREPTR)getstak(SWTYPE);
chkword();
((SWPTR)t)->swarg=wdarg->argval;
((SWPTR)t)->swlst=syncase(wdval==INSYM?ESSYM:KTSYM);
((SWPTR)t)->swtyp=TSW;
break;
- END
+ }
case IFSYM:
- BEGIN
+ {
REG INT w;
t=(TREPTR)getstak(IFTYPE);
((IFPTR)t)->iftyp=TIF;
((IFPTR)t)->eltre=((w=wdval)==ELSYM ? cmd(FISYM,NLFLG) : (w==EFSYM ? (wdval=IFSYM, item(0)) : 0));
IF w==EFSYM THEN return(t) FI
break;
- END
+ }
case FORSYM:
- BEGIN
+ {
t=(TREPTR)getstak(FORTYPE);
((FORPTR)t)->fortyp=TFOR;
((FORPTR)t)->forlst=0;
chksym(DOSYM|BRSYM);
((FORPTR)t)->fortre=cmd(wdval==DOSYM?ODSYM:KTSYM,NLFLG);
break;
- END
+ }
case WHSYM:
case UNSYM:
- BEGIN
+ {
t=(TREPTR)getstak(WHTYPE);
((WHPTR)t)->whtyp=(wdval==WHSYM ? TWH : TUN);
((WHPTR)t)->whtre = cmd(DOSYM,NLFLG);
((WHPTR)t)->dotre = cmd(ODSYM,NLFLG);
break;
- END
+ }
case BRSYM:
t=cmd(KTSYM,NLFLG);
break;
case '(':
- BEGIN
+ {
REG PARPTR p;
p=(PARPTR)getstak(PARTYPE);
p->partre=cmd(')',NLFLG);
p->partyp=TPAR;
t=makefork(0,p);
break;
- END
+ }
default:
IF io==0
FI
case 0:
- BEGIN
+ {
REG ARGPTR argp;
REG ARGPTR *argtail;
REG ARGPTR *argset=0;
((COMPTR)t)->comset=(ARGPTR)argset;
*argtail=0;
return(t);
- END
+ }
ENDSW
reserv++; word();
s=cs=as; entry.d_name[DIRSIZ-1]=0; /* to end the string */
/* check for meta chars */
- BEGIN
+ {
REG BOOL slash; slash=0;
WHILE !fngchar(*cs)
DO IF *cs++==0
THEN slash++;
FI
OD
- END
+ }
for(;;) { IF cs==s
THEN s=nullstr;
FI
FI
- BEGIN
+ {
REG CHAR c;
s=as;
WHILE c = *s
DO *s++=(c&STRIP?c:'/') OD
- END
+ }
return(count);
}
#define ELIF } else if (
#define FI ;}
-#define BEGIN {
-#define END }
#define SWITCH switch(
#define IN ){
#define ENDSW }
WHILE (d=readc())!=SQUOTE && d
DO pushstak(d) OD
- BEGIN
+ {
REG STRING argc;
trim(argc=fixstak());
push(&cb); estabf(argc);
- END
- BEGIN
+ }
+ {
REG TREPTR t = makefork(FPOU,cmd(EOFSYM,MTFLG|NLFLG));
INT pv[2];
initf(pv[INPIPE]);
execute(t, 0, 0, pv);
close(pv[OTPIPE]);
- END
+ }
tdystak(savptr); staktop=movstr(savptr,stakbot);
WHILE d=readc() DO pushstak(d|quote) OD
await(0);
REG INT sig;
INT w_hi;
- BEGIN
+ {
REG INT *pw=pwlist;
p=wait(&w);
WHILE pw <= &pwlist[ipwc]
ELSE pw++;
FI
OD
- END
+ }
IF p == -1 THEN continue FI
SWITCH type IN
case TCOM:
- BEGIN
+ {
STRING a1;
INT argn, internal;
ARGPTR schain=gchain;
ELIF t->treio==0
THEN break;
FI
- END
+ }
case TFORK:
IF execflg && (treeflgs&(FAMP|FPOU))==0
done();
case TFIL:
- BEGIN
+ {
INT pv[2]; chkpipe(pv);
IF execute(((LSTPTR)t)->lstlef, 0, pf1, pv)==0
THEN execute(((LSTPTR)t)->lstrit, execflg, pv, pf2);
ELSE closepipe(pv);
FI
- END
+ }
break;
case TLST:
break;
case TFOR:
- BEGIN
+ {
NAMPTR n = lookup(((FORPTR)t)->fornam);
STRING *args;
DOLPTR argsav=0;
IF breakcnt THEN breakcnt-- FI
execbrk=breakcnt; loopcnt--;
argfor=freeargs(argsav);
- END
+ }
break;
case TWH:
case TUN:
- BEGIN
+ {
INT i=0;
loopcnt++;
OD
IF breakcnt THEN breakcnt-- FI
execbrk=breakcnt; loopcnt--; exitval=i;
- END
+ }
break;
case TIF:
break;
case TSW:
- BEGIN
+ {
REG STRING r = mactrim(((SWPTR)t)->swarg);
t=(TREPTR)((SWPTR)t)->swlst;
WHILE t
OD
IF t THEN t=(TREPTR)((REGPTR)t)->regnxt FI
OD
- END
+ }
break;
ENDSW
exitset();