bool PerformCall( address start, bool far_rtn, unsigned num_parms ) { const mad_string *list; list = MADCallTypeList(); if( far_rtn && list[0] != MAD_MSTR_NIL ) ++list; return( PerformExplicitCall( start, list[0], num_parms ) ); }
void ProcCall( void ) { mad_string ctype; int parm; const char *results; address start; const char *old; location_list ll; dig_type_info ti; dig_type_info *pti; char *p; const mad_reg_info **parm_reg; if( CurrToken == T_DIV ) { Scan(); ctype = ScanCall(); if( ctype == MAD_MSTR_NIL ) { Error( ERR_LOC, LIT_ENG( ERR_BAD_CALL_TYPE ) ); } } else { ctype = DefCallType; } CallExpr( &start ); if( _IsOff( SW_HAVE_SET_CALL ) ) { FiniCall(); p = TxtBuff; *p++ = '('; parm_reg = MADCallParmRegList( ctype, start ); for( parm = 0; parm_reg[parm] != NULL; ++parm ) { if( parm > 0 ) { *p++ = ','; } p = StrCopy( parm_reg[parm]->name, p ); } *p++ = ')'; StrCopy( MADCallReturnReg( ctype, start )->name, p ); old = ReScan( TxtBuff ); DoCallSet(); ReScan( old ); } parm = 0; results = DefReturn; if( CurrToken == T_LEFT_PAREN ) { Scan(); if( CurrToken != T_RIGHT_PAREN ) { for( ; ; ) { pti = &ti; if( CurrToken == T_DIV ) { Scan(); if( CurrToken == T_DIV ) { Scan(); /* on stack */ LocationCreate( &ll, LT_INTERNAL, NULL ); pti = NULL; } else { GetLocation( &ll, pti ); } } else { if( DefParms[parm] == NULL ) { /* on stack */ LocationCreate( &ll, LT_INTERNAL, NULL ); pti = NULL; } else { old = ReScan( DefParms[parm] ); GetLocation( &ll, pti ); ReScan( old ); } } PushLocation( &ll, pti ); NormalExpr(); SwapStack( 1 ); ++parm; if( CurrToken != T_COMMA ) break; Scan(); } } Recog( T_RIGHT_PAREN ); results = ScanPos(); if( CurrToken == T_DIV ) { Scan(); } else if( ScanEOC() ) { results = DefReturn; } else { /* syntax check */ ChkPrintList(); } } ReqEOC(); FreezeRegs(); if( PerformExplicitCall( start, ctype, parm ) && results != NULL ) { old = ReScan( results ); if( Spawn( CallResults ) == 0 ) { ReScan( old ); } } UnFreezeRegs(); FreePgmStack( false ); }