void MemTracker::report(bool summary_only, outputStream* output) { assert(output != NULL, "No output stream"); MemBaseline baseline; if (baseline.baseline(summary_only)) { if (summary_only) { MemSummaryReporter rpt(baseline, output); rpt.report(); } else { MemDetailReporter rpt(baseline, output); rpt.report(); } } }
bool Wiimote::Read() { Report rpt(MAX_PAYLOAD); auto const result = IORead(rpt.data()); if (result > 0 && m_channel > 0) { if (SConfig::GetInstance().iBBDumpPort > 0 && m_index == WIIMOTE_BALANCE_BOARD) { static sf::UdpSocket Socket; Socket.send((char*)rpt.data(), rpt.size(), sf::IpAddress::LocalHost, SConfig::GetInstance().iBBDumpPort); } // Add it to queue rpt.resize(result); m_read_reports.Push(std::move(rpt)); return true; } else if (0 == result) { ERROR_LOG(WIIMOTE, "Wiimote::IORead failed. Disconnecting Wiimote %d.", m_index + 1); DisconnectInternal(); } return false; }
bool Wiimote::Read() { Report rpt(MAX_PAYLOAD); auto const result = IORead(rpt.data()); if (result > 0 && m_channel > 0) { if (Core::g_CoreStartupParameter.iBBDumpPort > 0 && index == WIIMOTE_BALANCE_BOARD) { static sf::SocketUDP Socket; Socket.Send((char*)rpt.data(), rpt.size(), sf::IPAddress::LocalHost, Core::g_CoreStartupParameter.iBBDumpPort); } // Add it to queue rpt.resize(result); m_read_reports.Push(std::move(rpt)); return true; } else if (0 == result) { ERROR_LOG(WIIMOTE, "Wiimote::IORead failed. Disconnecting Wiimote %d.", index + 1); DisconnectInternal(); } return false; }
// to be called from CPU thread void Wiimote::QueueReport(u8 rpt_id, const void* _data, unsigned int size) { auto const data = static_cast<const u8*>(_data); Report rpt(size + 2); rpt[0] = WM_SET_REPORT | WM_BT_OUTPUT; rpt[1] = rpt_id; std::copy_n(data, size, rpt.begin() + 2); WriteReport(std::move(rpt)); }
void CDummyCalendarApp::RepeatExceptedEntryCreateL() { test.Next(_L("Add entry, repeat twice, set excepted and delete")); iEntries.ResetAndDestroy(); // Create new calendar entry. CCalEntry* entry = NULL; HBufC8* guid = KGUIDInc081869().AllocLC(); entry = CreateCalEntryL(CCalEntry::EAppt, guid); CleanupStack::Pop(guid); iEntries.AppendL(entry); // Set start and end date. TTime start(TDateTime(2006, EMarch, 6, 10, 0, 0, 0)); TTime end(TDateTime(2006, EMarch, 6, 14, 0, 0, 0)); SetEntryStartAndEndTimeL(entry, start, end); TBuf<50> summary; RandomText(summary); entry->SetSummaryL(summary); TBuf<50> location; RandomText(location); entry->SetLocationL(location); TBuf<50> description; RandomText(description); entry->SetDescriptionL(description); // Create a daily repeating rule that occurs for 2 days. TCalRRule rpt(TCalRRule::EDaily); rpt.SetInterval(1); rpt.SetCount(2); // Make sure the repeat time is within the delete time range. TCalTime repeatStart; TCalTime repeatEnd; repeatStart.SetTimeLocalL(TDateTime(2006, EMarch, 6, 0, 0, 0, 0)); repeatEnd.SetTimeLocalL(TDateTime(2006, EMarch, 8, 0, 0, 0, 0)); rpt.SetDtStart(repeatStart); rpt.SetUntil(repeatEnd); entry->SetRRuleL(rpt); // Store the entry. Because it repeats over 2 days, there will // be 2 entries. TInt entriesStored(0); SynCGetEntryViewL().StoreL(iEntries, entriesStored); test(entriesStored == iEntries.Count()); }
void Wiimote::InterruptChannel(const u16 channel, const void* const _data, const u32 size) { // first interrupt/control channel sent if (channel != m_channel) { m_channel = channel; ClearReadQueue(); EmuStart(); } auto const data = static_cast<const u8*>(_data); Report rpt(data, data + size); WiimoteEmu::Wiimote *const wm = (WiimoteEmu::Wiimote*)::Wiimote::GetConfig()->controllers[m_index]; // Convert output DATA packets to SET_REPORT packets. // Nintendo Wiimotes work without this translation, but 3rd // party ones don't. if (rpt[0] == 0xa2) { rpt[0] = WM_SET_REPORT | WM_BT_OUTPUT; } // Disallow games from turning off all of the LEDs. // It makes Wiimote connection status confusing. if (rpt[1] == WM_LEDS) { auto& leds_rpt = *reinterpret_cast<wm_leds*>(&rpt[2]); if (0 == leds_rpt.leds) { // Turn on ALL of the LEDs. leds_rpt.leds = 0xf; } } else if (rpt[1] == WM_WRITE_SPEAKER_DATA && (!SConfig::GetInstance().m_WiimoteEnableSpeaker || (!wm->m_status.speaker || wm->m_speaker_mute))) { // Translate speaker data reports into rumble reports. rpt[1] = WM_RUMBLE; // Keep only the rumble bit. rpt[2] &= 0x1; rpt.resize(3); } WriteReport(std::move(rpt)); }
void Scene::renderGameStatistics() { // Show intro if( m_fTimer < 3.0f ) { scene->renderFont( 255, 0, 255, 0, 3.0f, GAME_WIDTH / 2.0f, 30.0f, HGETEXT_CENTER, "-=SURVIVAL=-" ); } // Show statistics std::string atp( "attempts: " ); atp += std::to_string( attempts ); renderFont( 255, 128, 128, 128, 1.0f, GAME_WIDTH - 140.0f, 10.0f, HGETEXT_LEFT, atp ); std::string str( "health: "); int health = static_cast<int>( objects->getTank( )->getHealth( ) * 100 ); str += std::to_string( health ); renderFont( 255, 128, 128, 128, 1.0f, GAME_WIDTH - 140.0f, 40.0f, HGETEXT_LEFT, str ); std::string timer( "timer: "); timer += std::to_string( static_cast<int>(SURVIVAL_TIME) - static_cast<int>(m_fTimer) ); timer += "s"; renderFont( 255, 128, 128, 128, 1.0f, GAME_WIDTH - 140.0f, 70.0f, HGETEXT_LEFT, timer ); std::string bst( "beasts: ") ; bst += std::to_string( objects->getDeadBeastQuantity( ) ); renderFont( 255, 128, 128, 128, 1.0f, 10.0f, 10.0f, HGETEXT_LEFT, bst ); std::string dmn( "daemons: "); dmn += std::to_string( objects->getDeadDaemonQuantity( ) ); renderFont( 255, 128, 128, 128, 1.0f, 10.0f, 40.0f, HGETEXT_LEFT, dmn ); std::string rpt( "reptiles: "); rpt += std::to_string( objects->getDeadReptileQuantity( ) ); renderFont( 255, 128, 128, 128, 1.0f, 10.0f, 70.0f, HGETEXT_LEFT, rpt ); std::string blt( "bullets: "); blt += std::to_string( Weapon::getBulletsQuantity( ) ); renderFont( 255, 128, 128, 128, 1.0f, 10.0f, GAME_HEIGHT - 90.0f, HGETEXT_LEFT, blt ); std::string shl( "shells: "); shl += std::to_string( Weapon::getShellsQuantity( ) ); renderFont( 255, 128, 128, 128, 1.0f, 10.0f, GAME_HEIGHT - 60.0f, HGETEXT_LEFT, shl ); std::string rct( "rockets: "); rct += std::to_string( Weapon::getRocketsQuantity( ) ); renderFont( 255, 128, 128, 128, 1.0f, 10.0f, GAME_HEIGHT - 30.0f, HGETEXT_LEFT, rct ); }
void CDummyCalendarApp::AddEntryL(TInt aNumToAdd, TBool isParent, TBool isRepeat) { test.Next(_L("Adding entries")); TBuf<50> summary; TBuf<50> location; TBuf<50> description; iEntries.ResetAndDestroy(); for (TInt index=0; index<aNumToAdd; index++) { TBuf8<255> buf; buf.Append(_L("GuidId")); buf.AppendNum(index); HBufC8* guid = buf.AllocLC(); // need to be pushed to ... CCalEntry::TType entryType=(index%2==0)?CCalEntry::ETodo:CCalEntry::EAppt; CCalEntry* entry = NULL; if(isParent) { entry = CreateCalEntryL(entryType, guid); } else { TTime localTime(KRecurrIdLocalTime); TCalTime recurrenceId; recurrenceId.SetTimeLocalL(localTime); entry = CCalEntry::NewL(entryType, guid, CCalEntry::EMethodAdd, 1, recurrenceId, CalCommon::EThisAndFuture); } CleanupStack::Pop(guid); iEntries.AppendL(entry); TInt year = -1; TInt month = -1; TInt day = -1; if (isParent) { year = index % 5 + 2001; // Any year in the range: 2001 - 2005 month = index % 12; day = index % 28; } else { // if this is a child entry, use the recurrence local time as the entry start time // so it won't be out of range TCalTime recurrId = entry->RecurrenceIdL(); TDateTime localTime = recurrId.TimeLocalL().DateTime(); year = localTime.Year(); month = localTime.Month(); day = localTime.Day(); } TTime start(TDateTime(year, (TMonth)month, day, 0, 0, 0, 0)); TTime end(TDateTime(year, (TMonth)month, day, 0, 0, 0, 0)); end += TTimeIntervalDays(1); SetEntryStartAndEndTimeL(entry,start,end); RandomText(summary); entry->SetSummaryL(summary); RandomText(location); entry->SetLocationL(location); RandomText(description); entry->SetDescriptionL(description); if(isRepeat) { //create a daily repeat rule and make sure its repeat start\end date is within the deleting time range TCalRRule rpt(TCalRRule::EDaily); rpt.SetInterval(1); TCalTime repeatStart; TCalTime repeatend; if(isParent) { //make sure the repeat time is within the delete time range repeatStart.SetTimeLocalL(TDateTime(2000, EJune, 0, 0, 0, 0, 0)); repeatend.SetTimeLocalL(TDateTime(2006, EJune, 0, 0, 0, 0, 0)); } else if (index<aNumToAdd/2) { // if this is a child entry, use the entry's recurrance time as repeating rule // start time TCalTime recurrId = entry->RecurrenceIdL(); // make sure the repeat time is within the delete time range for the first half entries repeatStart.SetTimeLocalL(recurrId.TimeLocalL()); // June 1, 2003 00:00:00 repeatend.SetTimeLocalL(recurrId.TimeLocalL() + TTimeIntervalMonths(1)); // July 1, 2003 00:00:00 } else { //make sure the repeat time is out of the delete time range for the second half entries repeatStart.SetTimeLocalL(TDateTime(2003, EJune, 0, 0, 0, 0, 0)); repeatend.SetTimeLocalL(TDateTime(2007, EJune, 0, 0, 0, 0, 0)); } rpt.SetDtStart(repeatStart); rpt.SetUntil(repeatend); entry->SetRRuleL(rpt); } } TInt entriesStored(0); iLocalEntryView->StoreL(iEntries, entriesStored); //temp test(entriesStored == iEntries.Count()); }
main () { term x, n; type t; term plus_omega, omega_2, plus_omega_2, plus_omega_n, omega_n, omega_omega, plus_omega_omega; term f, p; param_out.fd = stdout; param_err.fd = stderr; init (); /* Exemple : construction de l'ordinal omega * 2 */ x = ap (LIM, ap (ap (S(ORD,ORD,ORD), ap (ap (S(ORD,fnc(ORD,ORD),fnc(ORD,ORD)),rep(ORD)), ap(K(fnc(ORD,ORD),ORD),SUC))), ap(K(ORD,ORD),ap(LIM,I(ORD))))); sput ("x = ", out); write_term (x, out); t = type_term (x); sput ("\nt = ", out); write_type (t, out); sput ("\n", out); n = var ("n", ORD); /* x = ap (LIM, lambda (n, ap (ap (ap (rep(ORD), n), SUC), ap (LIM, I(ORD))) )); */ x = ap (ap (ap (rep(ORD), n), SUC), ap (LIM, I(ORD))); /* x = ap (rep(ORD), n); */ sput ("x = ", out); write_term (x, out); t = type_term (x); sput ("\nt = ", out); write_type (t, out); sput ("\n", out); x = lambda (n, x); sput ("x = ", out); write_term (x, out); t = type_term (x); sput ("\nt = ", out); write_type (t, out); sput ("\n", out); x = ap (LIM, x); sput ("x = ", out); write_term (x, out); t = type_term (x); sput ("\nt = ", out); write_type (t, out); sput ("\n", out); x = var ("x", ORD); plus_omega = lambda (x, lim (lambda (n, rpt (ORD, n, SUC, x) ))); omega_2 = lim (lambda (n, rpt (ORD, n, plus_omega, ZERO))); t = type_term (omega_2); sput ("Type of omega_2 = ", out); write_type (t, out); sput ("\n", out); plus_omega_2 = lambda (x, lim (lambda (n, rpt (ORD, n, plus_omega, x)))); t = type_term (plus_omega_2); sput ("Type of plus_omega_2 is ", out); write_type (t, out); f = var ("f", fnc(ORD,ORD)); p = var ("p", ORD); plus_omega_n = lambda (n, rpt (fnc(ORD,ORD), n, lambda (f, lambda (x, lim (lambda (p, rpt (ORD, p, f, x)))) ), SUC)); /* next_power = lambda (f, lambda (x, lim (lambda (p, rpt (ORD, p, f, x))))); plus_omega_n = lambda (n, rpt (fnc(ORD,ORD), n, */ t = type_term (plus_omega_n); sput ("\nType of plus_omega_n is ", out); write_type (t, out); omega_n = lambda (n, ap (ap (plus_omega_n, n), ZERO)); t = type_term (omega_n); sput ("\nType of omega_n is ", out); write_type (t, out); omega_omega = lim (omega_n); t = type_term (omega_omega); sput ("\nType of omega_omega is ", out); write_type (t, out); plus_omega_omega = lambda (x, lim (lambda (n, ap (ap (plus_omega_n, n), x) ))); t = type_term (plus_omega_omega); sput ("\nType of plus_omega_omega is ", out); write_type (t, out); sput ("\n", out); }
void CCrashHandler::GenerateErrorReport(PEXCEPTION_POINTERS pExInfo) { CExceptionReport rpt(pExInfo); CMainDlg mainDlg; CZLib zlib; CString sTempFileName = CUtility::getTempFileName(); unsigned int i; // let client add application specific files to report if (m_lpfnCallback && !m_lpfnCallback(this)) return; //Определеяем, что делать с отчетом DumpType dumpType = Referenced;//По умолчанию сбрасываем только ту память, на которую идут ссылки в стеке ActionType actionType = GUI;//По умолчанию - выводим пользователю диалог CString action, storeFolder, dump; ATL::CRegKey rk; //Читаем из ключа с именем приложения int32_t lRet = rk.Open(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cognitive Technologies Ltd.\\CuneiForm\\PumaCrashRpt\\") + CUtility::getAppName(), KEY_QUERY_VALUE); if(lRet != ERROR_SUCCESS) { //Читаем из дефолтного ключа lRet = rk.Open(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cognitive Technologies Ltd.\\CuneiForm\\PumaCrashRpt\\Default"), KEY_QUERY_VALUE); } if(lRet == ERROR_SUCCESS) { //Читаем дейтсвие uint32_t dwBufLen = 1000; rk.QueryValue(action.GetBuffer(1000), "Action", &dwBufLen); action.ReleaseBuffer(MAX(dwBufLen - 1, 0)); //Читаем папку для автосохранения dwBufLen = 1000; rk.QueryValue(storeFolder.GetBuffer(1000), "StoreFolder", &dwBufLen); storeFolder.ReleaseBuffer(MAX(dwBufLen - 1, 0)); //Читаем тип дампа dwBufLen = 1000; rk.QueryValue(dump.GetBuffer(1000), "DumpType", &dwBufLen); dump.ReleaseBuffer(MAX(dwBufLen - 1, 0)); rk.Close(); if (!action.IsEmpty()) { if (action.CompareNoCase("GUI") == 0) actionType = GUI; else if (action.CompareNoCase("QuietStore") == 0) actionType = QuietStore; else if (action.CompareNoCase("NoAction") == 0) actionType = NoAction; } if (!dump.IsEmpty()) { if (dump.CompareNoCase("Mini") == 0) dumpType = Mini; else if (dump.CompareNoCase("Referenced") == 0) dumpType = Referenced; else if (dump.CompareNoCase("Full") == 0) dumpType = Full; } if (storeFolder.CompareNoCase("Temp folder") == 0) storeFolder = getenv("TEMP"); } if (actionType == NoAction) return; // add crash files to report m_files[rpt.getCrashFile(dumpType)] = CString((const char *)IDS_CRASH_DUMP); m_files[rpt.getCrashLog()] = CString((const char *)IDS_CRASH_LOG); // add symbol files to report for (i = 0; i < (uint)rpt.getNumSymbolFiles(); i++) m_files[(const char *)rpt.getSymbolFile(i)] = CString((const char *)IDS_SYMBOL_FILE); // zip the report if (!zlib.Open(sTempFileName)) return; // add report files to zip TStrStrMap::iterator cur = m_files.begin(); for (i = 0; i < m_files.size(); i++, cur++) zlib.AddFile((*cur).first); zlib.Close(); if (actionType == GUI) { // display main dialog mainDlg.m_pUDFiles = &m_files; //Сохраняем флаги по исключениям с плавающей точкой - кто-то их злобно сбрасывает при показе диалога uint oldFpState = _controlfp(0, 0); if (IDOK == mainDlg.DoModal()) { if (m_sTo.IsEmpty() || !MailReport(rpt, sTempFileName, mainDlg.m_sEmail, mainDlg.m_sDescription)) { SaveReport(rpt, sTempFileName); } } //Восстанавливаем флаги _controlfp(oldFpState, _MCW_DN | _MCW_EM | _MCW_IC | _MCW_RC | _MCW_PC); } else if (actionType == QuietStore) { // Just in-case it already exist ::DeleteFile(storeFolder + '\\' + CUtility::formatSaveFileName() + ".zip"); ::CopyFile(sTempFileName, storeFolder + '\\' + CUtility::formatSaveFileName() + ".zip", TRUE); } DeleteFile(sTempFileName); }
void start_echo() { start_process(sample_sound()); start_process(capture_command(),1); start_process(echo_control(),1); start_process(rpt(),1); }