/* this forces larger trees, etc. */
/* masks for unpacking longs */
# define FOP(x) (int)((x)&0377)
# define VAL(x) (int)(((x)>>8)&0377)
# define REST(x) (((x)>>16)&0177777)
FILE * lrd
; /* for default reading routines */
if( fread( (char *) &x
, 4, 1, lrd
) <= 0 ) cerror( "intermediate file read error" );
/* if null, opens the standard input */
if( lrd
== NULL
) cerror( "cannot open intermediate file %s", s
);
lcread( cp
, n
) char *cp
; {
if( fread( cp
, 4, n
, lrd
) != n
) cerror( "intermediate file read error" );
lccopy( n
) register n
; {
if( n
> 32 ) cerror( "lccopy asked to copy too much" );
if( fread( fbuf
, 4, n
, lrd
) != n
) cerror( "intermediate file read error" );
for( i
=4*n
; fbuf
[i
-1] == '\0' && i
>0; --i
) { /* VOID */ }
if( fwrite( fbuf
, 1, i
, stdout
) != i
) cerror( "output file error" );
/* new opcode definitions */
/* stack for reading nodes in postfix form */
NODE
** fsp
; /* points to next free position on the stack */
mainp2( argc
, argv
) char *argv
[]; {
files
= p2init( argc
, argv
);
while( files
< argc
&& argv
[files
][0] == '-' ) {
if( files
> argc
) return( nerrors
);
/* read nodes, and go to work... */
if( xdebug
) fprintf( stderr
, "op=%d, val = %d, rest = 0%o\n", FOP(x
), VAL(x
), (int)REST(x
) );
switch( (int)FOP(x
) ){ /* switch on opcode */
fprintf( stderr
, "null opcode ignored\n" );
tmpoff
= baseoff
= lread();
/* beginning of function */
if( baseoff
> maxoff
) maxoff
= baseoff
;
/* maxoff at end of ftn is max of autos and temps
over all blocks in the function */
SETOFF( maxoff
, ALSTACK
);
uerror( "switch not yet done" );
for( x
=VAL(x
); x
>0; --x
) lread();
if( fsp
>= &fstack
[NSTACKSZ
] ) uerror( "expression depth exceeded" );
if( VAL(x
) ) p
->lval
= lread();
rbusy( p
->rval
, p
->type
);
if( VAL(x
) ) lcread( filename
, VAL(x
) );
if( fsp
== fstack
) continue; /* filename only */
if( --fsp
!= fstack
) uerror( "expression poorly formed" );
if( lflag
) lineid( lineno
, filename
);
if( edebug
) fwalk( p
, eprint
, 0 );
cbgen( 0, (int) REST(x
), 'I' ); /* unconditional branch */
/* otherwise, treat as unary */
switch( optype( p
->op
) ){
uerror( "illegal leaf node: %d", p
->op
);