int main(int argc, char **argv) { int nskip; /* number to skip */ int nkeep; /* number to keep */ if ( argc < 1 || isatty(fileno(stdin)) || isatty(fileno(stdout)) ) { bu_exit(1, "Usage: dsel num\n dsel skip keep ...\n"); } if ( argc == 2 ) { keep( atoi(argv[1]) ); exit( 0 ); } while ( argc > 1 ) { nskip = atoi(argv[1]); argc--; argv++; if ( nskip > 0 ) skip( nskip ); if ( argc > 1 ) { nkeep = atoi(argv[1]); argc--; argv++; } else { nkeep = INTEGER_MAX; } if ( nkeep <= 0 ) exit( 0 ); keep( nkeep ); } return 0; }
signed escaped (signed c) { if (c == '\\') { c = keep (c); } c = keep (c); return (c); }
signed literal (signed c) { signed e = c; c = keep (e); while ((c != e) && (c != EOF)) { c = escaped (c); } c = keep (e); return (c); }
static void keep(IMODE *l) { if (l && l->mode == i_direct && l->offset->type == en_tempref) { QUAD *i = tempInfo[l->offset->v.sp->value.i]->instructionDefines; if (i->invarInserted) { i->invarKeep = TRUE; keep(i->dc.left); keep(i->dc.right); } } }
void menu::init() { using lifetime = support::action::lifetime; namespace a = support::action::menu; namespace mse = support::action::mouse; auto assetM = engine->get<asset>().lock(); auto act = engine->get<action>().lock(); auto tw = engine->get<tweener<float>>().lock(); assetM->request<polar::asset::audio>("menu1"); font = assetM->get<polar::asset::font>("nasalization-rg"); keep(act->bind<a::down >(lifetime::on, [this] { navigate( 1); })); keep(act->bind<a::up >(lifetime::on, [this] { navigate(-1); })); keep(act->bind<a::right >(lifetime::on, [this] { navigate(0, 1); })); keep(act->bind<a::left >(lifetime::on, [this] { navigate(0, -1); })); keep(act->bind<a::forward>(lifetime::on, [this] { activate(); })); keep(act->bind<a::back >(lifetime::on, [this] { navigate(0, -1, true); })); keep(act->bind<mse::position_y>([this](Decimal y) { if(int(y) != 0) { on_cursor(int(y)); } })); keep(tw->tween(0.0f, 1.0f, 0.25, true, [this](auto, const float &x) { selectionAlpha = x; })); render_all(); }
void MickeyApplyDialog::on_KeepButton_pressed() { timer.stop(); //std::cout<<"Keeping..."<<std::endl; emit keep(); hide(); }
Mickey::Mickey() : updateTimer(this), btnThread(this), state(STANDBY), calDlg(), aplDlg(), recenterFlag(true), dw(NULL) { trans = new MickeyTransform(); //QObject::connect(onOffSwitch, SIGNAL(activated()), this, SLOT(onOffSwitch_activated())); //QObject::connect(&lbtnSwitch, SIGNAL(activated()), &btnThread, SLOT(on_key_pressed())); QObject::connect(this, SIGNAL(mouseHotKey_activated(int, bool)), &btnThread, SLOT(on_mouseHotKey_activated(int, bool))); QObject::connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateTimer_activated())); QObject::connect(&aplDlg, SIGNAL(keep()), this, SLOT(keepSettings())); QObject::connect(&aplDlg, SIGNAL(revert()), this, SLOT(revertSettings())); QObject::connect(&calDlg, SIGNAL(recenterNow(bool)), this, SLOT(recenterNow(bool))); QObject::connect(&calDlg, SIGNAL(startCalibration()), this, SLOT(startCalibration())); QObject::connect(&calDlg, SIGNAL(finishCalibration()), this, SLOT(finishCalibration())); QObject::connect(&calDlg, SIGNAL(cancelCalibration(bool)), this, SLOT(cancelCalibration(bool))); if(!mouse.init()){ exit(1); } dw = QApplication::desktop(); // screenBBox = dw->screenGeometry(); screenBBox = QRect(0, 0, dw->width(), dw->height()); screenCenter = screenBBox.center(); updateTimer.setSingleShot(false); updateTimer.setInterval(8); btnThread.start(); linuxtrack_init((char *)"Mickey"); changeState(TRACKING); }
int minSwap(vector<int>& A, vector<int>& B) { const int n = A.size(); vector<int> keep(n, INT_MAX); vector<int> swap(n, INT_MAX); keep[0] = 0; swap[0] = 1; for (int i = 1; i < n; ++i) { if (A[i] > A[i - 1] && B[i] > B[i - 1]) { // Good case, no swapping needed. keep[i] = keep[i - 1]; // Swapped A[i - 1] / B[i - 1], swap A[i], B[i] as well swap[i] = swap[i - 1] + 1; } if (B[i] > A[i - 1] && A[i] > B[i - 1]) { // A[i - 1] / B[i - 1] weren't swapped. swap[i] = min(swap[i], keep[i - 1] + 1); // Swapped A[i - 1] / B[i - 1], no swap needed for A[i] / B[i] keep[i] = min(keep[i], swap[i - 1]); } } return min(keep.back(), swap.back()); }
static signed preamble (signed c) { extern unsigned level; if (! level) { while (c != EOF) { if (isspace (c)) { c = getc (stdin); continue; } if (c == '/') { c = comment (c); continue; } if (c == ';') { c = keep (c); continue; } printf ("\n\n/*===*\n *\n *\n *\n *.\n *:\n *;\n *---*/\n\n"); break; } } return (c); }
void compute() { StateId* maxEnds = 0; if (maxEnd) { maxEnd->clear(); maxEnd->resize(nStates); maxEnds = &maxEnd->front(); } for (StateId from = 0; from < nStates; ++from) { // ultimate source Weight* distancesFrom = distances.row(from); distancesFrom[from] = oneWeight; StateId maxEndFrom = 0; for (StateId via = from; via < nStates; ++via) { Weight& viaWt = distancesFrom[via]; if (viaWt == zeroWeight) continue; // TODO: slight speedup: maintain reachability set (log n or bit vector, instead of n) if (!keep()(viaWt)) { if (kZeroDropped) viaWt = zeroWeight; continue; // we already don't care for from->via. definitely don't continue it. } maxEndFrom = via; // for outarcs of via: ArcId nArcs = hg.numOutArcs(via); for (ArcId a = 0; a < nArcs; ++a) { Arc const& arc = *hg.outArc(via, a); ArcId to = arc.head(); checkTopoSort(from, to); assert(to < distances.getNumCols()); improve(distancesFrom[to], viaWt, ArcWtFn::operator()(&arc)); // don't reject head yet (semiring may accumulate sums). } } if (maxEnds) maxEnds[from] = maxEndFrom; } }
signed fortran (signed c) { c = keep (c); while (nobreak (c)) { if (c == '/') { c = comment (c); continue; } c = escaped (c); } c = keep (c); return (c); }
void gotop(int c) { char optmp[OPLENGTH]; char *op_ptr; struct op *s_op; char *a, *b; op_ptr = optmp; *op_ptr++ = c; while (isop((uchar)( *op_ptr = getch())))op_ptr++; if(!strict)unget(*op_ptr); else if (*op_ptr != ' ')unget( *op_ptr); *op_ptr = '\0'; s_op = op; b = optmp; while ((a = s_op->name) != 0){ op_ptr = b; while ((*op_ptr == *a) && (*op_ptr != '\0')){ a++; op_ptr++; } if (*a == '\0'){ keep(s_op); opflag = s_op->setop; if (*op_ptr != '\0'){ b = op_ptr; s_op = op; continue; } else break; } else s_op++; } }
void main(void) { unsigned int segment, offst; disable(); /* Deshabilita las interrupciones */ vieja1c=getvect(0x1c); setvect(0x1c,otra1c); enable(); /* Habilita las interrupciones hardware */ asm{ mov ah,34h /* Detectamos la inactividad del DOS */ int 21h /* Retornar 0 si el DOS se encuentra */ mov segment,es /* inactivo y 1 si est activo */ mov offst,bx } tiempo=(char far *) MK_FP(0x0040,0x006c); keep(0,1000); /* Finaliza y permanece residente ( 1000 es el tama¤o */ /* del archivo .EXE creado.Siempre es mejor poner un poco */ /* m s... ) El tama¤o no se expresa en bytes.Divide el */ /* tama¤o entre 16 y eso es lo que tendr s que poner en la */ /* funci¢n keep(). */ }
void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); Collection* coll = db->getCollection(&_txn, ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); wuow.commit(); } WorkingSet ws; std::set<WorkingSetID> expectedResultIds; std::set<WorkingSetID> resultIds; // Create a KeepMutationsStage with an EOF child, and flag 50 objects. We expect these // objects to be returned by the KeepMutationsStage. MatchExpression* nullFilter = NULL; std::auto_ptr<KeepMutationsStage> keep(new KeepMutationsStage(nullFilter, &ws, new EOFStage())); for (size_t i = 0; i < 50; ++i) { WorkingSetID id = ws.allocate(); WorkingSetMember* member = ws.get(id); member->state = WorkingSetMember::OWNED_OBJ; member->obj = BSON("x" << 1); ws.flagForReview(id); expectedResultIds.insert(id); } // Call work() on the KeepMutationsStage. The stage should start streaming the // already-flagged objects. WorkingSetID id = getNextResult(keep.get()); resultIds.insert(id); // Flag more objects, then call work() again on the KeepMutationsStage, and expect none // of the newly-flagged objects to be returned (the KeepMutationsStage does not // incorporate objects flagged since the streaming phase started). // // This condition triggers SERVER-15580 (the new flagging causes a rehash of the // unordered_set "WorkingSet::_flagged", which invalidates all iterators, which were // previously being dereferenced in KeepMutationsStage::work()). // Note that std::unordered_set<>::insert() triggers a rehash if the new number of // elements is greater than or equal to max_load_factor()*bucket_count(). size_t rehashSize = static_cast<size_t>(ws.getFlagged().max_load_factor() * ws.getFlagged().bucket_count()); while (ws.getFlagged().size() <= rehashSize) { WorkingSetID id = ws.allocate(); WorkingSetMember* member = ws.get(id); member->state = WorkingSetMember::OWNED_OBJ; member->obj = BSON("x" << 1); ws.flagForReview(id); } while ((id = getNextResult(keep.get())) != WorkingSet::INVALID_ID) { resultIds.insert(id); } // Assert that only the first 50 objects were returned. ASSERT(expectedResultIds == resultIds); }
void ModelResource::setModel(QAbstractItemModel* model) { Q_D(ModelResource); if(d->model == model) return; if(d->model) { keep()->resetAll(); } d->model = model; }
Resource::Handle ModelItemResource::child(const QString &name) { Orchid::Resource::Handle handle = keep()->acquireHandle(name); if(handle.isEmpty()) { handle.init(new ModelItemResource(root, root->index(name, index))); } return handle; }
T_void main(T_void) { puts("Installing color mapper.") ; IOldTickerInterrupt = _dos_getvect(TICKER_INTERRUPT_NUMBER); _dos_setvect(TICKER_INTERRUPT_NUMBER, ITickerInterruptSimple); puts("Installed.") ; keep(0, (_SS + (_SP/16) - _psp)); }
void main(void) { oldhandler = getvect (0x1c); displayclock(); setvect (0x1c, clockproc); keep (0, (_SS + (_SP/16) - _psp)); }
void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); Collection* coll = db->getCollection(&_txn, ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); wuow.commit(); } WorkingSet ws; // Add 10 objects to the collection. for (size_t i = 0; i < 10; ++i) { insert(BSON("x" << 1)); } // Create 10 objects that are flagged. for (size_t i = 0; i < 10; ++i) { WorkingSetID id = ws.allocate(); WorkingSetMember* member = ws.get(id); member->state = WorkingSetMember::OWNED_OBJ; member->obj = BSON("x" << 2); ws.flagForReview(id); } // Create a collscan to provide the 10 objects in the collection. CollectionScanParams params; params.collection = coll; params.direction = CollectionScanParams::FORWARD; params.tailable = false; params.start = RecordId(); CollectionScan* cs = new CollectionScan(&_txn, params, &ws, NULL); // Create a KeepMutations stage to merge in the 10 flagged objects. // Takes ownership of 'cs' MatchExpression* nullFilter = NULL; std::auto_ptr<KeepMutationsStage> keep(new KeepMutationsStage(nullFilter, &ws, cs)); for (size_t i = 0; i < 10; ++i) { WorkingSetID id = getNextResult(keep.get()); WorkingSetMember* member = ws.get(id); ASSERT_FALSE(ws.isFlagged(id)); ASSERT_EQUALS(member->obj["x"].numberInt(), 1); } ASSERT(cs->isEOF()); // Flagged results *must* be at the end. for (size_t i = 0; i < 10; ++i) { WorkingSetID id = getNextResult(keep.get()); WorkingSetMember* member = ws.get(id); ASSERT(ws.isFlagged(id)); ASSERT_EQUALS(member->obj["x"].numberInt(), 2); } }
int main(void) { oldhandler = getvect(28); setvect(28, handler); keep(0, (_SS + (_SP/16) - _psp)); return 0; }
signed nmtoken (signed c, signed e) { do { c = keep (c); } while (isalnum (c) || (c == '_') || (c == '-') || (c == '.') || (c == ':')); return (c); }
Resource::Handle ModelResource::child(const QString& name) { Q_D(ModelResource); Orchid::Resource::Handle handle = keep()->acquireHandle(name); if(handle.isEmpty()) { handle.init(new ModelItemResource(this, index(name, QModelIndex()))); } return handle; }
/*-------------------------------------------------------------------------- MAIN - Funcao principal --------------------------------------------------------------------------*/ main() { if ((peek (0,0x410) & 0x30) == 0x30) { /* Video = HERCULES ? */ porta_video = 0x3b8; /* sim, entao inicia */ liga_video = her_video_on; /* variaveis */ desl_video = her_video_off; } velha_int_09h = getvect (0x09); /* Desvia INT 0x9 */ setvect (0x09,int_09h); keep (0,_SS + (_SP / 16) - _psp + 10); /* Fica residente */ }
/** * Returns the child \a name. You shouldn't need to reimplement this * method. Reimplement childResource() instead. * * \sa childResource() */ Handle Object::child(const QString &name) { Handle handle = keep()->acquireHandle(name); // Create the resource if it doesn't exist yet if(handle.isEmpty()) childResource(handle); // Make sure not to return uninitialized handles if(handle.isEmpty()) handle = Handle(); return handle; }
int main(int argc, char *argv[]) { static char usage[]="Usage: dsel keep ...\n or\n dsel skip keep ...\n\n(must use <inputfile >outputfile)\n"; int nskip; /* number to skip */ int nkeep; /* number to keep */ if (isatty(fileno(stdin)) || isatty(fileno(stdout))) bu_exit(1, "%s", usage); if (BU_STR_EQUAL(argv[1], "-h") || BU_STR_EQUAL(argv[1], "-?")) bu_exit(1, "%s", usage); if (argc == 2) { keep(atoi(argv[1])); exit(0); } while (argc > 1) { nskip = atoi(argv[1]); argc--; argv++; if (nskip > 0) skip(nskip); if (argc > 1) { nkeep = atoi(argv[1]); argc--; argv++; } else { #define INTEGER_MAX (((int) ~0) >> 1) nkeep = INTEGER_MAX; } if (nkeep <= 0) exit(0); keep(nkeep); } return 0; }
int strip_quotes(char *s, int len){ int i,j; int inquote=0; int escape=0; int ret=len; for(i=0;i<len;i++){ if(keep(s+i,&inquote,&escape)==0){ for(j=i;j<len;j++) s[j]=s[j+1]; ret--; } } return ret; }
static void MoveTo(BLOCK *dest, BLOCK *src, QUAD *head) { QUAD *insert = beforeJmp(dest->tail, TRUE); QUAD *head2 = Alloc(sizeof(QUAD)); *head2 = *head; EnterRef(head, head2); head = head2; if (insert == dest->tail) dest->tail = head; head->back = insert; head->fwd = insert->fwd; insert->fwd = insert->fwd->back = head; tempInfo[head->ans->offset->v.sp->value.i]->blockDefines = dest; tempInfo[head->ans->offset->v.sp->value.i]->instructionDefines = head; head->block = dest; head->invarInserted = TRUE; if (head->dc.opcode != i_assn || head->dc.left->mode == i_immed) { keep(head->dc.left); keep(head->dc.right); head->invarKeep = TRUE; } }
const CEnumeratedTypeValues::TValueToName& CEnumeratedTypeValues::ValueToName(void) const { TValueToName* m = m_ValueToName.get(); if ( !m ) { CFastMutexGuard GUARD(s_EnumValuesMutex); m = m_ValueToName.get(); if ( !m ) { auto_ptr<TValueToName> keep(m = new TValueToName); ITERATE ( TValues, i, m_Values ) { (*m)[i->second] = &i->first; } m_ValueToName = keep; }
static signed statement (signed c) { while (isspace (c)) { c = keep (c); } if (c == '{') { c = keep (c); c = program (c, '}'); c = keep (c); } else if (c != ';') { putc ('{', stdout); putc (' ', stdout); c = program (c, ';'); c = keep (c); putc (' ', stdout); putc ('}', stdout); } return (c); }
//--------------------------------------------------------------------------- void main(int argc,char *argv[ ]) { disable(); clock_tick = getvect(28); setvect(28,minha_rotina_de_relogio); enable(); #ifdef RESIDENTE keep(0,(_SS + (_SP/16) - _psp)); #else system("\command"); disable(); setvect(28,clock_tick); enable(); #endif }