int tellstdfunc::stdCELLAREF::execute() { UNDOcmdQ.push_front(this); // get the parameters from the operand stack //cellaref("boza",getpoint(),0,false,1,3,2,30,70); real stepY = getOpValue(); real stepX = getOpValue(); word row = getWordValue(); word col = getWordValue(); real magn = getOpValue(); bool flip = getBoolValue(); real angle = getOpValue(); telldata::ttpnt *rpnt = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop(); std::string name = getStringValue(); real DBscale = DATC->DBscale(); int4b istepX = (int4b)rint(stepX * DBscale); int4b istepY = (int4b)rint(stepY * DBscale); CTM ori(TP(rpnt->x(), rpnt->y(), DBscale), magn,angle,flip); laydata::ArrayProperties arrprops(istepX,istepY,col,row); laydata::tdtdesign* ATDB = DATC->lockDB(); telldata::ttlayout* cl = DEBUG_NEW telldata::ttlayout( ATDB->addcellaref(name,ori,arrprops),REF_LAY); DATC->unlockDB(); OPstack.push(cl); UNDOPstack.push_front(cl->selfcopy()); LogFile << LogFile.getFN() << "(\""<< name << "\"," << *rpnt << "," << angle << "," << LogFile._2bool(flip) << "," << magn << "," << col << "," << row << "," << stepX << "," << stepY << ");"; LogFile.flush(); delete rpnt; RefreshGL(); return EXEC_NEXT; }
int tellstdfunc::stdADDTEXT::execute() { // get the parameters from the operand stack real magn = getOpValue(); bool flip = getBoolValue(); real angle = getOpValue(); telldata::ttpnt *rpnt = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop(); word la = getWordValue(); std::string text = getStringValue(); if ("" == text) { tell_log(console::MT_ERROR,"Empty string. Operation ignored"); return EXEC_ABORT; } if (0.0 == magn) { tell_log(console::MT_ERROR,"Text with size 0. Operation ignored"); return EXEC_ABORT; } UNDOcmdQ.push_front(this); UNDOPstack.push_front(DEBUG_NEW telldata::ttint(la)); real DBscale = DATC->DBscale(); CTM ori(TP(rpnt->x(), rpnt->y(), DBscale), magn*DBscale/OPENGL_FONT_UNIT,angle,flip); laydata::tdtdesign* ATDB = DATC->lockDB(); telldata::ttlayout* tx = DEBUG_NEW telldata::ttlayout(ATDB->addtext(la, text, ori), la); DATC->unlockDB(); OPstack.push(tx);UNDOPstack.push_front(tx->selfcopy()); LogFile << LogFile.getFN() << "(\"" << text << "\"," << la << "," << *rpnt << "," << angle << "," << LogFile._2bool(flip) << "," << magn << ");"; LogFile.flush(); delete rpnt; RefreshGL(); return EXEC_NEXT; }
//============================================================================= int parsercmd::cmdGET::execute() { TELL_DEBUG(cmdGET); real value2 = getOpValue(); real value1 = getOpValue(); OPstack.push(new telldata::ttbool(value1 >= value2)); return EXEC_NEXT; }
//============================================================================= int parsercmd::cmdMULTIPLY::execute() { TELL_DEBUG(cmdMULTIPLY); real value2 = getOpValue(); real value1 = getOpValue(); OPstack.push(new telldata::ttreal(value1 * value2)); return EXEC_NEXT; }
//============================================================================= int parsercmd::cmdDIVISION::execute() { TELL_DEBUG(cmdDIVISION); real value2 = getOpValue(); real value1 = getOpValue(); OPstack.push(new telldata::ttreal(value1 / value2)); return EXEC_NEXT; }
//============================================================================= int parsercmd::cmdNE::execute() { TELL_DEBUG(cmdNE); if (NUMBER_TYPE(OPstack.top()->get_type())) OPstack.push(new telldata::ttbool(getOpValue() != getOpValue())); // else if (tn_ // box & poly equal return EXEC_NEXT; }
int tellstdfunc::CIFimport::execute() { real techno = getOpValue(); bool over = getBoolValue(); bool recur = getBoolValue(); SIMap* cifLays = DEBUG_NEW SIMap(); telldata::ttlist *lll = static_cast<telldata::ttlist*>(OPstack.top());OPstack.pop(); std::string name = getStringValue(); // Convert layer map telldata::tthsh* nameh; for (unsigned i = 0; i < lll->size(); i++) { nameh = static_cast<telldata::tthsh*>((lll->mlist())[i]); (*cifLays)[nameh->value().value()] = nameh->key().value(); } // Convert top structure list nameList top_cells; top_cells.push_back(name.c_str()); DATC->lockDB(false); DATC->CIFimport(top_cells, cifLays, recur, over, techno * DATC->DBscale()); updateLayerDefinitions(DATC->TEDLIB(), top_cells, TARGETDB_LIB); DATC->unlockDB(); // Don't refresh the tree browser here. See the comment in GDSimportAll::execute() LogFile << LogFile.getFN() << "(\"" << name<< "\"," << *lll << "," << LogFile._2bool(recur) << "," << LogFile._2bool(over) << "," << techno << ");"; LogFile.flush(); delete lll; cifLays->clear(); delete cifLays; return EXEC_NEXT; }
int tellstdfunc::stdDRAWWIRE::execute() { word la = getWordValue(); real w = getOpValue(); DATC->setcmdlayer(la); real DBscale = DATC->DBscale(); if (!tellstdfunc::waitGUInput(static_cast<int>(rint(w * DBscale)), &OPstack)) return EXEC_ABORT; // get the data from the stack la = DATC->curcmdlay(); telldata::ttlist *pl = static_cast<telldata::ttlist*>(OPstack.top());OPstack.pop(); if (pl->size() > 1) { UNDOcmdQ.push_front(this); UNDOPstack.push_front(DEBUG_NEW telldata::ttint(la)); laydata::tdtdesign* ATDB = DATC->lockDB(); pointlist* plst = t2tpoints(pl,DBscale); telldata::ttlayout* wr = DEBUG_NEW telldata::ttlayout(ATDB->addwire(la,plst, static_cast<word>(rint(w * DBscale))), la); delete plst; DATC->unlockDB(); OPstack.push(wr);UNDOPstack.push_front(wr->selfcopy()); LogFile << "addwire(" << *pl << "," << w << "," << la << ");"; LogFile.flush(); } else { tell_log(console::MT_ERROR,"At least 2 points expected to create a wire"); OPstack.push(DEBUG_NEW telldata::ttlayout()); } delete pl; RefreshGL(); return EXEC_NEXT; }
int tellstdfunc::stdROTATESEL::execute() { UNDOcmdQ.push_front(this); UNDOPstack.push_front(OPstack.top()); telldata::ttpnt *p1 = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop(); real angle = getOpValue(); UNDOPstack.push_front(DEBUG_NEW telldata::ttreal(angle)); real DBscale = DATC->DBscale(); // rotate_selected returns 3 select lists : Failed/Deleted/Added // This is because of the box rotation in which case box has to be converted to polygon // Failed shapes here should not exist but no explicit check for this laydata::selectList* fadead[3]; byte i; for (i = 0; i < 3; fadead[i++] = DEBUG_NEW laydata::selectList()); laydata::tdtdesign* ATDB = DATC->lockDB(); ATDB->rotate_selected(TP(p1->x(), p1->y(), DBscale), angle, fadead); telldata::ttlist* added = make_ttlaylist(fadead[2]); ATDB->select_fromList(get_ttlaylist(added)); // save for undo operations ... UNDOPstack.push_front(make_ttlaylist(fadead[0])); // first failed UNDOPstack.push_front(make_ttlaylist(fadead[1])); // then deleted UNDOPstack.push_front(added); // and added for (i = 0; i < 3; delete fadead[i++]); DATC->unlockDB(); LogFile << LogFile.getFN() << "("<< angle << "," << *p1 << ");"; LogFile.flush(); //delete p1; undo will delete them RefreshGL(); return EXEC_NEXT; }
int tellstdfunc::stdSIN::execute() { real value = getOpValue(OPstack); double angle = (value / 180.0 * M_PI);// translate in radians OPstack.push(DEBUG_NEW telldata::ttreal(sin(angle))); return EXEC_NEXT; }
//============================================================================= int parsercmd::cmdSHIFTPNT::execute() { TELL_DEBUG(cmdSHIFTPNT); real shift = getOpValue(); telldata::ttpnt *p = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop(); telldata::ttpnt* r = new telldata::ttpnt(p->x()+_sign*shift,p->y()+_sign*shift); delete p; OPstack.push(r); return EXEC_NEXT; }
int tellstdfunc::stdGRIDDEF::execute() { std::string colname = getStringValue(); real step = getOpValue(); byte no = getByteValue(); DATC->setGrid(no,step,colname); LogFile << LogFile.getFN() << "(" << no << "," << step << ",\"" << colname << "\");";LogFile.flush(); RefreshGL(); return EXEC_NEXT; }
int tellstdfunc::stdCELLAREF_D::execute() { real stepY = getOpValue(); real stepX = getOpValue(); word row = getWordValue(); word col = getWordValue(); std::string name = getStringValue(); // check that target cell exists - otherwise tmp_draw can't obviously work. // there is another more extensive check when the cell is added, there the circular // references are checked as well laydata::tdtdesign* ATDB = DATC->lockDB(false); laydata::tdtcell *excell = static_cast<laydata::tdtcell*>(ATDB->checkcell(name)); DATC->unlockDB(); if (NULL == excell) { std::string news = "Can't find cell \""; news += name; news += "\" "; tell_log(console::MT_ERROR,news); return EXEC_ABORT; } real DBscale = DATC->DBscale(); int4b istepX = (int4b)rint(stepX * DBscale); int4b istepY = (int4b)rint(stepY * DBscale); // stop the thread and wait for input from the GUI if (!tellstdfunc::waitGUInput(console::op_abind, &OPstack, name, CTM(), istepX, istepY,col,row)) return EXEC_ABORT; // get the data from the stack telldata::ttbnd *bnd = static_cast<telldata::ttbnd*>(OPstack.top());OPstack.pop(); OPstack.push(DEBUG_NEW telldata::ttstring(name)); OPstack.push(DEBUG_NEW telldata::ttpnt(bnd->p())); OPstack.push(DEBUG_NEW telldata::ttreal(bnd->rot())); OPstack.push(DEBUG_NEW telldata::ttbool(bnd->flx())); OPstack.push(DEBUG_NEW telldata::ttreal(bnd->sc())); OPstack.push(DEBUG_NEW telldata::ttint(col)); OPstack.push(DEBUG_NEW telldata::ttint(row)); OPstack.push(DEBUG_NEW telldata::ttreal(stepX)); OPstack.push(DEBUG_NEW telldata::ttreal(stepY)); delete bnd; return stdCELLAREF::execute(); }
int tellstdfunc::stdSTEP::execute() { // prepare undo first UNDOcmdQ.push_front(this); UNDOPstack.push_front(new telldata::ttreal(DATC->step())); // real step = getOpValue(); DATC->setstep(step); LogFile << LogFile.getFN() << "(" << step << ");"; LogFile.flush(); return EXEC_NEXT; }
bool operator==(VixMntMsgOp op, const char *cstr_op) { #if defined(__cplusplus) && __cplusplus >= 201103L if (op != VixMntMsgOp::ERROR) #else if (op != ERROR) #endif return !strcmp(cstr_op, getOpValue(op)); return false; }
int tellstdfunc::stdADDBOXr::execute() { UNDOcmdQ.push_front(this); word la = getWordValue(); UNDOPstack.push_front(DEBUG_NEW telldata::ttint(la)); real heigth = getOpValue(); real width = getOpValue(); telldata::ttpnt *p1 = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop(); telldata::ttpnt p2 = telldata::ttpnt(p1->x()+width,p1->y()+heigth); real DBscale = DATC->DBscale(); TP* p1DB = DEBUG_NEW TP(p1->x(), p1->y(), DBscale); TP* p2DB = DEBUG_NEW TP(p2.x() , p2.y() , DBscale); laydata::tdtdesign* ATDB = DATC->lockDB(); telldata::ttlayout* bx = DEBUG_NEW telldata::ttlayout(ATDB->addbox(la, p1DB, p2DB), la); DATC->unlockDB(); OPstack.push(bx);UNDOPstack.push_front(bx->selfcopy()); LogFile << LogFile.getFN() << "("<< *p1 << "," << width << "," << heigth << "," << la << ");"; LogFile.flush(); delete p1; RefreshGL(); return EXEC_NEXT; }
int tellstdfunc::stdCELLREF::execute() { UNDOcmdQ.push_front(this); // get the parameters from the operand stack real magn = getOpValue(); bool flip = getBoolValue(); real angle = getOpValue(); telldata::ttpnt *rpnt = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop(); std::string name = getStringValue(); real DBscale = DATC->DBscale(); CTM ori(TP(rpnt->x(), rpnt->y(), DBscale), magn,angle,flip); laydata::tdtdesign* ATDB = DATC->lockDB(); telldata::ttlayout* cl = DEBUG_NEW telldata::ttlayout(ATDB->addcellref(name,ori), 0); DATC->unlockDB(); OPstack.push(cl); UNDOPstack.push_front(cl->selfcopy()); LogFile << LogFile.getFN() << "(\""<< name << "\"," << *rpnt << "," << angle << "," << LogFile._2bool(flip) << "," << magn <<");"; LogFile.flush(); delete rpnt; RefreshGL(); return EXEC_NEXT; }
bool VixMntMsgQue::sendMsgOp(VixMntMsgOp msg_op, unsigned msg_prio) { // throw exception if op equal to ERROR #if defined(__cplusplus) && __cplusplus >= 201103L assert(msg_op != VixMntMsgOp::ERROR); #else assert(msg_op != ERROR); #endif const char *msg_str = getOpValue(msg_op); return send(msg_str, strlen(msg_str), msg_prio) >= 0; }
void tellstdfunc::stdROTATESEL::undo_cleanup() { telldata::ttpnt *p1 = static_cast<telldata::ttpnt*>(UNDOPstack.back());UNDOPstack.pop_back(); getOpValue(UNDOPstack, false); telldata::ttlist* failed = static_cast<telldata::ttlist*>(UNDOPstack.back());UNDOPstack.pop_back(); telldata::ttlist* deleted = static_cast<telldata::ttlist*>(UNDOPstack.back());UNDOPstack.pop_back(); telldata::ttlist* added = static_cast<telldata::ttlist*>(UNDOPstack.back());UNDOPstack.pop_back(); clean_ttlaylist(deleted); delete added; delete deleted; delete failed; delete p1; }
int tellstdfunc::stdCELLREF::execute() { // get the parameters from the operand stack real magn = getOpValue(); bool flip = getBoolValue(); real angle = getOpValue(); telldata::ttpnt *rpnt = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop(); std::string name = getStringValue(); real DBscale = DATC->DBscale(); CTM ori(TP(rpnt->x(), rpnt->y(), DBscale), magn,angle,flip); // check that target cell exists - otherwise tmp_draw can't obviously work. // there is another more extensive check when the cell is added, there the circular // references are checked as well laydata::CellDefin strdefn; if (DATC->getCellNamePair(name, strdefn)) { UNDOcmdQ.push_front(this); laydata::tdtdesign* ATDB = DATC->lockDB(); telldata::ttlayout* cl = DEBUG_NEW telldata::ttlayout(ATDB->addcellref(strdefn,ori), REF_LAY); DATC->unlockDB(); OPstack.push(cl); UNDOPstack.push_front(cl->selfcopy()); LogFile << LogFile.getFN() << "(\""<< name << "\"," << *rpnt << "," << angle << "," << LogFile._2bool(flip) << "," << magn <<");"; LogFile.flush(); delete rpnt; RefreshGL(); return EXEC_NEXT; } else { std::string news = "Cell \""; news += name; news += "\" is not defined"; tell_log(console::MT_ERROR,news); delete rpnt; return EXEC_ABORT; } }
int tellstdfunc::stdROTATESEL_D::execute() { real angle = getOpValue(); if (DATC->numselected() == 0) { tell_log(console::MT_ERROR,"No objects selected. Nothing to rotate"); return EXEC_NEXT; } CTM rct; rct.Rotate(angle); OPstack.push(DEBUG_NEW telldata::ttreal(angle)); // stop the thread and wait for input from the GUI if (!tellstdfunc::waitGUInput(console::op_rotate, &OPstack, "", rct)) return EXEC_ABORT; return stdROTATESEL::execute(); }
int tellstdfunc::stdADDTEXT_D::execute() { real magn = getOpValue(); std::string name = getStringValue(); CTM ftrans; ftrans.Scale(magn,magn); // stop the thread and wait for input from the GUI if (!tellstdfunc::waitGUInput(console::op_tbind, &OPstack, name, ftrans)) return EXEC_ABORT; // get the data from the stack telldata::ttbnd *bnd = static_cast<telldata::ttbnd*>(OPstack.top());OPstack.pop(); OPstack.push(DEBUG_NEW telldata::ttstring(name)); OPstack.push(CurrentLayer()); OPstack.push(DEBUG_NEW telldata::ttpnt(bnd->p())); OPstack.push(DEBUG_NEW telldata::ttreal(bnd->rot())); OPstack.push(DEBUG_NEW telldata::ttbool(bnd->flx())); OPstack.push(DEBUG_NEW telldata::ttreal(bnd->sc())); delete bnd; return stdADDTEXT::execute(); }
void tellstdfunc::stdROTATESEL::undo() { TEUNDO_DEBUG("rotate(point real) UNDO"); telldata::ttlist* added = static_cast<telldata::ttlist*>(UNDOPstack.front());UNDOPstack.pop_front(); telldata::ttlist* deleted = static_cast<telldata::ttlist*>(UNDOPstack.front());UNDOPstack.pop_front(); telldata::ttlist* failed = static_cast<telldata::ttlist*>(UNDOPstack.front());UNDOPstack.pop_front(); real angle = 360 - getOpValue(UNDOPstack, true); telldata::ttpnt *p1 = static_cast<telldata::ttpnt*>(UNDOPstack.front());UNDOPstack.pop_front(); real DBscale = DATC->DBscale(); laydata::tdtdesign* ATDB = DATC->lockDB(); ATDB->unselect_fromList(get_ttlaylist(failed)); ATDB->unselect_fromList(get_ttlaylist(added)); laydata::selectList* fadead[3]; byte i; for (i = 0; i < 3; fadead[i++] = DEBUG_NEW laydata::selectList()); ATDB->rotate_selected(TP(p1->x(), p1->y(), DBscale), angle, fadead); //@TODO Here - an internal check can be done - all 3 of the fadead lists // MUST be empty, otherwise - god knows what's wrong! for (i = 0; i < 3; delete fadead[i++]); ATDB->select_fromList(get_ttlaylist(failed)); // put back the replaced (deleted) shapes ATDB->addlist(get_shlaylist(deleted)); // and select them ATDB->select_fromList(get_ttlaylist(deleted)); // delete the added shapes for (word j = 0 ; j < added->mlist().size(); j++) { ATDB->destroy_this(static_cast<telldata::ttlayout*>(added->mlist()[j])->data(), static_cast<telldata::ttlayout*>(added->mlist()[j])->layer(), DATC->TEDLIB()); } DATC->unlockDB(); delete failed; delete deleted; delete added; delete p1; RefreshGL(); }
int tellstdfunc::lgcSTRETCH::execute() { if (DATC->numselected() == 0) { tell_log(console::MT_ERROR,"No object selected. Nothing to modify"); } else { real bfactor = getOpValue(); if (0.0 == bfactor) { tell_log(console::MT_WARNING,"Resize argument is 0. Nothing was changed"); } else { //expand/shrink returns 2 Attic lists -> Delete/AddSelect, // create and initialize them here laydata::atticList* dasao[2]; for (byte i = 0; i < 2; dasao[i++] = DEBUG_NEW laydata::atticList()); laydata::tdtdesign* ATDB = DATC->lockDB(); real DBscale = DATC->DBscale(); if (ATDB->stretch((int) rint(bfactor * DBscale), dasao)) { // push the command for undo UNDOcmdQ.push_front(this); // put the list of selected shapes in undo stack UNDOPstack.push_front(make_ttlaylist(ATDB->shapesel())); // unselect everything ATDB->unselect_all(); telldata::ttlist* shdeleted = make_ttlaylist(dasao[0]); // select the shapes to delete & delete them ... ATDB->select_fromList(get_ttlaylist(shdeleted)); laydata::atticList* sh_delist = DEBUG_NEW laydata::atticList(); ATDB->delete_selected(sh_delist, DATC->TEDLIB()); // ... not forgetting to save them in the undo data stack for undo UNDOPstack.push_front(make_ttlaylist(sh_delist)); // clean-up the delete attic list clean_atticlist(sh_delist); delete sh_delist; delete shdeleted; // add the result of the expand/shrink... telldata::ttlist* shaddselect = make_ttlaylist(dasao[1]); ATDB->addlist(dasao[1]); UNDOPstack.push_front(shaddselect); // and finally select the_cut ATDB->select_fromList(get_ttlaylist(shaddselect)); LogFile << "resize("<< bfactor << ");"; LogFile.flush(); clean_atticlist(dasao[0]); delete (dasao[0]); // delete dasao[1]; delete dasao[2]; - deleted by ATDB->addlist } else { for (byte i = 0; i < 2; delete dasao[i++]); } DATC->unlockDB(); UpdateLV(); } } return EXEC_NEXT; }
int tellstdfunc::stdABS::execute() { real value = getOpValue(OPstack); OPstack.push(DEBUG_NEW telldata::ttreal(fabs(value))); return EXEC_NEXT; }
void tellstdfunc::stdSTEP::undo_cleanup() { getOpValue(UNDOPstack, false); }
void tellstdfunc::stdSTEP::undo() { TEUNDO_DEBUG("step() UNDO"); DATC->setstep(getOpValue(UNDOPstack,true)); }