void TriggerStatusWA::updateTriggerStatusPerTable() { Int32 triggersPerStatement = getRootTdb()->getTriggersCount(); // robustness: triggers may be dropped and disappear from rfork // and still this method can be called from fixup phase, which // occurs prior to similarity check. if (getCurrentNumEntries() == 0) return; ex_assert(triggersPerStatement <= MAX_TRIGGERS_PER_STATEMENT, "Too many triggers in this statement"); TrgStatus status; unsigned char mask; unsigned char mask2; // first time allocation of the TCB buffer from the executor heap if (rootTcb_->getTriggerStatusVector() == NULL) { char * p = new (rootTcb_->getGlobals()->getDefaultHeap()) char[TRIGGERS_STATUS_VECTOR_SIZE]; rootTcb_->setTriggerStatusVector(p); // initialize to disabled memset(p, 0, TRIGGERS_STATUS_VECTOR_SIZE); } char* tcbBuffer = rootTcb_->getTriggerStatusVector(); // for all triggers in the statement for (Int32 i = 0; i < triggersPerStatement; i++) { status = getStatus(getRootTdb()->getTriggersList()[i]); UInt32 byteOffset = i / 8; UInt32 withinByte = i % 8; mask = 0x80; // 128 (single 1 in MSB of byte) mask2 = 0xFF; switch (status) { // enabled case ENABLED: // set the appropriate bit in the mask mask >>= withinByte; tcbBuffer[byteOffset] |= mask; totalTriggersCount_++; break; // disabled case DISABLED: // unset the appropriate bit in the mask mask >>= withinByte; mask ^= mask2; tcbBuffer[byteOffset] &= mask; // just count the found trigger totalTriggersCount_++; break; // not found in this array of this table case NOT_FOUND: break; default: ex_assert(0, "Illegal status of a trigger"); break; } } #ifdef _DEBUG if (getenv("SHOW_ENABLE")) { cout << "\nTcb Buffer:\n"; bitDisplay(tcbBuffer, (getRootTdb()->getTriggersCount() / 8 + 1)); cout << endl; } #endif //_DEBUG }
void Led2x7bit::display(int value) { bitDisplay((value & 0x0f), charFirst); bitDisplay((value & 0xf0) >> 4, charLast); }