/* Copyright (c) 1980 Regents of the University of California */
static char sccsid
[] = "@(#)flvalue.c 1.2 10/2/80";
* define the display structure for purposes of allocating
* 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.
typename
= formalp
-> class == FFUNC
? "function":"procedure";
error("Expression given, %s required for %s parameter %s" ,
typename
, typename
, formalp
-> symbol
);
error("Formal %s %s cannot be qualified" ,
typename
, p
-> symbol
);
put( 2 , PTR_RV
| bn
<< 8+INDX
, p
-> value
[NL_OFFS
] );
putRV( p
-> symbol
, bn
, p
-> value
[ NL_OFFS
] ,
error("%s %s cannot be qualified" , typename
,
error("Built-in %s %s cannot be passed as a parameter" ,
typename
, p
-> symbol
);
* formal routine structure:
* struct dispsave disp[2*MAXLVL];
sizes
[ cbn
].om_off
-= sizeof (long (*)())
+ 2*bn
*sizeof (struct dispsave
);
tempoff
= sizes
[ cbn
].om_off
;
if ( sizes
[ cbn
].om_off
< sizes
[ cbn
].om_max
) {
sizes
[ cbn
].om_max
= tempoff
;
put( 2 , O_LV
| cbn
<< 8 + INDX
, tempoff
);
put( 2 , O_FSAV
| bn
<< 8 + INDX
, p
-> entloc
);
putlbracket( ftnno
, -tempoff
);
putleaf( P2ICON
, 0 , 0 ,
ADDTYPE( P2PTR
, ADDTYPE( P2FTN
, P2PTR
|P2STRTY
) ) ,
for ( i
= 1 ; i
< bn
; i
++ ) {
sprintf( starthere
, EXTFORMAT
, enclosing
[ i
] );
starthere
+= strlen( enclosing
[ i
] ) + 1;
sprintf( starthere
, EXTFORMAT
, p
-> symbol
);
starthere
+= strlen( p
-> symbol
) + 1;
if ( starthere
>= &extname
[ BUFSIZ
] ) {
panic( "flvalue namelength" );
putleaf( P2ICON
, 0 , 0 , p2type( p
) , extname
);
putleaf( P2ICON
, bn
, 0 , P2INT
, 0 );
putop( P2LISTOP
, P2INT
);
putLV( 0 , cbn
, tempoff
, P2STRTY
);
putop( P2LISTOP
, P2INT
);
putop( P2CALL
, P2PTR
| P2STRTY
);
error("Variable given, %s required for %s parameter %s" ,
typename
, typename
, formalp
-> symbol
);