expp->nd_class = Set;
inc_refcount(expp->nd_set);
}
+ else if (df->df_type->tp_fund == T_PROCEDURE) {
+ /* for procedure constants */
+ expp->nd_class = Def;
+ }
else expp->nd_class = Value;
}
return ChkCast(expp);
}
- if (IsProcCall(left) || left->nd_type == error_type) {
+ if (IsProc(left) || left->nd_type == error_type) {
/* A procedure call.
It may also be a call to a standard procedure
*/
and result is already done.
*/
register t_node *left = nd->nd_left;
- register t_type *result_tp;
+ t_type *result_tp;
int needs_fn;
if (left->nd_type == std_type) {
return;
}
- assert(IsProcCall(left));
+ assert(IsProc(left));
if (nd->nd_right) {
CodeParameters(ParamList(left->nd_type), nd->nd_right);
switch(left->nd_class) {
case Def: {
- if (left->nd_def->df_kind & (D_PROCEDURE|D_PROCHEAD)) {
- int level = left->nd_def->df_scope->sc_level;
+ register t_def *df = left->nd_def;
+
+ if (df->df_kind == D_CONST) {
+ df = df->con_const.tk_data.tk_def;
+ }
+ if (df->df_kind & (D_PROCEDURE|D_PROCHEAD)) {
+ int level = df->df_scope->sc_level;
if (level > 0) {
C_lxl((arith) (proclevel - level));
}
- needs_fn = left->nd_def->df_scope->sc_defmodule;
- C_cal(NameOfProc(left->nd_def));
+ needs_fn = df->df_scope->sc_defmodule;
+ C_cal(NameOfProc(df));
break;
}}
/* Fall through */
allow for warning messages whose class is a member of \fIclasses\fR.
.IP \fB\-x\fR
make all procedure names global, so that \fIadb\fR(1) understands them.
+.IP \fB\-l\fR
+enable local extensions. Currently, the only local extension consists of
+procedure constants.
.IP \fB\-s\fR
make INTEGER ranges symmetric, t.i., MIN(INTEGER) = - MAX(INTEGER).
This is useful for interpreters that use the "real" MIN(INTEGER) to
DO_DEBUG(options['C'], PrNode(nd, 0));
if (ChkExpression(nd) &&
- ((nd)->nd_class != Set && (nd)->nd_class != Value)) {
+ nd->nd_class != Set &&
+ nd->nd_class != Value &&
+ ! (options['l'] && nd->nd_class == Def && IsProc(nd))) {
error("constant expression expected");
}
InitTypes();
AddStandards();
#ifdef DEBUG
- if (options['l']) {
+ if (options['t']) {
LexScan();
return 1;
}
#define VALUE 010
#define IsCast(lnd) ((lnd)->nd_class == Def && is_type((lnd)->nd_def))
-#define IsProcCall(lnd) ((lnd)->nd_type->tp_fund == T_PROCEDURE)
+#define IsProc(lnd) ((lnd)->nd_type->tp_fund == T_PROCEDURE)
case 'x': /* every name global */
case 's': /* symmetric: MIN(INTEGER) = -MAX(INTEGER) */
case '3': /* strict 3rd edition Modula-2 */
+ case 'l': /* local additions enabled */
options[text[-1]]++;
break;