str shutdownFactoryByName(Client cntxt, Module m, str nme){ Plant pl, plim; InstrPtr p; Symbol s; plim = plants + lastPlant; for (pl = plants; pl < plim; pl++) if (pl->factory ) { MalStkPtr stk; p= getInstrPtr(pl->factory,0); if( strcmp(nme, getFunctionId(p)) != 0) continue; s = findSymbolInModule(m, nme ); if (s == NULL){ throw(MAL, "factory.remove", OPERATION_FAILED " SQL entry '%s' not found", putName(nme)); } stk = pl->stk; MSresetVariables(cntxt, pl->factory, stk, 0); shutdownFactory(cntxt, pl->factory); freeStack(stk); deleteSymbol(m,s); return MAL_SUCCEED; } return MAL_SUCCEED; }
str SQLCacheRemove(Client c, str nme) { Symbol s; #ifdef _SQL_CACHE_DEBUG mnstr_printf(GDKout, "#SQLCacheRemove %s\n", nme); #endif s = findSymbolInModule(c->nspace, nme); if (s == NULL) throw(MAL, "cache.remove", "internal error, symbol missing\n"); if (getInstrPtr(s->def, 0)->token == FACTORYsymbol) shutdownFactoryByName(c, c->nspace, nme); else deleteSymbol(c->nspace, s); return MAL_SUCCEED; }
void deleteFreeSymbol(SYMBOL * sPtr, int checkReferences) { SYMBOL * context; context = sPtr->context; root = (SYMBOL *)((CELL *)context->contents)->aux; if(!deleteSymbol(sPtr->name)) return; ((CELL *)context->contents)->aux = (UINT)root; /* root may have changed */ /* printf("deleting: %s\n", sPtr->name); */ deleteList((CELL *)sPtr->contents); if(checkReferences) references(sPtr, TRUE); freeMemory(sPtr->name); freeMemory(sPtr); }
bool LineOfSymbols::replaceVar(const QString &pattern, modbusVar *var, unsigned int pos) { variable curVar; QVector<quint16> curSymbols; for(int i=0;i<vars.count();i++) { unsigned char startPos = vars[i].view.getPosition(); unsigned char endPos = startPos + vars[i].view.getLength()-1; if((pos>=startPos)&&(pos<=endPos)) { curVar = vars[i]; for(int j=startPos;j<=endPos;j++) curSymbols+=symbols.at(j); break; } } for(int i=0;i<vars.count();i++) { unsigned char startPos = vars[i].view.getPosition(); unsigned char endPos = startPos + vars[i].view.getLength()-1; if((pos>=startPos)&&(pos<=endPos)) { vars.remove(i); for(int j=startPos;j<=endPos;j++) { if(j<symbols.count()) deleteSymbol(startPos); } bool res = insertVar(pattern,var,startPos); if(res==false) { for(int j=startPos;j<=endPos;j++) { insertSymbol(curSymbols[j-startPos],j); } vars+=curVar; } return res; } } return false; }
dpLoader::~dpLoader() { while(!m_binaries.empty()) { unloadImpl(m_binaries.front()); } m_hostsymbols.eachSymbols([&](dpSymbol *sym){ deleteSymbol(sym); }); m_hostsymbols.clear(); }
QWidget* FiPage::makeMainTab() { // Start on the right with the symbol area mProvider = new QComboBox; mProvider->setSizeAdjustPolicy(QComboBox::AdjustToContents); mSymbol = new QLineEdit; mMarket = new QComboBox; mMarket->setSizeAdjustPolicy(QComboBox::AdjustToContents); QToolButton* saveBtn = new QToolButton; saveBtn->setToolTip(tr("Save Symbol Changes")); saveBtn->setAutoRaise(true); saveBtn->setIcon(QIcon::fromTheme("document-save")); // saveBtn->setShortcut(QKeySequence(QKeySequence::Save)); connect(saveBtn, SIGNAL(clicked()), this, SLOT(saveSymbol())); QToolButton* newBtn = new QToolButton; newBtn->setToolTip(tr("Add New Symbol")); newBtn->setAutoRaise(true); newBtn->setIcon(QIcon::fromTheme("list-add")); // newBtn->setShortcut(QKeySequence(QKeySequence::Save)); connect(newBtn, SIGNAL(clicked()), this, SLOT(newSymbol())); QToolButton* delBtn = new QToolButton; delBtn->setToolTip(tr("Delete Symbol")); delBtn->setAutoRaise(true); delBtn->setIcon(QIcon::fromTheme("edit-delete")); // delBtn->setShortcut(QKeySequence("Ctrl+Del")); connect(delBtn, SIGNAL(clicked()), this, SLOT(deleteSymbol())); QHBoxLayout* hbox = new QHBoxLayout; // Symbol Edit Line hbox->setMargin(0); hbox->addWidget(saveBtn); hbox->addWidget(newBtn); hbox->addWidget(mSymbol); hbox->addWidget(mMarket); hbox->addWidget(mProvider); hbox->addWidget(delBtn); hbox->addStretch(1); mSymbolView = new SymbolTableView(mSymbols); connect(mSymbolView, SIGNAL(newSelection(const QModelIndex &)), this, SLOT(symbolClicked(const QModelIndex &))); QVBoxLayout* vbox = new QVBoxLayout; // That's all with the symbols.. vbox->setMargin(0); vbox->addLayout(hbox); vbox->addWidget(mSymbolView); hbox = new QHBoxLayout; // ..but add a stretch to the right hbox->setMargin(0); hbox->addLayout(vbox); hbox->addStretch(1); QWidget* widget = new QWidget; // Place all on a widget needed by the splitter widget->setLayout(hbox); mLookUp = new SearchFiWidget(this); // No more to do on the left connect(mLookUp, SIGNAL(selected(int, int)), this, SLOT(fiClicked(int, int))); QSplitter* splitter = new QSplitter(Qt::Horizontal); splitter->addWidget(mLookUp); splitter->addWidget(widget); // Build the FI edit line saveBtn = new QToolButton; saveBtn->setToolTip(tr("Save FI Changes")); saveBtn->setAutoRaise(true); saveBtn->setIcon(QIcon::fromTheme("document-save")); // saveBtn->setShortcut(QKeySequence(QKeySequence::Save)); connect(saveBtn, SIGNAL(clicked()), this, SLOT(saveFi())); delBtn = new QToolButton; delBtn->setToolTip(tr("Delete FI")); delBtn->setAutoRaise(true); delBtn->setIcon(QIcon::fromTheme("edit-delete")); // delBtn->setShortcut(QKeySequence("Ctrl+Del")); connect(delBtn, SIGNAL(clicked()), this, SLOT(deleteFi())); QToolButton* mLockBtn = new QToolButton; mLockBtn->setToolTip(tr("Lock FI, don't download bars")); mLockBtn->setAutoRaise(true); mLockBtn->setIcon(QIcon::fromTheme("object-unlocked")); // mLockBtn->setShortcut(QKeySequence(QKeySequence::Save)); connect(mLockBtn, SIGNAL(clicked()), this, SLOT(lockFi())); QFontMetrics f(font()); int w = f.width("X"); mFiName = new QLineEdit; mFiName->setToolTip(tr("FI Name")); mFiName->setMinimumWidth(w * 40); mFiType = new QComboBox; mFiType->setSizeAdjustPolicy(QComboBox::AdjustToContents); // mFiType->addItems(mFilu->getFiTypeNames()); // mFiType->setCurrentIndex(-1); mFiType->setToolTip(tr("FI Type")); mExpiryDate = new QLineEdit; mExpiryDate->setToolTip(tr("FI Expiry Date")); mExpiryDate->setMinimumWidth(w * 15); hbox = new QHBoxLayout; hbox->addWidget(saveBtn); hbox->addWidget(mFiName); hbox->addWidget(mFiType); hbox->addWidget(mLockBtn); hbox->addWidget(mExpiryDate); hbox->addWidget(delBtn); hbox->addStretch(1); widget = new QWidget; widget->setLayout(hbox); vbox = new QVBoxLayout; vbox->addWidget(splitter); // SearchFiWidget + SymbolTableView vbox->addWidget(widget); // FI edit line vbox->setStretch(0, 1); widget = new QWidget; // Complete Main Tab Widget widget->setLayout(vbox); setFocusWidget(mLookUp); return widget; }
void MainWindow::createActions() { openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open an existing file")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this); saveAct->setShortcuts(QKeySequence::Save); saveAct->setStatusTip(tr("Save the document to disk")); saveAct->setEnabled(false); connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); closeAct = new QAction(QIcon(":/images/close.png"), tr("Cl&ose"), this); closeAct->setShortcut(QKeySequence::Close); closeAct->setStatusTip(tr("Close the active tab")); connect(closeAct, SIGNAL(triggered()), this, SLOT(closeActiveTab())); closeAllAct = new QAction(tr("Close &All"), this); closeAllAct->setShortcut(tr("Ctrl+Shift+W")); closeAllAct->setStatusTip(tr("Close all the tabs")); connect(closeAllAct, SIGNAL(triggered()), this, SLOT(closeAllTabs())); separatorAct = new QAction(this); separatorAct->setSeparator(true); exitAct = new QAction(QIcon(":/images/exit.png"), tr("E&xit"), this); exitAct->setShortcut(tr("Ctrl+Q")); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); boldAct = new QAction(QIcon(":/images/textbold.png"), tr("&Bold"), this); boldAct->setShortcut(QKeySequence::Bold); boldAct->setCheckable(true); connect(boldAct, SIGNAL(triggered(bool)), this, SLOT(bold(bool))); italicAct = new QAction(QIcon(":/images/textitalic.png"), tr("&Italic"), this); italicAct->setShortcut(QKeySequence::Italic); italicAct->setCheckable(true); connect(italicAct, SIGNAL(triggered(bool)), this, SLOT(italic(bool))); underlineAct = new QAction(QIcon(":/images/textunder.png"), tr("&Underine"), this); underlineAct->setShortcut(QKeySequence::Underline); underlineAct->setCheckable(true); connect(underlineAct, SIGNAL(triggered(bool)), this, SLOT(underline(bool))); zoomInAct = new QAction(QIcon(":/images/zoomin.png"), tr("Zoom &in"), this); zoomInAct->setShortcut(QKeySequence::ZoomIn); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(QIcon(":/images/zoomout.png"), tr("Zoom &out"), this); zoomOutAct->setShortcut(QKeySequence::ZoomOut); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); nextAct = new QAction(QIcon(":/images/next.png"), tr("Ne&xt"), this); nextAct->setShortcuts(QKeySequence::NextChild); nextAct->setStatusTip(tr("Move the focus to the next window")); connect(nextAct, SIGNAL(triggered()), this, SLOT(nextTab())); previousAct = new QAction(QIcon(":/images/previous.png"), tr("Pre&vious"), this); previousAct->setShortcuts(QKeySequence::PreviousChild); previousAct->setStatusTip(tr("Move the focus to the previous window")); connect(previousAct, SIGNAL(triggered()), this, SLOT(previousTab())); splitAct = new QAction(tr("&Split symbol"), this); splitAct->setShortcut(tr("Ctrl+2")); connect(splitAct, SIGNAL(triggered()), this, SLOT(splitSymbol())); joinAct = new QAction(tr("&Join with Next Symbol"), this); joinAct->setShortcut(tr("Ctrl+1")); connect(joinAct, SIGNAL(triggered()), this, SLOT(joinSymbol())); deleteAct = new QAction(tr("&Delete symbol"), this); deleteAct->setShortcut(QKeySequence::Delete); connect(deleteAct, SIGNAL(triggered()), this, SLOT(deleteSymbol())); aboutAct = new QAction(QIcon(":/images/about.png"), tr("&About"), this); aboutAct->setStatusTip(tr("Show the application's About box")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); }