/* Copyright (c) 1979 Regents of the University of California */
* pi - Pascal interpreter code translator
* Charles Haley, Bill Joy UCB
* Version 1.2 November 1978
* Const enters the definitions
* of the constant declaration
* part into the namelist.
error("Constant declarations must precede type and variable declarations");
error("All constants must be declared in one const part");
send(REVCNST
, cline
, cid
, cdecl);
np
= enter(defnl(cid
, CONST
, con
.ctype
, con
.cival
));
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
));