bool ASTPrinter::visit(BinaryOperation const& _node) { writeLine(string("BinaryOperation using operator ") + Token::toString(_node.getOperator())); printType(_node); printSourcePart(_node); return goDeeper(); }
SolutionNode* SolutionTree::goUp(SolutionNode *node) { // std::cout << "GoUp node = " << node << std::endl; SolutionNode *parent = node->parent; if (parent) { // std::cout << "Wchodze w prawego syna!" << std::endl; if (parent->matrix.getSize() > 3) { parent->rightSon = new SolutionNode; SolutionNode *son = parent->rightSon; son->visited = true; son->parent = parent; son->leftSon = 0; son->rightSon = 0; son->matrix = parent->matrix; son->trace = parent->trace; son->lowBound += son->matrix.reduction(); std::pair<int, int> best = son->matrix.maxMin(); // std::cout << "best (" << best.first << " , " << best.second << ")" // << std::endl; std::pair<int, int> vert = son->matrix.getVert(best); son->matrix.blockEdge(vert); std::cout << "Matrix po blokowaniu" << std::endl; std::cout << son->matrix.toString() << std::endl; if (son->lowBound < uBound) { goUp(goDeeper(son)); } } } return 0; }
bool ASTPrinter::visit(NewExpression const& _node) { writeLine("NewExpression"); printType(_node); printSourcePart(_node); return goDeeper(); }
void insertDSSM(DSSM* dssm, char graph6Format[], int* ds) { //printf("INSERTING INTO %d at depth %d ", dssm->id, dssm->depth); //printArray(ds); //printf("\n"); if (dssm->nGraphs >= dssm->maxNGraphs) { //printf("case A\n"); if (dssm->depth < dssm->nVertices) { goDeeper(dssm); insertDSSM(dssm, graph6Format, ds); return; } } else if (dssm->nGraphs == -1) { //printf("case B\n"); if (dssm->nextOnes[ds[dssm->depth]] == NULL) { dssm->nextOnes[ds[dssm->depth]] = makeDSSM(dssm->nVertices, dssm->maxNGraphs, dssm->depth + 1); } insertDSSM(dssm->nextOnes[ds[dssm->depth]], graph6Format, ds); return; } if (dssm->los == NULL) { //printf("case C\n"); dssm->los = newListOfGraphs(graph6Format, ds); } else { //printf("case D\n"); dssm->los = addToListOfGraphs(dssm->los, graph6Format, ds); } dssm->nGraphs = dssm->nGraphs + 1; }
bool ASTPrinter::visit(IndexAccess const& _node) { writeLine("IndexAccess"); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(MemberAccess const& _node) { writeLine("MemberAccess to member " + _node.getMemberName()); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(Identifier const& _node) { writeLine(string("Identifier ") + _node.getName()); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(TupleExpression const& _node) { writeLine(string("TupleExpression")); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(ElementaryTypeNameExpression const& _node) { writeLine(string("ElementaryTypeNameExpression ") + Token::toString(_node.getTypeToken())); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(Assignment const& _node) { writeLine(string("Assignment using operator ") + Token::toString(_node.getAssignmentOperator())); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(FunctionCall const& _node) { writeLine("FunctionCall"); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(FunctionDefinition const& _node) { writeLine("FunctionDefinition \"" + _node.getName() + "\"" + (_node.isPublic() ? " - public" : "") + (_node.isDeclaredConst() ? " - const" : "")); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(UnaryOperation const& _node) { writeLine(string("UnaryOperation (") + (_node.isPrefixOperation() ? "prefix" : "postfix") + ") " + Token::toString(_node.getOperator())); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(Literal const& _node) { char const* tokenString = Token::toString(_node.getToken()); if (!tokenString) tokenString = "[no token]"; writeLine(string("Literal, token: ") + tokenString + " value: " + _node.getValue()); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(VariableDeclaration const& _node) { writeLine("VariableDeclaration \"" + _node.name() + "\""); *m_ostream << indentation() << ( _node.annotation().type ? string(" Type: ") + _node.annotation().type->toString() : string(" Type unknown.") ) << "\n"; printSourcePart(_node); return goDeeper(); }
//---------------------------------------------------------------------------- void LayMap::goDeeper(SLICE *slice,LAYOUT *lPtr,short *matrix) // // { if(slice->chld_type == SLICE_CHLD) { for(SLICE *cslPtr=slice->chld.slice;cslPtr != NULL;cslPtr=cslPtr->next) goDeeper(cslPtr,lPtr,matrix); } else { for(LAYINST *liPtr=slice->chld.layinst;liPtr!=NULL;liPtr=liPtr->next) if(strstr(liPtr->layout->name,"Tmp_Cell_")==NULL ) // don't consider // nelsis's tmp cells { short out[6], *mtxb=liPtr->mtx; // transformation for this cell is a multiplication // of transfomation of parrent and transformation // of child within parrent out[A11] = matrix[A11]*mtxb[A11] + matrix[A12]*mtxb[A21]; out[A12] = matrix[A11]*mtxb[A12] + matrix[A12]*mtxb[A22]; out[A21] = matrix[A21]*mtxb[A11] + matrix[A22]*mtxb[A21]; out[A22] = matrix[A21]*mtxb[A12] + matrix[A22]*mtxb[A22]; out[B1] = matrix[A11]*mtxb[B1] + matrix[A12]*mtxb[B2] + matrix[B1]; out[B2] = matrix[A21]*mtxb[B1] + matrix[A22]*mtxb[B2] + matrix[B2]; addWires(0,0,liPtr->layout,out); // addWires(liPtr->mtx[B1],liPtr->mtx[B2],liPtr->layout,matrix); } else { cerr << "\n Layouts cannot be build of nelsis's temporary cells\n"; usrErr("LayMap::goDeeper",EINPDAT); } } }// LayMap::goDeeper //
Solution SolutionTree::findSolution() { Solution solution; SolutionNode *n = goDeeper(0); // std::cout << "findSolution *n: " << n << std::endl; goUp(n); solution.trace = bestSolution->trace; solution.cost = 0; /*std::list<int>::iterator it = solution.trace.begin(); while (++it != solution.trace.end()) { solution.cost += bestSolution->matrix.getCost( std::pair<int, int>(*(--it), *(++it))); } solution.cost += bestSolution->matrix.getCost( std::pair<int, int>(bestSolution->trace.back(), bestSolution->trace.front())); */ return solution; }
bool ASTPrinter::visit(ExpressionStatement const& _node) { writeLine("ExpressionStatement"); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(ParameterList const& _node) { writeLine("ParameterList"); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(EnumValue const& _node) { writeLine("EnumValue \"" + _node.getName() + "\""); return goDeeper(); }
bool ASTPrinter::visit(EnumDefinition const& _node) { writeLine("EnumDefinition \"" + _node.getName() + "\""); return goDeeper(); }
bool ASTPrinter::visit(StructDefinition const& _node) { writeLine("StructDefinition \"" + _node.getName() + "\""); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(InheritanceSpecifier const& _node) { writeLine("InheritanceSpecifier \"" + _node.getName()->getName() + "\""); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(ImportDirective const& _node) { writeLine("ImportDirective \"" + _node.getIdentifier() + "\""); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(VariableDeclarationStatement const& _node) { writeLine("VariableDeclarationStatement"); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(PlaceholderStatement const& _node) { writeLine("PlaceholderStatement"); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(WhileStatement const& _node) { writeLine("WhileStatement"); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(Continue const& _node) { writeLine("Continue"); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(Break const& _node) { writeLine("Break"); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(Return const& _node) { writeLine("Return"); printSourcePart(_node); return goDeeper(); }