macro and string routines, storage allocation
extern struct s
*frame
, *stk
, *nxf
;
if((i
= copyb()) != '.')control(i
,1);
if(((i
=getrq())==0) || ((oldmn
=findmn(i
)) < 0))return;
clrmn(findmn(j
=getrq()));
if(j
)contab
[oldmn
].rq
= (contab
[oldmn
].rq
& MMASK
) | j
;
if((i
=getrq())==0)goto de1
;
if((offset
=finds(i
)) == 0)goto de1
;
if(newmn
)contab
[newmn
].rq
= i
| MMASK
;
if(req
!= '.')control(req
,1);
if(i
== (contab
[j
].rq
& ~MMASK
))break;
if(contab
[i
].rq
& MMASK
)ffree(((filep
)contab
[i
].x
.mx
)<<BLKBITS
);
if(app
&& (oldmn
>= 0) && (contab
[oldmn
].rq
& MMASK
)){
ip
= (((filep
)contab
[oldmn
].x
.mx
)<<BLKBITS
);
if(!diflg
)ip
= incoff(ip
);
if(contab
[i
].rq
== 0)break;
if(macerr
++ > 1)done2(02);
prstr("Too many string/macro names.\n");
contab
[i
].x
.mx
= (unsigned)(nextb
>>BLKBITS
);
if(oldmn
== -1)contab
[i
].rq
= -1;
contab
[i
].rq
= mn
| MMASK
;
while(((i
=getch()) & CMASK
) == ' ');
if(skip() || !(j
=getrq()))j
= '.';
i
= (ii
= getch()) & CMASK
;
if((state
== 1) && (i
== '.')){
if((state
== 2) && (i
== j
)){
if(((i
=getch()) & CMASK
) != '"')wbf(i
);
while(((i
=getch()) & CMASK
) != '\n')wbf(i
);
if((j
= boff(i
)) < NEV
*EVS
)j
= 0;
while((blist
[j
= blisti(i
)]) != -1){
i
= ((filep
)blist
[j
])<<BLKBITS
;
return(((filep
)i
)*BLK
+ NEV
*EVS
);
if(!((++offset
) & (BLK
-1))){
if(blist
[j
= blisti(--offset
)] == -1){
prstr("Out of temp file space.\n");
blist
[j
] = (unsigned)(nextb
>>BLKBITS
);
offset
= ((filep
)blist
[j
])<<BLKBITS
;
lseek(ibf
, ((long)woff
) * sizeof(int), 0);
write(ibf
, (char *)wbuf
, wbfi
* sizeof(int));
if((woff
& (~(BLK
-1))) == (roff
& (~(BLK
-1))))roff
= -1;
return((i
-NEV
*EVS
)/(BLK
));
if((i
= (p
& (~(BLK
-1)))) != roff
){
lseek(ibf
, ((long)roff
) * sizeof(int), 0);
if(read(ibf
, (char *)rbuf
, BLK
* sizeof(int)) == 0)return(0);
return(rbuf
[p
& (BLK
-1)]);
if(!((j
= (++p
)) & (BLK
-1))){
if((i
= blist
[blisti(--p
)]) == -1){
prstr("Bad storage allocation.\n");
if(frame
== stk
)return(0);
if((enda
- sizeof(struct s
)) < (char *)nxf
)setbrk(DELTA
);
nchar
= rchar
= pendt
= ch0
= ch
= 0;
if(nxf
->nargs
== 0) nxf
+= 1;
else nxf
= (struct s
*)argtop
;
if((i
= sbrk(x
)) == MAXPTR
){
prstrfl("Core limit reached.\n");
if((i
=getach()) == 0)return(0);
if(i
== '(')return(getrq());
!(contab
[i
].rq
& MMASK
)){
if((enda
-2) < (char *)nxf
)setbrk(DELTA
);
return(pushi(((filep
)contab
[i
].x
.mx
)<<BLKBITS
));
lim
= (int *)(nxf
= savnxf
+ sizeof(struct s
)/sizeof(savnxf
));
(argpp
= (int **)savnxf
+(sizeof(struct s
)/sizeof(int **))) + 9)
> (int **)enda
)setbrk(DELTA
);
for(i
=8; i
>=0; i
--)argpp
[i
] = 0;
while((argpp
!= argppend
) && (!skip())){
if(((i
= getch()) & CMASK
) == '"')quote
++;
((!quote
) && ((i
& CMASK
) == ' ')))break;
if(quote
&& ((i
& CMASK
) == '"') &&
(((i
=getch()) & CMASK
) != '"')){
if(strflg
&& (strp
>= lim
)){
prstrfl("Macro argument too long.\n");
if((enda
-4) <= (char *)strp
)setbrk(DELTA
);
nxf
->nargs
= argpp
-(int **)(nxf
+ 1);
if(((i
= (getch() & CMASK
) - '0') > 0) &&
(i
<= 9) && (i
<= frame
->nargs
))ap
= *((int **)frame
+ i
-1 + (sizeof(struct s
)/sizeof(int **)));
if(skip() || ((i
=getrq()) == 0)){
prstr("Cannot divert.\n");
for(j
=0; j
<10; j
++)k
[j
] = 0; /*not op and curd*/
dip
->dimac
= dip
->ditrap
= dip
->ditf
= 0;
dip
->ditrap
= vnumb((int *)0);
if((offset
= begin
= alloc()) == 0)return;
if((delim
= getch()) & MOT
){
while(((i
= getch()) & CMASK
) != '\n'){
if((i
& CMASK
) == delim
)i
= IMP
;
wbf(IMP
);wbf(IMP
);wbt(0);
w2
= hseg(width
,(filep
)0);
w3
= hseg(width
,(filep
)0);
if(w2
|| w3
)horiz(j
=quant((lt
- w2
)/2-w1
,HOR
));
if(dip
!= d
){if(dip
->dnl
> dip
->hnl
)dip
->hnl
= dip
->dnl
;}
else{if(v
.nl
> dip
->hnl
)dip
->hnl
= v
.nl
;}
if(!i
|| (i
== IMP
))return(acc
);
if((i
& CMASK
) == pagech
){
if(!((xx
= contab
[i
].rq
) & MMASK
))continue;
j
= (((filep
)contab
[i
].x
.mx
)<<BLKBITS
);
while((j
= blist
[blisti(j
)]) != -1){k
++; j
<<= BLKBITS
;}
if(!(*p
++ = (xx
>> BYTE
) & 0177))*(p
-1) = ' ';
if(k
>=100)*p
++ = k
/100 + '0';
if(k
>=10)*p
++ = (k
%100)/10 + '0';