static char mess
[ ] = "inconsistent attributes";
register struct atblock
*a1
, *a2
;
#define MERGE1(x) {if(a1->x==0) a1->x = a2->x; else if(a2->x!=0 && a1->x!=a2->x) dclerr(mess,"x"+2); }
if(a1
->atprec
!=0 && (a1
->attype
==TYREAL
|| a1
->attype
==TYCOMPLEX
) )
a1
->attype
+= (TYLREAL
-TYREAL
);
register struct atblock
* a
;
for(p
=v
; p
!=0 ; p
= p
->nextp
)
else if(a
->attype
== TYCHAR
)
#define MERGE(x,y) {if(v->y==0) v->y = a->x; else if(a->x!=0 && a->x!=v->y) dclerr(mess,"x"+2); }
register struct atblock
* a
;
register struct varblock
* v
;
dclerr("attempt to declare variable after use", v
->sthead
->namep
);
dclerr("attempt to redefine structure member", v
->sthead
->namep
);
else if(!eqdim(a
->atdim
, v
->vdim
))
dclerr("inconsistent dimensions", v
->sthead
->namep
);
v
->vtypep
= ALLOC(fieldspec
);
cpblock(a
->attypep
, v
->vtypep
, sizeof(struct fieldspec
));
else if(a
->attype
== TYCHAR
)
v
->vtypep
= cpexpr(a
->attypep
);
else v
->vtypep
= a
->attypep
;
else if(a
->attypep
!=0 && a
->attypep
!=v
->vtypep
)
dclerr("inconsistent attributes", "typep");
if(v
->vprec
!=0 && (v
->vtype
==TYREAL
|| v
->vtype
==TYCOMPLEX
) )
v
->vtype
+= (TYLREAL
-TYREAL
);
dclerr("common variable already in common, argument list, or external",
if(blklevel
!= a
->atcommon
->blklevel
)
dclerr("inconsistent common block usage", "");
for(p
= &(a
->atcommon
->comchain
) ; p
->nextp
!=0 ; p
= p
->nextp
) ;
p
->nextp
= mkchain(v
, PNULL
);
if(a
->atext
!=0 && v
->vext
==0)
else if(a
->atclass
== CLVALUE
)
if(v
->vclass
==CLARG
|| v
->vclass
==CLVALUE
)
else dclerr("cannot value a non-argument variable",v
->sthead
->namep
);
else MERGE(atclass
,vclass
);
if(v
->vclass
==CLCOMMON
|| v
->vclass
==CLVALUE
|| v
->vclass
==CLAUTO
)
if(a
==0 || b
==0 || a
==b
) return(1);
if(!eqexpr(a
->lowerb
,b
->lowerb
) || !eqexpr(a
->upperb
,b
->upperb
))
if(a
==0 || b
==0) return(0);
if(a
->tag
!=b
->tag
|| a
->subtype
!=b
->subtype
)
return( equals(a
->leftp
, b
->leftp
) );
return( a
->sthead
== b
->sthead
);
if(!eqexpr(a
->datap
,b
->datap
))
return(eqexpr(a
->leftp
,b
->leftp
) && eqexpr(a
->rightp
,b
->rightp
));
return(eqexpr(a
->leftp
,b
->leftp
));
badtag("eqexpr", a
->tag
);
if(c1
<'a' || c2
<c1
|| c2
>'z')
dclerr("bad implicit range", CNULL
);
else if(type
==TYUNDEFINED
|| type
>TYLCOMPLEX
)
dclerr("bad type in implicit statement", CNULL
);
for(i
= c1
; i
<=c2
; ++i
)
if( (q
= p
->datap
)->vinit
)
if(v
->vtype
!=TYCHAR
&& v
->vtypep
)
dclerr("structure initialization", v
->sthead
->namep
);
else if(v
->vdim
==NULL
|| v
->vsubs
!=NULL
)
if(e
->tag
==TLIST
&& (v
->vtype
==TYCOMPLEX
|| v
->vtype
==TYLCOMPLEX
) )
static char buf
[4] = "1hX";
/*check for special case of one-character initialization of
if(vt
==TYCHAR
|| e
->vtype
!=TYCHAR
|| !isconst(e
) || strlen(e
->leftp
)!=1)
e
= simple(RVAL
, coerce(vt
,e
) );
dclerr("nonconstant initializer", v
->sthead
->namep
);
prexpr( simple(LVAL
,v
) );
else if(strlen(e
->leftp
) == 1)
else dclerr("character initialization of nonchar", v
->sthead
->namep
);
struct exprblock
*listinit(), *firstelt(), *nextelt();
if(e
->tag
!=TLIST
&& e
->tag
!=TREPOP
)
e
= mknode(TREPOP
, 0, arrsize(v
), e
);
if( listinit(v
, firstelt(v
), e
) )
warn("too few initializers");
struct exprblock
*listinit(v
, subs
, e
)
register struct varblock
*v
;
struct varblock
*subscript();
struct exprblock
*nextelt();
for(p
= e
->leftp
; p
; p
= p
->nextp
)
subs
= listinit(v
, subs
, p
->datap
);
if( ! isicon(e
->leftp
, &n
) )
dclerr("nonconstant repetition factor");
subs
= listinit(v
, subs
, e
->rightp
);
vt
= subscript(cpexpr(v
), cpexpr(subs
));
return( nextelt(v
,subs
) );
dclerr("too many initializers", NULL
);
v
->vsubs
= mknode(TLIST
,0, mkchain(mkint(1),CHNULL
), PNULL
);
nwd
= ceil( nch
= conval(v
->vtypep
) , tailor
.ftnchwd
);
sprintf(buf
,"%dh", tailor
.ftnchwd
);
for(bp
= buf
; *bp
; ++bp
)
if(i
> 0) v
->vsubs
->leftp
->datap
=
mknode(TAROP
,OPPLUS
, v
->vsubs
->leftp
->datap
, mkint(1));
prexpr( v
= simple(LVAL
,v
) );
for(j
= 0 ; j
<tailor
.ftnchwd
&& *e
!='\0' && nch
-->0 ; )
while(j
< tailor
.ftnchwd
)
struct exprblock
*firstelt(v
)
register struct varblock
*v
;
register struct dimblock
*b
;
if(v
->vdim
==NULL
|| v
->vsubs
!=NULL
)
fatal("firstelt: bad argument");
for(b
= v
->vdim
->datap
; b
; b
= b
->nextp
)
t
= (b
->lowerb
? cpexpr(b
->lowerb
) : mkint(1) );
s
= hookup(s
, mkchain(t
,CHNULL
) );
if(!isicon(b
->upperb
,&junk
) || (b
->lowerb
&& !isicon(b
->lowerb
,&junk
)) )
dclerr("attempt to initialize adjustable array",
return( mknode(TLIST
, 0, s
, PNULL
) );
struct exprblock
*nextelt(v
,subs
)
register struct dimblock
*b
;
if( sv
< conval(b
->upperb
) )
s
->datap
= (b
->lowerb
? cpexpr(b
->lowerb
) : mkint(1) );
fatal("nextelt: bad subscript count");