task main()
{
	EventList eList;

	clearDebugStream();
	ClearTimer(T1);
	ClearTimer(T4);

	while(1)
	{
		getEvents(&eList);
		processAll(&eList);
		processDrive(&eList);

		for(int i = 0; i<eventCnt;i++)
		{
			switch(bevents[i].keyID){
				//case *name-of-button* :
				//*actions* ;
				//break;
			};
		}



		//_________________________________________________________________________



	}
}
Esempio n. 2
0
void AbstractOptionStorage::finish()
{
    GMX_RELEASE_ASSERT(!bInSet_, "finishSet() not called");
    processAll();
    if (isRequired() && !(isSet() || hasFlag(efOption_ExplicitDefaultValue)))
    {
        GMX_THROW(InvalidInputError("Option is required, but not set"));
    }
}
Esempio n. 3
0
/**
* Run instead of exec when operating on groups
*/
bool SaveNXTomo::processGroups() {
  try {
    std::string name = getPropertyValue("InputWorkspaces");
    WorkspaceGroup_sptr groupWS =
        AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>(name);

    for (int i = 0; i < groupWS->getNumberOfEntries(); ++i) {
      m_workspaces.push_back(
          boost::dynamic_pointer_cast<Workspace2D>(groupWS->getItem(i)));
    }
  } catch (...) {
  }

  if (m_workspaces.size() != 0)
    processAll();

  return true;
}
Esempio n. 4
0
File: launch.c Progetto: wavs/ocre
/**
 * This function starts the extraction process without
 * the display option.
 *
 * @param infos Informations about the launch process.
 */
void launchProgramWithoutDisplay(t_launch_infos *infos)
{
  SDL_Surface *screen;

  screen = NULL;
  if (infos->inFile != NULL && infos->outFile != NULL)
    {
      if (is_bmp(infos->inFile))
	{
	  InitSDL(screen);
	  processAll(infos);
	  SDL_Quit();
	}
      else
	{
	  help("learn");
	  wfree(infos);
	  exit(EXIT_SUCCESS);
	}
    }
}
Esempio n. 5
0
void ExportDialog::slotStartStop()
{
    if (!d->busy)
    {
        if (d->listView->imageUrls().isEmpty())
        {
            KMessageBox::error(this, i18n("There are no images in the list to process."));
            busy(false);
            slotAborted();
            return;
        }

        MyImageListViewItem* const item = setUpImageItems();

        processAll(item);

        d->progressBar->setMaximum(d->thread->getTotalFrames(item));
        d->progressBar->setValue(0);
        d->progressBar->show();
        d->progressBar->progressScheduled(i18n("Video SlideShow"), true, true);

        busy(true);

        if (!d->thread->isRunning())
            d->thread->start();
    }
    else
    {
        d->thread->cancel();
        busy(false);

        d->listView->cancelProcess();

        QTimer::singleShot(500, this, SLOT(slotAborted()));
    }
}
Esempio n. 6
0
void AudioWalkera::readThread(){


	for(;;){

		inFrame = false;
		highCount = 0;
		lowCount = 0;



		rc = snd_pcm_readi(handle, buffer, frames);

		if( rc == -EPIPE )
			//fprintf(stderr, "buffer overrun\n");
			std::cerr << "Buffer overrun" << std::endl;
		else if( rc < 0 )
			//fprintf(stderr, "read error: %s\n", snd_strerror(rc));
			std::cerr << "Read error: " << snd_strerror(rc) << std::endl;
		else {
			for(int i=0; i < rc; i++){
				//t++;
				
					//std::cout << buffer[i] << std::endl;

				if(buffer[i] > 0){
					highCount++;
				}else{
					highCount = 0;
				}

				if(highCount >= 62 && (buffer[i+1] < 0)){
					//std::cout << "FRAME" << std::endl;
					highCount = 0;
					inFrame = true;
					startIndex = i+1;
					//std::cout << time.elapsed()*1000 << std::endl;
					//time.restart();

					break;
				}

				//usleep(10);
			}

			valuesIndex = 1;
			falling = true;

			while(inFrame){


				if(falling){

					if(buffer[startIndex] < 0){
						lowCount++;
						startIndex++;
					}else{
						values[valuesIndex] = processBin(lowCount);
						lowCount = 0;
						falling = false;
						valuesIndex++;


					}

				}else{
					if(buffer[startIndex] > 0){
						highCount++;
						startIndex++;
					}else{
						values[valuesIndex] = processOct(highCount);
						highCount = 0;
						falling = true;
						valuesIndex++;
					}
				}

				if(valuesIndex == 24) inFrame = false;



			}

			std::lock_guard<std::mutex> guard(mutex);

			processAll(values);

			if(uinputEnabled) uinputEvents();

			newData = true;
/*
			if(debug){
				std::cout << "\r" << throttle << "  " << elevator << "  " << 
					rudder << "  " << ailerons << "  " << flipSwitch << "         " << std::flush;
			}
*/
			if(debug){
				std::cout << throttle << "  " << elevator << "  " << 
					rudder << "  " << ailerons << "  " << flipSwitch << "         " << std::endl;
			}

		}
	}

}
    void QtOpenGLRenderThread::run()
    {
        ViewportSize viewportSize;
        bool suspended = false;

        m_ShuttingDown.store(false);

        // Initialize the renderer
        m_GL->context()->makeCurrent();
        viewportSize.packed = m_ViewportSize.load();
        m_Delegate->initializeGL(viewportSize.unpacked.width, viewportSize.unpacked.height);
        m_GL->context()->doneCurrent();

        // Notify UI thread that we have started
        m_ThreadStartPromise.set_value();

        // Run the main loop
        m_Timer.start();
        while (!m_ShuttingDown.load(std::memory_order_relaxed))
        {
            processAll();

            // Consume less resources when suspended
            bool newSuspended = m_Suspended.load();
            if (suspended && newSuspended) {
                yieldCurrentThread();
                continue;
            }

            m_GL->context()->makeCurrent();

            // Notify delegate about suspension
            if (newSuspended != suspended) {
                if (newSuspended)
                    m_Delegate->suspendGL();
                else {
                    m_Delegate->resumeGL();
                    m_Timer.restart();
                }
                suspended = newSuspended;
            }

            if (!suspended)
            {
                // Notify delegate about viewport size changes
                uint32_t newViewportSize = m_ViewportSize.load();
                if (viewportSize.packed != newViewportSize) {
                    viewportSize.packed = newViewportSize;
                    m_Delegate->resizeGL(viewportSize.unpacked.width, viewportSize.unpacked.height);
                }

                // Run frame
                auto time = m_Timer.restart();
                m_Delegate->renderGL(time * 0.001);
                m_GL->context()->swapBuffers();
            }

            m_GL->context()->doneCurrent();
        }

        // Shutdown the engine
        m_GL->context()->makeCurrent();
        m_Delegate->shutdownGL();
        m_GL->context()->doneCurrent();
    }
int main(int argc, char *argv[])
{
    char word[20]; //primul cuvant de pe fiecare linie din fisierul de intrare
    FILE *f = fopen(argv[1], "r");

    int N;
    fscanf(f, "%d\n", &N);

    struct window *windows = new struct window[N]; //vector de ghisee
    Queue<person> *q = new Queue<person>[N]; //vector de cozii
    Stack<int> *s = new Stack<int>[N]; //vector de stive
    struct array arrayWindows; //retine cate ghisee au fost deschise si ID-urile
    arrayWindows.nrWindows = 0;
    arrayWindows.A = new int[N];

    //citirea si interpretarea fisierului de input
    while(fscanf(f, "%s", word) == 1)
    {
        if(strcmp(word, "OPEN_WINDOW") == 0)
        {
            int window_id, weight_min, weight_max, q_, k;
            fscanf(f, "%d%d%d%d%d", &window_id, &weight_min, &weight_max, &q_, &k);
            open_window(windows, &arrayWindows, q, s, window_id, weight_min,
                        weight_max, q_, k);
        }

        else if(strcmp(word, "ADD_PERSON") == 0)
        {
            int personal_id, package_weight, window_id;
            fscanf(f, "%d%d%d", &personal_id, &package_weight, &window_id);
            add_person(q, personal_id, package_weight, window_id);
        }

        else if(strcmp(word, "PROCESS") == 0)
        {
            int window_id, n_people;
            fscanf(f, "%d%d", &window_id, &n_people);
            process(windows, arrayWindows, q, s, window_id, n_people);
        }

        else if(strcmp(word, "PROCESS_ALL") == 0)
        {
            int window_id;
            fscanf(f, "%d", &window_id);
            processAll(windows, arrayWindows, q, s, window_id);
        }

        else if(strcmp(word, "PRINT_QUEUES") == 0)
            printQueues(q, arrayWindows);

        else if(strcmp(word, "PRINT_STACKS") == 0)
            printStacks(s, arrayWindows);

        else if(strcmp(word, "FLUSH_STACKS") == 0)
            flushStacks(s, arrayWindows);
    }

    fclose(f);

    return 0;
}
Esempio n. 9
0
INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
{
	switch (Message) 
	{
        case WM_INITDIALOG :
		{
			initDialog();
			goToCenter();
			return TRUE;
		}
		case WM_ACTIVATE :
        {
			UINT	posBeg;
			UINT	posEnd;

			::SendMessage(_hParentHandle, HEXM_GETSEL, (WPARAM)&posBeg, (LPARAM)&posEnd);
			::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_IN_SEL), ((posBeg == posEnd)?FALSE:TRUE));

			/* change language */
			NLChangeDialog(_hInst, _nppData._nppHandle, _hSelf, _T("FindReplace"));

            break;
        }
		case WM_COMMAND : 
		{
			switch (LOWORD(wParam))
			{
				case IDOK :
                {
					onFind(FALSE);
					return TRUE;
                }
				case IDC_REPLACE:
                {
					onReplace();
					break;
                }
				case IDC_COUNT :
				{
					processAll(COUNT);
					break;
                }
				case IDC_REPLACEALL :
                {
					HWND	hSci = getCurrentHScintilla();
					ScintillaMsg(hSci, SCI_BEGINUNDOACTION);
					processAll(REPLACE_ALL);
					ScintillaMsg(hSci, SCI_ENDUNDOACTION);
					return TRUE;
                }
				case IDC_COMBO_DATATYPE:
				{
					if (HIWORD(wParam) == CBN_SELCHANGE)
						changeCoding();
					break;
				}
				case IDC_CHECK_TRANSPARENT :
				{
					setTrans();
					break;
				}
				case IDC_RADIO_DIRUP :
				case IDC_RADIO_DIRDOWN :
				{
					_whichDirection = isChecked(IDC_RADIO_DIRDOWN);
					return TRUE;
				}
				case IDC_CHECK_MATCHCASE :
				{
					_isMatchCase = isChecked(IDC_CHECK_MATCHCASE);
					return TRUE;
				}
				case IDC_CHECK_WRAP :
				{
					_isWrap = isChecked(IDC_CHECK_WRAP);
					return TRUE;
				}
				case IDC_CHECK_IN_SEL :
				{
					_isInSel = isChecked(IDC_CHECK_IN_SEL);
					return TRUE;
				}
				case IDCANCEL :
				{
					display(FALSE);
					::SetFocus(_hParentHandle);
					break;
				}
				default :
					break;
			}
			break;
		}
		case WM_NOTIFY:
		{
			NMHDR	nmhdr = *((LPNMHDR)lParam);

			if ((nmhdr.idFrom == IDC_SWITCH) && (nmhdr.code == TCN_SELCHANGE))
			{
				_findReplace = TabCtrl_GetCurSel(::GetDlgItem(_hSelf, IDC_SWITCH));
				updateDialog();
			}
			break;
		}
		case WM_HSCROLL :
		{
			if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_SLIDER_PERCENTAGE))
			{
				setTrans();
			}
			return TRUE;
		}
	}
	return FALSE;
}