cmpstr(a
, b
, la
, lb
) /* compare two strings */
register char *aend
, *bend
;
for(p
= x
; p
->nextp
; p
= p
->nextp
)
struct Listblock
*mklist(p
)
register struct Listblock
*q
;
for(i
=0; i
<n
&& *s
!=' ' && *s
!='\0' ; ++i
)
for(i
=0; i
<n
&& *s
!=' ' && *s
!='\0' ; ++i
)
for(i
=0; i
<n
&& *s
!=' ' && *s
!='\0' ; ++s
)
p
= q
= (char *) ckalloc(n
);
return( copyn( strlen(s
)+1 , s
) );
sum
= 10*sum
+ (*s
++ - '0');
err("too many digits in floating constant");
for(t
= v
; n
-- > 0 ; s
++)
*t
++ = (*s
=='d' ? 'e' : *s
);
for(i
= 0 ; i
<l
&& *s
!='\0' ; ++i
)
if( hash
==hp
->hashval
&& eqn(VL
,n
,q
->varname
) )
else if(++hp
>= lasthash
)
if(++nintnames
>= maxhash
-1)
hp
->varp
= q
= ALLOC(Nameblock
);
struct Labelblock
*mklabel(l
)
register struct Labelblock
*lp
;
for(lp
= labeltab
; lp
< highlabtab
; ++lp
)
if(++highlabtab
> labtabend
)
many("statement numbers", 's');
lp
->labelno
= newlabel();
lp
->labtype
= LABUNKNOWN
;
/* this label appears in a branch context */
struct Labelblock
*execlab(stateno
)
register struct Labelblock
*lp
;
if(lp
= mklabel(stateno
))
warn1("illegal branch to inner block, statement %s",
else if(lp
->labdefined
== NO
)
if(lp
->labtype
== LABFORMAT
)
err("may not branch to a format");
execerr("illegal label %s", convic(stateno
));
/* find or put a name in the external symbol table */
for(p
= extsymtab
; p
<nextext
; ++p
)
if(eqn(XL
, n
, p
->extname
))
many("external symbols", 'x');
cpn(XL
, n
, nextext
->extname
);
nextext
->extstg
= STGUNKNOWN
;
register struct Extsym
*p
;
if(p
->extstg
== STGUNKNOWN
)
else if(p
->extstg
!= STGEXT
)
errstr("improper use of builtin %s", s
);
q
->memno
= p
- extsymtab
;
for(q
= *p
; q
->nextp
; q
= q
->nextp
)
if(t
==TYCOMPLEX
&& (t1
==TYDREAL
|| t2
==TYDREAL
) )
/* return log base 2 of n if n a power of 2; otherwise -1 */
/* trick based on binary representation */
if(n
<=0 || (n
& (n
-1))!=0)
for(k
= 0 ; n
>>= 1 ; ++k
)
free( (charptr
) rpllist
);
expptr
callk(type
, name
, args
)
p
= mkexpr(OPCALL
, builtin(type
,name
), args
);
p
->exprblock
.vtype
= type
;
expptr
call4(type
, name
, arg1
, arg2
, arg3
, arg4
)
expptr arg1
, arg2
, arg3
, arg4
;
args
= mklist( mkchain(arg1
, mkchain(arg2
, mkchain(arg3
,
mkchain(arg4
, CHNULL
)) ) ) );
return( callk(type
, name
, args
) );
expptr
call3(type
, name
, arg1
, arg2
, arg3
)
args
= mklist( mkchain(arg1
, mkchain(arg2
, mkchain(arg3
, CHNULL
) ) ) );
return( callk(type
, name
, args
) );
expptr
call2(type
, name
, arg1
, arg2
)
args
= mklist( mkchain(arg1
, mkchain(arg2
, CHNULL
) ) );
return( callk(type
,name
, args
) );
expptr
call1(type
, name
, arg
)
return( callk(type
,name
, mklist(mkchain(arg
,CHNULL
)) ));
return( callk(type
, name
, PNULL
) );
struct Impldoblock
*mkiodo(dospec
, list
)
register struct Impldoblock
*q
;
if( p
= calloc(1, (unsigned) n
) )
switch(p
->exprblock
.opcode
)
return( isaddr(p
->exprblock
.rightp
) );
return( isaddr(p
->exprblock
.leftp
) );
if(p
->headblock
.vleng
&& !ISCONST(p
->headblock
.vleng
))
if(ONEOF(p
->addrblock
.vstg
,MSKSTATIC
) &&
ISCONST(p
->addrblock
.memoffset
))
return( addressable(p
->addrblock
.memoffset
) );
static char p0
[17] = "0123456789abcdef";