示例#1
0
/*
 * Walks the subsection directory.
 *
 * Use 'sst' to limit the callbacks to one specific type. A 'sst' of 0
 * means everything.
 */
walk_result hllWalkDirList( imp_image_handle *ii, hll_sst sst, DIR_WALKER *wk, void *d )
{
    unsigned            i;
    unsigned            block;
    unsigned            full_blocks;
    unsigned            remainder;
    walk_result         wr;
    hll_dir_entry       *p;

    full_blocks = BLOCK_FACTOR( ii->dir_count, DIRECTORY_BLOCK_ENTRIES ) - 1;
    for( block = 0; block < full_blocks; ++block ) {
        for( i = 0; i < DIRECTORY_BLOCK_ENTRIES; ++i ) {
            p = &ii->directory[block][i];
            if( p->subsection == sst || sst == 0) {
                wr = wk( ii, p, d );
                if( wr != WR_CONTINUE ) {
                    return( wr );
                }
            }
        }
    }
    remainder = ii->dir_count - (full_blocks * DIRECTORY_BLOCK_ENTRIES);
    for( i = 0; i < remainder; ++i ) {
        p = &ii->directory[block][i];
        if( p->subsection == sst || sst == 0) {
            wr = wk( ii, p, d );
            if( wr != WR_CONTINUE ) {
                return( wr );
            }
        }
    }
    return( WR_CONTINUE );
}
示例#2
0
walk_result     DIGENTRY MIRegWalk( const mad_reg_set_data *rsd, const mad_reg_info *ri, MI_REG_WALKER *wk, void *d )
{
    const ppc_reg_info  *curr;
    walk_result         wr;
    unsigned            reg_set;

    if( ri != NULL ) {
        switch( ((ppc_reg_info *)ri)->sublist_code ) {
        case RS_DWORD:
           curr = RegSubList[ ri->bit_start / (sizeof( unsigned_64 )*BITS_PER_BYTE) ];
           break;
        default:
            curr = SubList[((ppc_reg_info *)ri)->sublist_code];
            break;
        }
        if( curr != NULL ) {
            while( curr->info.name != NULL ) {
                wr = wk( &curr->info, 0, d );
                if( wr != WR_CONTINUE ) return( wr );
                ++curr;
            }
        }
    } else {
        reg_set = rsd - RegSet;
        curr = RegList;
        while( curr < &RegList[ IDX_LAST_ONE ] ) {
            if( curr->reg_set == reg_set ) {
                wr = wk( &curr->info, curr->sublist_code != 0, d );
                if( wr != WR_CONTINUE ) return( wr );
            }
            ++curr;
        }
    }
    return( WR_CONTINUE );
}
示例#3
0
walk_result MADIMPENTRY( RegSetWalk )( mad_type_kind tk, MI_REG_SET_WALKER *wk, void *d )
{
    walk_result wr;

    if( tk & MTK_INTEGER ) {
        wr = wk( &RegSet[CPU_REG_SET], d );
        if( wr != WR_CONTINUE ) return( wr );
    }
    if( tk & MTK_FLOAT ) {
        wr = wk( &RegSet[FPU_REG_SET], d );
        if( wr != WR_CONTINUE ) return( wr );
    }
    return( WR_CONTINUE );
}
示例#4
0
static walk_result WalkAllScopes( imp_image_handle *ii, unsigned mb_idx,
            addr_off off, WALK_GLUE *wk, imp_sym_handle *is, void *d )
{
    ji_ptr              lv_tbl;
    unsigned            lv_num;
    unsigned            idx;
    struct localvar     var;
    walk_result         wr;

    is->kind = JS_LOCAL;
    off -= (ji_ptr)ii->methods[mb_idx].code;
    lv_tbl = (ji_ptr)ii->methods[mb_idx].localvar_table;
    lv_num = ii->methods[mb_idx].localvar_table_length;
    for( idx = 0; idx < lv_num; ++idx ) {
        is->u.lv = lv_tbl + idx * sizeof( var );
        if( GetData( is->u.lv, &var, sizeof( var ) ) != DS_OK ) {
            return( WR_FAIL );
        }
        if( (off >= var.pc0) && (off < (var.pc0+var.length)) ) {
            wr = wk( ii, SWI_SYMBOL, is, d );
            if( wr != WR_CONTINUE ) return( wr );
        }
    }
    return( WalkObject( ii, FALSE, ii->cc, wk, is, d ) );
}
示例#5
0
static bool runJSTest(WKPageRef page, const char* script, const char* expectedResult)
{
    JavaScriptCallbackContext context(expectedResult);
    WKPageRunJavaScriptInMainFrame(page, wk(script).get(), &context, javaScriptCallback);
    Util::run(&context.didFinish);
    return context.didMatchExpectedString;
}
示例#6
0
static walk_result WalkAScope( imp_image_handle *ii, unsigned mb_idx,
            scope_block *scope, WALK_GLUE *wk, imp_sym_handle *is, void *d )
{
    ji_ptr              lv_tbl;
    unsigned            lv_num;
    unsigned            idx;
    struct localvar     var;
    ji_ptr              code_start;
    walk_result         wr;

    is->kind = JS_LOCAL;
    code_start = (ji_ptr)ii->methods[mb_idx].code;
    lv_tbl = (ji_ptr)ii->methods[mb_idx].localvar_table;
    lv_num = ii->methods[mb_idx].localvar_table_length;
    for( idx = scope->unique; idx < lv_num; ++idx ) {
        is->u.lv = lv_tbl + idx * sizeof( var );
        if( GetData( is->u.lv, &var, sizeof( var ) ) != DS_OK ) {
            return( WR_FAIL );
        }
        if( var.length != scope->len || (code_start+var.pc0) != scope->start.mach.offset ) {
            return( WR_CONTINUE );
        }
        wr = wk( ii, SWI_SYMBOL, is, d );
        if( wr != WR_CONTINUE ) return( wr );
    }
    return( WR_CONTINUE );
}
示例#7
0
walk_result MyWalkModList( imp_image_handle *ii, INT_MOD_WKR *wk,
                                        void *d )
{
    info_block          *blk;
    mod_table           *tbl;
    unsigned            num_sects;
    unsigned            count;
    section_info        *inf;
    imp_mod_handle      im;
    walk_result         wr;

    inf = ii->sect;
    for( num_sects = ii->num_sects; num_sects != 0; --num_sects ) {
        im = inf->mod_base_idx;
        for( blk = inf->mod_info; blk != NULL; blk = blk->next ) {
            tbl = blk->link;
            for( count = 0; count < tbl->count; ++count ) {
                wr = wk( ii, im, d );
                if( wr != WR_CONTINUE ) return( wr );
                ++im;
            }
        }
        ++inf;
    }
    return( WR_CONTINUE );
}
示例#8
0
walk_result     DIGENTRY MITypeWalk( mad_type_kind tk, MI_TYPE_WALKER *wk, void *data )
{
    mad_type_handle     th;
    processor_level     iol;
    processor_level     meml;
    walk_result         wr;

    iol = LN;
    meml = LN;
    if( ( MCSystemConfig()->cpu & X86_CPU_MASK ) < X86_386 ) {
        if( tk & MAS_IO ) iol = L1;
        if( tk & MAS_MEMORY ) meml = L1;
    } else {
        if( tk & MAS_IO ) iol = L3;
        if( tk & MAS_MEMORY ) meml = L3;
    }

    for( th = 0; th < sizeof( TypeArray ) / sizeof( TypeArray[0] ); ++th ) {
        if( TypeArray[th].io <= iol || TypeArray[th].mem <= meml ) {
            if( tk & TypeArray[th].u.info->b.kind ) {
                wr = wk( th, data );
                if( wr != WR_CONTINUE ) return( wr );
            }
        }
    }
    return( WR_CONTINUE );
}
示例#9
0
/*
        Call back to the client routine with pointers to the various
        reg set structure(s).
*/
walk_result     DIGENTRY MIRegSetWalk( mad_type_kind tk, MI_REG_SET_WALKER *wk, void *d )
{
    walk_result wr;

    if( tk & MTK_INTEGER ) {
        wr = wk( &RegSet[CPU_REG_SET], d );
        if( wr != WR_CONTINUE ) return( wr );
    }
    return( WR_CONTINUE );
}
示例#10
0
walk_result     DIGENTRY MIRegWalk( const mad_reg_set_data *rsd, const mad_reg_info *ri, MI_REG_WALKER *wk, void *d )
{
    walk_result         wr;

    if( ri == NULL ) {
        wr = wk( &RegList[CPU_REG_SET].info, 0, d );
        if( wr != WR_CONTINUE ) return( wr );
    }
    return( WR_CONTINUE );
}
示例#11
0
walk_result DoDisasmMemRefWalk( mad_disasm_data *dd, MEMREF_WALKER *wk, const mad_registers *mr, void *d )
{
    walk_result         wr;
    mad_type_handle     th;
    int                 i;

    th = (mad_type_handle)-1;
    switch( dd->ins.type ) {
    case DI_X86_ret:
    case DI_X86_ret2:
        th = (dd->ins.flags.u.x86 & DIF_X86_OPND_LONG) ? X86T_N32_PTR : X86T_N16_PTR;
        break;
    case DI_X86_retf:
    case DI_X86_retf2:
        th = (dd->ins.flags.u.x86 & DIF_X86_OPND_LONG) ? X86T_F32_PTR : X86T_F16_PTR;
        break;
    case DI_X86_iret:
    case DI_X86_iretd:
        th = (dd->ins.flags.u.x86 & DIF_X86_OPND_LONG) ? X86T_IRET32 : X86T_IRET16;
        break;
    case DI_X86_pop:
    case DI_X86_pop2:
    case DI_X86_pop3d:
    case DI_X86_pop3e:
    case DI_X86_pop3s:
    case DI_X86_pop4f:
    case DI_X86_pop4g:
    case DI_X86_popf:
    case DI_X86_popfd:
    case DI_X86_leave:
        th = (dd->ins.flags.u.x86 & DIF_X86_OPND_LONG) ? X86T_DWORD : X86T_WORD;
        break;
    case DI_X86_popa:
    case DI_X86_popad:
        th = (dd->ins.flags.u.x86 & DIF_X86_OPND_LONG) ? X86T_POPAD : X86T_POPA;
        break;
    default:
        break;
    }
    if( th != (mad_type_handle)-1 ) {
        wr = wk( GetRegSP( mr ), th, MMK_VOLATILE|MMK_IMPLICIT|MMK_READ, d );
        if( wr != WR_CONTINUE ) {
            return( wr );
        }
    }
    for( i = 0; i < dd->ins.num_ops; i++ ) {
        if( ( dd->ins.op[i].type & ( DO_MASK | DO_HIDDEN ) ) == DO_MEMORY_ABS ) {
            wr = MemReference( i, dd, wk, mr, d );
            if( wr != WR_CONTINUE ) {
                return( wr );
            }
        }
    }
    return( WR_CONTINUE );
}
示例#12
0
walk_result MADIMPENTRY( RegWalk )( const mad_reg_set_data *rsd, const mad_reg_info *ri, MI_REG_WALKER *wk, void *d )
{
    const axp_reg_info  *curr;
    walk_result         wr;
    unsigned            reg_set;

    if( ri != NULL ) {
        switch( ((axp_reg_info *)ri)->sublist_code ) {
        case RS_INT:
        case RS_FLT:
            curr = RegSubList[TYPEIDX( ri->bit_start, axpreg )];
            break;
        default:
            curr = SubList[((axp_reg_info *)ri)->sublist_code];
            break;
        }
        if( curr != NULL ) {
            while( curr->info.name != NULL ) {
                wr = wk( &curr->info, 0, d );
                if( wr != WR_CONTINUE )
                    return( wr );
                ++curr;
            }
        }
    } else {
        reg_set = (unsigned)( rsd - RegSet );
        curr = RegList;
        while( curr < &RegList[ IDX_LAST_ONE ] ) {
            if( curr->reg_set == reg_set && (curr->pal == PAL_all || curr->pal == CurrPAL) ) {
                wr = wk( &curr->info, curr->sublist_code != 0, d );
                if( wr != WR_CONTINUE ) {
                    return( wr );
                }
            }
            ++curr;
        }
    }
    return( WR_CONTINUE );
}
示例#13
0
walk_result     DIGENTRY DIPImpWalkModList( imp_image_handle *ii,
                        IMP_MOD_WKR *wk, void *d )
{
    struct find_mod     find;
    walk_result         wr;

    find.wk = wk;
    find.d  = d;
    wr = WalkDirList( ii, &FindMods, &find );
    if( wr == WR_CONTINUE )
        wr = wk( ii, IMH_GBL, d );
    return( wr );
}
示例#14
0
walk_result MADIMPENTRY( RegWalk )( const mad_reg_set_data *rsd, const mad_reg_info *ri, MI_REG_WALKER *wk, void *d )
{
    const ppc_reg_info  *curr;
    walk_result         wr;
    unsigned            reg_set;

    if( ri != NULL ) {
        switch( ((ppc_reg_info *)ri)->sublist_code ) {
        case RS_DWORD:
           curr = RegSubList[TYPEIDX( ri->bit_start, unsigned_64 )];
           break;
        default:
            curr = SubList[((ppc_reg_info *)ri)->sublist_code];
            break;
        }
        if( curr != NULL ) {
            for( ; curr->info.name != NULL; ++curr ) {
                wr = wk( &curr->info, 0, d );
                if( wr != WR_CONTINUE ) {
                    return( wr );
                }
            }
        }
    } else {
        reg_set = (unsigned)( rsd - RegSet );
        for( curr = RegList; curr < &RegList[IDX_LAST_ONE]; ++curr ) {
            if( curr->reg_set == reg_set ) {
                wr = wk( &curr->info, curr->sublist_code != 0, d );
                if( wr != WR_CONTINUE ) {
                    return( wr );
                }
            }
        }
    }
    return( WR_CONTINUE );
}
示例#15
0
walk_result     DoWalkSymList( imp_image_handle *ii,
                symbol_source ss, void *source, IMP_SYM_WKR *wk,
                imp_sym_handle *is, void *d )
{
    walk_result         wr;

    source = source;
    if( ss != SS_MODULE ) return( WR_CONTINUE );
    wr = WR_CONTINUE;
    for( is->p = ii->gbl; is->p != NULL; is->p = is->p->next ) {
        wr = wk( ii, SWI_SYMBOL, is, d );
        if( wr != WR_CONTINUE ) break;
    }
    return( wr );
}
示例#16
0
walk_result     DIGENTRY MITypeWalk( mad_type_kind tk, MI_TYPE_WALKER *wk, void *data )
{
    mad_type_handle     th;
    walk_result         wr;

    if( !(tk & MAS_MEMORY) ) return( WR_CONTINUE );
    for( th = 0; th < sizeof( TypeArray ) / sizeof( TypeArray[0] ); ++th ) {
        if( (tk & TypeArray[th].u.info->b.kind)
         && TypeArray[th].name != MAD_MSTR_NIL ) {
            wr = wk( th, data );
            if( wr != WR_CONTINUE ) return( wr );
        }
    }
    return( WR_CONTINUE );
}
示例#17
0
walk_result DIGENTRY DIPImpWalkModList( imp_image_handle *ii, IMP_MOD_WKR *wk, void *d )
{
    im_idx          i;
    walk_result     ret;
    dr_dbg_handle   saved;

    ret = WR_CONTINUE;
    for( i = 0; i < ii->mod_count; ++i ) {
        saved = DRGetDebug();
        ret = wk( ii, IMX2IM( i ), d );
        DRSetDebug( saved );
        if( ret != WR_CONTINUE ) {
            break;
        }
    }
    return( ret );
}
示例#18
0
walk_result MADIMPENTRY( TypeWalk )( mad_type_kind tk, MI_TYPE_WALKER *wk, void *data )
{
    mad_type_handle     mth;
    walk_result         wr;

    if( !(tk & MAS_MEMORY) ) return( WR_CONTINUE );
    for( mth = 0; mth < sizeof( TypeArray ) / sizeof( TypeArray[0] ); ++mth ) {
        if( (tk & TypeArray[mth].u.mti->b.kind)
         && TypeArray[mth].name != MAD_MSTR_NIL ) {
            wr = wk( mth, data );
            if( wr != WR_CONTINUE ) {
                return( wr );
            }
        }
    }
    return( WR_CONTINUE );
}
    /**
     * Forcing term for Poisson solver solver
     */ 
    void   VelocityCorrectionScheme::v_SetUpPressureForcing(
        const Array<OneD, const Array<OneD, NekDouble> > &fields, 
        Array<OneD, Array<OneD, NekDouble> > &Forcing, 
        const NekDouble aii_Dt)
    {                
        int i;
        int physTot = m_fields[0]->GetTotPoints();
        int nvel = m_velocity.num_elements();
        Array<OneD, NekDouble> wk(physTot, 0.0);
        
        Vmath::Zero(physTot,Forcing[0],1);
        
        for(i = 0; i < nvel; ++i)
        {
            m_fields[i]->PhysDeriv(MultiRegions::DirCartesianMap[i],fields[i], wk);
            Vmath::Vadd(physTot,wk,1,Forcing[0],1,Forcing[0],1);
        }

        Vmath::Smul(physTot,1.0/aii_Dt,Forcing[0],1,Forcing[0],1);        
    }
示例#20
0
walk_result     DIPENTRY DIPImpWalkFileList( imp_image_handle *ii,
                    imp_mod_handle im, IMP_CUE_WKR *wk, imp_cue_handle *ic,
                    void *d )
{
    cv_directory_entry                  *cde;
    cv_sst_src_module_header            *hdr;
    cv_sst_src_module_file_table        *fp;
    unsigned_32                         *file_off;
    unsigned                            file_tab_size;
    unsigned                            file_tab_count;
    unsigned                            i;
    walk_result                         wr;

    if( im == MH_GBL ) return( WR_CONTINUE );

    cde = FindDirEntry( ii, im, sstSrcModule );
    if( cde == NULL ) return(  WR_CONTINUE );
    hdr = VMBlock( ii, cde->lfo, sizeof( *hdr ) );
    if( hdr == NULL ) return( WR_FAIL );
    file_tab_count = hdr->cFile;
    file_tab_size = file_tab_count * sizeof( unsigned_32 );
    hdr = VMBlock( ii, cde->lfo, sizeof( *hdr ) + file_tab_size );
    /*
        Make a copy of the file table offset so that we don't have to worry
        about the VM system throwing it out.
    */
    file_off = __alloca( file_tab_size );
    memcpy( file_off, &hdr->baseSrcFile[0], file_tab_size );
    ic->im = im;
    for( i = 0; i < file_tab_count; ++i ) {
        ic->pair = 0;
        ic->file = cde->lfo + file_off[i];
        fp = VMBlock( ii, ic->file, sizeof( *fp ) );
        if( fp == NULL ) return( WR_FAIL );
        ic->line = cde->lfo + fp->baseSrcLn[0];
        wr = wk( ii, ic, d );
        if( wr != WR_CONTINUE ) return( wr );
    }
    return( WR_CONTINUE );
}
bool ConvertKeyEvent(Input* input, const StringHash eventType, VariantMap& eventData, CefKeyEvent& keyEvent)
{
    memset((void*)&keyEvent, 0, sizeof(keyEvent));
    
    WebKeyEvent wk(eventType, eventData);

    if (wk.scanCode == SDL_SCANCODE_RETURN)
    {
        if (!wk.keyDown)
            return false;

        keyEvent.character = VKEY_RETURN;
        keyEvent.windows_key_code = VKEY_RETURN;
        keyEvent.type = KEYEVENT_RAWKEYDOWN;
        return true;
    }

    long int lParam = 0, wParam = 0;

    keyEvent.modifiers = EVENTFLAG_NONE;

    if (wk.qual & QUAL_SHIFT)
        keyEvent.modifiers |= EVENTFLAG_SHIFT_DOWN;
    if (wk.qual & QUAL_ALT)
        keyEvent.modifiers |= EVENTFLAG_ALT_DOWN;
    if (wk.qual & QUAL_CTRL)
        keyEvent.modifiers |= EVENTFLAG_CONTROL_DOWN;

    if (SDLScanCodeToWindowsScanCode((SDL_Scancode) wk.scanCode, lParam, wParam))
    {
        keyEvent.windows_key_code = (int) wParam;
        keyEvent.native_key_code = (int) lParam;
        keyEvent.type = wk.keyDown ? KEYEVENT_RAWKEYDOWN : KEYEVENT_KEYUP;
    }

    return true;
}
    void MappingExtrapolate::v_CorrectPressureBCs(
        const Array<OneD, NekDouble>  &pressure)
    {
        if(m_HBCdata.num_elements()>0)
        {
            int cnt, n;
            int physTot = m_fields[0]->GetTotPoints();
            int nvel = m_fields.num_elements()-1;
            
            Array<OneD, NekDouble> Vals;
            // Remove previous correction
            for(cnt = n = 0; n < m_PBndConds.num_elements(); ++n)
            {
                if(m_PBndConds[n]->GetUserDefined() == "H")
                {
                    int nq = m_PBndExp[n]->GetNcoeffs();
                    Vmath::Vsub(nq, &(m_PBndExp[n]->GetCoeffs()[0]),  1,
                                    &(m_bcCorrection[cnt]), 1, 
                                    &(m_PBndExp[n]->UpdateCoeffs()[0]), 1);
                    cnt += nq;
                }
            }
            
            // Calculate new correction
            Array<OneD, NekDouble> Jac(physTot, 0.0);
            m_mapping->GetJacobian(Jac);
            
            Array<OneD, Array<OneD, NekDouble> > correction(nvel);
            Array<OneD, Array<OneD, NekDouble> > gradP(nvel);
            Array<OneD, Array<OneD, NekDouble> > wk(nvel);
            Array<OneD, Array<OneD, NekDouble> > wk2(nvel);
            for (int i=0; i<nvel; i++)
            {
                wk[i] = Array<OneD, NekDouble> (physTot, 0.0);
                gradP[i] = Array<OneD, NekDouble> (physTot, 0.0);
                correction[i] = Array<OneD, NekDouble> (physTot, 0.0);
            }

            // Calculate G(p)
            for(int i = 0; i < nvel; ++i)
            {
                m_fields[0]->PhysDeriv(MultiRegions::DirCartesianMap[i], pressure, gradP[i]);
                if(m_fields[0]->GetWaveSpace())
                {
                    m_fields[0]->HomogeneousBwdTrans(gradP[i], wk[i]);
                }
                else
                {
                    Vmath::Vcopy(physTot, gradP[i], 1, wk[i], 1);
                }
            }
            m_mapping->RaiseIndex(wk, correction);   // G(p)

            // alpha*J*(G(p))
            if (!m_mapping->HasConstantJacobian())
            {
                for(int i = 0; i < nvel; ++i)
                {
                    Vmath::Vmul(physTot, correction[i], 1, Jac, 1, correction[i], 1);
                }                
            }   
            for(int i = 0; i < nvel; ++i)
            {
                Vmath::Smul(physTot, m_pressureRelaxation, correction[i], 1, correction[i], 1); 
            }
            
            if(m_pressure->GetWaveSpace())
            {
                for(int i = 0; i < nvel; ++i)
                {
                    m_pressure->HomogeneousFwdTrans(correction[i], correction[i]);
                }
            }            
            // p_i - alpha*J*div(G(p))    
            for (int i = 0; i < nvel; ++i)
            {
                Vmath::Vsub(physTot, gradP[i], 1, correction[i], 1, correction[i], 1);
            }
            
            // Get value at boundary and calculate Inner product
            StdRegions::StdExpansionSharedPtr Pbc;
            StdRegions::StdExpansionSharedPtr elmt;
            Array<OneD, Array<OneD, const NekDouble> > correctionElmt(m_bnd_dim);
            Array<OneD, Array<OneD, NekDouble> > BndValues(m_bnd_dim);
            for(int i = 0; i < m_bnd_dim; i++)
            {
                BndValues[i] = Array<OneD, NekDouble> (m_pressureBCsMaxPts,0.0);
            }
            for(int j = 0 ; j < m_HBCdata.num_elements() ; j++)
            {
                /// Casting the boundary expansion to the specific case
                Pbc =  boost::dynamic_pointer_cast<StdRegions::StdExpansion> 
                            (m_PBndExp[m_HBCdata[j].m_bndryID]
                                ->GetExp(m_HBCdata[j].m_bndElmtID));

                /// Picking up the element where the HOPBc is located
                elmt = m_pressure->GetExp(m_HBCdata[j].m_globalElmtID);

                /// Assigning
                for(int i = 0; i < m_bnd_dim; i++)
                {
                    correctionElmt[i]  = correction[i] + m_HBCdata[j].m_physOffset;
                }
                Vals = m_bcCorrection + m_HBCdata[j].m_coeffOffset;
                // Getting values on the edge and filling the correction
                switch(m_pressure->GetExpType())
                {
                    case MultiRegions::e2D:
                    case MultiRegions::e3DH1D:
                    {                                                         
                        elmt->GetEdgePhysVals(m_HBCdata[j].m_elmtTraceID, Pbc,
                                              correctionElmt[0], BndValues[0]);                    
                        elmt->GetEdgePhysVals(m_HBCdata[j].m_elmtTraceID, Pbc,
                                              correctionElmt[1], BndValues[1]);

                        // InnerProduct 
                        Pbc->NormVectorIProductWRTBase(BndValues[0], BndValues[1],
                                                       Vals);
                    }
                    break;

                    case MultiRegions::e3D:
                    {
                        elmt->GetFacePhysVals(m_HBCdata[j].m_elmtTraceID, Pbc, 
                                              correctionElmt[0], BndValues[0]);
                        elmt->GetFacePhysVals(m_HBCdata[j].m_elmtTraceID, Pbc,
                                              correctionElmt[1], BndValues[1]);
                        elmt->GetFacePhysVals(m_HBCdata[j].m_elmtTraceID, Pbc,
                                              correctionElmt[2], BndValues[2]);
                        Pbc->NormVectorIProductWRTBase(BndValues[0], BndValues[1],
                                              BndValues[2], Vals);
                    }
                    break;
                default:
                    ASSERTL0(0,"Dimension not supported");
                    break;
                }
            }      
            
            // Apply new correction
            for(cnt = n = 0; n < m_PBndConds.num_elements(); ++n)
            {
                if(m_PBndConds[n]->GetUserDefined() == "H")
                {
                    int nq = m_PBndExp[n]->GetNcoeffs();
                    Vmath::Vadd(nq, &(m_PBndExp[n]->GetCoeffs()[0]),  1,
                                    &(m_bcCorrection[cnt]), 1, 
                                    &(m_PBndExp[n]->UpdateCoeffs()[0]), 1);
                    cnt += nq;
                }
            }                
        }        
    }
示例#23
0
walk_result     DIGENTRY DIPImpWalkModList( imp_image_handle *ii,
                        IMP_MOD_WKR *wk, void *d )
{
    return( wk( ii, IMH_JAVA, d ) );
}
示例#24
0
walk_result MemReference( int opnd, mad_disasm_data *dd, MEMREF_WALKER *wk, const mad_registers *mr, void *d )
{
    mad_type_handle     th;
    address             addr;
    dis_operand         *op;
    mad_memref_kind     mmk;

    op = &dd->ins.op[opnd];
    switch( op->ref_type ) {
    case DRT_X86_DWORDF:
        th = X86T_FLOAT;
        break;
    case DRT_X86_DWORD:
        th = X86T_DWORD;
        break;
    case DRT_X86_QWORDF:
        th = X86T_DOUBLE;
        break;
    case DRT_X86_QWORD:
        th = X86T_QWORD;
        break;
    case DRT_X86_WORD:
        th = X86T_WORD;
        break;
    case DRT_X86_BYTE:
        th = X86T_BYTE;
        break;
    case DRT_X86_TBYTE:
        th = X86T_EXTENDED;
        break;
    case DRT_X86_FARPTR48:
        th = X86T_F32_PTR;
        break;
    case DRT_X86_FARPTR32:
        th = X86T_F16_PTR;
        break;
    default:
        th = X86T_BYTE;
        break;
    }
    addr.sect_id = 0;
    addr.indirect = 0;
    addr.mach.offset = op->value;
    if( op->base != DR_NONE ) {
        addr.mach.offset += RegValue( mr, op->base );
    }
    if( op->index != DR_NONE ) {
        addr.mach.offset += RegValue( mr, op->index ) * op->scale;
    }
    if( op->type & DO_NO_SEG_OVR ) {
        addr.mach.segment = RegValue( mr, DR_X86_es );
    } else {
        addr.mach.segment = RegValue( mr, GetSegRegOverride( dd, op ) );
    }
    if( dd->ins.flags.u.x86 & DIF_X86_ADDR_LONG ) {
        addr.mach.offset &= ~(dword)0;
    } else {
        addr.mach.offset &= ~(word)0;
    }
    mmk = MMK_READ;
    switch( dd->ins.type ) {
    case DI_X86_pop:
    case DI_X86_pop2:
    case DI_X86_pop3d:
    case DI_X86_pop3e:
    case DI_X86_pop3s:
    case DI_X86_pop4f:
    case DI_X86_pop4g:
    case DI_X86_ins:
    case DI_X86_stos:
        mmk = MMK_WRITE;
        break;
    case DI_X86_xchg:
    case DI_X86_xchg2:
    case DI_X86_inc:
    case DI_X86_inc2:
    case DI_X86_dec:
    case DI_X86_dec2:
        mmk |= MMK_WRITE;
        break;
    case DI_X86_cmps:
    case DI_X86_lods:
    case DI_X86_outs:
    case DI_X86_scas:
        break;
    case DI_X86_movzx:
    case DI_X86_movsx:
    case DI_X86_mov:
    case DI_X86_mov2:
    case DI_X86_mov3:
    case DI_X86_mov4:
    case DI_X86_mov5:
    case DI_X86_mov6:
    case DI_X86_mov7:
    case DI_X86_movs:
        if( opnd == OP_1 ) {
            mmk = MMK_WRITE;
        }
        break;
    default:
        if( dd->ins.num_ops >= 2 && opnd == OP_1 ) {
            mmk |= MMK_WRITE;
        }
        break;
    }
    return( wk( addr, th, mmk, d ) );
}
示例#25
0
static walk_result WalkObject( imp_image_handle *ii, bool statics_only,
                ji_ptr clazz, WALK_GLUE *wk, imp_sym_handle *is, void *d )
{
    ji_ptr      super;
    ji_ptr      super_name;
    ji_ptr      block;
    unsigned    num;
    unsigned    i;
    walk_result wr;
    unsigned    acc;

    super = GetPointer( clazz + offsetof( ClassClass, superclass ) );
    if( super != 0 ) {
        super = GetPointer( super + offsetof( JHandle, obj ) );
        is->kind = JS_TYPE;
        is->u.cn = super;
        if( ii->object_class == 0 ) {
            super_name = GetPointer( super + offsetof( ClassClass, name ) );
            GetString( super_name, NameBuff, sizeof( NameBuff ) );
            if( strcmp( NameBuff, JAVA_OBJECT_NAME ) == 0 ) {
                ii->object_class = super;
            }
        }
        /* Don't bother walking java.lang.Object fields - nothing interesting */
        if( super != ii->object_class ) {
            wr = wk( ii, SWI_INHERIT_START, is, d );
            if( wr == WR_CONTINUE ) {
                wr = WalkObject( ii, statics_only, super, wk, is, d );
                if( wr != WR_CONTINUE ) return( wr );
                wk( ii, SWI_INHERIT_END, NULL, d );
            }
        }
    }
    /* walk the fields */
    block = GetPointer( clazz + offsetof( ClassClass, fields ) );
    num = GetU16( clazz + offsetof( ClassClass, fields_count ) );
    is->kind = JS_FIELD;
    for( i = 0; i < num; ++i, block += sizeof( struct fieldblock ) ) {
        if( statics_only ) {
            acc = GetU16( block + offsetof( struct fieldblock, access ) );
            if( !(acc & ACC_STATIC) ) continue;
        }
        is->u.fb = block;
        wr = wk( ii, SWI_SYMBOL, is, d );
        if( wr != WR_CONTINUE ) return( wr );
    }
    /* walk the methods */
    block = GetPointer( clazz + offsetof( ClassClass, methods ) );
    num = GetU16( clazz + offsetof( ClassClass, methods_count ) );
    is->kind = JS_METHOD;
    for( i = 0; i < num; ++i ) {
        acc = GetU16( block + offsetof( struct methodblock, fb.access ) );
        if( !(acc & ACC_NATIVE) ) {
            /* Don't bother telling debugger about native methods */
            is->u.mb = block;
            wr = wk( ii, SWI_SYMBOL, is, d );
            if( wr != WR_CONTINUE ) return( wr );
        }
        block += sizeof( struct methodblock );
    }
    return( WR_CONTINUE );
}
示例#26
0
void
e_week_view_layout_get_day_position (gint day,
                                     gboolean multi_week_view,
                                     gint weeks_shown,
                                     gint display_start_day,
                                     gboolean compress_weekend,
                                     gint *day_x,
                                     gint *day_y,
                                     gint *rows)
{
	gint week, day_of_week, col, weekend_col;

	*day_x = *day_y = *rows = 0;
	g_return_if_fail (day >= 0);

	if (multi_week_view) {
		g_return_if_fail (day < weeks_shown * 7);

		week = day / 7;
		col = day % 7;
		day_of_week = (display_start_day + day) % 7;
		if (compress_weekend && day_of_week >= 5) {
			/* In the compressed view Saturday is above Sunday and
			 * both have just one row as opposed to 2 for all the
			 * other days. */
			if (day_of_week == 5) {
				*day_y = week * 2;
				*rows = 1;
			} else {
				*day_y = week * 2 + 1;
				*rows = 1;
				col--;
			}
			/* Both Saturday and Sunday are in the same column. */
			*day_x = col;
		} else {
			/* If the weekend is compressed and the day is after
			 * the weekend we have to move back a column. */
			if (compress_weekend) {
				/* Calculate where the weekend column is.
				 * Note that 5 is Saturday. */
				weekend_col = (5 + 7 - display_start_day) % 7;
				if (col > weekend_col)
					col--;
			}

			*day_y = week * 2;
			*rows = 2;
			*day_x = col;
		}
	} else {
		#define wk(x) \
			((working_days & \
			(days[((x) + display_start_day) % 7])) ? 1 : 0)
		CalWeekdays days[] = {
			CAL_MONDAY,
			CAL_TUESDAY,
			CAL_WEDNESDAY,
			CAL_THURSDAY,
			CAL_FRIDAY,
			CAL_SATURDAY,
			CAL_SUNDAY };
		CalWeekdays working_days;
		gint arr[4] = {1, 1, 1, 1};
		gint edge, i, wd, m, M;
		gboolean any = TRUE;

		g_return_if_fail (day < 7);

		working_days = calendar_config_get_working_days ();
		edge = 3;

		if (wk (0) + wk (1) + wk (2) < wk (3) + wk (4) + wk (5) + wk (6))
			edge++;

		if (day < edge) {
			*day_x = 0;
			m = 0;
			M = edge;
		} else {
			*day_x = 1;
			m = edge;
			M = 7;
		}

		wd = 0; /* number of used rows in column */
		for (i = m; i < M; i++) {
			arr[i - m] += wk (i);
			wd += arr[i - m];
		}

		while (wd != 6 && any) {
			any = FALSE;

			for (i = M - 1; i >= m; i--) {
				if (arr[i - m] > 1) {
					any = TRUE;

					if (wd > 6) { /* too many rows, make last shorter */
						arr[i - m] --;
						wd--;
					} else if (wd < 6) { /* free rows left, enlarge those bigger */
						arr[i - m] ++;
						wd++;
					}

					if (wd == 6)
						break;
				}
			}

			if (!any && wd != 6) {
				any = TRUE;

				for (i = m; i < M; i++) {
					arr[i - m] += 3;
					wd += 3;
				}
			}
		}

		*rows = arr [day - m];

		*day_y = 0;
		for (i = m; i < day; i++) {
			*day_y += arr [i - m];
		}

		#undef wk
	}
}
示例#27
0
walk_result DIPIMPENTRY( WalkModList )( imp_image_handle *iih, DIP_IMP_MOD_WALKER *wk, void *d )
{
    return( wk( iih, IMH_MAP, d ) );
}