void excute(){ if(stall){ extype = 0; EX = "NOP"; }else { extype = idtype; EX = ID; } if(strcmp(EX,"ADD") == 0){ if(Add(rs,rt,rd) < 0){ error_no = 1; } }else if(strcmp(EX,"SUB") == 0){ if(Sub(rs,rt,rd) < 0){ error_no = 1; } }else if(strcmp(EX,"ADDU") == 0){ Add(rs,rt,rd); }else if(strcmp(EX,"AND") == 0){ And(rs,rt,rd); }else if(strcmp(EX,"OR") == 0){ Or(rs,rt,rd); }else if(strcmp(EX,"XOR") == 0){ Xor(rs,rt,rd); }else if(strcmp(EX,"NOR") == 0){ Nor(rs,rt,rd); }else if(strcmp(EX,"NAND") == 0){ Nand(rs,rt,rd); }else if(strcmp(EX,"SLT") == 0){ Slt(rs,rt,rd); }else if(strcmp(EX,"SLL") == 0){ Sll(rt,rd,shamt); }else if(strcmp(EX,"SRL") == 0){ Srl(rt,rd,shamt); }else if(strcmp(EX,"SRA") == 0){ Sra(rt,rd,shamt); }else if(strcmp(EX,"JR") == 0){ PC = registers[rs]; }else if(strcmp(EX,"ADDI") == 0){ if(Addi(rs,rt,imm)<0){ error_no = 1; } }else if(strcmp(EX,"ADDIU") == 0){ Addiu(rs,rt,imm); }else if(strcmp(EX,"LW") == 0){ Lw(rs,rt,imm); }else if(strcmp(EX,"LH") == 0){ Lh(rs,rt,imm); }else if(strcmp(EX,"LHU") == 0){ Lhu(rs,rt,imm); }else if(strcmp(EX,"LB") == 0){ Lb(rs,rt,imm); }else if(strcmp(EX,"LBU") == 0){ Lbu(rs,rt,imm); }else if(strcmp(EX,"SW") == 0){ Sw(rs,rt,imm); }else if(strcmp(EX,"SH") == 0){ Sh(rs,rt,imm); }else if(strcmp(EX,"SB") == 0){ Sb(rs,rt,imm); }else if(strcmp(EX,"LUI") == 0){ Lui(rt,imm); }else if(strcmp(EX,"ANDI") == 0){ Andi(rs,rt,imm); }else if(strcmp(EX,"ORI") == 0){ Ori(rs,rt,imm); }else if(strcmp(EX,"NORI") == 0){ Nori(rs,rt,imm); }else if(strcmp(EX,"SLTI") == 0){ Slti(rs,rt,imm); }else if(strcmp(EX,"JAL") == 0){ registers[31] = PC; PC = (PC)/(int)(Pow(2,28)+0.01)*(int)(Pow(2,28)+0.01) + ads*4; }else if(strcmp(EX,"J") == 0){ PC = (PC)/(int)(Pow(2,28)+0.01)*(int)(Pow(2,28)+0.01) + ads*4; }/*else if(strcmp(EX,"BEQ") == 0 || strcmp(EX,"BNE") == 0 || strcmp(EX,"BGTZ") == 0){ PC = go; }*/ }
void EPSPlug::parseOutput(QString fn, bool eps) { QString tmp, token, params, lasttoken, lastPath, currPath; int z, lcap, ljoin, dc, pagecount; int failedImages = 0; double dcp; bool fillRuleEvenOdd = true; PageItem* ite; QStack<PageItem*> groupStack; QStack< QList<PageItem*> > groupStackP; QStack<int> gsStack; QStack<uint> gsStackMarks; QFile f(fn); lasttoken = ""; pagecount = 1; if (f.open(QIODevice::ReadOnly)) { int fProgress = 0; int fSize = (int) f.size(); if (progressDialog) { progressDialog->setTotalSteps("GI", fSize); qApp->processEvents(); } lastPath = ""; currPath = ""; LineW = 0; Opacity = 1; CurrColor = CommonStrings::None; JoinStyle = Qt::MiterJoin; CapStyle = Qt::FlatCap; DashPattern.clear(); ScTextStream ts(&f); int line_cnt = 0; while (!ts.atEnd() && !cancel) { tmp = ""; tmp = ts.readLine(); if (progressDialog && (++line_cnt % 100 == 0)) { int fPos = f.pos(); int progress = static_cast<int>(ceil(fPos / (double) fSize * 100)); if (progress > fProgress) { progressDialog->setProgress("GI", fPos); qApp->processEvents(); fProgress = progress; } } token = tmp.section(' ', 0, 0); params = tmp.section(' ', 1, -1, QString::SectionIncludeTrailingSep); if (lasttoken == "sp" && !eps && token != "sp" ) //av: messes up anyway: && (!interactive)) { m_Doc->addPage(pagecount); m_Doc->view()->addPage(pagecount, true); pagecount++; } if (token == "n") { Coords.resize(0); FirstM = true; WasM = false; ClosedPath = false; } else if (token == "m") WasM = true; else if (token == "c") { Curve(&Coords, params); currPath += params; } else if (token == "l") { LineTo(&Coords, params); currPath += params; } else if (token == "fill-winding") { fillRuleEvenOdd = false; } else if (token == "fill-evenodd") { fillRuleEvenOdd = true; } else if (token == "f") { //TODO: pattern -> Imageframe + Clip if (Coords.size() != 0) { if ((Elements.count() != 0) && (lastPath == currPath)) { ite = Elements.last(); ite->setFillColor(CurrColor); ite->setFillTransparency(1.0 - Opacity); lastPath = ""; } else { if (ClosedPath) z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColor, CommonStrings::None); else z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColor, CommonStrings::None); ite = m_Doc->Items->at(z); ite->PoLine = Coords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset()); ite->ClipEdited = true; ite->FrameType = 3; ite->fillRule = (fillRuleEvenOdd); FPoint wh = getMaxClipF(&ite->PoLine); ite->setWidthHeight(wh.x(),wh.y()); ite->Clip = FlattenPath(ite->PoLine, ite->Segments); ite->setFillTransparency(1.0 - Opacity); ite->setTextFlowMode(PageItem::TextFlowDisabled); m_Doc->AdjustItemSize(ite); if (ite->itemType() == PageItem::Polygon) ite->ContourLine = ite->PoLine.copy(); if ((groupStack.count() != 0) && (groupStackP.count() != 0)) groupStackP.top().append(ite); Elements.append(ite); lastPath = currPath; } currPath = ""; } } else if (token == "s") { if (Coords.size() != 0) { // LineW = qMax(LineW, 0.01); // Set Linewidth to be a least 0.01 pts, a Stroke without a Linewidth makes no sense if ((Elements.count() != 0) && (lastPath == currPath)) { ite = Elements.last(); ite->setLineColor(CurrColor); ite->setLineWidth(LineW); ite->PLineEnd = CapStyle; ite->PLineJoin = JoinStyle; ite->setLineTransparency(1.0 - Opacity); ite->DashOffset = DashOffset; ite->DashValues = DashPattern; } else { if (ClosedPath) z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColor); else z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColor); ite = m_Doc->Items->at(z); ite->PoLine = Coords.copy(); //FIXME: try to avoid copy when FPointArray is properly shared ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset()); ite->ClipEdited = true; ite->FrameType = 3; ite->PLineEnd = CapStyle; ite->PLineJoin = JoinStyle; ite->DashOffset = DashOffset; ite->DashValues = DashPattern; FPoint wh = getMaxClipF(&ite->PoLine); ite->setWidthHeight(wh.x(), wh.y()); ite->Clip = FlattenPath(ite->PoLine, ite->Segments); ite->setLineTransparency(1.0 - Opacity); m_Doc->AdjustItemSize(ite); if (ite->itemType() == PageItem::Polygon) ite->ContourLine = ite->PoLine.copy(); ite->setLineWidth(LineW); ite->setTextFlowMode(PageItem::TextFlowDisabled); if ((groupStack.count() != 0) && (groupStackP.count() != 0)) groupStackP.top().append(ite); Elements.append(ite); } lastPath = ""; currPath = ""; } } else if (token == "co") CurrColor = parseColor(params, eps); else if (token == "corgb") CurrColor = parseColor(params, eps, colorModelRGB); else if (token == "ci") { if (Coords.size() != 0) { QPainterPath tmpPath = Coords.toQPainterPath(true); tmpPath = boundingBoxRect.intersected(tmpPath); if ((tmpPath.boundingRect().width() != 0) && (tmpPath.boundingRect().height() != 0)) { clipCoords.fromQPainterPath(tmpPath); z = m_Doc->itemAdd(PageItem::Group, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None); ite = m_Doc->Items->at(z); ite->PoLine = clipCoords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset()); ite->ClipEdited = true; ite->FrameType = 3; FPoint wh = getMaxClipF(&ite->PoLine); ite->setWidthHeight(wh.x(),wh.y()); ite->Clip = FlattenPath(ite->PoLine, ite->Segments); m_Doc->AdjustItemSize(ite, true); ite->ContourLine = ite->PoLine.copy(); ite->setItemName( tr("Group%1").arg(m_Doc->GroupCounter)); ite->setTextFlowMode(PageItem::TextFlowDisabled); Elements.append(ite); if ((groupStack.count() != 0) && (groupStackP.count() != 0)) groupStackP.top().append(ite); groupStack.push(ite); QList<PageItem*> gElements; groupStackP.push(gElements); gsStackMarks.push(gsStack.count()); m_Doc->GroupCounter++; } } Coords = FPointArray(0); lastPath = ""; currPath = ""; } else if (token == "gs") { gsStack.push(1); } else if (token == "gr") { // #6834 : self defense against incorrectly balanced save/restore if (gsStack.count() > 0) gsStack.pop(); if ((groupStack.count() != 0) && (groupStackP.count() != 0)) { if (gsStack.count() < static_cast<int>(gsStackMarks.top())) { PageItem *ite = groupStack.pop(); QList<PageItem*> gList = groupStackP.pop(); for (int d = 0; d < gList.count(); d++) { Elements.removeAll(gList.at(d)); } m_Doc->groupObjectsToItem(ite, gList); gsStackMarks.pop(); } } } else if (token == "w") { ScTextStream Lw(¶ms, QIODevice::ReadOnly); Lw >> LineW; } else if (token == "ld")
/*! Compute and return the interaction matrix \f$ L \f$ from a subset (\f$ \theta u_x, \theta u_y, \theta u_z\f$) of the possible \f$ \theta u \f$ features that represent the 3D rotation \f$^{c^*}R_c\f$ or \f$^{c}R_{c^*}\f$, with \f[ L = [ 0_3 \; L_{\theta u}] \f] See the vpFeatureThetaU class description for the equations of \f$L_{\theta u}\f$. \param select : Selection of a subset of the possible \f$ \theta u \f$ features. - To compute the interaction matrix for all the three \f$ \theta u \f$ features use vpBasicFeature::FEATURE_ALL. In that case the dimension of the interaction matrix is \f$ [3 \times 6] \f$ - To compute the interaction matrix for only one of the \f$ \theta u \f$ component feature (\f$\theta u_x, \theta u_y, \theta u_z\f$) use one of the corresponding function selectTUx(), selectTUy() or selectTUz(). In that case the returned interaction matrix is \f$ [1 \times 6] \f$ dimension. \return The interaction matrix computed from the \f$ \theta u \f$ features that represent either the rotation \f$^{c^*}R_c\f$ or the rotation \f$^{c}R_{c^*}\f$. The code below shows how to compute the interaction matrix associated to the visual feature \f$s = \theta u_x \f$. \code vpRotationMatrix cdMc; // Creation of the current feature s vpFeatureThetaU s(vpFeatureThetaU::cdRc); s.buildFrom(cdMc); vpMatrix L_x = s.interaction( vpFeatureThetaU::selectTUx() ); \endcode The code below shows how to compute the interaction matrix associated to the \f$s = (\theta u_x, \theta u_y) \f$ subset visual feature: \code vpMatrix L_xy = s.interaction( vpFeatureThetaU::selectTUx() | vpFeatureThetaU::selectTUy() ); \endcode L_xy is here now a 2 by 6 matrix. The first line corresponds to the \f$ \theta u_x \f$ visual feature while the second one to the \f$ \theta u_y \f$ visual feature. It is also possible to build the interaction matrix from all the \f$ \theta u \f$ components by: \code vpMatrix L_xyz = s.interaction( vpBasicFeature::FEATURE_ALL ); \endcode In that case, L_xyz is a 3 by 6 interaction matrix where the last line corresponds to the \f$ \theta u_z \f$ visual feature. */ vpMatrix vpFeatureThetaU::interaction(const unsigned int select) { vpMatrix L ; L.resize(0,6) ; if (deallocate == vpBasicFeature::user) { for (unsigned int i = 0; i < nbParameters; i++) { if (flags[i] == false) { switch(i){ case 0: vpTRACE("Warning !!! The interaction matrix is computed but Tu_x was not set yet"); break; case 1: vpTRACE("Warning !!! The interaction matrix is computed but Tu_y was not set yet"); break; case 2: vpTRACE("Warning !!! The interaction matrix is computed but Tu_z was not set yet"); break; default: vpTRACE("Problem during the reading of the variable flags"); } } } resetFlags(); } // Lw computed using Lw = [theta/2 u]_x +/- (I + alpha [u]_x [u]_x) vpColVector u(3) ; for (unsigned int i=0 ; i < 3 ; i++) { u[i] = s[i]/2.0 ; } vpMatrix Lw(3,3) ; Lw = vpColVector::skew(u) ; /* [theta/2 u]_x */ vpMatrix U2(3,3) ; U2.eye() ; double theta = sqrt(s.sumSquare()) ; if (theta >= 1e-6) { for (unsigned int i=0 ; i < 3 ; i++) u[i] = s[i]/theta ; vpMatrix skew_u ; skew_u = vpColVector::skew(u) ; U2 += (1-vpMath::sinc(theta)/vpMath::sqr(vpMath::sinc(theta/2.0)))*skew_u*skew_u ; } if (rotation == cdRc) { Lw += U2; } else { Lw -= U2; } //This version is a simplification if (vpFeatureThetaU::selectTUx() & select ) { vpMatrix Lx(1,6) ; Lx[0][0] = 0 ; Lx[0][1] = 0 ; Lx[0][2] = 0 ; for (int i=0 ; i < 3 ; i++) Lx[0][i+3] = Lw[0][i] ; L = vpMatrix::stack(L,Lx) ; } if (vpFeatureThetaU::selectTUy() & select ) { vpMatrix Ly(1,6) ; Ly[0][0] = 0 ; Ly[0][1] = 0 ; Ly[0][2] = 0 ; for (int i=0 ; i < 3 ; i++) Ly[0][i+3] = Lw[1][i] ; L = vpMatrix::stack(L,Ly) ; } if (vpFeatureThetaU::selectTUz() & select ) { vpMatrix Lz(1,6) ; Lz[0][0] = 0 ; Lz[0][1] = 0 ; Lz[0][2] = 0 ; for (int i=0 ; i < 3 ; i++) Lz[0][i+3] = Lw[2][i] ; L = vpMatrix::stack(L,Lz) ; } return L ; }