/* Copyright (c) 1979 Regents of the University of California */
static char sccsid
[] = "@(#)const.c 1.4 9/4/80";
* Const enters the definitions
* of the constant declaration
* part into the namelist.
* this allows for multiple declaration
* parts, unless the "standard" option
* If a routine segment is being compiled,
* do level one processing.
if (parts
[ cbn
] & (TPRT
|VPRT
|RPRT
)) {
error("Constant declarations should precede type, var and routine declarations");
if (parts
[ cbn
] & CPRT
) {
error("All constants should be declared in one const part");
send(REVCNST
, cline
, cid
, cdecl);
np
= enter(defnl(cid
, CONST
, con
.ctype
, con
.cival
));
stabgconst( cid
, line
);
pPointer Const
= ConstDecl( cid
, cdecl );
pSeize( PorFHeader
[ nesting
] );
Consts
= &( pDEF( PorFHeader
[ nesting
] ).PorFConsts
);
*Consts
= ListAppend( *Consts
, Const
);
pRelease( PorFHeader
[ nesting
] );
if ( con
.ctype
== nl
+ TSTR
)
np
->range
[0] = con
.crval
;
else if (isa(con
.ctype
, "d"))
* only types of constants
* are integer, reals, strings
* and scalars, the first two
if (cn
== NIL
|| cn
[1] == NIL
)
if (np
->class != CONST
) {
derror("%s is a %s, not a constant as required", cn
[1], classes
[np
->class]);
switch (classify(np
->type
)) {
con
.crval
= np
->range
[0];
con
.cival
= np
->value
[0];
con
.crval
= a8tol(cn
[1]);
if (con
.crval
> MAXINT
|| con
.crval
< MININT
) {
derror("Constant too large for this implementation");
if (isnta(con
.ctype
, "id"))
derror("%s constants cannot be signed", nameof(con
.ctype
));