static void PushBaseSize( void ) { DIPHDL( type, th ); dig_type_info ti; DIPTypeBase( ExprSP->th, th, NULL, NULL ); DIPTypeInfo( th, ExprSP->lc, &ti ); PushNum( ti.size ); }
static bool IsCodePointer( stack_entry *entry ) { DIPHDL( type, base_th ); dip_type_info ti; if( entry->th == NULL ) return( false ); if( DIPTypeBase( entry->th, base_th, NULL, NULL ) != DS_OK ) return( false ); if( DIPTypeInfo( base_th, entry->lc, &ti ) != DS_OK ) return( false ); switch( ti.kind ) { case TK_CODE: case TK_FUNCTION: return( true ); } return( false ); }
bool ClassifyType( location_context *lc, type_handle *th, dip_type_info *info ) { DIPTypeInfo( th, lc, info ); return( DefaultTypeInfo( info ) ); }
void LRValue( stack_entry *entry ) { location_list ll; item_mach tmp; bool extend; mad_type_info mti; DIPHDL( type, th ); ExprResolve( entry ); if( entry->flags & SF_LOCATION ) { if( entry->info.kind == TK_FUNCTION || entry->info.kind == TK_CODE ) { /* rvalue of procedure is its address */ entry->v.addr = entry->v.loc.e[0].u.addr; ExprSetAddrInfo( entry, false ); entry->info.kind = TK_ADDRESS; } else if( !AddressExpression( entry ) ) { extend = false; switch( entry->info.kind ) { case TK_ARRAY: /* rvalue of array is its address */ entry->v.addr = entry->v.loc.e[0].u.addr; if( entry->th != NULL ) { /* change typing from "array of..." to "pointer to..." */ GetMADTypeDefaultAt( entry->v.addr, MTK_ADDRESS, &mti ); DIPTypeBase( entry->th, th, NULL, NULL ); DIPTypePointer( th, TM_FAR, BITS2BYTES( mti.b.bits ), entry->th ); DIPTypeInfo( entry->th, entry->lc, &entry->info ); } else { ExprSetAddrInfo( entry, false ); } break; case TK_STRING: _ChkAlloc( entry->v.string.allocated, entry->info.size, LIT_ENG( ERR_NO_MEMORY_FOR_EXPR ) ); LocationCreate( &ll, LT_INTERNAL, entry->v.string.allocated ); if( LocationAssign( &ll, &entry->v.loc, entry->info.size, false ) != DS_OK ) { _Free( entry->v.string.allocated ); Error( ERR_NONE, LIT_ENG( ERR_NO_ACCESS ) ); } entry->v.string.loc = ll; break; case TK_BOOL: case TK_CHAR: case TK_ENUM: case TK_INTEGER: if( (entry->info.modifier & TM_MOD_MASK) == TM_SIGNED ) extend = true; /* fall through */ default: LocationCreate( &ll, LT_INTERNAL, &tmp ); if( LocationAssign( &ll, &entry->v.loc, entry->info.size, extend ) != DS_OK ) { Error( ERR_NONE, LIT_ENG( ERR_NO_ACCESS ) ); } FromItem( &tmp, entry ); break; } } entry->flags &= ~(SF_LOCATION | SF_IMP_ADDR); } if( entry->info.kind == TK_POINTER && (entry->info.modifier & TM_MOD_MASK) == TM_NEAR ) { NearToFar( entry ); } }