Esempio n. 1
0
void ExprSymbol( stack_entry *entry, sym_handle *sh )
{
    SET_TH( entry );
    if( SymType( sh, entry->th ) != DS_OK ) entry->th = NULL;
    ClassifyEntry( entry, &entry->info );
    SET_SH( entry );
    HDLAssign( sym, entry->v.sh, sh );
    entry->flags |= SF_SYM;
}
Esempio n. 2
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;
}