/* Copyright (c) 1979 Regents of the University of California */
static char sccsid
[] = "@(#)fdec.c 1.20 %G%";
* this array keeps the pxp counters associated with
* functions and procedures, so that they can be output
* when their bodies are encountered
* save the counter for this function
fp
-> value
[ NL_CNTR
] = bodycnts
[ cbn
];
* Funcext marks the procedure or
* function external in the symbol
* table. Funcext should only be
* called if PC, and is an error
error("External procedures and functions are not standard");
fp
->extra_flags
|= NEXTERN
;
stabefunc( fp
-> symbol
, fp
-> class , line
);
error("External procedures and functions can only be declared at the outermost level.");
error("Procedures or functions cannot be declared external.");
* when the actual (resolved)
* declaration of a procedure is
* encountered. It puts the names
* of the (function) and parameters
register struct nl
*q
, *p
;
error("Too many levels of function/procedure nesting");
sizes
[cbn
].om_max
= sizes
[cbn
].curtmps
.om_off
= -DPOFF1
;
sizes
[cbn
].curtmps
.reg_off
= 0;
for (q
= fp
->chain
; q
!= NIL
; q
= q
->chain
) {
q
-> extra_flags
|= NPARAM
;
* For functions, enter the fvar
q
= fp
-> ptr
[ NL_FVAR
];
(long)align(q
-> type
))),
if ( q
-> ptr
[NL_OFFS
] != functemp
->value
[NL_OFFS
] )
q
-> extra_flags
|= functemp
-> extra_flags
;
* pick up the pointer to porf declaration
PorFHeader
[ ++nesting
] = fp
-> inTree
;
* Segend is called to check for
* unresolved variables, funcs and
* procs, and deliver unresolved and
* baduse error diagnostics at the
* end of a routine segment (a separately
* compiled segment that is not the
* main program) for PC. This
* routine should only be called
error("Separately compiled routine segments are not standard.");
for (p
= disptab
[i
]; p
!= NIL
&& (p
->nl_block
& 037) == b
; p
= p
->nl_next
) {
if (p
->chain
->ud_next
== NIL
)
if (p
->value
[NL_KINDS
] & ISUNDEF
)
nerror("%s undefined on line%s", p
->symbol
, cp
);
nerror("%s improperly used on line%s", p
->symbol
, cp
);
if ((p
->nl_flags
& NFORWD
) &&
((p
->extra_flags
& NEXTERN
) == 0))
nerror("Unresolved forward declaration of %s %s", classes
[p
->class], p
->symbol
);
if (((p
->nl_flags
& NMOD
) == 0) &&
((p
->chain
->extra_flags
& NEXTERN
) == 0))
nerror("No assignment to the function variable");
error("Missing program statement and program body");
* Level1 does level one processing for
* separately compiled routine segments
error("Missing program statement");
error("Missing program statement");
sizes
[cbn
].om_max
= sizes
[cbn
].curtmps
.om_off
= -DPOFF1
;
printf(" %d", p
->ud_line
);
printf("In %s %s:\n", classes
[Fp
->class], Fp
->symbol
);