int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setGL(); break;
        case 1: setPixelmap(); break;
        case 2: refresh(); break;
        case 3: grabFrameBuffer(); break;
        case 4: clearPixmap(); break;
        case 5: about(); break;
        case 6: open(); break;
        case 7: hideDim(); break;
        case 8: ctxMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 9: dimensionClick((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 10: marginClick((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 11: setLinear(); break;
        case 12: setLog(); break;
        case 13: insertDim(); break;
        case 14: brush(); break;
        case 15: reset(); break;
        case 16: finishedDrawing(); break;
        default: ;
        }
        _id -= 17;
    }
    return _id;
}
Example #2
0
File: exporter.cpp Project: aox/aox
Exporter::Exporter( const UString & source, Selector * selector )
    : d( new ExporterData )
{
    d->sourceName = source;
    d->selector = selector;
    setLog( new Log );
}
Example #3
0
bool OVAFSearchContext::handleDirectText(const string& text, OVTextBuffer* readingText, OVTextBuffer* composingText, OVCandidateService* candidateService, OVLoaderService* loaderService)
{
	string locale = loaderService->locale();
    string composing = composingText->composedText();

	// If we are now in the logging mode, log the composingText to the internal string.
	// However, in the English-Chinese dictionary mode, we log the key stroke but not 
	// the composingText.
	if (m_logging && m_searchType != 0) {
		m_searchString += text;

        composingText->clear();
        composingText->setText("");
        composingText->commit();
        composingText->setText(composing);
        composingText->updateDisplay();
        setLog(composingText, loaderService);

		return true;
	}

    // or pass thru
    composingText->setText(text);
    composingText->commit();
    composingText->setText(composing);
    composingText->updateDisplay();
	
	return true;
}
Example #4
0
VolKnob::VolKnob(QWidget* parent)
   : Knob(parent)
      {
      setLog(true);
      setRange(-60.0f, 10.0f);
      _lineStep = .8f;
      _pageStep = 3.0f;
      }
Example #5
0
VolSlider::VolSlider(QWidget* parent)
   : Slider(parent)
      {
      setLog(true);
      setRange(-60.0f, 10.0f);
      setScaleWidth(7);
      setLineStep(.8f);
      setPageStep(3.0f);
      }
Example #6
0
int main()
{
    setLog();
    testThreadPool();
    testSHA1();
    testUtf8();
    testFile();
    testUrl();
    return 0;
}
Example #7
0
File: session.cpp Project: aox/aox
SessionInitialiser::SessionInitialiser( Mailbox * mailbox, Transaction * t,
                                        Session * also )
    : EventHandler(), d( new SessionInitialiserData )
{
    setLog( new Log );
    d->mailbox = mailbox;
    d->also = also;
    if ( t )
        d->t = t->subTransaction( this );
    execute();
}
Example #8
0
StabilizerBase::StabilizerBase()
{
    setLog(new LogToStdout());
    setFrameSource(new NullFrameSource());
    setMotionEstimator(new KeypointBasedMotionEstimator(new MotionEstimatorRansacL2()));
    setDeblurer(new NullDeblurer());
    setInpainter(new NullInpainter());
    setRadius(15);
    setTrimRatio(0);
    setCorrectionForInclusion(false);
    setBorderMode(BORDER_REPLICATE);
}
ManageSieveCommand::ManageSieveCommand( ManageSieve * sieve,
                                        Command cmd )
    : d( new ManageSieveCommandData )
{
    d->sieve = sieve;
    d->cmd = cmd;
    setLog( new Log );
    Scope x( log() );
    switch( cmd ) {
    case Authenticate:
        log( "Executing authenticate command" );
        break;
    case StartTls:
        log( "Executing starttls command" );
        break;
    case Logout:
        log( "Executing logout command" );
        break;
    case Capability:
        log( "Executing capability command" );
        break;
    case HaveSpace:
        log( "Executing havespace command" );
        break;
    case PutScript:
        log( "Executing putscript command" );
        break;
    case ListScripts:
        log( "Executing listscripts command" );
        break;
    case SetActive:
        log( "Executing setactive command" );
        break;
    case GetScript:
        log( "Executing getscript command" );
        break;
    case DeleteScript:
        log( "Executing deletescript command" );
        break;
    case RenameScript:
        log( "Executing renamescript command" );
        break;
    case Noop:
        log( "Executing noop command" );
        break;
    case XAoxExplain:
        log( "Executing xaoxexplain command" );
        break;
    case Unknown:
        log( "Executing unknown command" );
        break;
    }
}
void MainWindow::createThread()
{
    threadList->clear();
    for(int i=1;i<=atoi(ui->lineEdit_thread->text().toAscii());i++)
    {
        workThread *thread = new workThread(QString::number(i),test);
        threadList->push_back(thread);
//        connect(thread,SIGNAL(finished()),this,SLOT(threadOver()));
        connect(thread,SIGNAL(changeText(QString)),this,SLOT(setLog(QString)));
        //        qDebug()<<i;
    }
}
Example #11
0
void CTable::dealCards(CPlayer *player, int numcards)
{
    CCard *tmpCard;
    CpduDealCardsFlex pdu;
    char message[100] = { '\0' };
    char vChar[3] = { '\0' };
    char sChar;

    if (numcards)
        sprintf(message, "%s was dealt ", player->getUsername());

    pdu.setDeal(0xffff, Hole);
    
    for (; numcards > 0; numcards--)
    {
        tmpCard = deck_.popCard();

        player->getHand()->addCard(tmpCard);

        memset(vChar, 0x0, sizeof(vChar));
        
        switch (tmpCard->getValue())
        {
        case (10):  strcpy(vChar, "10"); break;
        case (11):  vChar[0] = 'J'; break;
        case (12):  vChar[0] = 'Q'; break;
        case (13):  vChar[0] = 'K'; break;
        case (14):  vChar[0] = 'A'; break;
        default: itoa(tmpCard->getValue(), vChar, 10); break;
        }

        switch (tmpCard->getSuit())
        {
        case (1):   sChar = 'C'; break;         // Clubs
        case (2):   sChar = 'D'; break;         // Diamonds
        case (3):   sChar = 'H'; break;         // Hearts
        case (4):   sChar = 'S'; break;         // Spades
        }
        
        sprintf(message, "%s [%s%c]", message, vChar, sChar);

        pdu.addCard(tmpCard->getValue(), tmpCard->getSuit());

        delete tmpCard;
    }

    pdu.sendDealCards(player);

    setLog(message);
  
}
Example #12
0
bool OVAFSearchContext::candidateSelected(OVCandidateService* candidateService, const string& text, size_t index, OVTextBuffer* readingText, OVTextBuffer* composingText, OVLoaderService* loaderService)
{
	readingText->clear();
	readingText->updateDisplay();
	composingText->clear();
	composingText->updateDisplay();

	m_searchType = index;
	m_logging = true;

	setLog(composingText, loaderService);

	return true;
}
Example #13
0
void setLogFile(LtpInterfaceType *ltpInterfaceP,int onB)
{
	char *pathP=0,*filePathP=0;
	if(ltpInterfaceP==0)
		return ;
	if(onB)
	{
		pathP = GetPathFunction();
		filePathP = malloc(400);
		sprintf(filePathP,"%s/%s",pathP,"logtext.txt");
		setLog(ltpInterfaceP->ltpObjectP, true,filePathP );
		free(pathP);
		free(filePathP);
		
	}
	else {
		setLog(ltpInterfaceP->ltpObjectP, false,0 );
	}

	
		
	

}
Example #14
0
SpoolManager::SpoolManager()
    : d( new SpoolManagerData )
{
    setLog( new Log );

    Query * q = new Query( "update deliveries "
                           "set expires_at=current_timestamp+interval '900 s' "
                           "where expires_at<current_timestamp+interval '900 s' "
                           "and id in "
                           "(select delivery from delivery_recipients"
                           " where action=$1 or action=$2)",
                           0 );
    q->bind( 1, Recipient::Unknown );
    q->bind( 2, Recipient::Delayed );
    q->execute();
}
Example #15
0
void CTable::dealCards(Cring *ring, int numcards)
{
    CCard *tmpCard;
    CpduDealCommunity pdu;
    char message[100] = "Community Cards dealt ";
    char vChar[3] = { '\0' };
    char sChar;

    

    for (; numcards > 0; numcards--)
    {
        tmpCard = deck_.popCard();

        memset(vChar, 0x0, sizeof(vChar));

        switch (tmpCard->getValue())
        {
        case (10):  strcpy(vChar, "10"); break;
        case (11):  vChar[0] = 'J'; break;
        case (12):  vChar[0] = 'Q'; break;
        case (13):  vChar[0] = 'K'; break;
        case (14):  vChar[0] = 'A'; break;
        default: itoa(tmpCard->getValue(), vChar, 10); break;
        }

        switch (tmpCard->getSuit())
        {
        case (1):   sChar = 'C'; break;         // Clubs
        case (2):   sChar = 'D'; break;         // Diamonds
        case (3):   sChar = 'H'; break;         // Hearts
        case (4):   sChar = 'S'; break;         // Spades
        }

        getBoard()->addCard(tmpCard);

        sprintf(message, "%s [%s%c]", message, vChar, sChar);
        pdu.sendDealCommunity(ring, tmpCard->getValue(), tmpCard->getSuit(), 500);
        delete tmpCard;
    }

    setLog(message);
}
void run(){

	system("clear");

	struct winsize win;
	ioctl(STDOUT_FILENO,TIOCGWINSZ,&win);	
	w = win.ws_col;
	h = win.ws_row -3;
	//动态分配绘图区的二维数组
	img =  malloc (h * sizeof(char *));
	for(int iw = 0; iw< h;iw++){
		img[iw] = malloc(w*sizeof(char));	
	}
	
	
	p1.x= 10.0;
	p1.y = 10.0;
	p1.view = '@';
	p1.rad = 3.14;
	
	reSet(&p1);

	
	//创建100个点
	ps =  malloc(psNum * sizeof(struct Point));
	for(int i = 0;i<psNum;i++){
		reSet(&(ps[i]));
		printf("i:%d  ps[i].speed:%f\n",i,ps[i].speed);
	}

	char s[] = "---gcc test---- ";
	setLog(s,sizeof(s)-1);

	draw();

	paint();

	while(1){
		updata();
		usleep(dt);
	}

}
Example #17
0
bool OVAFSearchContext::handleKey(OVKey* key, OVTextBuffer* readingText, OVTextBuffer* composingText, OVCandidateService* candidateService, OVLoaderService* loaderService)
{
	if (composingText->composedText().length()) {
		return false;
	}
	if (readingText->composedText().length()) {
		return false;
	}

	if ((key->keyCode() == OVKeyCode::Left || key->keyCode() == OVKeyCode::Right) && m_logging) {
		if (composingText->isEmpty() && readingText->isEmpty())
			return true;
	}

	string locale = loaderService->locale();
	
	if (key->keyCode() == m_module->m_cfgShortcutKey && !key->isCombinedFunctionKey() && !m_logging)
	{
		OVOneDimensionalCandidatePanel* panel = candidateService->useVerticalCandidatePanel();
		OVCandidateList* list = panel->candidateList();
		list->clear();
		if (locale == "zh_TW" || locale == "zh-Hant") {
		#ifndef _MSC_VER
			list->addCandidate("英漢字典");
			list->addCandidate("漢英字典");			
			list->addCandidate("綜合搜尋");
			list->addCandidate("台灣股市");
			list->addCandidate("無名搜尋");
			list->addCandidate("拍賣搜尋");
			list->addCandidate("地圖搜尋");
		#else
			list->addCandidate("\xe8\x8b\xb1\xe6\xbc\xa2\xe5\xad\x97\xe5\x85\xb8");
			list->addCandidate("\xe6\xbc\xa2\xe8\x8b\xb1\xe5\xad\x97\xe5\x85\xb8");			
			list->addCandidate("\xe7\xb6\x9c\xe5\x90\x88\xe6\x90\x9c\xe5\xb0\x8b");
			list->addCandidate("\xe5\x8f\xb0\xe7\x81\xa3\xe8\x82\xa1\xe5\xb8\x82");
			list->addCandidate("\xe7\x84\xa1\xe5\x90\x8d\xe6\x90\x9c\xe5\xb0\x8b");
			list->addCandidate("\xe6\x8b\x8d\xe8\xb3\xa3\xe6\x90\x9c\xe5\xb0\x8b");
			list->addCandidate("\xe5\x9c\xb0\xe5\x9c\x96\xe6\x90\x9c\xe5\xb0\x8b");
		#endif
		}
		else if (locale == "zh_CN" || locale == "zh-Hans") {
		#ifndef _MSC_VER
			list->addCandidate("英汉字典");
			list->addCandidate("汉英字典");			
			list->addCandidate("综合搜索");
			list->addCandidate("台湾股市");
			list->addCandidate("无名搜索");
			list->addCandidate("拍卖搜索");
			list->addCandidate("地图搜索");			
		#else
			list->addCandidate("\xe8\x8b\xb1\xe6\xb1\x89\xe5\xad\x97\xe5\x85\xb8");
			list->addCandidate("\xe6\xb1\x89\xe8\x8b\xb1\xe5\xad\x97\xe5\x85\xb8");			
			list->addCandidate("\xe7\xbb\xbc\xe5\x90\x88\xe6\x90\x9c\xe7\xb4\xa2");
			list->addCandidate("\xe5\x8f\xb0\xe6\xb9\xbe\xe8\x82\xa1\xe5\xb8\x82");
			list->addCandidate("\xe6\x97\xa0\xe5\x90\x8d\xe6\x90\x9c\xe7\xb4\xa2");
			list->addCandidate("\xe6\x8b\x8d\xe5\x8d\x96\xe6\x90\x9c\xe7\xb4\xa2");
			list->addCandidate("\xe5\x9c\xb0\xe5\x9b\xbe\xe6\x90\x9c\xe7\xb4\xa2");			
		#endif		
		}
		else {
			list->addCandidate("English-Chinese Dictionary");
			list->addCandidate("Chinese-English Dictionary");			
			list->addCandidate("Web Search");
			list->addCandidate("Taiex (TW Stock)");
			list->addCandidate("Wretch.cc");
			list->addCandidate("Yahoo! Taiwan Auction");
			list->addCandidate("Yahoo! Taiwan Map");			
		}
		composingText->clear();
		composingText->updateDisplay();
		readingText->clear();
		readingText->updateDisplay();
		loaderService->setLog("");

		panel->setCandidatesPerPage(7);
		panel->updateDisplay();
		panel->show();
		panel->yieldToCandidateEventHandler();
		m_searchString = "";
		return true;
	}

	if (m_logging)  {
		if (key->keyCode() == OVKeyCode::Space) {
			if (m_searchString.size()) {
				m_searchString.append(" ");
				setLog(composingText, loaderService);
				return true;
			}
			else {
				return false;
			}
		}	
		if ((key->keyCode() == m_module->m_cfgShortcutKey || key->keyCode() == OVKeyCode::Esc) && !key->isCombinedFunctionKey()) {
			showStopMessage(loaderService);		
			loaderService->setPrompt("");
			loaderService->setPromptDescription("");
			loaderService->setLog("");
			m_searchString = "";
			m_logging = false;
			return true;
		}	
		if (key->keyCode() == OVKeyCode::Backspace) {
			vector<string> codepoints = OVUTF8Helper::SplitStringByCodePoint(m_searchString);			
			if (codepoints.size() <= 1) {
				m_searchString = "";
				setLog(composingText, loaderService);
				loaderService->beep();                        
				return true;
			}
			
			codepoints.pop_back();
			m_searchString = OVUTF8Helper::CombineCodePoints(codepoints);
			setLog(composingText, loaderService);
			return true;
		}
		
		if (key->keyCode() == OVKeyCode::Return || key->keyCode() == OVKeyCode::Enter) {
			m_logging = false;
			if (m_searchString.length()) {

				if (!m_seachedText.size())
					m_seachedText.push_back(m_searchString);
				else if (m_searchString != string(m_seachedText.at(m_seachedText.size() - 1)))
					m_seachedText.push_back(m_searchString);

				if (m_seachedText.size() > 10)
					m_seachedText.erase(m_seachedText.begin(), m_seachedText.begin() + 1);
				m_searchedCursor = m_seachedText.size();

				if (m_searchType == 0 || m_searchType == 1) {
					loaderService->lookupInDefaultDictionary(m_searchString);
				}
				else if (m_searchType == 2 ) {
					loaderService->openURL(searchWeb(m_searchString, loaderService));
				}
				else if (m_searchType == 3 ) {
					loaderService->openURL(searchStock(m_searchString, loaderService));					
				}
				else if (m_searchType == 4 ) {
					loaderService->openURL(searchWretch(m_searchString, loaderService));					
				}
				else if (m_searchType == 5 ) {
					loaderService->openURL(searchAuction(m_searchString, loaderService));					
				}
				else if (m_searchType == 6 ) {
					loaderService->openURL(searchMap(m_searchString, loaderService));					
				}
				
				loaderService->setPrompt("");
				loaderService->setPromptDescription("");
				loaderService->setLog("");
				composingText->clear();
				composingText->updateDisplay();
				return true;
			}
			else {
				if (locale == "zh_TW" || locale == "zh-Hant") {
				#ifndef _MSC_VER
					loaderService->notify("沒有輸入任何內容,取消搜尋");
				#else
					loaderService->notify("\xE6\xB2\x92\xE6\x9C\x89\xE8\xBC\xB8\xE5\x85\xA5\xE4\xBB\xBB\xE4\xBD\x95\xE5\x85\xA7\xE5\xAE\xB9\x2C\xE5\x8F\x96\xE6\xB6\x88\xE6\x90\x9C\xE5\xB0\x8B");
				#endif
				}
				else if (locale == "zh_CN" || locale == "zh-Hans") {
				#ifndef _MSC_VER
					loaderService->notify("没有输入任何内容,取消搜索");
				#else
					loaderService->notify("\xE6\xB2\xA1\xE6\x9C\x89\xE8\xBE\x93\xE5\x85\xA5\xE4\xBB\xBB\xE4\xBD\x95\xE5\x86\x85\xE5\xAE\xB9\xEF\xBC\x8C\xE5\x8F\x96\xE6\xB6\x88\xE6\x90\x9C\xE5\xAF\xBB");
				#endif
				}				
				else {
					loaderService->notify("Canceled, you did not enter any content.");
				}
				loaderService->setPrompt("");
				loaderService->setPromptDescription("");
				loaderService->setLog("");
				composingText->clear();
				composingText->updateDisplay();
				return true;
			}
		}	
		if (key->keyCode() == OVKeyCode::Tab)
			return true;
		if (key->keyCode() == OVKeyCode::PageUp)
			return true;
		if (key->keyCode() == OVKeyCode::PageDown)
			return true;
		if (key->keyCode() == OVKeyCode::Home || key->keyCode() == OVKeyCode::End || key->keyCode() == OVKeyCode::Up || key->keyCode() == OVKeyCode::Down) {
			if (!m_seachedText.size())
				return true;
			if (key->keyCode() == OVKeyCode::Up) {
				if (m_searchedCursor == 0)
					m_searchedCursor = m_seachedText.size() - 1;
				else
					m_searchedCursor--;
			}
			else if (key->keyCode() == OVKeyCode::Down) {				
				if (m_searchedCursor >= m_seachedText.size() -1)
					m_searchedCursor = 0;
				else
					m_searchedCursor++;
			}
			else if (key->keyCode() == OVKeyCode::Home) {
				m_searchedCursor = 0;
			}
			else if (key->keyCode() == OVKeyCode::End) {
				m_searchedCursor = m_searchedCursor = m_seachedText.size() - 1;
			}

			if (m_searchedCursor >= m_seachedText.size())
				return true;
			setLog(composingText, loaderService);
			m_searchString = m_seachedText.at(m_searchedCursor);
			loaderService->setLog(m_seachedText.at(m_searchedCursor));
			return true;
		}
		setLog(composingText, loaderService);
	}
	
	// English/Chinese Dictionary
	if (m_logging && m_searchType == 0) {		
		char buf[2];
		if (key->isDirectTextKey() || key->isCapsLockOn()) 
			snprintf(buf, 2, "%c", toupper((char)key->keyCode()));
		else
			snprintf(buf, 2, "%c", (char)key->keyCode());
		m_searchString = m_searchString + string(buf);
		loaderService->setLog(m_searchString);
		return true;
	}
	
	return false;
}
Example #18
0
bool MetalinkXml::metalinkInit(const KUrl &src, const QByteArray &data)
{
    kDebug(5001);

    if (!src.isEmpty()) {
        m_localMetalinkLocation = src;
    }

    //use the downloaded metalink-file data directly if possible
    if (!data.isEmpty()) {
        KGetMetalink::HandleMetalink::load(data, &m_metalink);
    }

    //try to parse the locally stored metalink-file
    if (!m_metalink.isValid() && m_localMetalinkLocation.isValid()) {
        KGetMetalink::HandleMetalink::load(m_localMetalinkLocation.toLocalFile(), &m_metalink);
    }

    if (!m_metalink.isValid()) {
        kError(5001) << "Unknown error when trying to load the .metalink-file. Metalink is not valid.";
        setStatus(Job::Aborted);
        setTransferChange(Tc_Status, true);
        return false;
    }

    //offers a dialog to download the newest version of a dynamic metalink
     if ((m_source.isLocalFile() || !m_metalinkJustDownloaded) &&
         m_metalink.dynamic && (UrlChecker::checkSource(m_metalink.origin) == UrlChecker::NoError)) {
        if (KMessageBox::questionYesNo(0, i18n("A newer version of this Metalink might exist, do you want to download it?"),
                                       i18n("Redownload Metalink")) == KMessageBox::Yes) {
            m_localMetalinkLocation.clear();
            m_source = m_metalink.origin;
            downloadMetalink();
            return false;
        }
    }

    QList<KGetMetalink::File>::const_iterator it;
    QList<KGetMetalink::File>::const_iterator itEnd = m_metalink.files.files.constEnd();
    m_totalSize = 0;
    KIO::fileoffset_t segSize = 500 * 1024;//TODO use config here!
    const KUrl tempDest = KUrl(m_dest.directory());
    KUrl dest;
    for (it = m_metalink.files.files.constBegin(); it != itEnd ; ++it)
    {
        dest = tempDest;
        dest.addPath((*it).name);

        QList<KGetMetalink::Url> urlList = (*it).resources.urls;
        //sort the urls according to their priority (highest first)
        qSort(urlList.begin(), urlList.end(), qGreater<KGetMetalink::Url>());

        KIO::filesize_t fileSize = (*it).size;
        m_totalSize += fileSize;

        //create a DataSourceFactory for each separate file
        DataSourceFactory *dataFactory = new DataSourceFactory(this, dest, fileSize, segSize);
        dataFactory->setMaxMirrorsUsed(MetalinkSettings::mirrorsPerFile());

#ifdef HAVE_NEPOMUK
        nepomukHandler()->setProperties((*it).properties(), QList<KUrl>() << dest);
#endif //HAVE_NEPOMUK

//TODO compare available file size (<size>) with the sizes of the server while downloading?

        connect(dataFactory, SIGNAL(capabilitiesChanged()), this, SLOT(slotUpdateCapabilities()));
        connect(dataFactory, SIGNAL(dataSourceFactoryChange(Transfer::ChangesFlags)), this, SLOT(slotDataSourceFactoryChange(Transfer::ChangesFlags)));
        connect(dataFactory->verifier(), SIGNAL(verified(bool)), this, SLOT(slotVerified(bool)));
        connect(dataFactory->signature(), SIGNAL(verified(int)), this, SLOT(slotSignatureVerified()));
        connect(dataFactory, SIGNAL(log(QString,Transfer::LogLevel)), this, SLOT(setLog(QString,Transfer::LogLevel)));

        //add the DataSources
        for (int i = 0; i < urlList.size(); ++i)
        {
            const KUrl url = urlList[i].url;
            if (url.isValid())
            {
                dataFactory->addMirror(url, MetalinkSettings::connectionsPerUrl());
            }
        }
        //no datasource has been created, so remove the datasource factory
        if (dataFactory->mirrors().isEmpty())
        {
            delete dataFactory;
        }
        else
        {
            dataFactory->verifier()->addChecksums((*it).verification.hashes);

            foreach (const KGetMetalink::Pieces &pieces, (*it).verification.pieces) {
                dataFactory->verifier()->addPartialChecksums(pieces.type, pieces.length, pieces.hashes);
            }

            const QHash <QString, QString> signatures = (*it).verification.signatures;
            QHash<QString, QString>::const_iterator it;
            QHash<QString, QString>::const_iterator itEnd = signatures.constEnd();
            for (it = signatures.constBegin(); it != itEnd; ++it) {
                if (it.key().toLower() == "pgp") {
                    dataFactory->signature()->setAsciiDetatchedSignature(*it);
                }
            }

            m_dataSourceFactory[dataFactory->dest()] = dataFactory;
        }
    }

    if ((m_metalink.files.files.size() == 1) &&   m_dataSourceFactory.size())
    {
        m_dest = dest;
    }

    if (!m_dataSourceFactory.size()) {
        //TODO make this via log in the future + do not display the KMessageBox
        kWarning(5001) << "Download of" << m_source << "failed, no working URLs were found.";
        KMessageBox::error(0, i18n("Download failed, no working URLs were found."), i18n("Error"));
        setStatus(Job::Aborted);
        setTransferChange(Tc_Status, true);
        return false;
    }

    m_ready = !m_dataSourceFactory.isEmpty();
    slotUpdateCapabilities();

    //the metalink-file has just been downloaded, so ask the user to choose the files that
    // should be downloaded
    /* TODO this portion seems not to be working. Need to ask boom1992 */
    if (m_metalinkJustDownloaded) {
        KDialog *dialog = new FileSelectionDlg(fileModel());
        dialog->setAttribute(Qt::WA_DeleteOnClose);
        connect(dialog, SIGNAL(finished(int)), this, SLOT(fileDlgFinished(int)));

        dialog->show();
    }

    return true;
}
//--------------------------------------------------------------------------
// Function:	FileAccPropList::setLog
///\brief	This is an overloaded member function, provided for convenience.
///		It differs from the above function only in what arguments it
///		accepts.
///\param	logfile  - IN: Name of the log file - string
///\param	flags    - IN: Flags specifying the types of logging activity
///\param	buf_size - IN: Size of the logging buffer
// Programmer:  Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const
{
   setLog(logfile.c_str(), flags, buf_size);
}
Example #20
0
File: mailbox.cpp Project: aox/aox
 MailboxObliterator(): EventHandler(), mr( 0 ) {
     setLog( log() );
     (void)new DatabaseSignal( "obliterated", this );
 }
Example #21
0
int
main(int argc, char** argv)
{
  OptionParser options;
  options.executable("dune-test-tail")
  .program(DUNE_SHORT_NAME)
  .copyright(DUNE_COPYRIGHT)
  .email(DUNE_CONTACT)
  .version(getFullVersion())
  .date(getCompileDate())
  .arch(DUNE_SYSTEM_NAME)
  .add("-i", "--address",
       "Vehicle's IP address", "ADDRESS")
  .add("-w", "--wait",
       "Wait DELAY seconds before starting test", "DELAY")
  .add("-d", "--duration",
       "Test duration in seconds", "DURATION")
  .add("-s", "--speed",
       "Speed in percentage", "SPEED")
  .add("-t", "--angle",
       "Angle in degrees", "ANGLE");

  // Parse command line arguments.
  if (!options.parse(argc, argv))
  {
    if (options.bad())
      std::cerr << "ERROR: " << options.error() << std::endl;
    options.usage();
    return 1;
  }

  // Set destination address.
  if (options.value("--address") == "")
    g_addr = "127.0.0.1";
  else
    g_addr = options.value("--address").c_str();

  // Set start delay.
  double sdelay = 0;
  if (options.value("--wait") == "")
    sdelay = 0;
  else
    sdelay = castLexical<double>(options.value("--wait"));

  // Set duration.
  double duration = 0;
  if (options.value("--duration") == "")
    duration = 0;
  else
    duration = castLexical<double>(options.value("--duration"));

  // Set speed.
  double speed = 0;
  if (options.value("--speed") == "")
    speed = 0;
  else
  {
    speed = castLexical<double>(options.value("--speed"));
    speed /= 100.0;
  }

  // Set Angle
  double angle = 0;
  if (options.value("--angle") == "")
    angle = 0;
  else
    angle = castLexical<double>(options.value("--angle"));

  // POSIX implementation.
#if defined(DUNE_SYS_HAS_SIGACTION)
  struct sigaction actions;
  std::memset(&actions, 0, sizeof(actions));
  sigemptyset(&actions.sa_mask);
  actions.sa_flags = 0;
  actions.sa_handler = handleTerminate;
  sigaction(SIGALRM, &actions, 0);
  sigaction(SIGHUP, &actions, 0);
  sigaction(SIGINT, &actions, 0);
  sigaction(SIGQUIT, &actions, 0);
  sigaction(SIGTERM, &actions, 0);
  sigaction(SIGCHLD, &actions, 0);
  sigaction(SIGCONT, &actions, 0);
#endif

  setThrust(0);
  Delay::wait(sdelay);

  setLog("mcrt_endurance");
  Delay::wait(2.0);

  double deadline = Clock::get() + duration;
  setThrust(speed);

  while ((Clock::get() < deadline) && !g_stop)
  {
    setFin(0, -angle);
    setFin(1, -angle);
    setFin(2, -angle);
    setFin(3, -angle);

    if (!g_stop)
      Delay::wait(1.0);

    if (!g_stop)
      Delay::wait(1.0);

    if (!g_stop)
      Delay::wait(1.0);

    if (!g_stop)
      Delay::wait(1.0);

    setFin(0, angle);
    setFin(1, angle);
    setFin(2, angle);
    setFin(3, angle);

    if (!g_stop)
      Delay::wait(1.0);

    if (!g_stop)
      Delay::wait(1.0);

    if (!g_stop)
      Delay::wait(1.0);

    if (!g_stop)
      Delay::wait(1.0);
  }

  // Change log.
  Delay::wait(2.0);
  setLog("idle");

  onTerminate();

  return 0;
}
Example #22
0
void LoadingDialog::setupFile(QString fileName)
{
    progressBar->reset();
    progressBar->setRange(0, 20);
    setLog("Loading: " + fileName + "\n");
}
Example #23
0
int main( int argc, char **argv )
{
	int n, i;
	char *com;

	fp_err = stderr;

	init_conf();

	com = argv[0];
	--argc;  ++argv;
	while( argc > 0 && argv[0][0] == '-' )  {
		switch( argv[0][1] )  {
		case 'C':
			if( argc < 2 )  usage( com );
			read_conf( argv[1] );
			--argc;  ++argv;
			break;
		/*******↓for server mode *******/
		case 'p':
   		        /* 引数が不正な場合はエラー出力 */
			if( argc < 2 )  usage( com );
			/* ポート番号の読み込み */
			i = atoi( argv[1] );
			if (i > 1024) {
			        nPort = i;
			}
			s_mode = 1;
			--argc;  ++argv;
			break;
		/*******↑***********************/
		case 'v':
			printf( "%s\n", moduleVersion );
			printf( "%s\n", protocolVersion );
			exit(0);
		default:
			usage( com );
		}
		--argc;  ++argv;
	}
	set_default_conf();

	initialize();

	n = setjmp( ebuf );

	if( n > 0 )  chasen_process = 0;	/* to restart 'chasen' process */

	for( ;; )  {
#ifdef PRINTDATA
		TmpMsg( "> " );
#endif
		n_arg = read_command( v_arg );

#ifdef PRINTDATA
		{
			int i;
			TmpMsg( "command is \n" );
			for( i=0; i<n_arg; ++i )  {
				TmpMsg( "  %d: %s\n", i+1, v_arg[i] );
			}
		}
#endif

		/* 「o」 で set Speak = NOW のショートカット */
		if( strcmp(v_arg[0],"o")==0 )  {
			setSpeak( "=", "NOW" );
			continue;
		}

		if( n_arg < 2 )  { unknown_com();  continue; }

		switch( commandID( v_arg[0] ) )  {
		  case C_set:
			if( n_arg < 4 )  { unknown_com();  break; }
			switch( slotID( v_arg[1] ) )  {
			  case S_Run:   setRun( v_arg[2], v_arg[3] );  break;
			  case S_Speaker:  setSpeaker( v_arg[2], v_arg[3] );  break;
			  case S_Alpha: setAlpha( v_arg[2], v_arg[3] );  break;
			  case S_Postfilter_coef: setPostfilter_coef( v_arg[2], v_arg[3] );  break;
			  case S_Text:  setText( v_arg[2], v_arg[3] );  break;
			  case S_Speak: setSpeak( v_arg[2], v_arg[3] );  break;

			  case S_SaveRAW: setSave( v_arg[2], v_arg[3] );  break;
			  case S_Save:    setSave( v_arg[2], v_arg[3] );  break;
			  case S_LoadRAW: setSpeechFile( v_arg[2], v_arg[3], RAW );  break;
			  case S_SpeechFile: setSpeechFile( v_arg[2], v_arg[3], RAW );  break;
			  case S_SaveWAV: setSaveWAV( v_arg[2], v_arg[3] );  break;
			  case S_LoadWAV: setSpeechFile( v_arg[2], v_arg[3], WAV );  break;

			  case S_SavePros:  setSavePros( v_arg[2], v_arg[3] );  break;
			  case S_LoadPros:  setProsFile( v_arg[2], v_arg[3] );  break;
			  case S_ProsFile:  setProsFile( v_arg[2], v_arg[3] );  break;

			  case S_ParsedText: setParsedText( v_arg[2], v_arg[3] );  break;
			  case S_Speak_syncinterval: setSpeakSyncinterval( v_arg[2], v_arg[3] );  break;
			  case S_AutoPlay: 
				slot_Auto_play = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_AutoPlayDelay: 
				slot_Auto_play_delay = atoi( v_arg[3] ); break;
			  case S_Log:   setLog( v_arg[2], v_arg[3] ); break;
			  case S_Log_conf:
				slot_Log_conf = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_Log_text:
				slot_Log_text = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_Log_arranged_text:
				slot_Log_arranged_text = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_Log_chasen:
				slot_Log_chasen = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_Log_tag:
				slot_Log_tag = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_Log_phoneme:
				slot_Log_phoneme = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_Log_mora:
				slot_Log_mora = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_Log_morph:
				slot_Log_morph = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_Log_aphrase:
				slot_Log_aphrase = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_Log_breath:
				slot_Log_breath = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_Log_sentence:
				slot_Log_sentence = setLogYesNo( v_arg[2], v_arg[3] ); break;
			  case S_Err:          setErr( v_arg[2], v_arg[3] ); break;
			  default:
				unknown_com();
			}
			break;
		  case C_inq:
			switch( slotID( v_arg[1] ) ) {
			  case S_Run:        inqRun();  break;
			  case S_ModuleVersion: inqModuleVersion();  break;
			  case S_ProtocolVersion: inqProtocolVersion();  break;
			  case S_SpeakerSet: inqSpeakerSet();  break;
			  case S_Speaker:    inqSpeaker();  break;
			  case S_SpeechFile: inqSpeechFile();  break;
			  case S_ProsFile:   inqProsFile();  break;
			  case S_AutoPlay:   inqAutoPlay();  break;
			  case S_AutoPlayDelay:   inqAutoPlayDelay();  break;
			  case S_Text_text:  inqTextText();  break;
			  case S_Text_pho:   inqTextPho();  break;
			  case S_Text_dur:   inqTextDur();  break;
			  case S_Speak_text: inqSpeakText();  break;
			  case S_Speak_pho:  inqSpeakPho();  break;
			  case S_Speak_dur:  inqSpeakDur();  break;
			  case S_Speak_utt:  inqSpeakUtt();  break;
			  case S_Speak_len:  inqSpeakLen();  break;
			  case S_Speak_stat: inqSpeakStat();  break;
			  case S_Speak_syncinterval: inqSpeakSyncinterval();  break;
			  case S_Log:
				RepMsg( "rep Log = %s\n", slot_Log_file );  break;
			  case S_Log_conf:
				RepMsg( "rep Log.conf = %s\n", YesNoSlot(S_Log_conf) );  break;
			  case S_Log_text:
				RepMsg( "rep Log.text = %s\n", YesNoSlot(S_Log_text) );  break;
			  case S_Log_arranged_text:
				RepMsg( "rep Log.arranged_text = %s\n", YesNoSlot(S_Log_arranged_text) );  break;
			  case S_Log_chasen:
				RepMsg( "rep Log.chasen = %s\n", YesNoSlot(S_Log_chasen) );  break;
			  case S_Log_tag:
				RepMsg( "rep Log.tag = %s\n", YesNoSlot(S_Log_tag) );  break;
			  case S_Log_phoneme:
				RepMsg( "rep Log.phoneme = %s\n", YesNoSlot(S_Log_phoneme) );  break;
			  case S_Log_mora:
				RepMsg( "rep Log.mora = %s\n", YesNoSlot(S_Log_mora) );  break;
			  case S_Log_morph:
				RepMsg( "rep Log.morph = %s\n", YesNoSlot(S_Log_morph) );  break;
			  case S_Log_aphrase:
				RepMsg( "rep Log.aphrase = %s\n", YesNoSlot(S_Log_aphrase) );  break;
			  case S_Log_breath:
				RepMsg( "rep Log.breath = %s\n", YesNoSlot(S_Log_breath) );  break;
			  case S_Log_sentence:
				RepMsg( "rep Log.sentence = %s\n", YesNoSlot(S_Log_sentence) );  break;
			  case S_Err:
				RepMsg( "rep Err = %s\n", slot_Err_file );  break;
			  default:
				unknown_com();
			}
			break;
		  case C_prop:
			{ SlotProp prop;
			if( strcmp(v_arg[2],"=")!=0 )  { unknown_com(); break; }
			if( strcmp(v_arg[3],"AutoOutput")==0 )  {
				prop = AutoOutput;
			} else if(strcmp(v_arg[3],"NoAutoOutput")==0 )  {
				prop = NoAutoOutput;
			} else {
				unknown_com(); break;
			}
			switch( slotID( v_arg[1] ) ) {
			  case S_Run:        prop_Run = prop;  break;
			  case S_ModuleVersion: prop_ModuleVersion = prop;  break;
			  case S_ProtocolVersion: prop_ProtocolVersion = prop;  break;
			  case S_SpeakerSet: prop_SpeakerSet = prop;  break;
			  case S_Speaker:    prop_Speaker = prop;  break;
			  case S_SpeechFile: prop_SpeechFile = prop;  break;
			  case S_ProsFile:   prop_ProsFile = prop;  break;
			  case S_Text:       prop_Text = prop;  break;
			  case S_Text_text:  prop_Text_text = prop;  break;
			  case S_Text_pho:   prop_Text_pho = prop;  break;
			  case S_Text_dur:   prop_Text_dur = prop;  break;
			  case S_Speak:      prop_Speak = prop;  break;
			  case S_Speak_text: prop_Speak_text = prop;  break;
			  case S_Speak_pho:  prop_Speak_pho = prop;  break;
			  case S_Speak_dur:  prop_Speak_dur = prop;  break;
			  case S_Speak_utt:  prop_Speak_utt = prop;  break;
			  case S_Speak_len:  prop_Speak_len = prop;  break;
			  case S_Speak_stat: prop_Speak_stat = prop;  break;
			  case S_Speak_syncinterval: prop_Speak_syncinterval = prop;  break;
			  default:
				unknown_com();
			}
			}
			break;
		  default:
			unknown_com();
		}
	}
	
	if( s_mode ) {
	        server_destroy ();
	}
	exit(0);
}
bool FastThread::threadLoop()
{
    for (;;) {

        // either nanosleep, sched_yield, or busy wait
        if (sleepNs >= 0) {
            if (sleepNs > 0) {
                ALOG_ASSERT(sleepNs < 1000000000);
                const struct timespec req = {0, sleepNs};
                nanosleep(&req, NULL);
            } else {
                sched_yield();
            }
        }
        // default to long sleep for next cycle
        sleepNs = FAST_DEFAULT_NS;

        // poll for state change
        const FastThreadState *next = poll();
        if (next == NULL) {
            // continue to use the default initial state until a real state is available
            // FIXME &initial not available, should save address earlier
            //ALOG_ASSERT(current == &initial && previous == &initial);
            next = current;
        }

        command = next->mCommand;
        if (next != current) {

            // As soon as possible of learning of a new dump area, start using it
            dumpState = next->mDumpState != NULL ? next->mDumpState : mDummyDumpState;
            logWriter = next->mNBLogWriter != NULL ? next->mNBLogWriter : &dummyLogWriter;
            setLog(logWriter);

            // We want to always have a valid reference to the previous (non-idle) state.
            // However, the state queue only guarantees access to current and previous states.
            // So when there is a transition from a non-idle state into an idle state, we make a
            // copy of the last known non-idle state so it is still available on return from idle.
            // The possible transitions are:
            //  non-idle -> non-idle    update previous from current in-place
            //  non-idle -> idle        update previous from copy of current
            //  idle     -> idle        don't update previous
            //  idle     -> non-idle    don't update previous
            if (!(current->mCommand & FastThreadState::IDLE)) {
                if (command & FastThreadState::IDLE) {
                    onIdle();
                    oldTsValid = false;
#ifdef FAST_MIXER_STATISTICS
                    oldLoadValid = false;
#endif
                    ignoreNextOverrun = true;
                }
                previous = current;
            }
            current = next;
        }
#if !LOG_NDEBUG
        next = NULL;    // not referenced again
#endif

        dumpState->mCommand = command;

        // << current, previous, command, dumpState >>

        switch (command) {
        case FastThreadState::INITIAL:
        case FastThreadState::HOT_IDLE:
            sleepNs = FAST_HOT_IDLE_NS;
            continue;
        case FastThreadState::COLD_IDLE:
            // only perform a cold idle command once
            // FIXME consider checking previous state and only perform if previous != COLD_IDLE
            if (current->mColdGen != coldGen) {
                int32_t *coldFutexAddr = current->mColdFutexAddr;
                ALOG_ASSERT(coldFutexAddr != NULL);
                int32_t old = android_atomic_dec(coldFutexAddr);
                if (old <= 0) {
                    syscall(__NR_futex, coldFutexAddr, FUTEX_WAIT_PRIVATE, old - 1, NULL);
                }
                int policy = sched_getscheduler(0);
                if (!(policy == SCHED_FIFO || policy == SCHED_RR)) {
                    ALOGE("did not receive expected priority boost");
                }
                // This may be overly conservative; there could be times that the normal mixer
                // requests such a brief cold idle that it doesn't require resetting this flag.
                isWarm = false;
                measuredWarmupTs.tv_sec = 0;
                measuredWarmupTs.tv_nsec = 0;
                warmupCycles = 0;
                sleepNs = -1;
                coldGen = current->mColdGen;
#ifdef FAST_MIXER_STATISTICS
                bounds = 0;
                full = false;
#endif
                oldTsValid = !clock_gettime(CLOCK_MONOTONIC, &oldTs);
                timestampStatus = INVALID_OPERATION;
            } else {
                sleepNs = FAST_HOT_IDLE_NS;
            }
            continue;
        case FastThreadState::EXIT:
            onExit();
            return false;
        default:
            LOG_ALWAYS_FATAL_IF(!isSubClassCommand(command));
            break;
        }

        // there is a non-idle state available to us; did the state change?
        if (current != previous) {
            onStateChange();
#if 1   // FIXME shouldn't need this
            // only process state change once
            previous = current;
#endif
        }

        // do work using current state here
        attemptedWrite = false;
        onWork();

        // To be exactly periodic, compute the next sleep time based on current time.
        // This code doesn't have long-term stability when the sink is non-blocking.
        // FIXME To avoid drift, use the local audio clock or watch the sink's fill status.
        struct timespec newTs;
        int rc = clock_gettime(CLOCK_MONOTONIC, &newTs);
        if (rc == 0) {
            //logWriter->logTimestamp(newTs);
            if (oldTsValid) {
                time_t sec = newTs.tv_sec - oldTs.tv_sec;
                long nsec = newTs.tv_nsec - oldTs.tv_nsec;
                ALOGE_IF(sec < 0 || (sec == 0 && nsec < 0),
                        "clock_gettime(CLOCK_MONOTONIC) failed: was %ld.%09ld but now %ld.%09ld",
                        oldTs.tv_sec, oldTs.tv_nsec, newTs.tv_sec, newTs.tv_nsec);
                if (nsec < 0) {
                    --sec;
                    nsec += 1000000000;
                }
                // To avoid an initial underrun on fast tracks after exiting standby,
                // do not start pulling data from tracks and mixing until warmup is complete.
                // Warmup is considered complete after the earlier of:
                //      MIN_WARMUP_CYCLES write() attempts and last one blocks for at least warmupNs
                //      MAX_WARMUP_CYCLES write() attempts.
                // This is overly conservative, but to get better accuracy requires a new HAL API.
                if (!isWarm && attemptedWrite) {
                    measuredWarmupTs.tv_sec += sec;
                    measuredWarmupTs.tv_nsec += nsec;
                    if (measuredWarmupTs.tv_nsec >= 1000000000) {
                        measuredWarmupTs.tv_sec++;
                        measuredWarmupTs.tv_nsec -= 1000000000;
                    }
                    ++warmupCycles;
                    if ((nsec > warmupNs && warmupCycles >= MIN_WARMUP_CYCLES) ||
                            (warmupCycles >= MAX_WARMUP_CYCLES)) {
                        isWarm = true;
                        dumpState->mMeasuredWarmupTs = measuredWarmupTs;
                        dumpState->mWarmupCycles = warmupCycles;
                    }
                }
                sleepNs = -1;
                if (isWarm) {
                    if (sec > 0 || nsec > underrunNs) {
                        ATRACE_NAME("underrun");
                        // FIXME only log occasionally
                        ALOGV("underrun: time since last cycle %d.%03ld sec",
                                (int) sec, nsec / 1000000L);
                        dumpState->mUnderruns++;
                        ignoreNextOverrun = true;
                    } else if (nsec < overrunNs) {
                        if (ignoreNextOverrun) {
                            ignoreNextOverrun = false;
                        } else {
                            // FIXME only log occasionally
                            ALOGV("overrun: time since last cycle %d.%03ld sec",
                                    (int) sec, nsec / 1000000L);
                            dumpState->mOverruns++;
                        }
                        // This forces a minimum cycle time. It:
                        //  - compensates for an audio HAL with jitter due to sample rate conversion
                        //  - works with a variable buffer depth audio HAL that never pulls at a
                        //    rate < than overrunNs per buffer.
                        //  - recovers from overrun immediately after underrun
                        // It doesn't work with a non-blocking audio HAL.
                        sleepNs = forceNs - nsec;
                    } else {
                        ignoreNextOverrun = false;
                    }
                }
#ifdef FAST_MIXER_STATISTICS
                if (isWarm) {
                    // advance the FIFO queue bounds
                    size_t i = bounds & (dumpState->mSamplingN - 1);
                    bounds = (bounds & 0xFFFF0000) | ((bounds + 1) & 0xFFFF);
                    if (full) {
                        bounds += 0x10000;
                    } else if (!(bounds & (dumpState->mSamplingN - 1))) {
                        full = true;
                    }
                    // compute the delta value of clock_gettime(CLOCK_MONOTONIC)
                    uint32_t monotonicNs = nsec;
                    if (sec > 0 && sec < 4) {
                        monotonicNs += sec * 1000000000;
                    }
                    // compute raw CPU load = delta value of clock_gettime(CLOCK_THREAD_CPUTIME_ID)
                    uint32_t loadNs = 0;
                    struct timespec newLoad;
                    rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &newLoad);
                    if (rc == 0) {
                        if (oldLoadValid) {
                            sec = newLoad.tv_sec - oldLoad.tv_sec;
                            nsec = newLoad.tv_nsec - oldLoad.tv_nsec;
                            if (nsec < 0) {
                                --sec;
                                nsec += 1000000000;
                            }
                            loadNs = nsec;
                            if (sec > 0 && sec < 4) {
                                loadNs += sec * 1000000000;
                            }
                        } else {
                            // first time through the loop
                            oldLoadValid = true;
                        }
                        oldLoad = newLoad;
                    }
#ifdef CPU_FREQUENCY_STATISTICS
                    // get the absolute value of CPU clock frequency in kHz
                    int cpuNum = sched_getcpu();
                    uint32_t kHz = tcu.getCpukHz(cpuNum);
                    kHz = (kHz << 4) | (cpuNum & 0xF);
#endif
                    // save values in FIFO queues for dumpsys
                    // these stores #1, #2, #3 are not atomic with respect to each other,
                    // or with respect to store #4 below
                    dumpState->mMonotonicNs[i] = monotonicNs;
                    dumpState->mLoadNs[i] = loadNs;
#ifdef CPU_FREQUENCY_STATISTICS
                    dumpState->mCpukHz[i] = kHz;
#endif
                    // this store #4 is not atomic with respect to stores #1, #2, #3 above, but
                    // the newest open & oldest closed halves are atomic with respect to each other
                    dumpState->mBounds = bounds;
                    ATRACE_INT("cycle_ms", monotonicNs / 1000000);
                    ATRACE_INT("load_us", loadNs / 1000);
                }
#endif
            } else {
                // first time through the loop
                oldTsValid = true;
                sleepNs = periodNs;
                ignoreNextOverrun = true;
            }
            oldTs = newTs;
        } else {
            // monotonic clock is broken
            oldTsValid = false;
            sleepNs = periodNs;
        }

    }   // for (;;)

    // never return 'true'; Thread::_threadLoop() locks mutex which can result in priority inversion
}