unsigned DefaultSize( default_kind dk ) { dip_type_info info; mad_type_info mti; if( DIPModDefault( CodeAddrMod, dk, &info ) != 0 ) { info.kind = TK_NONE; info.size = 0; } mti.b.kind = MTK_BASIC; if( info.size == 0 ) { GetMADTypeDefaultAt( GetCodeDot(), ( dk == DK_INT ) ? MTK_INTEGER : MTK_ADDRESS, &mti ); info.size = BITS2BYTES( mti.b.bits ); if( mti.b.kind == MTK_ADDRESS ) { info.size -= BITS2BYTES( mti.a.seg.bits ); } } if( info.kind == TK_POINTER && info.modifier == TM_FAR ) { if( mti.b.kind == MTK_BASIC ) { /* haven't gotten the info yet */ GetMADTypeDefaultAt( GetCodeDot(), MTK_ADDRESS, &mti ); } info.size -= BITS2BYTES( mti.a.seg.bits ); } return( info.size ); }
static void FillInDefaults( dig_type_info *ti ) { mad_type_info mti; switch( ti->kind ) { case TK_INTEGER: if( ti->modifier == TM_NONE ) ti->modifier = TM_SIGNED; if( ti->size == 0 ) { if( DIPModDefault( CodeAddrMod, DK_INT, ti ) != DS_OK ) { GetMADTypeDefault( MTK_INTEGER, &mti ); ti->size = BITS2BYTES( mti.b.bits ); } } break; case TK_POINTER: case TK_CODE: case TK_DATA: if( ti->modifier == TM_NONE ) { if( DIPModDefault( CodeAddrMod, (ti->kind == TK_CODE) ? DK_CODE_PTR : DK_DATA_PTR, ti ) != DS_OK ) { ti->modifier = TM_NONE; ti->size = 0; } } if( ti->modifier == TM_NONE || ti->size == 0 ) { GetMADTypeDefault( MTK_ADDRESS, &mti ); if( ti->modifier == TM_NONE ) { if( mti.a.seg.bits != 0 ) { ti->modifier = TM_FAR; } else { ti->modifier = TM_NEAR; } } if( ti->size == 0 ) { if( ti->modifier == TM_NEAR ) mti.b.bits -= mti.a.seg.bits; ti->size = BITS2BYTES( mti.b.bits ); } } break; } }