void TestStandardWorkflow() { // Set NavigationDatas for player player->SetNavigationDataSet(NavigationDataSet); MITK_TEST_CONDITION(player->GetNumberOfSnapshots() == 3,"Testing if player reports correct number of Snapshots"); MITK_TEST_CONDITION(player->GetNumberOfIndexedOutputs() == 2,"Testing number of outputs"); //rest repeat player->SetRepeat(true); MITK_TEST_CONDITION(runLoop(),"Testing first run."); MITK_TEST_CONDITION(runLoop(),"Testing second run."); //repeat is on should work a second time // now test the go to snapshot function player->GoToSnapshot(2); mitk::NavigationData::Pointer nd1 = player->GetOutput(1); mitk::NavigationData::Pointer ref1 = NavigationDataSet->GetNavigationDataForIndex(2,1); MITK_TEST_CONDITION(ref1->GetPosition().GetVnlVector() == nd1->GetPosition().GetVnlVector(), "Testing GoToSnapshot() [1]"); //MITK_TEST_OUTPUT( << "Reference:" << ref1->GetPosition().GetVnlVector() << "\tObserved: " << nd1->GetPosition().GetVnlVector()); player->GoToSnapshot(0); mitk::NavigationData::Pointer nd0 = player->GetOutput(); mitk::NavigationData::Pointer ref0 = NavigationDataSet->GetNavigationDataForIndex(0,0); MITK_TEST_CONDITION(ref0->GetOrientation().as_vector() == nd0->GetOrientation().as_vector(), "Testing GoToSnapshot() [2]"); //MITK_TEST_OUTPUT( << "Reference" << ref0->GetPosition().GetVnlVector() << "\tObserved:" <<nd0->GetOrientation().as_vector() ); }
void TestStandardWorkflow() { // create test values valid for the xml data above tTool0Snapshot1[0] = -336.65; tTool0Snapshot1[1] = 138.5; tTool0Snapshot1[2]= -2061.07; tTool1Snapshot2[0] = -56.93; tTool1Snapshot2[1] = 233.79; tTool1Snapshot2[2]= -2042.6; vnl_vector_fixed<mitk::ScalarType,4> qVec; qVec[0] = 0.0085; qVec[1] = -0.0576; qVec[2]= -0.0022; qVec[3]= 0.9982; qTool0Snapshot0 = mitk::Quaternion(qVec); qVec[0] = 0.4683; qVec[1] = 0.0188; qVec[2]= -0.8805; qVec[3]= 0.0696; qTool1Snapshot1 = mitk::Quaternion(qVec); //test SetXMLString() player->SetXMLString(XML_STRING); MITK_TEST_CONDITION_REQUIRED(player->GetNumberOfSnapshots() == 3,"Testing method SetXMLString with 3 navigation datas."); MITK_TEST_CONDITION_REQUIRED(player->GetNumberOfIndexedOutputs() == 2,"Testing number of outputs"); //rest repeat player->SetRepeat(true); MITK_TEST_CONDITION_REQUIRED(runLoop(),"Testing first run."); MITK_TEST_CONDITION_REQUIRED(runLoop(),"Testing second run."); //repeat is on should work a second time // now test the go to snapshot function player->GoToSnapshot(3); mitk::NavigationData::Pointer nd1 = player->GetOutput(1); MITK_TEST_CONDITION(tTool1Snapshot2 == nd1->GetPosition().GetVnlVector(), "Testing GoToSnapshot() [1]"); player->GoToSnapshot(1); mitk::NavigationData::Pointer nd0 = player->GetOutput(); MITK_TEST_CONDITION(qTool0Snapshot0.as_vector() == nd0->GetOrientation().as_vector(), "Testing GoToSnapshot() [2]"); player->GoToSnapshot(3); // and a third time MITK_TEST_CONDITION_REQUIRED(runLoop(),"Tested if repeat works again."); }
int main ( void ) { runLoop (); return 0; }
void WindowContentTransitionRunner::runRotateTransition(CardWebApp* app, PGSurface* toSurface, PGContext* dstContext, int currAngle, int targAngle) { m_transitionType = Transition_Rotate; m_app = app; m_toSceneSurface = toSurface; m_dstContext = dstContext; m_currRotateAngle = currAngle; m_targRotateAngle = targAngle; // ----------------------------------------------------------------------- runLoop(); // ----------------------------------------------------------------------- m_transitionType = Transition_Invalid; m_app = 0; m_toSceneSurface = 0; m_dstContext = 0; m_currRotateAngle = 0; m_targRotateAngle = 0; }
// ============================================================================ // TCP Socket Test // void runTCPSocketTest() { TraceL << "TCP Socket Test: Starting" << endl; ClientSocketTest<net::TCPSocket> test(1337); test.run(); runLoop(); }
void WinDebugInterface::run() { m_waitHandles[DataReadyEventHandle] = m_waitHandles[TerminateEventHandle] = 0; m_bufferReadyEvent = 0; m_sharedFile = 0; m_sharedMem = 0; if (!runLoop()) emit cannotRetrieveDebugOutput(); if (m_sharedMem) { UnmapViewOfFile(m_sharedMem); m_sharedMem = 0; } if (m_sharedFile) { CloseHandle(m_sharedFile); m_sharedFile = 0; } if (m_waitHandles[TerminateEventHandle]) { CloseHandle(m_waitHandles[TerminateEventHandle]); m_waitHandles[TerminateEventHandle] = 0; } if (m_waitHandles[DataReadyEventHandle]) { CloseHandle(m_waitHandles[DataReadyEventHandle]); m_waitHandles[DataReadyEventHandle] = 0; } if (m_bufferReadyEvent) { CloseHandle(m_bufferReadyEvent); m_bufferReadyEvent = 0; } }
void ImageViewer::setVisible(bool visible) { DEBUG_ENTER_FUNC(); if (_visible == visible) return; // from here on, we're making the loader visible if (visible && g_engine) { // we can only run the image viewer when there's an engine g_engine->pauseEngine(true); load(_imageNum ? _imageNum : 1); // load the 1st image or the current } if (visible && _init) { // we managed to load _visible = true; setViewerButtons(true); { // so dialog goes out of scope, destroying all allocations GUI::TimedMessageDialog dialog("Image Viewer", 1000); dialog.runModal(); } runLoop(); // only listen to viewer events } else { // we were asked to make invisible or failed to load _visible = false; unload(); setViewerButtons(false); if (g_engine && g_engine->isPaused()) g_engine->pauseEngine(false); } setDirty(); }
void eErrorOutput::thread() { // fprintf(stderr, "[eErrorOutput] start thread\n"); hasStarted(); nice(4); runLoop(); // fprintf(stderr, "[eErrorOutput] behind runloop\n"); }
void ATEM::delay(const unsigned int delayTimeMillis) { // Responsible delay function which keeps the ATEM run loop up! DO NOT USE INSIDE THIS CLASS! Recursion could happen... unsigned long timeout = millis(); timeout+=delayTimeMillis; while(timeout > millis()) { runLoop(); } }
void GameScreen::run(Window *window) { m_window = window; initSystems(); initShaders(); runLoop(); }
void RunLoop::wakeUp() { RefPtr<RunLoop> runLoop(this); GMainLoopSource::scheduleAndDeleteOnDestroy("[WebKit] RunLoop work", std::function<void()>([runLoop] { runLoop->performWork(); }), G_PRIORITY_DEFAULT, nullptr, m_mainContext.get()); g_main_context_wakeup(m_mainContext.get()); }
void runTimerTest() { TraceL << "Timer Test: Starting" << endl; Timer timer; timer.Timeout += sdelegate(this, &Tests::onOnTimerTimeout); timer.start(10, 10); runLoop(); }
/** * Calls runLoop until the _isReady flag has been set - or until delayTime has passed (if delay time is larger than 0 in which case it never times out) */ bool BMDSmartViewClient::waitForReady(uint16_t delayTime) { unsigned long enterTime = millis(); while (!_isReady && (delayTime==0 || !hasTimedOut(enterTime,delayTime))) { runLoop(); } return _isReady; }
void eBackgroundFileEraser::thread() { hasStarted(); nice(5); setIoPrio(IOPRIO_CLASS_BE, 7); reset(); runLoop(); stop_thread_timer->stop(); }
bool SchedulePair::operator==(const SchedulePair& other) const { if (runLoop() != other.runLoop()) return false; CFStringRef thisMode = mode(); CFStringRef otherMode = other.mode(); if (!thisMode || !otherMode) return thisMode == otherMode; return CFEqual(thisMode, otherMode); }
Common::Error KyraEngine_HoF::go() { if (_gameToLoad == -1) { if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) seq_showStarcraftLogo(); if (_flags.isDemo && !_flags.isTalkie) { #ifdef ENABLE_LOL if (_flags.gameID == GI_LOL) seq_playSequences(kSequenceLolDemoScene1, kSequenceLolDemoScene6); else #endif // ENABLE_LOL seq_playSequences(kSequenceDemoVirgin, kSequenceDemoFisher); _menuChoice = 4; } else { seq_playSequences(kSequenceVirgin, kSequenceZanfaun); } } else { _menuChoice = 1; } _res->unloadAllPakFiles(); if (_menuChoice != 4) { // load just the pak files needed for ingame _staticres->loadStaticResourceFile(); if (_flags.platform == Common::kPlatformPC && _flags.isTalkie) { if (!_res->loadFileList("FILEDATA.FDT")) error("couldn't load 'FILEDATA.FDT'"); } else { _res->loadFileList(_ingamePakList, _ingamePakListSize); } if (_flags.platform == Common::kPlatformPC98) { _res->loadPakFile("AUDIO.PAK"); _sound->loadSoundFile("SOUND.DAT"); } } _menuDirectlyToLoad = (_menuChoice == 3) ? true : false; _menuDirectlyToLoad &= saveFileLoadable(0); if (_menuChoice & 1) { startup(); if (!shouldQuit()) runLoop(); cleanup(); if (_showOutro) seq_playSequences(kSequenceFunters, kSequenceFrash); } return Common::kNoError; }
int Game::run() { if (!init()) { // TODO: write some sort of error message printf("init error in Game::run\n"); return -1; } // we don't leave this loop until we quit the game runLoop(); cleanUp(); return 0; }
Common::Error KyraEngine_HoF::go() { int menuChoice = 0; if (_gameToLoad == -1) { if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) seq_showStarcraftLogo(); if (_flags.isDemo && !_flags.isTalkie) { menuChoice = seq_playDemo(); } else { menuChoice = seq_playIntro(); } } else { menuChoice = 1; } _res->unloadAllPakFiles(); if (menuChoice != 4) { // load just the pak files needed for ingame _staticres->loadStaticResourceFile(); if (_flags.platform == Common::kPlatformDOS && _flags.isTalkie) { if (!_res->loadFileList("FILEDATA.FDT")) error("couldn't load 'FILEDATA.FDT'"); } else { _res->loadFileList(_ingamePakList, _ingamePakListSize); } if (_flags.platform == Common::kPlatformPC98) { _res->loadPakFile("AUDIO.PAK"); _sound->loadSoundFile("SOUND.DAT"); } } _menuDirectlyToLoad = (menuChoice == 3) ? true : false; _menuDirectlyToLoad &= saveFileLoadable(0); if (menuChoice & 1) { startup(); if (!shouldQuit()) runLoop(); cleanup(); if (_showOutro) seq_playOutro(); } return Common::kNoError; }
void runUDPSocketTest() { // Notes: Sending over home wireless network via // ADSL to US server round trip stays around 200ms // when sending 1450kb packets at 50ms intervals. // At 40ms send intervals latency increated to around 400ms. TraceL << "UDP Socket Test: Starting" << endl; //UDPPacketSize = 10000; UDPPacketSize = 1450; UDPNumPacketsWanted = 100; UDPNumPacketsReceived = 0; //serverBindAddr.swap(net::Address("0.0.0.0", 1337)); // udpServerAddr.swap(net::Address("74.207.248.97", 1337)); // //udpServerAddr.swap(net::Address("127.0.0.1", 1337)); // //clientBindAddr.swap(net::Address("0.0.0.0", 1338)); //clientSendAddr.swap(net::Address("58.7.41.244", 1337)); // //clientSendAddr.swap(net::Address("127.0.0.1", 1337)); // //net::UDPSocket serverSock; //serverSock.Recv += sdelegate(this, &Tests::onUDPSocketServerRecv); //serverSock.bind(serverBindAddr); //this->serverSock = &serverSock; net::UDPSocket clientSock; //clientSock.Recv += sdelegate(this, &Tests::onUDPClientSocketRecv); assert(0 && "fixme"); clientSock.bind(net::Address("0.0.0.0", 0)); clientSock.connect(udpServerAddr); this->udpClientSock = &clientSock; //for (unsigned i = 0; i < UDPNumPacketsWanted; i++) // clientSock.send("bounce", 6, serverBindAddr); // Start the send timer Timer timer; timer.Timeout += sdelegate(this, &Tests::onUDPClientSendTimer); timer.start(50, 50); timer.handle().ref(); runLoop(); //this->serverSock = nullptr; this->udpClientSock = nullptr; }
void ClientBMDVideohubTCP::routeInputToOutput(uint8_t input, uint8_t output, bool waitForConfirmedChange) { _resetBuffer(); _addToBuffer_P(PSTR("VIDEO OUTPUT ROUTING:\n")); _addToBuffer(String(output - 1)); _addToBuffer_P(PSTR(" ")); _addToBuffer(String(input - 1)); _addToBuffer_P(PSTR("\n\n")); _sendBuffer(); if (waitForConfirmedChange) { unsigned long timer = millis(); while(_outputRouting[output - 1] != input-1 && millis()-500 < timer) { // 500 ms timeout if route is not set... runLoop(); } } }
void main(void) { s7sInit(); chrgPmpInit(); my_delay(200); // Button init button.oldState = 0x83; button.timeout =0; DDRD &= ~(0x3); DDRB &= ~(0x80); // Logic init *((uint16_t*)&calibr) = eeprom_read_word(&EE_Calibr); SREG|=1<<7; s7s.dat[0]=16; s7s.dat[1]=16; s7s.dat[2]=16; s7s.dat[3]=16; s7s.point=3; for(;;) { switch (loop.state) { case RUN: runLoop(); break; case IDLE: idleLoop(); break; case SET: setLoop(); break; } } }
int main(int argc, char *argv[]) { gst_init(NULL, NULL); loop = g_main_loop_new (NULL, FALSE); createElementsOrExit(); registerBusCall(); gst_bin_add_many (GST_BIN (pipeline), source, sink, NULL); linkSourceAndSink(); runLoop(); cleanUp(); // Under normal conditions this method will never be called return 0; }
void SeccompBroker::initialize() { int sockets[2]; if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) < 0) CRASH(); pid_t pid = fork(); if (pid) { // Sandboxed process. close(sockets[1]); SeccompBrokerClient::shared(sockets[0]); registerSIGSYSHandler(); } else { // Broker. // TODO: The broker should setup seccomp filters // for itself and block everything else other than // the minimal set of syscalls needed to execute the // syscalls it is suppose to proxy. close(sockets[0]); runLoop(sockets[1]); } }
/** * Reads information from the device as it arrives, dispatches packages to parsing */ void SkaarhojSerialClient::runLoop() { runLoop(0); }
/** * Reads information from the SmartView as it arrives, does the parsing, stores in memory */ void BMDSmartViewClient::runLoop() { runLoop(0); }
//==================================== void runMode(int stop) //==================================== { int ch,x,step,tmp,res=0,a=0,b=0,ir,ok=0,n=0; char tempName[80],syscom[120],temp[80]; char command[40][40]; strcpy(tempName,"help.txt"); s_mode = S_RUN; if(stop > 1) { if(stop > g_steps)stop = g_steps; //if(stop > currentStep) runAll(stop); return; } putMsg(3,"Run Mode. Press h for help."); while(1) { anyErrors(); if(g_silent==S_NO )mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode); if(g_silent==S_YES)mvwprintw(uno,board_h-2,1,"R%1d<",confWinMode); unoInfo(); if(g_debug == 1) readFile(confSketchFile,g_lineSketch[currentStep]); ch = getchar(); if (ch=='q') { return; } if (ch=='h') { readMsg(fileInfoRun); } else if (ch=='c') { readMsg(currentConf); } else if (ch=='d') { readMsg(fileServTime); } else if(ch=='y' ) // scenario { readMsg(fileServScen); } else if (ch=='x') { readMsg(fileServScenario); } else if (ch=='G') { runAll(g_steps); } else if (ch=='l') { showLoops(); } else if (ch=='s') { g_debug++; if(g_debug > 1)g_debug = 0; } else if (ch=='w') { confWinMode++; if(confWinMode > WIN_MODES)confWinMode = 0; init(confWinMode); mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode); unoInfo(); } else if (ch=='a') { goStep(1); } else if (ch=='r') { goStep(loopStep[currentLoop+1]); } else if (ch=='o') { goStep(loopStep[currentLoop]); } else if (ch=='p') { goStep(loopStep[currentLoop-1]); } else if (ch=='z') { goStep(g_steps); } else if (ch=='k') { resetSim(); init(confWinMode); unoInfo(); mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode); show(uno); } else if (ch=='f')// Up Arrow { goStep(currentStep+1); } else if (ch=='b')// Down Arrow { goStep(currentStep-1); } else if (ch=='R') // Right Arrow { runLoop(S_FORWARD); } else if (ch=='P') // Left Arrow { runLoop(S_BACKWARD); } else if (ch=='t') { runNextRead(); } else if (ch=='j') { runPrevRead(); } else if (ch=='i') { step = currentStep; sprintf(temp,"(Step:%d) Enter: d/a pin value (q - cancel)",step); putMsg(2,temp); wgetstr(uno,temp); n = tokCommand(command,temp); if(strstr(command[0],"q") == NULL && n == 3) { g_pinNo = atoi(command[1]); x = atoi(command[2]); printf("%s %d %d",command[0],g_pinNo,x); if(strstr(command[0],"a")) { ok = ok + checkRange(S_OK,"anapin",g_pinNo); ok = ok + checkRange(S_OK,"anaval",x); g_pinType = ANA; } if(strstr(command[0],"d")) { ok = ok + checkRange(S_OK,"digpin",g_pinNo); ok = ok + checkRange(S_OK,"digval",x); g_pinType = DIG; } if(ok == S_OK) { g_scenSource = 1; // steps, source, pintype, pinno, pinvalue, pinstep sprintf(syscom,"cd servuino;./servuino %d %d %d %d %d %d %d;",confSteps,g_scenSource,g_pinType,g_pinNo,x,currentStep,S_ADD); tmp=system(syscom); initSim(); readSketchInfo(); readSimulation(); goStep(currentStep); readMsg(fileServScen); } } else putMsg(2,"Cancelled!"); } else if (ch=='v') { step = currentStep ; sprintf(temp," Enter value to be read at step %d (q - cancel)",step); putMsg(2,temp); res = analyzeEvent(simulation[step]); if(res > 0) { wgetstr(uno,temp); if(strstr(temp,"q") == NULL) { x = atoi(temp); ok = S_OK; if(res == ANA)ok = ok + checkRange(S_OK,"anaval",x); if(res == DIG)ok = ok + checkRange(S_OK,"digval",x); if(ok == S_OK) { g_scenSource = 1; // steps, source, pintype, pinno, pinvalue, pinstep sprintf(syscom,"cd servuino;./servuino %d %d %d %d %d %d %d;",confSteps,g_scenSource,g_pinType,g_pinNo,x,currentStep,S_ADD); tmp=system(syscom); initSim(); readSketchInfo(); readSimulation(); goStep(currentStep); readMsg(fileServScen); } } else putMsg(2,"Cancelled!"); } else putMsg(2,"Next step is not a Read event"); } else { sprintf(temp,"Unknown command: %c",ch); putMsg(msg_h-2,temp); } } return; }
Common::Error KyraEngine_MR::go() { bool running = true; preinit(); _screen->hideMouse(); initMainMenu(); _screen->clearPage(0); _screen->clearPage(2); const bool firstTimeGame = !saveFileLoadable(0); if (firstTimeGame) { playVQA("K3INTRO"); _wasPlayingVQA = false; } if (_gameToLoad != -1 || firstTimeGame) { while (!_screen->isMouseVisible()) _screen->showMouse(); uninitMainMenu(); _musicSoundChannel = -1; startup(); runLoop(); running = false; } while (running && !shouldQuit()) { _screen->_curPage = 0; _screen->clearPage(0); _screen->setScreenPalette(_screen->getPalette(0)); playMenuAudioFile(); for (int i = 0; i < 64 && !shouldQuit(); ++i) { uint32 nextRun = _system->getMillis() + 3 * _tickLength; _menuAnim->displayFrame(i, 0, 0, 0, 0, 0, 0); _screen->updateScreen(); delayUntil(nextRun); } for (int i = 64; i > 29 && !shouldQuit(); --i) { uint32 nextRun = _system->getMillis() + 3 * _tickLength; _menuAnim->displayFrame(i, 0, 0, 0, 0, 0, 0); _screen->updateScreen(); delayUntil(nextRun); } _eventList.clear(); switch (_menu->handle(3)) { case 2: _menuDirectlyToLoad = true; // fall through case 0: uninitMainMenu(); fadeOutMusic(60); _screen->fadeToBlack(60); _musicSoundChannel = -1; startup(); runLoop(); running = false; break; case 1: playVQA("K3INTRO"); _wasPlayingVQA = false; _screen->hideMouse(); break; case 3: fadeOutMusic(60); _screen->fadeToBlack(60); uninitMainMenu(); quitGame(); running = false; break; default: break; } } if (_showOutro && !shouldQuit()) playVQA("CREDITS"); return Common::kNoError; }
void WindowContentTransitionRunner::runSceneTransition(PIpcBuffer* ipcBuff, PIpcChannel* ipcChannel, PGSurface* fromSurface, PGSurface* toSurface, PGContext* dstContext, const char* transitionName, bool isPop) { m_transitionType = Transition_ZoomAndCrossFade; m_channel = ipcChannel; m_ipcBuffer = ipcBuff; m_fromSceneSurface = fromSurface; m_toSceneSurface = toSurface; m_dstContext = dstContext; m_transitionIsPop = isPop; if (transitionName) { if (strcmp(transitionName, "cross-fade") == 0) m_transitionType = Transition_CrossFade; else if (strcmp(transitionName, "zoom-fade") == 0) m_transitionType = Transition_ZoomAndCrossFade; } // ----------------------------------------------------------------------- AnimObject& aObj = m_fromSceneAnimObject; AnimObject& bObj = m_toSceneAnimObject; PGSurface* aSurf = m_fromSceneSurface; PGSurface* bSurf = m_toSceneSurface; if (m_transitionIsPop) { aObj = m_toSceneAnimObject; bObj = m_fromSceneAnimObject; aSurf = m_toSceneSurface; bSurf = m_fromSceneSurface; } float scaleFactor; if (m_transitionIsPop) scaleFactor = 0.75f; else scaleFactor = 1.25f; int W, H, w, h; aObj.currX = 0; aObj.currY = 0; aObj.currR = aSurf->width(); aObj.currB = aSurf->height(); aObj.currA = 0xFF; W = aSurf->width(); H = aSurf->height(); w = (int) (W * scaleFactor); h = (int) (H * scaleFactor); aObj.targX = (W - w)/2; aObj.targY = (H - h)/2; aObj.targR = (W + w)/2; aObj.targB = (H + h)/2; aObj.targA = 0x00; if (m_transitionIsPop) scaleFactor = 1.25f; else scaleFactor = 0.75f; bObj.targX = 0; bObj.targY = 0; bObj.targR = bSurf->width(); bObj.targB = bSurf->height(); bObj.targA = 0xFF; W = bSurf->width(); H = bSurf->height(); w = (int) (W * scaleFactor); h = (int) (H * scaleFactor); bObj.currX = (W - w)/2; bObj.currY = (H - h)/2; bObj.currR = (W + w)/2; bObj.currB = (H + h)/2; bObj.currA = 0x80; // ----------------------------------------------------------------------- runLoop(); // ----------------------------------------------------------------------- m_transitionType = Transition_Invalid; m_ipcBuffer = 0; m_channel = 0; m_fromSceneSurface = 0; m_toSceneSurface = 0; m_dstContext = 0; m_transitionIsPop = false; }
// ============================================================================ // SSL Socket Test // void runSSLSocketTest() { ClientSocketTest<net::SSLSocket> test(1338); test.run(); runLoop(); }
void NMEventManager::run() { runLoop(); }