Esempio n. 1
0
 Tree(const Point* a, const Point* sun, const double& size) :
     PointObj(a, size), sun(sun), sflowers(1), kleafsize(1.0), kleafrate(1.0)
 {
     DefaultColor();
     DefaultSize();
     f.SetNumsRandom();
 }
Esempio n. 2
0
 Tree() : PointObj(getmaxx()/2, getmaxy()/2+200, 400.0),
     sun((int)(getmaxx()*Fi), 0), sflowers(1),
     kleafsize(1.0), kleafrate(1.0)
 {
     DefaultColor();
     DefaultSize();
     f.SetNumsRandom();
 }
Esempio n. 3
0
static bool DefaultTypeInfo( dip_type_info *info )
{
    bool        real_type;

    real_type = TRUE;
    switch( info->kind ) {
    case TK_DATA:
    case TK_NONE:
        real_type = FALSE;
        info->kind = TK_INTEGER;
        /* fall through */
    case TK_INTEGER:
        if( info->modifier == TM_NONE ) {
            info->modifier = TM_UNSIGNED;
        }
        if( info->size == 0 ) {
            info->size = DefaultSize( DK_INT );
        }
        break;
    case TK_CODE:
    case TK_ADDRESS:
        real_type = FALSE;
        /* fall through */
    case TK_POINTER:
        if( info->modifier == TM_NONE ) {
            info->modifier = TM_FAR;
        }
        if( info->size == 0 ) {
            info->size = DefaultSize( DK_DATA_PTR );
            switch( info->modifier ) {
            case TM_FAR:
            case TM_HUGE:
                info->size += sizeof( addr_seg );
                break;
            }
        }
        break;
    case TK_STRING:
        if( info->modifier == TM_NONE ) {
            info->modifier = TM_ASCII;
        }
        break;
    }
    return( real_type );
}
Esempio n. 4
0
    Tree(const int& x, const int& y, const double& size) :
        PointObj(x, y, size), sflowers(1), kleafsize(1.0), kleafrate(1.0)
    {
        DefaultColor();
        DefaultSize();
        f.SetNumsRandom();

        if(getmaxx()/2-x > 0.0) sun.SetXY(getmaxx(), 0);
        else sun.SetXY(0, 0);
    }
Esempio n. 5
0
void VScroller::Reconfig() {
    if (size == 0) {
	shape->width = DefaultSize();
    } else {
	shape->width = size;
    }
    shape->vstretch = vfil;
    shape->vshrink = 0;
    MakeBackground();
    syncScroll = AttributeIsSet("syncScroll");
}
Esempio n. 6
0
void HScroller::Reconfig() {
    if (size == 0) {
	shape->height = DefaultSize();
    } else {
	shape->height = size;
    }
    shape->hstretch = hfil;
    shape->hshrink = 0;
    MakeBackground();
    syncScroll = AttributeIsSet("syncScroll");
}
Esempio n. 7
0
void DoAPoints( stack_entry *stk, type_kind def )
{
    stack_flags         was_imp_addr;
    addr_off            off;

    LRValue( stk );
    was_imp_addr = stk->flags & SF_IMP_ADDR;
    switch( stk->info.kind ) {
    case TK_BOOL:
    case TK_ENUM:
    case TK_CHAR:
    case TK_INTEGER:
        //NYI: 64 bit offsets
        off = U32FetchTrunc( stk->v.uint );
        stk->v.addr = DefAddrSpaceForAddr( Context.execution );
        stk->v.addr.mach.offset = off;
        stk->info.modifier = TM_NEAR;
        /* fall through */
    case TK_POINTER:
    case TK_ADDRESS:
        if( stk->th != NULL ) {
            LocationCreate( &stk->v.loc, LT_ADDR, &stk->v.addr );
            DIPTypeBase( stk->th, stk->th, stk->lc, &stk->v.loc );
            ClassifyEntry( stk, &stk->info );
            if( stk->info.kind == TK_VOID ) {
                Error( ERR_NONE, LIT_ENG( ERR_VOID_BASE ) );
            }
        } else {
            if( def == TK_NONE )
                def = TK_INTEGER;
            stk->info.kind = def;
            switch( def ) {
            case TK_INTEGER:
                stk->info.modifier = TM_UNSIGNED;
                stk->info.size = DefaultSize( DK_INT );
                break;
            case TK_ADDRESS:
                ExprSetAddrInfo( stk, false );
                break;
            }
            LocationCreate( &stk->v.loc, LT_ADDR, &stk->v.addr );
        }
        stk->flags |= SF_LOCATION | was_imp_addr;
        break;
    default:
        Error( ERR_NONE, LIT_ENG( ERR_ILL_TYPE ) );
        break;
    }
    stk->flags &= ~SF_CONST;
}
Esempio n. 8
0
void ClassNum( stack_entry *entry )
{
    unsigned long       val;

    entry->info.kind = TK_INTEGER;
    entry->flags &= ~SF_FORM_MASK;
    entry->flags |= SF_CONST;
    if( I64Test( &entry->v.sint ) < 0 ) {
        /*
            A bit backwards - if the top bit is on, it won't fit in in
            63 bits.
        */
        entry->info.modifier = TM_UNSIGNED;
        entry->info.size = sizeof( unsigned_64 );
        return;
    }
    if( !U64IsU32( entry->v.uint ) ) {
        entry->info.modifier = TM_SIGNED;
        entry->info.size = sizeof( signed_64 );
        return;
    }
    val = U32FetchTrunc( entry->v.uint );
    if( val > 0x7fffffff ) {
        entry->info.modifier = TM_UNSIGNED;
        entry->info.size = sizeof( unsigned_32 );
    } else if( DefaultSize( DK_INT ) > 2 ) {
        entry->info.modifier = TM_SIGNED;
        entry->info.size = sizeof( signed_32 );
    } else if( val > 0xffff ) {
        entry->info.modifier = TM_SIGNED;
        entry->info.size = sizeof( signed_32 );
    } else if( val > 0x7fff ) {
        entry->info.modifier = TM_UNSIGNED;
        entry->info.size = sizeof( unsigned_16 );
    } else {
        entry->info.modifier = TM_SIGNED;
        entry->info.size = sizeof( signed_16 );
    }
}
Esempio n. 9
0
void BreakOnExprSP( const char *comment )
{
    address             addr;
    dip_type_info       tinfo;
    tmp_break_struct    s;

    LValue( ExprSP );
    tinfo.size = ExprSP->info.size;
    if( !( ExprSP->flags & SF_LOCATION ) ) {
        tinfo.size = DefaultSize( DK_INT );
    }
    switch( WndGetExprSPInspectType( &addr ) ) {
    case INSP_CODE:
        AddBreak( addr );
        break;
    case INSP_DATA:
    case INSP_RAW_DATA:
        s.addr = addr;
        s.size = tinfo.size;
        s.comment = comment;
        BreakOnAddress( &s );
        break;
    }
}
Esempio n. 10
0
 void SetSize(const double& size)
 {
     this->size = size;
     DefaultSize();
 }
Esempio n. 11
0
/*
 * ConvertTo -- convert 'entry' to the given 'class'.
 *      'entry' should be an rvalue.
 */
void ConvertTo( stack_entry *entry, type_kind k, type_modifier m, unsigned s )
{
    conv_class  from;
    char        *dest;

    if( s == 0 && k == TK_INTEGER ) {
        s = DefaultSize( DK_INT );
    }
    if( entry->info.kind == k
     && entry->info.modifier == m
     && entry->info.size == s ) return;
    from = ConvIdx( &entry->info );
    switch( from ) {
    case U1:
        U32ToU64( U8FetchTrunc( entry->v.uint ), &entry->v.uint );
        break;
    case U2:
        U32ToU64( U16FetchTrunc( entry->v.uint ), &entry->v.uint );
        break;
    case U4:
        U32ToU64( U32FetchTrunc( entry->v.uint ), &entry->v.uint );
        break;
    case I1:
        I32ToI64( I8FetchTrunc( entry->v.uint ), &entry->v.uint );
        break;
    case I2:
        I32ToI64( I16FetchTrunc( entry->v.uint ), &entry->v.uint );
        break;
    case I4:
        I32ToI64( I32FetchTrunc( entry->v.uint ), &entry->v.uint );
        break;
    case F4:
        DToLD( (float)LDToD( &entry->v.real ), &entry->v.real );
        break;
    case F8:
        DToLD( (double)LDToD( &entry->v.real ), &entry->v.real );
        break;
    case C8:
        DToLD( (float)LDToD( &entry->v.cmplx.re ), &entry->v.cmplx.re );
        DToLD( (float)LDToD( &entry->v.cmplx.im ), &entry->v.cmplx.im );
        break;
    case C16:
        DToLD( (double)LDToD( &entry->v.cmplx.re ), &entry->v.cmplx.re );
        DToLD( (double)LDToD( &entry->v.cmplx.im ), &entry->v.cmplx.im );
        break;
    case NP2:
    case FP4:
        entry->v.addr.mach.offset &= 0xffff;
        break;
    case STR:
        if( k != TK_STRING ) {
            Error( ERR_NONE, LIT( ERR_TYPE_CONVERSION ) );
        }
        if( s > entry->info.size ) {
            /* have to expand string */
            _ChkAlloc( dest, s, LIT( ERR_NO_MEMORY_FOR_EXPR ) );
            memcpy( dest, entry->v.string.loc.e[0].u.p, entry->info.size );
            memset( &dest[entry->info.size], ' ', s - entry->info.size );
            if( AllocatedString( entry ) ) {
                _Free( entry->v.string.allocated );
            }
            entry->v.string.allocated = dest;
            LocationCreate( &entry->v.string.loc, LT_INTERNAL, dest );
        }
        break;
    default:
        break;
    }
    entry->info.kind = k;
    entry->info.modifier = m;
    entry->info.size = s;
    if( !ConvFunc[ ConvIdx( &entry->info ) ]( entry, from ) ) {
        Error( ERR_NONE, LIT( ERR_TYPE_CONVERSION ) );
    }
    entry->th = NULL;
}