void Exception::clear() throw() { for (size_t i = 0; i < maxDepth_; i++) { clearEntry(subEntries_[i]); } deallocate(subEntries_); subEntries_ = NULL; maxDepth_ = 0; clearEntry(topEntry_); deallocate(what_); what_ = NULL; bufferOffset_ = 0; }
void DialogBox::setEntry(const Common::UString &entry) { GfxMan.lockFrame(); clearEntry(); if (entry.empty()) { GfxMan.unlockFrame(); return; } _entry = TokenMan.parse(entry); // TODO: Check entry length, scrollbars const float maxWidth = _width - 2.0f - 2.0f - _portrait->getWidth() - 5.0f; std::vector<Common::UString> lines; _font.getFont().split(_entry, lines, maxWidth); for (std::vector<Common::UString>::iterator l = lines.begin(); l != lines.end(); ++l) _entryLines.push_back(new Graphics::Aurora::Text(_font, *l)); setPosition(_x, _y, _z); if (isVisible()) showEntry(); GfxMan.unlockFrame(); }
void DialogBox::clear() { clearReplies(); clearEntry(); setPortrait(""); setName(""); }
DialogBox::~DialogBox() { clearReplies(); clearEntry(); delete _name; delete _portrait; }
void reset() { multiLine = false; *language = '\0'; *valueBuffer = '\0'; clearEntry(); }
// return an entry to the free chain inline void returnToFreeChain(ItemLink position) { // clear the entry, then place at the head of the // free chain. clearEntry(position); // only use a single link for the free chain entries[position].next = freeChain; freeChain = position; }
// clear all symbols from the table. void SymbolTable::clear() { mSize = 0; // std::unique_lock<std::mutex> lock(mMutex); mSymbolTextsByID.clear(); mSymbolTextsByID.reserve(kDefaultSymbolTableSize); for(int i=0; i<kHashTableSize; ++i) { clearEntry(mHashTable[i]); } // add null entry - why? addEntry(HashedCharArray()); }
/** * We're merging a list contents into this collection after an * expansion. We need to take care to keep the same index * values for each of the inserted items. We cleare out all * slot positions, then rebuild the chains using the same * positions as the original. Once the merge is complete, then * we rescan the table for free entries and rebuild the table. */ void ListContents::prepareForMerge() { // no first or last items. firstItem = NoMore; lastItem = NoMore; // this is an empty bucket itemCount = 0; // we keep the available items on a chain, so // chain up the items into a free chain freeChain = NoMore; // now clear all of the entries out for (ItemLink i = 0; i < totalSize; i++) { clearEntry(i); } }
void LoopAndJumpControlView::clearAll() { for (int i = 0; i < mJumpButtons.size(); i++) clearEntry(i); }
int handleInterrupt() { /* * Figures out the event corresponding to the mask, * and wakes all events in its bucket. * Does not return anything. */ int *vic1base, *vic2base; uint32_t vic1, vic2; int result = 0; char *buf; int buflen; InterruptType_t type = NUM_INTERRUPTS; Task_t *task = NULL; // TODO: refactor code using these ptrs vic1base = (int*) VIC1_BASE; vic2base = (int*) VIC2_BASE; vic1 = vic1base[VICxIRQStatus]; vic2 = vic2base[VICxIRQStatus]; // Stop complaints about unused variable (void)u1flag; if (EXTRACT_BIT(vic2, TIMER_INTERRUPT)) { type = CLOCK_INTERRUPT; task = interruptTable[CLOCK_INTERRUPT].blockedTask; if (!task) { kerror("FATAL: missed clock tick"); return -1; } *((uint32_t*)TIMER_CLEAR) = 0; result = 1; } else if (EXTRACT_BIT(vic2, UART1_INTERRUPT)) { if (*u1int & RIS_MASK) { type = UART1_RCV_INTERRUPT; task = interruptTable[type].blockedTask; if (task) { result = *u1data & DATA_MASK; } else { // TODO: no waiting task, should send stop control bit sys_log_f("Uart1 rcv interrupt missed\n"); *u1ctlr &= ~(RIEN_MASK); } } else if (*u1int & TIS_MASK) { type = UART1_XMT_INTERRUPT; *u1ctlr &= ~(TIEN_MASK); task = interruptTable[type].blockedTask; if (!task) { sys_log_f("uart1 xmt interrupt missed\n"); } result = 1; } else if (*u1int & MIS_MASK) { type = UART1_MOD_INTERRUPT; task = interruptTable[type].blockedTask; result = 1; if (task) { *u1int = 0; } else { // TODO: no waiting task, mask intr sys_log_f("Uart1 MOD interrupt missed\n"); *u1ctlr &= ~(MSIEN_MASK); } } } else if (EXTRACT_BIT(vic2, UART2_INTERRUPT)) { if (*u2int & (RIS_MASK | RTIS_MASK)) { type = UART2_RCV_INTERRUPT; task = interruptTable[type].blockedTask; if (task) { buf = interruptTable[type].buf; buflen = interruptTable[type].buflen; result = 0; while (!(*(u2flag) & RXFE_MASK) && buflen --> 0) { buf[result++] = *u2data & DATA_MASK; } } else { // TODO: no waiting task -> input is faster than we are reading // should mask interrupt, send stop bit to sender sys_log_f("uart2 rcv interrupt missed\n"); *u2ctlr &= ~(RIEN_MASK); } } else if (*u2int & TIS_MASK) { type = UART2_XMT_INTERRUPT; // disable xmit interrupt *u2ctlr &= ~(TIEN_MASK); task = interruptTable[type].blockedTask; if (!task) { sys_log_f("uart2 xmt interrupt missed\n"); } result = 1; } } if (task) { addTask(task); setResult(task, result); clearEntry(type); } return 0; }
// ---------------------------------------------------------------------------- // parses the next command from m_instrStream // ---------------------------------------------------------------------------- void CRPNCalc::parse() { double number = 0; while (m_buffer.length() != 0) { bool delDecimal = false; //erase the spaces at the beginning of the string while(m_buffer[0] == ' ') m_buffer.erase(m_buffer.begin()); number = atof(m_buffer.c_str()); //if it is a number if((number != 0 && m_buffer[0] != '+') || m_buffer[0] == '0') { if(m_buffer[0] == '-') m_buffer.erase(m_buffer.begin()); while((m_buffer[0] >= '0' && m_buffer[0] <= '9') || m_buffer[0] == '.') { if(m_buffer[0] == '.') if(delDecimal == false) delDecimal = true; else break; m_buffer.erase(m_buffer.begin()); if(m_buffer.length() == 0) break; } m_stack.push_front(number); } else { string token; //if the beginning is a character if(m_buffer.length() >= 2) { //special situation with CE if(toupper(m_buffer[0]) == 'C' && toupper(m_buffer[1]) == 'E') { m_buffer.erase(m_buffer.begin(),m_buffer.begin() + 2); clearAll(); continue; } //special situation with -0 else if(m_buffer[0] == '-' && m_buffer[1] == '0') { m_buffer.erase(m_buffer.begin()); while(m_buffer[0] == '0') { m_buffer.erase(m_buffer.begin()); if(m_buffer.length() == 0) break; } m_stack.push_front(number); neg(); continue; } //special situation with S0-9 else if(toupper(m_buffer[0]) == 'S' && m_buffer[1] >= '0' && m_buffer[1] <= '9') { m_buffer.erase(m_buffer.begin()); // delete the 'S' to get the number char index = m_buffer[0]; setReg(static_cast<int>(index) - ZEROINASCII); m_buffer.erase(m_buffer.begin()); // delete the number continue; } //special situation with G0-9 else if(toupper(m_buffer[0]) == 'G' && m_buffer[1] >= '0' && m_buffer[1] <= '9') { m_buffer.erase(m_buffer.begin()); // delete the 'G' to get the number char index = m_buffer[0]; getReg(static_cast<int>(index) - ZEROINASCII); m_buffer.erase(m_buffer.begin()); // delete the number continue; } } if (m_buffer.length() != 0) { token = m_buffer[0]; if (0 == token.compare("+")) add(); else if (0 == token.compare("-")) subtract(); else if (0 == token.compare("*")) multiply(); else if (0 == token.compare("/")) divide(); else if (0 == token.compare("^")) exp(); else if (0 == token.compare("%")) mod(); else if (0 == token.compare("c") || 0 == token.compare("C")) clearEntry(); else if (0 == token.compare("d") || 0 == token.compare("D")) rotateDown(); else if (0 == token.compare("f") || 0 == token.compare("F")) saveToFile(); else if (0 == token.compare("h") || 0 == token.compare("H")) m_helpOn = !m_helpOn; else if (0 == token.compare("l") || 0 == token.compare("L")) loadProgram(); else if (0 == token.compare("m") || 0 == token.compare("M")) neg(); else if (0 == token.compare("p") || 0 == token.compare("P")) recordProgram(); else if (0 == token.compare("r") || 0 == token.compare("R")) { //the application only do this method and ignore other methods //if they are inputed at the same line runProgram(); return; } else if (0 == token.compare("u") || 0 == token.compare("U")) rotateUp(); else if (0 == token.compare("x") || 0 == token.compare("X")) m_on = false; else m_error = true; m_buffer.erase(m_buffer.begin()); } } } }