34c7f3432f7ffe152bc4bdef7653795371be5b8c
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)flvalue.c 5.1 (Berkeley) %G%";
* flvalue generates the code to either pass on a formal routine,
* or construct the structure which is the environment for passing.
* it tells the difference by looking at the tree it's given.
struct tnode
*r
; /* T_VAR */
typename
= formalp
-> class == FFUNC
? "function":"procedure";
error("Expression given, %s required for %s parameter %s" ,
typename
, typename
, formalp
-> symbol
);
p
= lookup(r
->var_node
.cptr
);
if ( r
->var_node
.qual
!= TR_NIL
) {
error("Formal %s %s cannot be qualified" ,
typename
, p
-> symbol
);
(void) put(2, PTR_RV
| bn
<< 8+INDX
, (int)p
->value
[NL_OFFS
]);
putRV( p
-> symbol
, bn
, p
-> value
[ NL_OFFS
] ,
if ( r
->var_node
.qual
!= TR_NIL
) {
error("%s %s cannot be qualified" , typename
,
error("Built-in %s %s cannot be passed as a parameter" ,
typename
, p
-> symbol
);
* allocate space for the thunk
tempnlp
= tmpalloc((long) (sizeof(struct formalrtn
)), NLNIL
, NOREG
);
(void) put(2 , O_LV
| cbn
<< 8 + INDX
,
(int)tempnlp
-> value
[ NL_OFFS
] );
(void) put(2, O_FSAV
| bn
<< 8, (long)p
->value
[NL_ENTLOC
]);
putleaf( PCC_ICON
, 0 , 0 ,
PCCM_ADDTYPE( PCCTM_PTR
, PCCM_ADDTYPE( PCCTM_FTN
, PCCTM_PTR
|PCCT_STRTY
) ) ,
sprintf( extname
, "%s" , FORMALPREFIX
);
sextname( &extname
[ strlen( extname
) ] ,
putleaf( PCC_ICON
, 0 , 0 , p2type( p
) , extname
);
putleaf( PCC_ICON
, bn
, 0 , PCCT_INT
, (char *) 0 );
putop( PCC_CM
, PCCT_INT
);
putLV( (char *) 0 , cbn
, tempnlp
-> value
[NL_OFFS
] ,
tempnlp
-> extra_flags
, PCCT_STRTY
);
putop( PCC_CM
, PCCT_INT
);
putop( PCC_CALL
, PCCTM_PTR
| PCCT_STRTY
);
error("Variable given, %s required for %s parameter %s" ,
typename
, typename
, formalp
-> symbol
);