* Copyright (c) 1980 The Regents of the University of California.
* This module is believed to contain source code proprietary to AT&T.
* Use and redistribution is subject to the Berkeley Software License
* Agreement and your Software Agreement with AT&T (Western Electric).
static char sccsid
[] = "@(#)paramset.c 5.3 (Berkeley) 4/12/91";
* Routines for handling PARAMETER statements, f77 compiler, 4.2 BSD.
* Revision 3.2 84/10/13 03:52:03 donn
* Setting a parameter variable to a nonconstant expression is an error;
* previously a mere warning was emitted. Also added a comment header.
/* process the items in a PARAMETER statement */
paramset( param_item_nm
, param_item_vl
)
if (param_item_nm
->vstg
!= STGUNKNOWN
&& param_item_nm
->vstg
!= STGCONST
)
dclerr("conflicting declarations", param_item_nm
);
else if (param_item_nm
->vclass
== CLUNKNOWN
)
param_item_nm
->vclass
= CLPARAM
;
else if ( param_item_nm
->vclass
== CLPARAM
)
dclerr("redefining PARAMETER value", param_item_nm
);
dclerr("conflicting declarations", param_item_nm
);
if (param_item_nm
->vclass
== CLPARAM
)
if (!ISCONST(param_item_vl
))
param_item_vl
= fixtype(param_item_vl
);
if (param_item_nm
->vtype
== TYUNKNOWN
)
c
= param_item_nm
->varname
[0];
if (c
>= 'A' && c
<= 'Z')
param_item_nm
->vtype
= impltype
[c
];
param_item_nm
->vleng
= ICON(implleng
[c
]);
if (param_item_nm
->vtype
== TYUNKNOWN
)
warn1("type undefined for %s",
varstr(VL
, param_item_nm
->varname
));
((struct Paramblock
*) (param_item_nm
))->paramval
= param_item_vl
;
extern expptr
constconv();
type
= param_item_nm
->vtype
;
if (param_item_nm
->vleng
!= NULL
)
len
= param_item_nm
->vleng
->constblock
.constant
.ci
;
else if (ISCONST(param_item_vl
) &&
param_item_vl
->constblock
.vtype
== TYCHAR
)
len
= param_item_vl
->constblock
.vleng
->
if (ISCONST(param_item_vl
))
((struct Paramblock
*) (param_item_nm
))->paramval
=
convconst(param_item_nm
->vtype
, len
, param_item_vl
);
((struct Paramblock
*) (param_item_nm
))->paramval
->
headblock
.vtype
= TYLOGICAL
;
frexpr((tagptr
) param_item_vl
);
erri("%s set to a nonconstant",
varstr(VL
, param_item_nm
->varname
));
((struct Paramblock
*) (param_item_nm
))->paramval
= param_item_vl
;