diff --git a/src/cheat/CheatManager.cxx b/src/cheat/CheatManager.cxx index 23e6483da..b3ca9dc60 100644 --- a/src/cheat/CheatManager.cxx +++ b/src/cheat/CheatManager.cxx @@ -255,7 +255,7 @@ void CheatManager::saveCheatDatabase() stringstream out; for(const auto& [md5, cheat]: myCheatMap) - out << "\"" << md5 << "\" " << "\"" << cheat << "\"" << endl; + out << "\"" << md5 << "\" " << "\"" << cheat << "\"\n"; try { myOSystem.cheatFile().write(out); } catch(...) { return; } diff --git a/src/common/EventHandlerSDL2.cxx b/src/common/EventHandlerSDL2.cxx index 50705845f..cce6b0974 100644 --- a/src/common/EventHandlerSDL2.cxx +++ b/src/common/EventHandlerSDL2.cxx @@ -41,7 +41,8 @@ EventHandlerSDL2::EventHandlerSDL2(OSystem& osystem) if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0) { ostringstream buf; - buf << "ERROR: Couldn't initialize SDL joystick support: " << SDL_GetError() << endl; + buf << "ERROR: Couldn't initialize SDL joystick support: " + << SDL_GetError() << '\n'; Logger::error(buf.str()); } Logger::debug("EventHandlerSDL2::EventHandlerSDL2 SDL_INIT_JOYSTICK"); diff --git a/src/common/FBBackendSDL2.cxx b/src/common/FBBackendSDL2.cxx index 804360c99..3f2303997 100644 --- a/src/common/FBBackendSDL2.cxx +++ b/src/common/FBBackendSDL2.cxx @@ -394,7 +394,7 @@ bool FBBackendSDL2::adaptRefreshRate(Int32 displayIndex, // cerr << "required (" << currentRefreshRate << " Hz -> " << adaptedSdlMode.refresh_rate << " Hz)"; //else // cerr << "not required/possible"; - //cerr << endl; + //cerr << '\n'; // Only change if the display supports a better refresh rate return adapt; @@ -425,7 +425,7 @@ bool FBBackendSDL2::createRenderer() if(recreate) { - //cerr << "Create new renderer for buffer type #" << int(myBufferType) << endl; + //cerr << "Create new renderer for buffer type #" << int(myBufferType) << '\n'; if(myRenderer) SDL_DestroyRenderer(myRenderer); @@ -471,18 +471,18 @@ string FBBackendSDL2::about() const ASSERT_MAIN_THREAD; ostringstream out; - out << "Video system: " << SDL_GetCurrentVideoDriver() << endl; + out << "Video system: " << SDL_GetCurrentVideoDriver() << '\n'; SDL_RendererInfo info; if(SDL_GetRendererInfo(myRenderer, &info) >= 0) { - out << " Renderer: " << info.name << endl; + out << " Renderer: " << info.name << '\n'; if(info.max_texture_width > 0 && info.max_texture_height > 0) out << " Max texture: " << info.max_texture_width << "x" - << info.max_texture_height << endl; + << info.max_texture_height << '\n'; out << " Flags: " << ((info.flags & SDL_RENDERER_PRESENTVSYNC) ? "+" : "-") << "vsync, " << ((info.flags & SDL_RENDERER_ACCELERATED) ? "+" : "-") << "accel" - << endl; + << '\n'; } return out.str(); } diff --git a/src/common/FBSurfaceSDL2.cxx b/src/common/FBSurfaceSDL2.cxx index 2de4aa737..d52f8f276 100644 --- a/src/common/FBSurfaceSDL2.cxx +++ b/src/common/FBSurfaceSDL2.cxx @@ -48,7 +48,7 @@ FBSurfaceSDL2::FBSurfaceSDL2(FBBackendSDL2& backend, : myBackend{backend}, myInterpolationMode{inter} { - //cerr << width << " x " << height << endl; + //cerr << width << " x " << height << '\n'; createSurface(width, height, staticData); } diff --git a/src/common/FSNodeZIP.cxx b/src/common/FSNodeZIP.cxx index a122da148..086d88483 100644 --- a/src/common/FSNodeZIP.cxx +++ b/src/common/FSNodeZIP.cxx @@ -46,7 +46,7 @@ FSNodeZIP::FSNodeZIP(string_view p) #endif } -// cerr << " => p: " << p << endl; +// cerr << " => p: " << p << '\n'; // Open file at least once to initialize the virtual file count try @@ -104,7 +104,7 @@ FSNodeZIP::FSNodeZIP(string_view p) setFlags(_zipFile, _virtualPath, _realNode); // cerr << "==============================================================\n"; -// cerr << _name << ", file: " << _isFile << ", dir: " << _isDirectory << endl << endl; +// cerr << _name << ", file: " << _isFile << ", dir: " << _isDirectory << "\n\n"; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -114,7 +114,7 @@ FSNodeZIP::FSNodeZIP(const string& zipfile, const string& virtualpath, _isDirectory{isdir}, _isFile{!isdir} { -// cerr << "=> c'tor 2: " << zipfile << ", " << virtualpath << ", " << isdir << endl; +// cerr << "=> c'tor 2: " << zipfile << ", " << virtualpath << ", " << isdir << '\n'; setFlags(zipfile, virtualpath, realnode); } diff --git a/src/common/FSNodeZIP.hxx b/src/common/FSNodeZIP.hxx index cfdce74f2..c02b74b9c 100644 --- a/src/common/FSNodeZIP.hxx +++ b/src/common/FSNodeZIP.hxx @@ -77,12 +77,12 @@ class FSNodeZIP : public AbstractFSNode friend ostream& operator<<(ostream& os, const FSNodeZIP& node) { - os << "_zipFile: " << node._zipFile << endl - << "_virtualPath: " << node._virtualPath << endl - << "_name: " << node._name << endl - << "_path: " << node._path << endl - << "_size: " << node._size << endl - << "_shortPath: " << node._shortPath << endl; + os << "_zipFile: " << node._zipFile << '\n' + << "_virtualPath: " << node._virtualPath << '\n' + << "_name: " << node._name << '\n' + << "_path: " << node._path << '\n' + << "_size: " << node._size << '\n' + << "_shortPath: " << node._shortPath << '\n'; return os; } diff --git a/src/common/Logger.cxx b/src/common/Logger.cxx index 3290def1a..ab3788a32 100644 --- a/src/common/Logger.cxx +++ b/src/common/Logger.cxx @@ -55,7 +55,7 @@ void Logger::logMessage(string_view message, Level level) if(level == Logger::Level::ERR) { - cout << message << endl << std::flush; + cout << message << '\n' << std::flush; myLogMessages += message; myLogMessages += "\n"; } @@ -63,7 +63,7 @@ void Logger::logMessage(string_view message, Level level) level == Logger::Level::ALWAYS) { if(myLogToConsole) - cout << message << endl << std::flush; + cout << message << '\n' << std::flush; myLogMessages += message; myLogMessages += "\n"; } diff --git a/src/common/MouseControl.cxx b/src/common/MouseControl.cxx index a915a8f63..aece01bf3 100644 --- a/src/common/MouseControl.cxx +++ b/src/common/MouseControl.cxx @@ -134,7 +134,7 @@ MouseControl::MouseControl(Console& console, string_view mode) #if 0 for(const auto& m: myModeList) - cerr << m << endl; + cerr << m << '\n'; #endif } diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index bb34af6e2..513b5fe7a 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -173,8 +173,8 @@ void PhysicalJoystickHandler::addToDatabase(const PhysicalJoystickPtr& stick) } ostringstream buf; - buf << "Added joystick " << stick->ID << ":" << endl - << " " << stick->about() << endl; + buf << "Added joystick " << stick->ID << ":\n" + << " " << stick->about() << '\n'; Logger::info(buf.str()); } @@ -194,8 +194,8 @@ bool PhysicalJoystickHandler::remove(int id) if(it != myDatabase.end() && it->second.joy == stick) { ostringstream buf; - buf << "Removed joystick " << mySticks[id]->ID << ":" << endl - << " " << mySticks[id]->about() << endl; + buf << "Removed joystick " << mySticks[id]->ID << ":\n" + << " " << mySticks[id]->about() << '\n'; Logger::info(buf.str()); // Remove joystick, but remember mapping @@ -263,8 +263,8 @@ bool PhysicalJoystickHandler::mapStelladaptors(string_view saport, int ID) { // Erase a previously added Stelladapter with a higher ID ostringstream buf; - buf << "Erased joystick " << _stick->ID << ":" << endl - << " " << _stick->about() << endl; + buf << "Erased joystick " << _stick->ID << ":\n" + << " " << _stick->about() << '\n'; Logger::info(buf.str()); _stick->name.erase(pos); @@ -1105,17 +1105,17 @@ PhysicalJoystickHandler::MinStrickInfoList PhysicalJoystickHandler::minStickList // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh) { - os << "---------------------------------------------------------" << endl - << "joy database:" << endl; + os << "---------------------------------------------------------\n" + << "joy database:\n"; for(const auto& [_name, _info]: jh.myDatabase) - os << _name << endl << _info << endl << endl; + os << _name << '\n' << _info << '\n\n'; - os << "---------------------" << endl - << "joy active:" << endl; + os << "---------------------\n" + << "joy active:\n"; for(const auto& [_id, _joyptr]: jh.mySticks) - os << _id << ": " << *_joyptr << endl; + os << _id << ": " << *_joyptr << '\n'; os << "---------------------------------------------------------" - << endl << endl << endl; + << '\n\n\n'; return os; } diff --git a/src/common/PJoystickHandler.hxx b/src/common/PJoystickHandler.hxx index d1514ba22..a732ae613 100644 --- a/src/common/PJoystickHandler.hxx +++ b/src/common/PJoystickHandler.hxx @@ -72,7 +72,7 @@ class PhysicalJoystickHandler PhysicalJoystickPtr joy; friend ostream& operator<<(ostream& os, const StickInfo& si) { - os << " joy: " << si.joy << endl << " map: " << si.mapping; + os << " joy: " << si.joy << "\n map: " << si.mapping; return os; } }; diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL2.cxx index 7a0b1d206..8b733f015 100644 --- a/src/common/SoundSDL2.cxx +++ b/src/common/SoundSDL2.cxx @@ -46,8 +46,8 @@ SoundSDL2::SoundSDL2(OSystem& osystem, AudioSettings& audioSettings) { ostringstream buf; - buf << "WARNING: Failed to initialize SDL audio system! " << endl - << " " << SDL_GetError() << endl; + buf << "WARNING: Failed to initialize SDL audio system! \n" + << " " << SDL_GetError() << '\n'; Logger::error(buf.str()); return; } @@ -126,8 +126,8 @@ bool SoundSDL2::openDevice() { ostringstream buf; - buf << "WARNING: Couldn't open SDL audio device! " << endl - << " " << SDL_GetError() << endl; + buf << "WARNING: Couldn't open SDL audio device! \n" + << " " << SDL_GetError() << '\n'; Logger::error(buf.str()); return myIsInitializedFlag = false; @@ -260,51 +260,51 @@ void SoundSDL2::adjustVolume(int direction) string SoundSDL2::about() const { ostringstream buf; - buf << "Sound enabled:" << endl - << " Volume: " << myAudioSettings.volume() << "%" << endl - << " Device: " << myDevices.at(myDeviceId).first << endl + buf << "Sound enabled:\n" + << " Volume: " << myAudioSettings.volume() << "%\n" + << " Device: " << myDevices.at(myDeviceId).first << '\n' << " Channels: " << static_cast(myHardwareSpec.channels) - << (myAudioQueue->isStereo() ? " (Stereo)" : " (Mono)") << endl + << (myAudioQueue->isStereo() ? " (Stereo)" : " (Mono)") << '\n' << " Preset: "; switch(myAudioSettings.preset()) { case AudioSettings::Preset::custom: - buf << "Custom" << endl; + buf << "Custom\n"; break; case AudioSettings::Preset::lowQualityMediumLag: - buf << "Low quality, medium lag" << endl; + buf << "Low quality, medium lag\n"; break; case AudioSettings::Preset::highQualityMediumLag: - buf << "High quality, medium lag" << endl; + buf << "High quality, medium lag\n"; break; case AudioSettings::Preset::highQualityLowLag: - buf << "High quality, low lag" << endl; + buf << "High quality, low lag\n"; break; case AudioSettings::Preset::ultraQualityMinimalLag: - buf << "Ultra quality, minimal lag" << endl; + buf << "Ultra quality, minimal lag\n"; break; } buf << " Fragment size: " << static_cast(myHardwareSpec.samples) - << " bytes" << endl + << " bytes\n" << " Sample rate: " << static_cast(myHardwareSpec.freq) - << " Hz" << endl; + << " Hz\n"; buf << " Resampling: "; switch(myAudioSettings.resamplingQuality()) { case AudioSettings::ResamplingQuality::nearestNeightbour: - buf << "Quality 1, nearest neighbor" << endl; + buf << "Quality 1, nearest neighbor\n"; break; case AudioSettings::ResamplingQuality::lanczos_2: - buf << "Quality 2, Lanczos (a = 2)" << endl; + buf << "Quality 2, Lanczos (a = 2)\n"; break; case AudioSettings::ResamplingQuality::lanczos_3: - buf << "Quality 3, Lanczos (a = 3)" << endl; + buf << "Quality 3, Lanczos (a = 3)\n"; break; } buf << " Headroom: " << std::fixed << std::setprecision(1) - << (0.5 * myAudioSettings.headroom()) << " frames" << endl + << (0.5 * myAudioSettings.headroom()) << " frames\n" << " Buffer size: " << std::fixed << std::setprecision(1) - << (0.5 * myAudioSettings.bufferSize()) << " frames" << endl; + << (0.5 * myAudioSettings.bufferSize()) << " frames\n"; return buf.str(); } diff --git a/src/common/StateManager.cxx b/src/common/StateManager.cxx index 439156810..92dd08d1d 100644 --- a/src/common/StateManager.cxx +++ b/src/common/StateManager.cxx @@ -339,7 +339,7 @@ bool StateManager::loadState(Serializer& in) } catch(...) { - cerr << "ERROR: StateManager::loadState(Serializer&)" << endl; + cerr << "ERROR: StateManager::loadState(Serializer&)\n"; } return false; } @@ -366,7 +366,7 @@ bool StateManager::saveState(Serializer& out) } catch(...) { - cerr << "ERROR: StateManager::saveState(Serializer&)" << endl; + cerr << "ERROR: StateManager::saveState(Serializer&)\n"; } return false; } diff --git a/src/common/ThreadDebugging.cxx b/src/common/ThreadDebugging.cxx index a0b1f7cad..d3fc05102 100644 --- a/src/common/ThreadDebugging.cxx +++ b/src/common/ThreadDebugging.cxx @@ -28,7 +28,7 @@ ThreadDebuggingHelper& ThreadDebuggingHelper::instance() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ThreadDebuggingHelper::fail(const string& message) { - cerr << message << endl; + cerr << message << '\n'; throw runtime_error(message); } diff --git a/src/common/ZipHandler.cxx b/src/common/ZipHandler.cxx index 15a08d8fb..f2f828996 100644 --- a/src/common/ZipHandler.cxx +++ b/src/common/ZipHandler.cxx @@ -194,8 +194,8 @@ void ZipHandler::addToCache() cerr << "\nCACHE contents:\n"; for(cachenum = 0; cachenum < myZipCache.size(); ++cachenum) if(myZipCache[cachenum] != nullptr) - cerr << " " << cachenum << " : " << myZipCache[cachenum]->filename << endl; - cerr << endl; + cerr << " " << cachenum << " : " << myZipCache[cachenum]->filename << '\n'; + cerr << '\n'; #endif } diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx index 27de24dae..35d0626ce 100644 --- a/src/common/bspf.hxx +++ b/src/common/bspf.hxx @@ -60,7 +60,6 @@ using uInt64 = uint64_t; using std::cin; using std::cout; using std::cerr; -using std::endl; using std::string; using std::string_view; using std::istream; diff --git a/src/common/main.cxx b/src/common/main.cxx index d686da88e..8e79f361e 100644 --- a/src/common/main.cxx +++ b/src/common/main.cxx @@ -114,7 +114,7 @@ void parseCommandLine(int ac, const char* const av[], if(++i >= ac) { - cerr << "Missing argument for '" << key << "'" << endl; + cerr << "Missing argument for '" << key << "'\n"; continue; } if(key == "basedir" || key == "break") @@ -127,12 +127,12 @@ void parseCommandLine(int ac, const char* const av[], } #if 0 - cout << "Global opts:" << endl; + cout << "Global opts:\n"; for(const auto& [key, value]: globalOpts) - cout << " -> " << key << ": " << value << endl; - cout << "Local opts:" << endl; + cout << " -> " << key << ": " << value << '\n'; + cout << "Local opts:\n"; for(const auto& [key, value]: localOpts) - cout << " -> " << key << ": " << value << endl; + cout << " -> " << key << ": " << value << '\n'; #endif } @@ -180,7 +180,7 @@ void attachConsole() SetConsoleCursorPosition(hConsole, pos); } else - cout << endl << endl; + cout << "\n\n"; #endif } @@ -188,7 +188,7 @@ void attachConsole() void freeConsole() { #if defined(BSPF_WINDOWS) - cout << "Press \"Enter\"" << endl << std::flush; + cout << "Press \"Enter\"" << '\n' << std::flush; FreeConsole(); #endif } @@ -213,7 +213,7 @@ int main(int ac, char* av[]) } catch(const runtime_error& e) { - cerr << e.what() << endl; + cerr << e.what() << '\n'; return 0; } } diff --git a/src/common/repository/KeyValueRepositoryConfigfile.cxx b/src/common/repository/KeyValueRepositoryConfigfile.cxx index 31d5ae58c..af417069d 100644 --- a/src/common/repository/KeyValueRepositoryConfigfile.cxx +++ b/src/common/repository/KeyValueRepositoryConfigfile.cxx @@ -62,24 +62,24 @@ KVRMap KeyValueRepositoryConfigfile::load(istream& in) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool KeyValueRepositoryConfigfile::save(ostream& out, const KVRMap& values) { - out << "; Stella configuration file" << endl - << ";" << endl - << "; Lines starting with ';' are comments and are ignored." << endl - << "; Spaces and tabs are ignored." << endl - << ";" << endl - << "; Format MUST be as follows:" << endl - << "; command = value" << endl - << ";" << endl - << "; Commands are the same as those specified on the commandline," << endl - << "; without the '-' character." << endl - << ";" << endl - << "; Values are the same as those allowed on the commandline." << endl - << "; Boolean values are specified as 1 (or true) and 0 (or false)" << endl - << ";" << endl; + out << "; Stella configuration file\n" + << ";\n" + << "; Lines starting with ';' are comments and are ignored.\n" + << "; Spaces and tabs are ignored.\n" + << ";\n" + << "; Format MUST be as follows:\n" + << "; command = value\n" + << ";\n" + << "; Commands are the same as those specified on the commandline,\n" + << "; without the '-' character.\n" + << ";\n" + << "; Values are the same as those allowed on the commandline.\n" + << "; Boolean values are specified as 1 (or true) and 0 (or false)\n" + << ";\n"; // Write out each of the key and value pairs for(const auto& [key, value]: values) - out << key << " = " << value << endl; + out << key << " = " << value << '\n'; return true; } diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 507aa7efe..c3f32fee7 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -232,7 +232,7 @@ string CartDebug::toString() if(j == 0x07) buf << " "; } - buf << endl; + buf << '\n'; } return buf.str(); @@ -453,7 +453,7 @@ string CartDebug::disassembleLines(uInt16 start, uInt16 lines) const buffer << tag.disasm << std::setw(static_cast(length - tag.disasm.length() + 2)) << std::setfill(' ') << " " - << std::setw(4) << std::left << tag.ccount << " " << tag.bytes << endl; + << std::setw(4) << std::left << tag.ccount << " " << tag.bytes << '\n'; } return buffer.str(); @@ -1037,12 +1037,11 @@ string CartDebug::saveConfigFile() // Store all bank information stringstream out; - out << "// Stella.pro: \"" << name << "\"" << endl - << "// MD5: " << md5 << endl - << endl; + out << "// Stella.pro: \"" << name << "\"\n" + << "// MD5: " << md5 << "\n\n"; for(uInt32 b = 0; b < myConsole.cartridge().romBankCount(); ++b) { - out << "[" << b << "]" << endl; + out << "[" << b << "]\n"; getBankDirectives(out, myBankInfo[b]); } @@ -1462,25 +1461,25 @@ string CartDebug::listConfig(int bank) } ostringstream buf; - buf << "(items marked '*' are user-defined)" << endl; + buf << "(items marked '*' are user-defined)\n"; for(uInt32 b = startbank; b < endbank; ++b) { const BankInfo& info = myBankInfo[b]; - buf << "Bank [" << b << "]" << endl; + buf << "Bank [" << b << "]\n"; for(const auto& i: info.directiveList) { if(i.type != Device::NONE) { buf << "(*) "; AccessTypeAsString(buf, i.type); - buf << " " << Base::HEX4 << i.start << " " << Base::HEX4 << i.end << endl; + buf << " " << Base::HEX4 << i.start << " " << Base::HEX4 << i.end << '\n'; } } getBankDirectives(buf, info); } if(myConsole.cartridge().romBankCount() > 1) - buf << DebuggerParser::red("config file for multi-bank ROM not fully supported") << endl; + buf << DebuggerParser::red("config file for multi-bank ROM not fully supported") << '\n'; return buf.str(); } @@ -1569,7 +1568,7 @@ CartDebug::AddrType CartDebug::addressType(uInt16 addr) void CartDebug::getBankDirectives(ostream& buf, const BankInfo& info) const { // Start with the offset for this bank - buf << "ORG " << Base::HEX4 << info.offset << endl; + buf << "ORG " << Base::HEX4 << info.offset << '\n'; // Now consider each byte uInt32 prev = info.offset, addr = prev + 1; @@ -1582,7 +1581,7 @@ void CartDebug::getBankDirectives(ostream& buf, const BankInfo& info) const if(currType != prevType) { AccessTypeAsString(buf, prevType); - buf << " " << Base::HEX4 << prev << " " << Base::HEX4 << (addr-1) << endl; + buf << " " << Base::HEX4 << prev << " " << Base::HEX4 << (addr-1) << '\n'; prev = addr; prevType = currType; @@ -1593,7 +1592,7 @@ void CartDebug::getBankDirectives(ostream& buf, const BankInfo& info) const if(prev != addr) { AccessTypeAsString(buf, prevType); - buf << " " << Base::HEX4 << prev << " " << Base::HEX4 << (addr-1) << endl; + buf << " " << Base::HEX4 << prev << " " << Base::HEX4 << (addr-1) << '\n'; } } @@ -1610,13 +1609,13 @@ void CartDebug::accessTypeAsString(ostream& buf, uInt16 addr) const debugger = myDebugger.getAccessFlags(addr) & 0xFC, label = myDisLabels[addr & 0xFFF]; - buf << endl << "directive: " << Base::toString(directive, Base::Fmt::_2_8) << " "; + buf << "\ndirective: " << Base::toString(directive, Base::Fmt::_2_8) << " "; AccessTypeAsString(buf, directive); - buf << endl << "emulation: " << Base::toString(debugger, Base::Fmt::_2_8) << " "; + buf << "\nemulation: " << Base::toString(debugger, Base::Fmt::_2_8) << " "; AccessTypeAsString(buf, debugger); - buf << endl << "tentative: " << Base::toString(label, Base::Fmt::_2_8) << " "; + buf << "\ntentative: " << Base::toString(label, Base::Fmt::_2_8) << " "; AccessTypeAsString(buf, label); - buf << endl; + buf << '\n'; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 8803677a7..fdd9d645d 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -172,13 +172,13 @@ string Debugger::autoExec(StringList* history) // autoexec.script is always run const FSNode autoexec(myOSystem.baseDir().getPath() + "autoexec.script"); - buf << "autoExec():" << endl - << myParser->exec(autoexec, history) << endl; + buf << "autoExec():\n" + << myParser->exec(autoexec, history) << '\n'; // Also, "romname.script" if present const string path = myOSystem.userDir().getPath() + myOSystem.romFile().getNameWithExt(".script"); const FSNode romname(path); - buf << myParser->exec(romname, history) << endl; + buf << myParser->exec(romname, history) << '\n'; // Init builtins for(const auto& func: ourBuiltinFunctions) @@ -188,7 +188,7 @@ string Debugger::autoExec(StringList* history) if(res == 0) addFunction(func.name, func.defn, YaccParser::getResult(), true); else - cerr << "ERROR in builtin function!" << endl; + cerr << "ERROR in builtin function!\n"; } return buf.str(); } @@ -857,7 +857,7 @@ string Debugger::builtinHelp() if(len > i_maxlen) i_maxlen = len; } - buf << std::setfill(' ') << endl << "Built-in functions:" << endl; + buf << std::setfill(' ') << "\nBuilt-in functions:\n"; for(const auto& func: ourBuiltinFunctions) { buf << std::setw(static_cast(c_maxlen)) << std::left << func.name @@ -865,7 +865,7 @@ string Debugger::builtinHelp() << std::setw(static_cast(i_maxlen)) << std::left << func.defn << std::setw(4) << "}" << func.help - << endl; + << '\n'; } // Get column widths for aligned output (pseudo-registers) @@ -876,13 +876,13 @@ string Debugger::builtinHelp() if(len > c_maxlen) c_maxlen = len; } - buf << endl << "Pseudo-registers:" << endl; + buf << "\nPseudo-registers:\n"; for(const auto& reg: ourPseudoRegisters) { buf << std::setw(static_cast(c_maxlen)) << std::left << reg.name << std::setw(2) << " " << std::setw(static_cast(i_maxlen)) << std::left << reg.help - << endl; + << '\n'; } return buf.str(); diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 8a8a4daae..2341f10a0 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -169,7 +169,7 @@ void DebuggerParser::outputCommandError(string_view errorMsg, int command) commandResult << red(errorMsg); if(!example.empty()) - commandResult << endl << example; + commandResult << '\n' << example; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -177,7 +177,7 @@ void DebuggerParser::outputCommandError(string_view errorMsg, int command) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DebuggerParser::getCompletions(string_view in, StringList& completions) { - // cerr << "Attempting to complete \"" << in << "\"" << endl; + // cerr << "Attempting to complete \"" << in << "\"\n"; for(const auto& c: commands) { if(BSPF::matchesCamelCase(c.cmdString, in)) @@ -317,9 +317,9 @@ string DebuggerParser::showWatches() argStrings.push_back(myWatches[i]); args.push_back(decipher_arg(argStrings[0])); if(args[0] < 0) - buf << "BAD WATCH " << (i+1) << ": " << argStrings[0] << endl; + buf << "BAD WATCH " << (i+1) << ": " << argStrings[0] << '\n'; else - buf << " watch #" << (i+1) << " (" << argStrings[0] << ") -> " << eval() << endl; + buf << " watch #" << (i+1) << " (" << argStrings[0] << ") -> " << eval() << '\n'; } } return buf.str(); @@ -341,7 +341,7 @@ bool DebuggerParser::getArgs(string_view command, string& verb) argStrings.clear(); args.clear(); - // cerr << "Parsing \"" << command << "\"" << ", length = " << command.length() << endl; + // cerr << "Parsing \"" << command << "\"" << ", length = " << command.length() << '\n'; // First, pick apart string into space-separated tokens. // The first token is the command verb, the rest go in an array @@ -368,7 +368,7 @@ bool DebuggerParser::getArgs(string_view command, string& verb) if(c == '}') { state = ParseState::IN_SPACE; argStrings.push_back(curArg); - // cerr << "{" << curArg << "}" << endl; + // cerr << "{" << curArg << "}\n"; curArg = ""; } else { curArg += c; @@ -410,7 +410,7 @@ bool DebuggerParser::getArgs(string_view command, string& verb) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool DebuggerParser::validateArgs(int cmd) { - // cerr << "entering validateArgs(" << cmd << ")" << endl; + // cerr << "entering validateArgs(" << cmd << ")\n"; const bool required = commands[cmd].parmsRequired; Parameters* p = commands[cmd].parms.data(); @@ -512,9 +512,9 @@ bool DebuggerParser::validateArgs(int cmd) } while(*p != Parameters::ARG_END_ARGS && curCount < argRequiredCount); /* -cerr << "curCount = " << curCount << endl - << "argRequiredCount = " << argRequiredCount << endl - << "*p = " << *p << endl << endl; +cerr << "curCount = " << curCount << '\n' + << "argRequiredCount = " << argRequiredCount << '\n' + << "*p = " << *p << "\n\n"; */ if(curCount < argRequiredCount) @@ -565,7 +565,7 @@ string DebuggerParser::eval() buf << " #" << static_cast(args[i]); if(i != argCount - 1) - buf << endl; + buf << '\n'; } return buf.str(); @@ -612,7 +612,7 @@ void DebuggerParser::printTimer(uInt32 idx, bool showHeader) else commandResult << " #| From | To | Execs| Avg. | Min. | Max. |"; } - commandResult << endl << Base::toString(idx) << "|" << labelFrom; + commandResult << '\n' << Base::toString(idx) << "|" << labelFrom; if(banked) { commandResult << "/" << setw(2) << setfill(' '); @@ -651,7 +651,7 @@ void DebuggerParser::printTimer(uInt32 idx, bool showHeader) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DebuggerParser::listTimers() { - commandResult << "timers:" << endl; + commandResult << "timers:\n"; for(uInt32 i = 0; i < debugger.m6502().numTimers(); ++i) printTimer(i, i == 0); @@ -662,7 +662,7 @@ void DebuggerParser::listTraps(bool listCond) { StringList names = debugger.m6502().getCondTrapNames(); - commandResult << (listCond ? "trapifs:" : "traps:") << endl; + commandResult << (listCond ? "trapifs:" : "traps:") << '\n'; for(uInt32 i = 0; i < names.size(); ++i) { const bool hasCond = !names[i].empty(); @@ -685,7 +685,7 @@ void DebuggerParser::listTraps(bool listCond) commandResult << " " << debugger.cartDebug().getLabel(myTraps[i]->end, true, 4); commandResult << trapStatus(*myTraps[i]); commandResult << " + mirrors"; - if(i != (names.size() - 1)) commandResult << endl; + if(i != (names.size() - 1)) commandResult << '\n'; } } } @@ -726,21 +726,21 @@ string DebuggerParser::saveScriptFile(string file) const Debugger::FunctionDefMap funcs = debugger.getFunctionDefMap(); for(const auto& [name, cmd]: funcs) if (!Debugger::isBuiltinFunction(name)) - out << "function " << name << " {" << cmd << "}" << endl; + out << "function " << name << " {" << cmd << "}\n"; for(const auto& w: myWatches) - out << "watch " << w << endl; + out << "watch " << w << '\n'; for(const auto& bp: debugger.breakPoints().getBreakpoints()) - out << "break " << Base::toString(bp.addr) << " " << Base::toString(bp.bank) << endl; + out << "break " << Base::toString(bp.addr) << " " << Base::toString(bp.bank) << '\n'; StringList conds = debugger.m6502().getCondBreakNames(); for(const auto& cond : conds) - out << "breakIf {" << cond << "}" << endl; + out << "breakIf {" << cond << "}\n"; conds = debugger.m6502().getCondSaveStateNames(); for(const auto& cond : conds) - out << "saveStateIf {" << cond << "}" << endl; + out << "saveStateIf {" << cond << "}\n"; StringList names = debugger.m6502().getCondTrapNames(); for(uInt32 i = 0; i < myTraps.size(); ++i) @@ -760,7 +760,7 @@ string DebuggerParser::saveScriptFile(string file) out << " " << Base::toString(myTraps[i]->begin); if(myTraps[i]->begin != myTraps[i]->end) out << " " << Base::toString(myTraps[i]->end); - out << endl; + out << '\n'; } // Append 'script' extension when necessary @@ -933,7 +933,7 @@ void DebuggerParser::executeBreak() const bool set = debugger.toggleBreakPoint(addr, i); if(i) - commandResult << endl; + commandResult << '\n'; if(set) commandResult << "set"; @@ -1009,9 +1009,9 @@ void DebuggerParser::executeCheat() { const string& cheat = argStrings[arg]; if(debugger.myOSystem.cheat().add("DBG", cheat)) - commandResult << "cheat code " << cheat << " enabled" << endl; + commandResult << "cheat code " << cheat << " enabled\n"; else - commandResult << red("invalid cheat code ") << cheat << endl; + commandResult << red("invalid cheat code ") << cheat << '\n'; } #else commandResult << red("Cheat support not enabled\n"); @@ -1253,7 +1253,7 @@ void DebuggerParser::executeDump() os << Base::toString(debugger.peek(j)) << " "; if(j == i+7 && j != end) os << "- "; } - os << endl; + os << '\n'; } }; @@ -1328,7 +1328,7 @@ void DebuggerParser::executeDump() << Base::toString(cpu.z()) << " " // Z (flag) << Base::toString(cpu.c()) << " " // C (flag) << Base::toString(0) << " " // unused - << endl; + << '\n'; commandResult << "CPU state"; if((args[2] & 0x04) != 0) commandResult << ", "; @@ -1354,7 +1354,7 @@ void DebuggerParser::executeDump() << Base::toString(debugger.peek(TIARegister::INPT5)) << " " << Base::toString(0) << " " // unused << Base::toString(0) << " " // unused - << endl; + << '\n'; commandResult << "switches and fire buttons"; } @@ -1483,7 +1483,7 @@ void DebuggerParser::executeHelp() commandResult << setfill(' '); for(const auto& c: commands) commandResult << setw(static_cast(clen)) << right << c.cmdString - << " - " << c.description << endl; + << " - " << c.description << '\n'; commandResult << Debugger::builtinHelp(); } @@ -1493,7 +1493,7 @@ void DebuggerParser::executeHelp() { if(argStrings[0] == c.cmdString) { - commandResult << " " << red(c.description) << endl << c.extendedDesc; + commandResult << " " << red(c.description) << '\n' << c.extendedDesc; break; } } @@ -1645,7 +1645,7 @@ void DebuggerParser::executeListBreaks() if(romBankCount == 1) { buf << debugger.cartDebug().getLabel(bp.addr, true, 4) << " "; - if(!(++count % 8)) buf << endl; + if(!(++count % 8)) buf << '\n'; } else { @@ -1656,23 +1656,23 @@ void DebuggerParser::executeListBreaks() buf << " #" << static_cast(bp.bank); else buf << " *"; - if(!(++count % 6)) buf << endl; + if(!(++count % 6)) buf << '\n'; } } if(count) - commandResult << "breaks:" << endl << buf.str(); + commandResult << "breaks:\n" << buf.str(); StringList conds = debugger.m6502().getCondBreakNames(); if(!conds.empty()) { if(count) - commandResult << endl; - commandResult << "BreakIfs:" << endl; + commandResult << '\n'; + commandResult << "BreakIfs:\n"; for(uInt32 i = 0; i < conds.size(); ++i) { commandResult << Base::toString(i) << ": " << conds[i]; - if(i != (conds.size() - 1)) commandResult << endl; + if(i != (conds.size() - 1)) commandResult << '\n'; } } @@ -1698,7 +1698,7 @@ void DebuggerParser::executeListFunctions() if(!functions.empty()) for(const auto& [name, cmd]: functions) - commandResult << name << " -> " << cmd << endl; + commandResult << name << " -> " << cmd << '\n'; else commandResult << "no user-defined functions"; } @@ -1710,11 +1710,11 @@ void DebuggerParser::executeListSaveStateIfs() StringList conds = debugger.m6502().getCondSaveStateNames(); if(!conds.empty()) { - commandResult << "saveStateIf:" << endl; + commandResult << "saveStateIf:\n"; for(uInt32 i = 0; i < conds.size(); ++i) { commandResult << Base::toString(i) << ": " << conds[i]; - if(i != (conds.size() - 1)) commandResult << endl; + if(i != (conds.size() - 1)) commandResult << '\n'; } } @@ -2660,7 +2660,7 @@ void DebuggerParser::executeType() { commandResult << Base::HEX4 << i << ": "; debugger.cartDebug().accessTypeAsString(commandResult, i); - commandResult << endl; + commandResult << '\n'; } } diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index a4884c5f2..30c033040 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -1008,15 +1008,15 @@ bool DiStella::check_range(uInt16 start, uInt16 end) const { if (start > end) { cerr << "Beginning of range greater than end: start = " << std::hex << start - << ", end = " << std::hex << end << endl; + << ", end = " << std::hex << end << '\n'; return false; } else if (start > myAppData.end + myOffset) { cerr << "Beginning of range out of range: start = " << std::hex << start - << ", range = " << std::hex << (myAppData.end + myOffset) << endl; + << ", range = " << std::hex << (myAppData.end + myOffset) << '\n'; return false; } else if (start < myOffset) { cerr << "Beginning of range out of range: start = " << std::hex << start - << ", offset = " << std::hex << myOffset << endl; + << ", offset = " << std::hex << myOffset << '\n'; return false; } return true; diff --git a/src/debugger/RiotDebug.cxx b/src/debugger/RiotDebug.cxx index 08f79f993..f15498763 100644 --- a/src/debugger/RiotDebug.cxx +++ b/src/debugger/RiotDebug.cxx @@ -380,11 +380,11 @@ string RiotDebug::toString() buf << "280/SWCHA(R)=" << Debugger::invIfChanged(state.SWCHA_R, oldstate.SWCHA_R) << " 280/SWCHA(W)=" << Debugger::invIfChanged(state.SWCHA_W, oldstate.SWCHA_W) << " 281/SWACNT=" << Debugger::invIfChanged(state.SWACNT, oldstate.SWACNT) - << endl + << '\n' << "282/SWCHB(R)=" << Debugger::invIfChanged(state.SWCHB_R, oldstate.SWCHB_R) << " 282/SWCHB(W)=" << Debugger::invIfChanged(state.SWCHB_W, oldstate.SWCHB_W) << " 283/SWBCNT=" << Debugger::invIfChanged(state.SWBCNT, oldstate.SWBCNT) - << endl + << '\n' // These are squirrely: some symbol files will define these as // 0x284-0x287. Doesn't actually matter, these registers repeat @@ -394,24 +394,24 @@ string RiotDebug::toString() << " 296/TIM64T=" << Debugger::invIfChanged(state.TIM64T, oldstate.TIM64T) << " 297/T1024T=" << Debugger::invIfChanged(state.T1024T, oldstate.T1024T) << " Divider=" << Debugger::invIfChanged(state.TIMDIV, oldstate.TIMDIV) - << endl + << '\n' << "0x284/INTIM=" << Debugger::invIfChanged(state.INTIM, oldstate.INTIM) << " 285/TIMINT=" << Debugger::invIfChanged(state.TIMINT, oldstate.TIMINT) << " Timer_Clocks=" << Debugger::invIfChanged(state.TIMCLKS, oldstate.TIMCLKS) << " INTIM_Clocks=" << Debugger::invIfChanged(state.INTIMCLKS, oldstate.INTIMCLKS) - << endl + << '\n' << "Left/P0diff: " << diffP0String() << " Right/P1diff: " << diffP1String() - << endl + << '\n' << "TVType: " << tvTypeString() << " Switches: " << switchesString() - << endl + << '\n' // Yes, the fire buttons are in the TIA, but we might as well // show them here for convenience. << "Left/P0 stick: " << dirP0String() << ((mySystem.peek(0x03c) & 0x80) ? "" : "(button) ") - << endl + << '\n' << "Right/P1 stick: " << dirP1String() << ((mySystem.peek(0x03d) & 0x80) ? "" : "(button) "); diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index a15b7561a..3d7cff656 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -1166,7 +1166,7 @@ string TIADebug::palette() for(uInt16 col = 0; col < 8; ++col, c += 2) buf << colorSwatch(c); - buf << endl; + buf << '\n'; } return buf.str(); } @@ -1193,7 +1193,7 @@ string TIADebug::toString() state.vsb[0] != oldState.vsb[0]) << " " << boolWithLabel("vblank", vblank(), state.vsb[1] != oldState.vsb[1]) - << endl + << '\n' << "Collisions: " << boolWithLabel("p0_pf", collP0_PF(), state.cx[0] != oldState.cx[0]) << " " << boolWithLabel("p0_bl", collP0_BL(), state.cx[1] != oldState.cx[1]) << " " @@ -1203,7 +1203,7 @@ string TIADebug::toString() << boolWithLabel("p1_pf", collP1_PF(), state.cx[5] != oldState.cx[5]) << " " << boolWithLabel("p1_bl", collP1_BL(), state.cx[6] != oldState.cx[6]) << " " << boolWithLabel("m1_p1", collM1_P1(), state.cx[7] != oldState.cx[7]) - << endl << " " + << '\n' << " " << boolWithLabel("m0_p1", collM0_P1(), state.cx[8] != oldState.cx[8]) << " " << boolWithLabel("m0_pf", collM0_PF(), state.cx[9] != oldState.cx[9]) << " " << boolWithLabel("m0_bl", collM0_BL(), state.cx[10] != oldState.cx[10]) << " " @@ -1211,7 +1211,7 @@ string TIADebug::toString() << boolWithLabel("m1_pf", collM1_PF(), state.cx[12] != oldState.cx[12]) << " " << boolWithLabel("m1_bl", collM1_BL(), state.cx[13] != oldState.cx[13]) << " " << boolWithLabel("bl_pf", collBL_PF(), state.cx[14] != oldState.cx[14]) - << endl + << '\n' << "COLUxx: " << hexWithLabel("P0", state.coluRegs[TiaState::P0], state.coluRegs[TiaState::P0] != oldState.coluRegs[TiaState::P0]) << "/" @@ -1225,7 +1225,7 @@ string TIADebug::toString() << hexWithLabel("BK", state.coluRegs[3], state.coluRegs[3] != oldState.coluRegs[3]) << "/" << colorSwatch(state.coluRegs[3]) - << endl + << '\n' << "P0: " << binWithLabel("GR", state.gr[TiaState::P0], state.gr[TiaState::P0] != oldState.gr[TiaState::P0]) << " " @@ -1239,7 +1239,7 @@ string TIADebug::toString() state.ref[TiaState::P0] != oldState.ref[TiaState::P0]) << " " << boolWithLabel("delay", vdelP0(), state.vdel[TiaState::P0] != oldState.vdel[TiaState::P0]) - << endl + << '\n' << "P1: " << binWithLabel("GR", state.gr[TiaState::P1], state.gr[TiaState::P1] != oldState.gr[TiaState::P1]) << " " @@ -1253,7 +1253,7 @@ string TIADebug::toString() state.ref[TiaState::P1] != oldState.ref[TiaState::P1]) << " " << boolWithLabel("delay", vdelP1(), state.vdel[TiaState::P1] != oldState.vdel[TiaState::P1]) - << endl + << '\n' << "M0: " << stringOnly(enaM0() ? "ENABLED " : "disabled", state.gr[6] != oldState.gr[6]) << " " @@ -1264,7 +1264,7 @@ string TIADebug::toString() << decWithLabel("size", state.size[TiaState::M0], state.size[TiaState::M0] != oldState.size[TiaState::M0], 1) << " " << boolWithLabel("reset", resMP0(), state.resm[TiaState::P0] != oldState.resm[TiaState::P0]) - << endl + << '\n' << "M1: " << stringOnly(enaM1() ? "ENABLED " : "disabled", state.gr[7] != oldState.gr[7]) << " " @@ -1275,7 +1275,7 @@ string TIADebug::toString() << decWithLabel("size", state.size[TiaState::M1], state.size[TiaState::M1] != oldState.size[TiaState::M1], 1) << " " << boolWithLabel("reset", resMP0(), state.resm[TiaState::P1] != oldState.resm[TiaState::P1]) - << endl + << '\n' << "BL: " << stringOnly(enaBL() ? "ENABLED " : "disabled", state.gr[4] != oldState.gr[4]) << " " @@ -1286,7 +1286,7 @@ string TIADebug::toString() << decWithLabel("size", state.size[TiaState::BL], state.size[TiaState::BL] != oldState.size[TiaState::BL], 1) << " " << boolWithLabel("delay", vdelBL(), state.vdel[2] != oldState.vdel[2]) - << endl + << '\n' << "PF0: " << binWithLabel("", state.pf[0], state.pf[0] != oldState.pf[0]) << "/" @@ -1302,11 +1302,11 @@ string TIADebug::toString() state.pf[2] != oldState.pf[2]) << "/" << hexWithLabel("", state.pf[2], state.pf[2] != oldState.pf[2]) << " " - << endl << " " + << '\n' << " " << boolWithLabel("reflect", refPF(), state.pf[3] != oldState.pf[3]) << " " << boolWithLabel("score", scorePF(), state.pf[4] != oldState.pf[4]) << " " << boolWithLabel("priority", priorityPF(), state.pf[5] != oldState.pf[5]) - << endl + << '\n' << boolWithLabel("inpt0", myTIA.peek(0x08) & 0x80, (riotState.INPT0 & 0x80) != (oldRiotState.INPT0 & 0x80)) << " " << boolWithLabel("inpt1", myTIA.peek(0x09) & 0x80, @@ -1321,7 +1321,7 @@ string TIADebug::toString() (riotState.INPT5 & 0x80) != (oldRiotState.INPT5 & 0x80)) << " " << boolWithLabel("dump_gnd_0123", myTIA.myAnalogReadouts[0].vblankDumped(), riotState.INPTDump != oldRiotState.INPTDump) - << endl + << '\n' << "AUDF0: " << hexWithLabel("", static_cast(audF0()), state.aud[0] != oldState.aud[0]) << "/" @@ -1333,7 +1333,7 @@ string TIADebug::toString() << "AUDV0: " << hexWithLabel("", static_cast(audV0()), state.aud[4] != oldState.aud[4], 1) - << endl + << '\n' << "AUDF1: " << hexWithLabel("", static_cast(audF1()), state.aud[1] != oldState.aud[1]) << "/" diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index 7409b4ce5..6390f496b 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -113,7 +113,7 @@ void DataGridWidget::setList(const IntArray& alist, const IntArray& vlist, cerr << "alist.size() = " << alist.size() << ", vlist.size() = " << vlist.size() << ", changed.size() = " << changed.size() - << ", _rows*_cols = " << _rows * _cols << endl << endl; + << ", _rows*_cols = " << _rows * _cols << "\n\n"; */ const size_t size = vlist.size(); // assume the alist is the same size @@ -141,7 +141,7 @@ void DataGridWidget::setList(const IntArray& alist, const IntArray& vlist, << ", _valueList.size() = " << _valueList.size() << ", _changedList.size() = " << _changedList.size() << ", _valueStringList.size() = " << _valueStringList.size() - << ", _rows*_cols = " << _rows * _cols << endl << endl; + << ", _rows*_cols = " << _rows * _cols << "\n\n"; */ enableEditMode(false); diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index c9219f601..0c2a8fff9 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -959,15 +959,14 @@ string PromptWidget::saveBuffer(const FSNode& file) for(int j = start; j <= end; ++j) out << static_cast(_buffer[j] & 0xff); - // add a \n - out << endl; + out << '\n'; } try { if(file.write(out) > 0) return "saved " + file.getShortPath() + " OK"; } - catch(...) { } + catch(...) { return "unable to save session"; } return "unable to save session"; } diff --git a/src/debugger/gui/TiaInfoWidget.cxx b/src/debugger/gui/TiaInfoWidget.cxx index efb408013..b16ad9a4f 100644 --- a/src/debugger/gui/TiaInfoWidget.cxx +++ b/src/debugger/gui/TiaInfoWidget.cxx @@ -144,7 +144,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TiaInfoWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount) { -//cerr << "TiaInfoWidget button press: x = " << x << ", y = " << y << endl; +//cerr << "TiaInfoWidget button press: x = " << x << ", y = " << y << '\n'; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/yacc/YaccParser.cxx b/src/debugger/yacc/YaccParser.cxx index d69102da7..ef666dd75 100644 --- a/src/debugger/yacc/YaccParser.cxx +++ b/src/debugger/yacc/YaccParser.cxx @@ -173,7 +173,7 @@ int const_to_int(char* ch) return ret; default: - cerr << "INVALID BASE in lexer!" << endl; + cerr << "INVALID BASE in lexer!\n"; return 0; } } diff --git a/src/emucore/AtariVox.cxx b/src/emucore/AtariVox.cxx index 0d8fa415f..b4b00d4ac 100644 --- a/src/emucore/AtariVox.cxx +++ b/src/emucore/AtariVox.cxx @@ -126,9 +126,9 @@ void AtariVox::clockDataIn(bool value) myShiftCount = 0; myShiftRegister >>= 6; if(!(myShiftRegister & (1<<9))) - cerr << "AtariVox: bad start bit" << endl; + cerr << "AtariVox: bad start bit\n"; else if((myShiftRegister & 1)) - cerr << "AtariVox: bad stop bit" << endl; + cerr << "AtariVox: bad stop bit\n"; else { const uInt8 data = ((myShiftRegister >> 1) & 0xff); diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx index 7e35ea14d..32bc8de39 100644 --- a/src/emucore/Cart.cxx +++ b/src/emucore/Cart.cxx @@ -57,7 +57,7 @@ bool Cartridge::saveROM(const FSNode& out) const const ByteBuffer& image = getImage(size); if(size == 0) { - cerr << "save not supported" << endl; + cerr << "save not supported\n"; return false; } out.write(image, size); diff --git a/src/emucore/Cart4A50.cxx b/src/emucore/Cart4A50.cxx index 9f5a5fefb..c72e14013 100644 --- a/src/emucore/Cart4A50.cxx +++ b/src/emucore/Cart4A50.cxx @@ -381,7 +381,7 @@ bool Cartridge4A50::save(Serializer& out) const } catch(...) { - cerr << "ERROR: Cartridge4A40::save" << endl; + cerr << "ERROR: Cartridge4A40::save\n"; return false; } @@ -411,7 +411,7 @@ bool Cartridge4A50::load(Serializer& in) } catch(...) { - cerr << "ERROR: Cartridge4A50::load" << endl; + cerr << "ERROR: Cartridge4A50::load\n"; return false; } diff --git a/src/emucore/CartAR.cxx b/src/emucore/CartAR.cxx index fe6e0eb5f..ef24c2057 100644 --- a/src/emucore/CartAR.cxx +++ b/src/emucore/CartAR.cxx @@ -426,7 +426,7 @@ bool CartridgeAR::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeAR::save" << endl; + cerr << "ERROR: CartridgeAR::save\n"; return false; } @@ -471,7 +471,7 @@ bool CartridgeAR::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeAR::load" << endl; + cerr << "ERROR: CartridgeAR::load\n"; return false; } diff --git a/src/emucore/CartARM.cxx b/src/emucore/CartARM.cxx index 698c6d70e..31add4819 100644 --- a/src/emucore/CartARM.cxx +++ b/src/emucore/CartARM.cxx @@ -110,7 +110,7 @@ bool CartridgeARM::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeARM::save" << endl; + cerr << "ERROR: CartridgeARM::save\n"; return false; } #endif @@ -133,7 +133,7 @@ bool CartridgeARM::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeARM::load" << endl; + cerr << "ERROR: CartridgeARM::load\n"; return false; } #endif diff --git a/src/emucore/CartBUS.cxx b/src/emucore/CartBUS.cxx index 9b713938b..289b06fde 100644 --- a/src/emucore/CartBUS.cxx +++ b/src/emucore/CartBUS.cxx @@ -945,7 +945,7 @@ bool CartridgeBUS::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeBUS::save" << endl; + cerr << "ERROR: CartridgeBUS::save\n"; return false; } @@ -988,7 +988,7 @@ bool CartridgeBUS::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeBUS::load" << endl; + cerr << "ERROR: CartridgeBUS::load\n"; return false; } diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx index b609cde8c..8c8f3640a 100644 --- a/src/emucore/CartCDF.cxx +++ b/src/emucore/CartCDF.cxx @@ -593,7 +593,7 @@ bool CartridgeCDF::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeCDF::save" << endl; + cerr << "ERROR: CartridgeCDF::save\n"; return false; } @@ -635,7 +635,7 @@ bool CartridgeCDF::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeCDF::load" << endl; + cerr << "ERROR: CartridgeCDF::load\n"; return false; } diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index 0c3fab349..6f913fafd 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -203,7 +203,7 @@ bool CartridgeCM::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeCM::save" << endl; + cerr << "ERROR: CartridgeCM::save\n"; return false; } @@ -222,7 +222,7 @@ bool CartridgeCM::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeCM::load" << endl; + cerr << "ERROR: CartridgeCM::load\n"; return false; } diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx index 366503653..87bc0934d 100644 --- a/src/emucore/CartCTY.cxx +++ b/src/emucore/CartCTY.cxx @@ -322,7 +322,7 @@ bool CartridgeCTY::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeCTY::save" << endl; + cerr << "ERROR: CartridgeCTY::save\n"; return false; } @@ -350,7 +350,7 @@ bool CartridgeCTY::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeCTY::load" << endl; + cerr << "ERROR: CartridgeCTY::load\n"; return false; } return true; @@ -559,7 +559,7 @@ void CartridgeCTY::saveScore(uInt8 index) catch(...) { // Maybe add logging here that save failed? - cerr << name() << ": ERROR saving score table " << static_cast(index) << endl; + cerr << name() << ": ERROR saving score table " << static_cast(index) << '\n'; } } } @@ -579,7 +579,7 @@ void CartridgeCTY::wipeAllScores() catch(...) { // Maybe add logging here that save failed? - cerr << name() << ": ERROR wiping score tables" << endl; + cerr << name() << ": ERROR wiping score tables\n"; } } } diff --git a/src/emucore/CartCreator.cxx b/src/emucore/CartCreator.cxx index ce8597619..1838f3cb1 100644 --- a/src/emucore/CartCreator.cxx +++ b/src/emucore/CartCreator.cxx @@ -96,7 +96,7 @@ unique_ptr CartCreator::create(const FSNode& file, if(type != Bankswitch::Type::_AUTO && type != detectedType) cerr << "Auto-detection not consistent: " << Bankswitch::typeToName(type) << ", " - << Bankswitch::typeToName(detectedType) << endl; + << Bankswitch::typeToName(detectedType) << '\n'; type = detectedType; buf << Bankswitch::typeToName(type) << "*"; diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index f2966dd50..4dd60d581 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -380,7 +380,7 @@ bool CartridgeDPC::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeDPC::save" << endl; + cerr << "ERROR: CartridgeDPC::save\n"; return false; } @@ -420,7 +420,7 @@ bool CartridgeDPC::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeDPC::load" << endl; + cerr << "ERROR: CartridgeDPC::load\n"; return false; } return true; diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index d090dd76f..a82bf0829 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -733,7 +733,7 @@ bool CartridgeDPCPlus::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeDPCPlus::save" << endl; + cerr << "ERROR: CartridgeDPCPlus::save\n"; return false; } @@ -796,7 +796,7 @@ bool CartridgeDPCPlus::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeDPCPlus::load" << endl; + cerr << "ERROR: CartridgeDPCPlus::load\n"; return false; } diff --git a/src/emucore/CartE7.cxx b/src/emucore/CartE7.cxx index ee9163826..0b43db6a0 100644 --- a/src/emucore/CartE7.cxx +++ b/src/emucore/CartE7.cxx @@ -335,7 +335,7 @@ bool CartridgeE7::save(Serializer& out) const } catch(...) { - cerr << "ERROR: " << name() << "::save" << endl; + cerr << "ERROR: " << name() << "::save\n"; return false; } @@ -355,7 +355,7 @@ bool CartridgeE7::load(Serializer& in) } catch(...) { - cerr << "ERROR: " << name() << "::load" << endl; + cerr << "ERROR: " << name() << "::load\n"; return false; } diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx index f99594dda..5a4d74716 100644 --- a/src/emucore/CartEnhanced.cxx +++ b/src/emucore/CartEnhanced.cxx @@ -404,7 +404,7 @@ bool CartridgeEnhanced::save(Serializer& out) const } catch(...) { - cerr << "ERROR: << " << name() << "::save" << endl; + cerr << "ERROR: << " << name() << "::save\n"; return false; } @@ -425,7 +425,7 @@ bool CartridgeEnhanced::load(Serializer& in) } catch(...) { - cerr << "ERROR: " << name() << "::load" << endl; + cerr << "ERROR: " << name() << "::load\n"; return false; } // Restore bank segments diff --git a/src/emucore/CartFA2.cxx b/src/emucore/CartFA2.cxx index 079682178..c91f2a5b3 100644 --- a/src/emucore/CartFA2.cxx +++ b/src/emucore/CartFA2.cxx @@ -137,7 +137,7 @@ uInt8 CartridgeFA2::ramReadWrite() catch(...) { // Maybe add logging here that save failed? - cerr << name() << ": ERROR saving score table" << endl; + cerr << name() << ": ERROR saving score table\n"; } myRamAccessTimeout += 101000; // Add 101 ms delay for write } @@ -177,6 +177,8 @@ void CartridgeFA2::flash(uInt8 operation) } catch(...) { + // Maybe add logging here that erase failed? + cerr << name() << ": ERROR erasing score table\n"; } } else if(operation == 1) // read @@ -199,7 +201,7 @@ void CartridgeFA2::flash(uInt8 operation) catch(...) { // Maybe add logging here that save failed? - cerr << name() << ": ERROR saving score table" << endl; + cerr << name() << ": ERROR saving score table\n"; } } } diff --git a/src/emucore/CartFE.cxx b/src/emucore/CartFE.cxx index 9a56dca86..7744f056a 100644 --- a/src/emucore/CartFE.cxx +++ b/src/emucore/CartFE.cxx @@ -92,7 +92,7 @@ bool CartridgeFE::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeFE::save" << endl; + cerr << "ERROR: CartridgeFE::save\n"; return false; } @@ -109,7 +109,7 @@ bool CartridgeFE::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeFE::load" << endl; + cerr << "ERROR: CartridgeFE::load\n"; return false; } diff --git a/src/emucore/CartMDM.cxx b/src/emucore/CartMDM.cxx index 7eb050ae2..8812deb78 100644 --- a/src/emucore/CartMDM.cxx +++ b/src/emucore/CartMDM.cxx @@ -112,7 +112,7 @@ bool CartridgeMDM::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeMDM::save" << endl; + cerr << "ERROR: CartridgeMDM::save\n"; return false; } @@ -129,7 +129,7 @@ bool CartridgeMDM::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeMDM::load" << endl; + cerr << "ERROR: CartridgeMDM::load\n"; return false; } diff --git a/src/emucore/CartTVBoy.cxx b/src/emucore/CartTVBoy.cxx index ae1ada5f9..180936e1b 100644 --- a/src/emucore/CartTVBoy.cxx +++ b/src/emucore/CartTVBoy.cxx @@ -62,7 +62,7 @@ bool CartridgeTVBoy::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeTVBoy::save" << endl; + cerr << "ERROR: CartridgeTVBoy::save\n"; return false; } @@ -79,7 +79,7 @@ bool CartridgeTVBoy::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeTVBoy::load" << endl; + cerr << "ERROR: CartridgeTVBoy::load\n"; return false; } diff --git a/src/emucore/CartWD.cxx b/src/emucore/CartWD.cxx index 3ea791d65..e8669fd8d 100644 --- a/src/emucore/CartWD.cxx +++ b/src/emucore/CartWD.cxx @@ -135,7 +135,7 @@ bool CartridgeWD::save(Serializer& out) const } catch(...) { - cerr << "ERROR: CartridgeWD::save" << endl; + cerr << "ERROR: CartridgeWD::save\n"; return false; } @@ -156,7 +156,7 @@ bool CartridgeWD::load(Serializer& in) } catch(...) { - cerr << "ERROR: CartridgeWD::load" << endl; + cerr << "ERROR: CartridgeWD::load\n"; return false; } diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 5ab1b62f6..f37cb8770 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -390,7 +390,7 @@ bool Console::save(Serializer& out) const } catch(...) { - cerr << "ERROR: Console::save" << endl; + cerr << "ERROR: Console::save\n"; return false; } @@ -413,7 +413,7 @@ bool Console::load(Serializer& in) } catch(...) { - cerr << "ERROR: Console::load" << endl; + cerr << "ERROR: Console::load\n"; return false; } diff --git a/src/emucore/ControllerDetector.cxx b/src/emucore/ControllerDetector.cxx index 30537b103..7559e473f 100644 --- a/src/emucore/ControllerDetector.cxx +++ b/src/emucore/ControllerDetector.cxx @@ -33,7 +33,7 @@ Controller::Type ControllerDetector::detectType( if(type != Controller::Type::Unknown && type != detectedType) { cerr << "Controller auto-detection not consistent: " - << Controller::getName(type) << ", " << Controller::getName(detectedType) << endl; + << Controller::getName(type) << ", " << Controller::getName(detectedType) << '\n'; } Logger::debug("'" + Controller::getName(detectedType) + "' detected for " + (port == Controller::Jack::Left ? "left" : "right") + " port"); diff --git a/src/emucore/EmulationWorker.cxx b/src/emucore/EmulationWorker.cxx index c5daa2df8..52228fef4 100644 --- a/src/emucore/EmulationWorker.cxx +++ b/src/emucore/EmulationWorker.cxx @@ -334,6 +334,6 @@ void EmulationWorker::waitUntilPendingSignalHasProcessed() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EmulationWorker::fatal(const string& message) { - (cerr << "FATAL in emulation worker: " << message << std::endl).flush(); + (cerr << "FATAL in emulation worker: " << message << '\n').flush(); throw runtime_error(message); } diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index a654bba2d..129f14689 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -396,7 +396,7 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int) break; default: // handle other events as testing requires - // cerr << "handleSystemEvent: " << e << endl; + // cerr << "handleSystemEvent: " << e << '\n'; break; } } diff --git a/src/emucore/FBSurface.cxx b/src/emucore/FBSurface.cxx index bdb51ae77..05aab2ee0 100644 --- a/src/emucore/FBSurface.cxx +++ b/src/emucore/FBSurface.cxx @@ -453,7 +453,7 @@ bool FBSurface::checkBounds(const uInt32 x, const uInt32 y) const return true; cerr << "FBSurface::checkBounds() failed: " - << x << ", " << y << " vs " << width() << ", " << height() << endl; + << x << ", " << y << " vs " << width() << ", " << height() << '\n'; return false; } diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 13c471f60..cbd91cc3c 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -820,7 +820,7 @@ inline bool FrameBuffer::drawMessage() { #ifdef DEBUG_BUILD cerr << "m"; - //cerr << "--- draw message ---" << endl; + //cerr << "--- draw message ---\n"; #endif // Draw the bounded box and text diff --git a/src/emucore/GlobalKeyHandler.cxx b/src/emucore/GlobalKeyHandler.cxx index 60e18602b..93c694f08 100644 --- a/src/emucore/GlobalKeyHandler.cxx +++ b/src/emucore/GlobalKeyHandler.cxx @@ -455,7 +455,8 @@ GlobalKeyHandler::SettingData GlobalKeyHandler::getSettingData(const Setting set return result->second; else { - cerr << "Error: setting " << static_cast(setting) << " missing in SettingMap!" << endl; + cerr << "Error: setting " << static_cast(setting) + << " missing in SettingMap!\n"; return SettingMap.find(Setting::VOLUME)->second; // default function! } } diff --git a/src/emucore/KidVid.cxx b/src/emucore/KidVid.cxx index 4a517f581..6eb39d59b 100644 --- a/src/emucore/KidVid.cxx +++ b/src/emucore/KidVid.cxx @@ -275,9 +275,8 @@ void KidVid::openSampleFiles() #ifdef DEBUG_BUILD if(myFilesFound) - cerr << endl - << "found file: " << getFileName() << endl - << "found file: " << "KVSHARED.WAV" << endl; + cerr << "\nfound file: " << getFileName() << '\n' + << "found file: " << "KVSHARED.WAV\n"; #endif mySongLength = 0; @@ -306,7 +305,7 @@ void KidVid::setNextSong() myCallback(msg.str(), false); #ifdef DEBUG_BUILD - cerr << fileName << ": " << (ourSongPositions[mySongPointer] & 0x7f) << endl; + cerr << fileName << ": " << (ourSongPositions[mySongPointer] & 0x7f) << '\n'; #endif mySongPlaying = myTapeBusy = true; diff --git a/src/emucore/M6502.cxx b/src/emucore/M6502.cxx index b3d368716..a884f03ef 100644 --- a/src/emucore/M6502.cxx +++ b/src/emucore/M6502.cxx @@ -515,7 +515,7 @@ bool M6502::save(Serializer& out) const } catch(...) { - cerr << "ERROR: M6502::save" << endl; + cerr << "ERROR: M6502::save\n"; return false; } @@ -566,7 +566,7 @@ bool M6502::load(Serializer& in) } catch(...) { - cerr << "ERROR: M6502::load" << endl; + cerr << "ERROR: M6502::load\n"; return false; } diff --git a/src/emucore/M6532.cxx b/src/emucore/M6532.cxx index 722d328f1..fbbaefb16 100644 --- a/src/emucore/M6532.cxx +++ b/src/emucore/M6532.cxx @@ -244,7 +244,7 @@ uInt8 M6532::peek(uInt16 addr) default: { #ifdef DEBUG_ACCESSES - cerr << "BAD M6532 Peek: " << hex << addr << endl; + cerr << "BAD M6532 Peek: " << hex << addr << '\n'; #endif return 0; } @@ -396,7 +396,7 @@ bool M6532::save(Serializer& out) const } catch(...) { - cerr << "ERROR: M6532::save" << endl; + cerr << "ERROR: M6532::save\n"; return false; } @@ -431,7 +431,7 @@ bool M6532::load(Serializer& in) } catch(...) { - cerr << "ERROR: M6532::load" << endl; + cerr << "ERROR: M6532::load\n"; return false; } diff --git a/src/emucore/MT24LC256.cxx b/src/emucore/MT24LC256.cxx index 5314821df..894e3b937 100644 --- a/src/emucore/MT24LC256.cxx +++ b/src/emucore/MT24LC256.cxx @@ -80,7 +80,7 @@ MT24LC256::~MT24LC256() if(myDataChanged) { try { myDataFile.write(myData, FLASH_SIZE); } - catch(...) { } + catch(...) { cerr << "ERROR writing MT24LC256 data file\n"; } } } @@ -120,8 +120,8 @@ void MT24LC256::update() if(myCyclesWhenSDASet == myCyclesWhenSCLSet) { #ifdef DEBUG_EEPROM - cerr << endl << " I2C_PIN_WRITE(SCL = " << mySCL - << ", SDA = " << mySDA << ")" << " @ " << mySystem.cycles() << endl; + cerr << "\n I2C_PIN_WRITE(SCL = " << mySCL + << ", SDA = " << mySDA << ")" << " @ " << mySystem.cycles() << '\n'; #endif jpee_clock(mySCL); jpee_data(mySDA); diff --git a/src/emucore/MT24LC256.hxx b/src/emucore/MT24LC256.hxx index 79b65147e..0f4cc2ee1 100644 --- a/src/emucore/MT24LC256.hxx +++ b/src/emucore/MT24LC256.hxx @@ -80,7 +80,7 @@ class MT24LC256 void jpee_data_stop(); void jpee_clock_fall(); bool jpee_timercheck(int mode); - void jpee_logproc(string_view st) { cerr << " " << st << endl; } + void jpee_logproc(string_view st) { cerr << " " << st << '\n'; } void update(); diff --git a/src/emucore/MindLink.cxx b/src/emucore/MindLink.cxx index 290613fd4..54c220d79 100644 --- a/src/emucore/MindLink.cxx +++ b/src/emucore/MindLink.cxx @@ -44,7 +44,7 @@ void MindLink::update() myMindlinkPos = myMindlinkPos | TRIGGER_VALUE; // starts game, calibration and reverse //#ifdef DEBUG_BUILD -// cerr << std::hex << myMindlinkPos << endl; +// cerr << std::hex << myMindlinkPos << '\n'; //#endif myMindlinkShift = 1; // start transfer with least significant bit diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index d83571e3c..a9a3a4a01 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -123,21 +123,21 @@ bool OSystem::initialize(const Settings::Options& options) loadConfig(options); ostringstream buf; - buf << "Stella " << STELLA_VERSION << endl - << " Features: " << myFeatures << endl - << " " << myBuildInfo << endl << endl + buf << "Stella " << STELLA_VERSION << '\n' + << " Features: " << myFeatures << '\n' + << " " << myBuildInfo << '\n\n' << "Base directory: '" - << myBaseDir.getShortPath() << "'" << endl + << myBaseDir.getShortPath() << "'\n" << "State directory: '" - << myStateDir.getShortPath() << "'" << endl + << myStateDir.getShortPath() << "'\n" << "NVRam directory: '" - << myNVRamDir.getShortPath() << "'" << endl + << myNVRamDir.getShortPath() << "'\n" << "Persistence: '" - << describePresistence() << "'" << endl + << describePresistence() << "'\n" << "Cheat file: '" - << myCheatFile.getShortPath() << "'" << endl + << myCheatFile.getShortPath() << "'\n" << "Palette file: '" - << myPaletteFile.getShortPath() << "'" << endl; + << myPaletteFile.getShortPath() << "'\n"; Logger::info(buf.str()); // NOTE: The framebuffer MUST be created before any other object!!! @@ -293,7 +293,7 @@ void OSystem::setConfigPaths() // Debug code auto dbgPath = [](string_view desc, const FSNode& location) { - cerr << desc << ": " << location << endl; + cerr << desc << ": " << location << '\n'; }; dbgPath("base dir ", myBaseDir); dbgPath("state dir ", myStateDir); @@ -373,7 +373,7 @@ bool OSystem::checkUserPalette(bool outputError) const if(size != 128 * 3 * 2 + 8 * 3) { if(outputError) - cerr << "ERROR: invalid palette file " << paletteFile() << endl; + cerr << "ERROR: invalid palette file " << paletteFile() << '\n'; return false; } @@ -511,12 +511,12 @@ string OSystem::createConsole(const FSNode& rom, string_view md5sum, bool newrom myFrameBuffer->showTextMessage("Multicart " + myConsole->cartridge().detectedType() + ", loading ROM" + id); } - buf << "Game console created:" << endl - << " ROM file: " << myRomFile.getShortPath() << endl; + buf << "Game console created:\n" + << " ROM file: " << myRomFile.getShortPath() << '\n'; const FSNode propsFile(myRomFile.getPathWithExt(".pro")); if(propsFile.exists()) - buf << " PRO file: " << propsFile.getShortPath() << endl; - buf << endl << getROMInfo(*myConsole); + buf << " PRO file: " << propsFile.getShortPath() << '\n'; + buf << '\n' << getROMInfo(*myConsole); Logger::info(buf.str()); myFrameBuffer->setCursorState(); @@ -861,12 +861,12 @@ string OSystem::getROMInfo(const Console& console) const ConsoleInfo& info = console.about(); ostringstream buf; - buf << " Cart Name: " << info.CartName << endl - << " Cart MD5: " << info.CartMD5 << endl - << " Controller 0: " << info.Control0 << endl - << " Controller 1: " << info.Control1 << endl - << " Display Format: " << info.DisplayFormat << endl - << " Bankswitch Type: " << info.BankSwitch << endl; + buf << " Cart Name: " << info.CartName << '\n' + << " Cart MD5: " << info.CartMD5 << '\n' + << " Controller 0: " << info.Control0 << '\n' + << " Controller 1: " << info.Control1 << '\n' + << " Display Format: " << info.DisplayFormat << '\n' + << " Bankswitch Type: " << info.BankSwitch << '\n'; return buf.str(); } @@ -933,7 +933,7 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker) #ifdef DEBUGGER_SUPPORT myDebugger->startWithFatalError(dispatchResult.getMessage()); #else - cerr << dispatchResult.getMessage() << endl; + cerr << dispatchResult.getMessage() << '\n'; #endif break; diff --git a/src/emucore/PlusROM.cxx b/src/emucore/PlusROM.cxx index 397a00375..1ee52d0cc 100644 --- a/src/emucore/PlusROM.cxx +++ b/src/emucore/PlusROM.cxx @@ -331,7 +331,7 @@ bool PlusROM::save(Serializer& out) const } catch(...) { - cerr << "ERROR: PlusROM::save" << endl; + cerr << "ERROR: PlusROM::save\n"; return false; } @@ -353,7 +353,7 @@ bool PlusROM::load(Serializer& in) } catch(...) { - cerr << "ERROR: PlusROM::load" << endl; + cerr << "ERROR: PlusROM::load\n"; return false; } diff --git a/src/emucore/PointingDevice.cxx b/src/emucore/PointingDevice.cxx index 10fc64cf0..db79874a0 100644 --- a/src/emucore/PointingDevice.cxx +++ b/src/emucore/PointingDevice.cxx @@ -81,7 +81,7 @@ void PointingDevice::update() return; // Update horizontal direction - //cerr << myEvent.get(Event::MouseAxisXMove) << ", " << myHCounterRemainder << endl; + //cerr << myEvent.get(Event::MouseAxisXMove) << ", " << myHCounterRemainder << '\n'; updateDirection( myEvent.get(Event::MouseAxisXMove), myHCounterRemainder, myTrackBallLeft, myTrackBallLinesH, myScanCountH, myFirstScanOffsetH); diff --git a/src/emucore/ProfilingRunner.cxx b/src/emucore/ProfilingRunner.cxx index 299e0e2d9..256e840fb 100644 --- a/src/emucore/ProfilingRunner.cxx +++ b/src/emucore/ProfilingRunner.cxx @@ -77,10 +77,11 @@ ProfilingRunner::ProfilingRunner(int argc, char* argv[]) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool ProfilingRunner::run() { - cout << "Profiling Stella..." << endl; + cout << "Profiling Stella...\n"; for (const ProfilingRun& run : profilingRuns) { - cout << endl << "running " << run.romFile << " for " << run.runtime << " seconds..." << endl; + cout << "\nrunning " << run.romFile << " for " << run.runtime + << " seconds...\n"; if (!runOne(run)) return false; } @@ -97,14 +98,14 @@ bool ProfilingRunner::runOne(const ProfilingRun& run) const FSNode imageFile(run.romFile); if (!imageFile.isFile()) { - cout << "ERROR: " << run.romFile << " is not a ROM image" << endl; + cout << "ERROR: " << run.romFile << " is not a ROM image\n"; return false; } ByteBuffer image; const size_t size = imageFile.read(image); if (size == 0) { - cout << "ERROR: unable to read " << run.romFile << endl; + cout << "ERROR: unable to read " << run.romFile << '\n'; return false; } @@ -114,7 +115,7 @@ bool ProfilingRunner::runOne(const ProfilingRun& run) imageFile, image, size, md5, type, mySettings); if (!cartridge) { - cout << "ERROR: unable to determine cartridge type" << endl; + cout << "ERROR: unable to determine cartridge type\n"; return false; } @@ -160,7 +161,7 @@ bool ProfilingRunner::runOne(const ProfilingRun& run) break; } - (cout << endl).flush(); + (cout << '\n').flush(); FrameManager frameManager; tia.setFrameManager(&frameManager); @@ -196,12 +197,12 @@ bool ProfilingRunner::runOne(const ProfilingRun& run) const double realtimeUsed = duration_cast>(high_resolution_clock::now () - tp).count(); if (dispatchResult.getStatus() != DispatchResult::Status::ok) { - cout << endl << "ERROR: emulation failed after " << cycles << " cycles"; + cout << "\nERROR: emulation failed after " << cycles << " cycles"; return false; } - (cout << "100%" << endl).flush(); - cout << "real time: " << realtimeUsed << " seconds" << endl; + (cout << "100%" << '\n').flush(); + cout << "real time: " << realtimeUsed << " seconds\n"; return true; } diff --git a/src/emucore/Props.cxx b/src/emucore/Props.cxx index 149c6b04e..20ae65ff1 100644 --- a/src/emucore/Props.cxx +++ b/src/emucore/Props.cxx @@ -153,37 +153,37 @@ void Properties::copy(const Properties& properties) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Properties::print() const { - cout << get(PropType::Cart_MD5) << "|" - << get(PropType::Cart_Name) << "|" - << get(PropType::Cart_Manufacturer) << "|" - << get(PropType::Cart_ModelNo) << "|" - << get(PropType::Cart_Note) << "|" - << get(PropType::Cart_Rarity) << "|" - << get(PropType::Cart_Sound) << "|" - << get(PropType::Cart_StartBank) << "|" - << get(PropType::Cart_Type) << "|" - << get(PropType::Cart_Highscore) << "|" - << get(PropType::Cart_Url) << "|" - << get(PropType::Console_LeftDiff) << "|" - << get(PropType::Console_RightDiff) << "|" - << get(PropType::Console_TVType) << "|" - << get(PropType::Console_SwapPorts) << "|" - << get(PropType::Controller_Left) << "|" - << get(PropType::Controller_Left1) << "|" - << get(PropType::Controller_Left2) << "|" - << get(PropType::Controller_Right) << "|" - << get(PropType::Controller_Right1) << "|" - << get(PropType::Controller_Right2) << "|" - << get(PropType::Controller_SwapPaddles) << "|" + cout << get(PropType::Cart_MD5) << "|" + << get(PropType::Cart_Name) << "|" + << get(PropType::Cart_Manufacturer) << "|" + << get(PropType::Cart_ModelNo) << "|" + << get(PropType::Cart_Note) << "|" + << get(PropType::Cart_Rarity) << "|" + << get(PropType::Cart_Sound) << "|" + << get(PropType::Cart_StartBank) << "|" + << get(PropType::Cart_Type) << "|" + << get(PropType::Cart_Highscore) << "|" + << get(PropType::Cart_Url) << "|" + << get(PropType::Console_LeftDiff) << "|" + << get(PropType::Console_RightDiff) << "|" + << get(PropType::Console_TVType) << "|" + << get(PropType::Console_SwapPorts) << "|" + << get(PropType::Controller_Left) << "|" + << get(PropType::Controller_Left1) << "|" + << get(PropType::Controller_Left2) << "|" + << get(PropType::Controller_Right) << "|" + << get(PropType::Controller_Right1) << "|" + << get(PropType::Controller_Right2) << "|" + << get(PropType::Controller_SwapPaddles) << "|" << get(PropType::Controller_PaddlesXCenter) << "|" << get(PropType::Controller_PaddlesYCenter) << "|" - << get(PropType::Controller_MouseAxis) << "|" - << get(PropType::Display_Format) << "|" - << get(PropType::Display_VCenter) << "|" - << get(PropType::Display_Phosphor) << "|" - << get(PropType::Display_PPBlend) << "|" + << get(PropType::Controller_MouseAxis) << "|" + << get(PropType::Display_Format) << "|" + << get(PropType::Display_VCenter) << "|" + << get(PropType::Display_Phosphor) << "|" + << get(PropType::Display_PPBlend) << "|" << get(PropType::Bezel_Name) - << endl; + << '\n'; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -244,7 +244,7 @@ void Properties::printHeader() << "Display_Phosphor|" << "Display_PPBlend|" << "Bezel_Name" - << endl; + << '\n'; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/PropsSet.cxx b/src/emucore/PropsSet.cxx index 812c0468a..cc6917b4d 100644 --- a/src/emucore/PropsSet.cxx +++ b/src/emucore/PropsSet.cxx @@ -124,7 +124,7 @@ void PropertiesSet::insert(const Properties& properties, bool save) return; else if(getMD5(md5, defaultProps, true) && defaultProps == properties) { - cerr << "DELETE" << endl << std::flush; + cerr << "DELETE" << '\n' << std::flush; myRepository->remove(md5); return; } diff --git a/src/emucore/Random.hxx b/src/emucore/Random.hxx index caabf862b..3cd49c262 100644 --- a/src/emucore/Random.hxx +++ b/src/emucore/Random.hxx @@ -78,7 +78,7 @@ class Random : public Serializable } catch(...) { - cerr << "ERROR: Random::save" << endl; + cerr << "ERROR: Random::save\n"; return false; } @@ -99,7 +99,7 @@ class Random : public Serializable } catch(...) { - cerr << "ERROR: Random::load" << endl; + cerr << "ERROR: Random::load\n"; return false; } diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 3e3bbeec9..92f647994 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -501,15 +501,12 @@ void Settings::validate() void Settings::usage() { stringstream buf; - buf << endl - << "Stella version " << STELLA_VERSION << endl - << endl - << "Usage: stella [options ...] romfile" << endl - << " Run without any options or romfile to use the ROM launcher" << endl - << " Consult the manual for more in-depth information" << endl - << endl - << "Valid options are:" << endl - << endl + buf << "\nStella version " << STELLA_VERSION + << "\n\n" + << "Usage: stella [options ...] romfile\n" + << " Run without any options or romfile to use the ROM launcher\n" + << " Consult the manual for more in-depth information\n\n" + << "Valid options are:\n\n" << " -video Type is one of the following:\n" #ifdef BSPF_WINDOWS << " direct3d Direct3D acceleration\n" @@ -517,14 +514,12 @@ void Settings::usage() << " opengl OpenGL acceleration\n" << " opengles2 OpenGLES 2 acceleration\n" << " opengles OpenGLES 1 acceleration\n" - << " software Software mode (no acceleration)\n" - << endl + << " software Software mode (no acceleration)\n\n" << " -vsync <1|0> Enable 'synchronize to vertical blank interrupt'\n" << " -fullscreen <1|0> Enable fullscreen mode\n" << " -center <1|0> Centers game window in windowed modes\n" << " -windowedpos Sets the window position in windowed emulator mode\n" - << " -display Sets the display for Stella's emulator\n" - << endl + << " -display Sets the display for Stella's emulator\n\n" << " -palette \n" @@ -540,24 +535,20 @@ void Settings::usage() << " -pal.saturation <-1.0 - 1.0> Adjust saturation of current palette\n" << " -pal.contrast <-1.0 - 1.0> Adjust contrast of current palette\n" << " -pal.brightness <-1.0 - 1.0> Adjust brightness of current palette\n" - << " -pal.gamma <-1.0 - 1.0> Adjust gamma of current palette\n" - << endl + << " -pal.gamma <-1.0 - 1.0> Adjust gamma of current palette\n\n" << " -detectpal60 <1|0> Enable PAL-60 autodetection\n" - << " -detectntsc50 <1|0> Enable NTSC-50 autodetection\n" - << endl + << " -detectntsc50 <1|0> Enable NTSC-50 autodetection\n\n" << " -speed Run emulation at the given speed\n" << " -turbo <1|0> Enable 'Turbo' mode for maximum emulation speed\n" << " -uimessages <1|0> Show onscreen UI messages for different events\n" - << " -pausedim <1|0> Enable emulation dimming in pause mode\n" - << endl + << " -pausedim <1|0> Enable emulation dimming in pause mode\n\n" << " -bezel.show <1|0> Show bezel around emulation window\n" << " -bezel.windowed <1|0> Show bezel in windowed modes\n" << " -bezel.win.auto <1|0> Automatically set bezel window position\n" << " -bezel.win.left <0-40> Set left bezel window position [%]\n" << " -bezel.win.right <0-40> Set right bezel window position [%]\n" << " -bezel.win.top <0-40> Set top bezel window position [%]\n" - << " -bezel.win.bottom <0-40> Set bottom bezel window position [%]\n" - << endl + << " -bezel.win.bottom <0-40> Set bottom bezel window position [%]\n\n" #ifdef SOUND_SUPPORT << " -audio.enabled <1|0> Enable audio\n" << " -audio.volume <0-100> Volume\n" @@ -570,8 +561,7 @@ void Settings::usage() << " -audio.headroom <0-20> Additional half-frames to prebuffer\n" << " -audio.buffer_size <0-20> Max. number of additional half-\n" << " frames to buffer\n" - << " -audio.stereo <1|0> Enable stereo mode for all ROMs\n" - << endl + << " -audio.stereo <1|0> Enable stereo mode for all ROMs\n\n" #endif << " -tia.zoom Use the specified zoom level (windowed mode)\n" << " for TIA image\n" @@ -583,8 +573,7 @@ void Settings::usage() << " -tia.fs_overscan <0-10> Add overscan to TIA image in fullscreen mode\n" << " -tia.dbgcolors Debug colors to use for each object (see manual\n" << " for description)\n" - << " -tia.correct_aspect <1|0> Enable aspect ratio correct scaling\n" - << endl + << " -tia.correct_aspect <1|0> Enable aspect ratio correct scaling\n\n" << " -tv.filter <0-5> Set TV effects off (0) or to specified mode\n" << " (1-5)\n" << " -tv.phosphor When to use phosphor mode\n" @@ -598,12 +587,10 @@ void Settings::usage() << " -tv.resolution <-1.0 - 1.0> Set TV effects custom resolution\n" << " -tv.artifacts <-1.0 - 1.0> Set TV effects custom artifacts\n" << " -tv.fringing <-1.0 - 1.0> Set TV effects custom fringing\n" - << " -tv.bleed <-1.0 - 1.0> Set TV effects custom bleed\n" - << endl + << " -tv.bleed <-1.0 - 1.0> Set TV effects custom bleed\n\n" << " -cheat Use the specified cheatcode (see manual for\n" << " description)\n" - << " -loglevel <0|1|2> Set level of logging during application run\n" - << endl + << " -loglevel <0|1|2> Set level of logging during application run\n\n" << " -logtoconsole <1|0> Log output to console/commandline\n" << " -joydeadzone <0-29> Sets digital 'dead zone' area for analog joysticks\n" << " -joyallow4 <1|0> Allow all 4 directions on a joystick to be\n" @@ -641,17 +628,14 @@ void Settings::usage() << " -ss1x <1|0> Generate TIA snapshot in 1x mode (ignore\n" << " scaling/effects)\n" << " -ssinterval Number of seconds between snapshots in\n" - << " continuous snapshot mode\n" - << endl + << " continuous snapshot mode\n\n" << " -saveonexit emulation\n" << " -autoslot <0|1> Automatically change to next save slot when\n" - << " state saving\n" - << endl + << " state saving\n\n" << " -rominfo Display detailed information for the given ROM\n" << " -listrominfo Display contents of stella.pro, one line per ROM\n" - << " entry\n" - << endl + << " entry\n\n" << " -exitlauncher <0|1> On exiting a ROM, go back to the ROM launcher\n" << " -launcherpos Sets the window position in windowed launcher\n" << " mode\n" @@ -723,17 +707,14 @@ void Settings::usage() << " -filterbstypes <0|1> Filter bankswitch type list by ROM size.\n" << " -help Show the text you're now reading\n" #ifdef DEBUGGER_SUPPORT - << endl - << " The following options are meant for developers\n" - << " Arguments are more fully explained in the manual\n" - << endl + << "\n The following options are meant for developers\n" + << " Arguments are more fully explained in the manual\n\n" << " -dis.resolve <1|0> Attempt to resolve code sections in disassembler\n" << " -dis.gfxformat <2|16> Set base to use for displaying (P)GFX sections\n" << " in disassembler\n" << " -dis.showaddr <1|0> Show opcode addresses in disassembler\n" << " -dis.relocate <1|0> Relocate calls out of address range in\n" - << " disassembler\n" - << endl + << " disassembler\n\n" << " -dbg.pos Sets the window position in windowed debugger mode\n" << " -dbg.display Sets the display for the debugger\n" << " -dbg.res The resolution to use in debugger mode\n" @@ -747,8 +728,7 @@ void Settings::usage() << " -dbg.logtrace <0|1> Log emulation\n" << " -dbg.autosave <0|1> Automatically save breaks, traps etc.\n" << " -break
Set a breakpoint at 'address'\n" - << " -debug Start in debugger mode\n" - << endl + << " -debug Start in debugger mode\n\n" << " -bs Sets the 'Cartridge.Type' (bankswitch) property\n" << " -type Same as using -bs\n" << " -startbank Sets the ROM's startup bank\n" @@ -767,15 +747,12 @@ void Settings::usage() << " -vcenter Sets the 'Display.vcenter' property\n" << " -pp Sets the 'Display.Phosphor' property\n" << " -ppblend Sets the 'Display.PPBlend' property\n" - << " -bezelname Sets the 'Bezel.Name' property\n" - << endl + << " -bezelname Sets the 'Bezel.Name' property\n\n" #endif - << " Various development related parameters for player settings mode\n" - << endl + << " Various development related parameters for player settings mode\n\n" << " -dev.settings <1|0> Select developer (1) or player (0) settings\n" - << " mode\n" - << endl + << " mode\n\n" << " -plr.stats <1|0> Overlay console info during emulation\n" << " -plr.detectedinfo <1|0> Enable initial detected settings info\n" << " -plr.console <2600|7800> Select console for B/W and Pause key\n" @@ -789,8 +766,7 @@ void Settings::usage() << " -plr.tv.jitter <1|0> Enable TV jitter effect\n" << " -plr.tv.jitter_sense <1-10> Set TV jitter effect sensitivity\n" << " -plr.tv.jitter_recovery <1-20> Set recovery time for TV jitter effect\n" - << " -plr.extaccess <1|0> Enable messages for external access\n" - << endl + << " -plr.extaccess <1|0> Enable messages for external access\n\n" << " The same parameters but for developer settings mode\n" << " -dev.stats <1|0> Overlay console info during emulation\n" << " -dev.detectedinfo <1|0> Enable initial detected settings info\n" @@ -836,8 +812,7 @@ void Settings::usage() << " -dev.tia.pfscoreglitch <1|0> Enable PF score mode color glitch\n" << " -dev.tia.delaybkcolor <1|0> Enable extra delay cycle for background color\n" << " -dev.tia.delayplswap <1|0> Enable extra delay cycle for VDELP0/1 swap\n" - << " -dev.tia.delayblswap <1|0> Enable extra delay cycle for VDELBL swap\n" - << endl; + << " -dev.tia.delayblswap <1|0> Enable extra delay cycle for VDELBL swap\n\n"; #ifdef BSPF_WINDOWS // int height = 25; @@ -864,11 +839,11 @@ void Settings::usage() row = 0; cout << "Press \"Enter\"" << std::flush; std::ignore = getchar(); - cout << endl; + cout << '\n'; } string substr; getline(buf, substr, '\n'); - cout << substr << endl; + cout << substr << '\n'; } #endif } diff --git a/src/emucore/System.cxx b/src/emucore/System.cxx index 39e8dbbc2..b64f5f9c1 100644 --- a/src/emucore/System.cxx +++ b/src/emucore/System.cxx @@ -241,7 +241,7 @@ bool System::save(Serializer& out) const } catch(...) { - cerr << "ERROR: System::save" << endl; + cerr << "ERROR: System::save\n"; return false; } @@ -270,7 +270,7 @@ bool System::load(Serializer& in) } catch(...) { - cerr << "ERROR: System::load" << endl; + cerr << "ERROR: System::load\n"; return false; } diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index b8f93e740..3de267b82 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -105,13 +105,11 @@ void TIASurface::initialize(const Console& console, #if 0 cerr << "INITIALIZE:\n" << "TIA:\n" - << "src: " << myTiaSurface->srcRect() << endl - << "dst: " << myTiaSurface->dstRect() << endl - << endl; -cerr << "SLine:\n" - << "src: " << mySLineSurface->srcRect() << endl - << "dst: " << mySLineSurface->dstRect() << endl - << endl; + << "src: " << myTiaSurface->srcRect() << '\n' + << "dst: " << myTiaSurface->dstRect() << "\n\n" + << "SLine:\n" + << "src: " << mySLineSurface->srcRect() << '\n' + << "dst: " << mySLineSurface->dstRect() << "\n\n"; #endif } diff --git a/src/emucore/Thumbulator.cxx b/src/emucore/Thumbulator.cxx index c1616dc99..d51650888 100644 --- a/src/emucore/Thumbulator.cxx +++ b/src/emucore/Thumbulator.cxx @@ -191,7 +191,7 @@ string Thumbulator::doRun(uInt32& cycles, bool irqDrivenAudio) #endif #if defined(THUMB_DISS) || defined(THUMB_DBUG) dump_counters(); - cout << statusMsg.str() << endl; + cout << statusMsg.str() << '\n'; return statusMsg.str(); #else return ""; @@ -245,8 +245,8 @@ string Thumbulator::run(uInt32& cycles, bool irqDrivenAudio) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int Thumbulator::fatalError(string_view opcode, uInt32 v1, string_view msg) { - statusMsg << "Thumb ARM emulation fatal error: " << endl - << opcode << "(" << Base::HEX8 << v1 << "), " << msg << endl; + statusMsg << "Thumb ARM emulation fatal error:\n" + << opcode << "(" << Base::HEX8 << v1 << "), " << msg << '\n'; dump_regs(); if(trapOnFatal) throw runtime_error(statusMsg.str()); @@ -257,9 +257,9 @@ int Thumbulator::fatalError(string_view opcode, uInt32 v1, string_view msg) int Thumbulator::fatalError(string_view opcode, uInt32 v1, uInt32 v2, string_view msg) { - statusMsg << "Thumb ARM emulation fatal error: " << endl + statusMsg << "Thumb ARM emulation fatal error:\n" << opcode << "(" << Base::HEX8 << v1 << "," << v2 << "), " << msg - << endl; + << '\n'; dump_regs(); if(trapOnFatal) throw runtime_error(statusMsg.str()); @@ -269,12 +269,11 @@ int Thumbulator::fatalError(string_view opcode, uInt32 v1, uInt32 v2, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Thumbulator::dump_counters() const { - cout << endl << endl - << "instructions " << _stats.instructions << endl; + cout << "\n\ninstructions " << _stats.instructions << '\n'; #ifdef THUMB_STATS - cout << "reads " << _stats.reads << endl - << "writes " << _stats.writes << endl - << "memcycles " << (_stats.instructions + _stats.reads + _stats.writes) << endl; + cout << "reads " << _stats.reads << '\n' + << "writes " << _stats.writes << '\n' + << "memcycles " << (_stats.instructions + _stats.reads + _stats.writes) << '\n'; #endif } @@ -286,14 +285,13 @@ void Thumbulator::dump_regs() statusMsg << "R" << std::dec << std::setfill(' ') << std::setw(2) << std::left << cnt << "= " << Base::HEX8 << reg_norm[cnt]; if((cnt + 1) % 4 == 0) - statusMsg << endl; + statusMsg << '\n'; else statusMsg << " "; } - statusMsg << endl - << "SP = " << Base::HEX8 << reg_norm[13] << " " + statusMsg << "\nSP = " << Base::HEX8 << reg_norm[13] << " " << "LR = " << Base::HEX8 << reg_norm[14] << " " - << "PC = " << Base::HEX8 << reg_norm[15] << endl; + << "PC = " << Base::HEX8 << reg_norm[15] << '\n'; } #endif @@ -343,14 +341,14 @@ FORCE_INLINE uInt32 Thumbulator::fetch16(uInt32 addr) fatalError("fetch16", addr, "abort"); addr >>= 1; data = CONV_RAMROM(rom[addr]); - DO_DBUG(statusMsg << "fetch16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << endl); + DO_DBUG(statusMsg << "fetch16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << '\n'); return data; case 0x40000000: //RAM addr &= RAMADDMASK; addr >>= 1; data = CONV_RAMROM(ram[addr]); - DO_DBUG(statusMsg << "fetch16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << endl); + DO_DBUG(statusMsg << "fetch16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << '\n'); return data; default: // reserved @@ -372,7 +370,7 @@ void Thumbulator::write16(uInt32 addr, uInt32 data) fatalError("write16", addr, "abort - misaligned"); #endif THUMB_STAT(_stats.writes) - DO_DBUG(statusMsg << "write16(" << Base::HEX8 << addr << "," << Base::HEX8 << data << ")" << endl); + DO_DBUG(statusMsg << "write16(" << Base::HEX8 << addr << "," << Base::HEX8 << data << ")\n"); switch(addr & 0xF0000000) { @@ -395,7 +393,7 @@ void Thumbulator::write16(uInt32 addr, uInt32 data) #endif if(addr == 0xE01FC000) { - DO_DBUG(statusMsg << "write16(" << Base::HEX8 << "MAMCR" << "," << Base::HEX8 << data << ") *" << endl); + DO_DBUG(statusMsg << "write16(" << Base::HEX8 << "MAMCR" << "," << Base::HEX8 << data << ") *\n"); if(!_lockMamcr) mamcr = static_cast(data); return; @@ -413,7 +411,7 @@ void Thumbulator::write32(uInt32 addr, uInt32 data) if(addr & 3) fatalError("write32", addr, "abort - misaligned"); #endif - DO_DBUG(statusMsg << "write32(" << Base::HEX8 << addr << "," << Base::HEX8 << data << ")" << endl); + DO_DBUG(statusMsg << "write32(" << Base::HEX8 << addr << "," << Base::HEX8 << data << ")\n"); switch(addr & 0xF0000000) { @@ -428,7 +426,7 @@ void Thumbulator::write32(uInt32 addr, uInt32 data) { #ifndef UNSAFE_OPTIMIZATIONS case 0xE0000000: - DO_DISS(statusMsg << "uart: [" << char(data&0xFF) << "]" << endl); + DO_DISS(statusMsg << "uart: [" << char(data&0xFF) << "]\n"); break; #endif #ifdef TIMER_0 @@ -507,7 +505,7 @@ void Thumbulator::write32(uInt32 addr, uInt32 data) #ifdef THUMB_CYCLE_COUNT case 0xE01FC000: //MAMCR DO_DBUG(statusMsg << "write32(" << Base::HEX8 << "MAMCR" << "," - << Base::HEX8 << data << ") *" << endl); + << Base::HEX8 << data << ") *\n"); if(!_lockMamcr) mamcr = static_cast(data); break; @@ -524,15 +522,15 @@ void Thumbulator::write32(uInt32 addr, uInt32 data) { case 0x00: statusMsg << "[" << Base::HEX8 << read_register(14) << "][" - << addr << "] " << data << endl; + << addr << "] " << data << '\n'; return; case 0x10: - statusMsg << Base::HEX8 << data << endl; + statusMsg << Base::HEX8 << data << '\n'; return; case 0x20: - statusMsg << Base::HEX8 << data << endl; + statusMsg << Base::HEX8 << data << '\n'; return; default: @@ -638,7 +636,7 @@ uInt32 Thumbulator::read16(uInt32 addr) addr &= ROMADDMASK; addr >>= 1; data = CONV_RAMROM(rom[addr]); - DO_DBUG(statusMsg << "read16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << endl); + DO_DBUG(statusMsg << "read16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << '\n'); return data; case 0x40000000: //RAM @@ -649,7 +647,7 @@ uInt32 Thumbulator::read16(uInt32 addr) addr &= RAMADDMASK; addr >>= 1; data = CONV_RAMROM(ram[addr]); - DO_DBUG(statusMsg << "read16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << endl); + DO_DBUG(statusMsg << "read16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << '\n'); return data; case 0xe0000000: //peripherals @@ -687,7 +685,7 @@ uInt32 Thumbulator::read32(uInt32 addr) #endif data = read16(addr+0); data |= read16(addr+2) << 16; - DO_DBUG(statusMsg << "read32(" << Base::HEX8 << addr << ")=" << Base::HEX8 << data << endl); + DO_DBUG(statusMsg << "read32(" << Base::HEX8 << addr << ")=" << Base::HEX8 << data << '\n'); return data; case 0x40000000: //RAM @@ -697,7 +695,7 @@ uInt32 Thumbulator::read32(uInt32 addr) #endif data = read16(addr+0); data |= read16(addr+2) << 16; - DO_DBUG(statusMsg << "read32(" << Base::HEX8 << addr << ")=" << Base::HEX8 << data << endl); + DO_DBUG(statusMsg << "read32(" << Base::HEX8 << addr << ")=" << Base::HEX8 << data << '\n'); return data; #ifndef UNSAFE_OPTIMIZATIONS @@ -784,12 +782,12 @@ FORCE_INLINE uInt32 Thumbulator::read_register(uInt32 reg) { reg &= 0xF; uInt32 data = reg_norm[reg]; - DO_DBUG(statusMsg << "read_register(" << dec << reg << ")=" << Base::HEX8 << data << endl); + DO_DBUG(statusMsg << "read_register(" << dec << reg << ")=" << Base::HEX8 << data << '\n'); if(reg == 15) { if(data & 1) { - DO_DBUG(statusMsg << "pc has lsbit set 0x" << Base::HEX8 << data << endl); + DO_DBUG(statusMsg << "pc has lsbit set 0x" << Base::HEX8 << data << '\n'); data &= ~1; } } @@ -800,7 +798,7 @@ FORCE_INLINE uInt32 Thumbulator::read_register(uInt32 reg) FORCE_INLINE void Thumbulator::write_register(uInt32 reg, uInt32 data, bool isFlowBreak) { reg &= 0xF; - DO_DBUG(statusMsg << "write_register(" << dec << reg << "," << Base::HEX8 << data << ")" << endl); + DO_DBUG(statusMsg << "write_register(" << dec << reg << "," << Base::HEX8 << data << ")\n"); if(reg == 15) { data &= ~1; @@ -1183,7 +1181,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::adc: { rd = (inst >> 0) & 0x07; rm = (inst >> 3) & 0x07; - DO_DISS(statusMsg << "adc r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "adc r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rd); rb = read_register(rm); rc = ra + rb; @@ -1204,7 +1202,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) if(rb) { DO_DISS(statusMsg << "adds r" << dec << rd << ",r" << dec << rn << "," - << "#0x" << Base::HEX2 << rb << endl); + << "#0x" << Base::HEX2 << rb << '\n'); ra = read_register(rn); rc = ra + rb; //fprintf(stderr,"0x%08X = 0x%08X + 0x%08X\n",rc,ra,rb); @@ -1224,7 +1222,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::add2: { rb = (inst >> 0) & 0xFF; rd = (inst >> 8) & 0x7; - DO_DISS(statusMsg << "adds r" << dec << rd << ",#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "adds r" << dec << rd << ",#0x" << Base::HEX2 << rb << '\n'); ra = read_register(rd); rc = ra + rb; write_register(rd, rc); @@ -1238,7 +1236,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; rm = (inst >> 6) & 0x7; - DO_DISS(statusMsg << "adds r" << dec << rd << ",r" << dec << rn << ",r" << rm << endl); + DO_DISS(statusMsg << "adds r" << dec << rd << ",r" << dec << rn << ",r" << rm << '\n'); ra = read_register(rn); rb = read_register(rm); rc = ra + rb; @@ -1257,7 +1255,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rd |= (inst >> 4) & 0x8; rm = (inst >> 3) & 0xF; - DO_DISS(statusMsg << "add r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "add r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rd); rb = read_register(rm); rc = ra + rb; @@ -1280,7 +1278,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rb = (inst >> 0) & 0xFF; rd = (inst >> 8) & 0x7; rb <<= 2; - DO_DISS(statusMsg << "add r" << dec << rd << ",PC,#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "add r" << dec << rd << ",PC,#0x" << Base::HEX2 << rb << '\n'); ra = read_register(15); rc = (ra & (~3U)) + rb; write_register(rd, rc); @@ -1292,7 +1290,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rb = (inst >> 0) & 0xFF; rd = (inst >> 8) & 0x7; rb <<= 2; - DO_DISS(statusMsg << "add r" << dec << rd << ",SP,#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "add r" << dec << rd << ",SP,#0x" << Base::HEX2 << rb << '\n'); ra = read_register(13); rc = ra + rb; write_register(rd, rc); @@ -1303,7 +1301,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::add7: { rb = (inst >> 0) & 0x7F; rb <<= 2; - DO_DISS(statusMsg << "add SP,#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "add SP,#0x" << Base::HEX2 << rb << '\n'); ra = read_register(13); rc = ra + rb; write_register(13, rc); @@ -1314,7 +1312,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::and_: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "ands r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "ands r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rd); rb = read_register(rm); rc = ra & rb; @@ -1328,7 +1326,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x07; rm = (inst >> 3) & 0x07; rb = (inst >> 6) & 0x1F; - DO_DISS(statusMsg << "asrs r" << dec << rd << ",r" << dec << rm << ",#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "asrs r" << dec << rd << ",r" << dec << rm << ",#0x" << Base::HEX2 << rb << '\n'); rc = read_register(rm); if(rb == 0) { @@ -1361,7 +1359,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::asr2: { rd = (inst >> 0) & 0x07; rs = (inst >> 3) & 0x07; - DO_DISS(statusMsg << "asrs r" << dec << rd << ",r" << dec << rs << endl); + DO_DISS(statusMsg << "asrs r" << dec << rd << ",r" << dec << rs << '\n'); rc = read_register(rd); rb = read_register(rs); rb &= 0xFF; @@ -1515,7 +1513,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::bic: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "bics r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "bics r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rd); rb = read_register(rm); rc = ra & (~rb); @@ -1528,7 +1526,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) //BKPT case Op::bkpt: { rb = (inst >> 0) & 0xFF; - statusMsg << "bkpt 0x" << Base::HEX2 << rb << endl; + statusMsg << "bkpt 0x" << Base::HEX2 << rb << '\n'; return 1; } #endif @@ -1537,7 +1535,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) // (bl, blx_thumb, blx_arm) case Op::bl: { // branch to label - DO_DISS(statusMsg << endl); + DO_DISS(statusMsg << '\n'); rb = inst & ((1 << 11) - 1); if(rb & 1 << 10) rb |= (~((1 << 11) - 1)); //sign extend rb <<= 12; @@ -1551,7 +1549,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rb = read_register(14); rb += (inst & ((1 << 11) - 1)) << 1; rb += 2; - DO_DISS(statusMsg << "bl 0x" << Base::HEX8 << (rb-3) << endl); + DO_DISS(statusMsg << "bl 0x" << Base::HEX8 << (rb-3) << '\n'); write_register(14, (pc-2) | 1); write_register(15, rb); return 0; @@ -1566,7 +1564,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rb += (inst & ((1 << 11) - 1)) << 1; rb &= 0xFFFFFFFC; rb += 2; - DO_DISS(statusMsg << "bl 0x" << Base::HEX8 << (rb-3) << endl); + DO_DISS(statusMsg << "bl 0x" << Base::HEX8 << (rb-3) << '\n'); write_register(14, (pc-2) | 1); write_register(15, rb); return 0; @@ -1575,7 +1573,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) //BLX(2) case Op::blx2: { rm = (inst >> 3) & 0xF; - DO_DISS(statusMsg << "blx r" << dec << rm << endl); + DO_DISS(statusMsg << "blx r" << dec << rm << '\n'); rc = read_register(rm); //fprintf(stderr,"blx r%u 0x%X 0x%X\n",rm,rc,pc); rc += 2; @@ -1599,7 +1597,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) //BX case Op::bx: { rm = (inst >> 3) & 0xF; - DO_DISS(statusMsg << "bx r" << dec << rm << endl); + DO_DISS(statusMsg << "bx r" << dec << rm << '\n'); rc = read_register(rm); rc += 2; //fprintf(stderr,"bx r%u 0x%X 0x%X\n",rm,rc,pc); @@ -1846,7 +1844,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::cmn: { rn = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "cmns r" << dec << rn << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "cmns r" << dec << rn << ",r" << dec << rm << '\n'); ra = read_register(rn); rb = read_register(rm); rc = ra + rb; @@ -1859,7 +1857,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::cmp1: { rb = (inst >> 0) & 0xFF; rn = (inst >> 8) & 0x07; - DO_DISS(statusMsg << "cmp r" << dec << rn << ",#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "cmp r" << dec << rn << ",#0x" << Base::HEX2 << rb << '\n'); ra = read_register(rn); rc = ra - rb; //fprintf(stderr,"0x%08X 0x%08X\n",ra,rb); @@ -1872,7 +1870,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::cmp2: { rn = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "cmps r" << dec << rn << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "cmps r" << dec << rn << ",r" << dec << rm << '\n'); ra = read_register(rn); rb = read_register(rm); rc = ra - rb; @@ -1895,7 +1893,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) //UNPREDICTABLE } rm = (inst >> 3) & 0xF; - DO_DISS(statusMsg << "cmps r" << dec << rn << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "cmps r" << dec << rn << ",r" << dec << rm << '\n'); ra = read_register(rn); rb = read_register(rm); rc = ra - rb; @@ -1907,7 +1905,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) #ifndef UNSAFE_OPTIMIZATIONS //CPS case Op::cps: { - DO_DISS(statusMsg << "cps TODO" << endl); + DO_DISS(statusMsg << "cps TODO\n"); return 1; } #endif @@ -1918,7 +1916,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) //going to let mov handle high registers rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "cpy r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "cpy r" << dec << rd << ",r" << dec << rm << '\n'); rc = read_register(rm); write_register(rd, rc); return 0; @@ -1928,7 +1926,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::eor: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "eors r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "eors r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rd); rb = read_register(rm); rc = ra ^ rb; @@ -1951,7 +1949,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rc++; } } - statusMsg << "}" << endl; + statusMsg << "}\n"; #endif bool first = true; @@ -1986,7 +1984,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rn = (inst >> 3) & 0x07; rb = (inst >> 6) & 0x1F; rb <<= 2; - DO_DISS(statusMsg << "ldr r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]" << endl); + DO_DISS(statusMsg << "ldr r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]\n"); rb = read_register(rn) + rb; rc = read32(rb); write_register(rd, rc); @@ -1999,7 +1997,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; rm = (inst >> 6) & 0x7; - DO_DISS(statusMsg << "ldr r" << dec << rd << ",[r" << dec << rn << ",r" << dec << "]" << endl); + DO_DISS(statusMsg << "ldr r" << dec << rd << ",[r" << dec << rn << ",r" << dec << "]\n"); rb = read_register(rn) + read_register(rm); rc = read32(rb); write_register(rd, rc); @@ -2016,7 +2014,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) ra = read_register(15); ra &= ~3; rb += ra; - DO_DISS(statusMsg << ";@ 0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << ";@ 0x" << Base::HEX2 << rb << '\n'); rc = read32(rb); write_register(rd, rc); INC_LDR_CYCLES; @@ -2028,7 +2026,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rb = (inst >> 0) & 0xFF; rd = (inst >> 8) & 0x07; rb <<= 2; - DO_DISS(statusMsg << "ldr r" << dec << rd << ",[SP+#0x" << Base::HEX2 << rb << "]" << endl); + DO_DISS(statusMsg << "ldr r" << dec << rd << ",[SP+#0x" << Base::HEX2 << rb << "]\n"); ra = read_register(13); //ra&=~3; rb += ra; @@ -2043,7 +2041,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x07; rn = (inst >> 3) & 0x07; rb = (inst >> 6) & 0x1F; - DO_DISS(statusMsg << "ldrb r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]" << endl); + DO_DISS(statusMsg << "ldrb r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]\n"); rb = read_register(rn) + rb; #ifndef UNSAFE_OPTIMIZATIONS rc = read16(rb & (~1U)); @@ -2067,7 +2065,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; rm = (inst >> 6) & 0x7; - DO_DISS(statusMsg << "ldrb r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]" << endl); + DO_DISS(statusMsg << "ldrb r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]\n"); rb = read_register(rn) + read_register(rm); #ifndef UNSAFE_OPTIMIZATIONS rc = read16(rb & (~1U)); @@ -2089,7 +2087,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rn = (inst >> 3) & 0x07; rb = (inst >> 6) & 0x1F; rb <<= 1; - DO_DISS(statusMsg << "ldrh r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]" << endl); + DO_DISS(statusMsg << "ldrh r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]\n"); rb = read_register(rn) + rb; rc = read16(rb); write_register(rd, rc & 0xFFFF); @@ -2102,7 +2100,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; rm = (inst >> 6) & 0x7; - DO_DISS(statusMsg << "ldrh r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]" << endl); + DO_DISS(statusMsg << "ldrh r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]\n"); rb = read_register(rn) + read_register(rm); rc = read16(rb); write_register(rd, rc & 0xFFFF); @@ -2115,7 +2113,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; rm = (inst >> 6) & 0x7; - DO_DISS(statusMsg << "ldrsb r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]" << endl); + DO_DISS(statusMsg << "ldrsb r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]\n"); rb = read_register(rn) + read_register(rm); #ifndef UNSAFE_OPTIMIZATIONS rc = read16(rb & (~1U)); @@ -2139,7 +2137,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; rm = (inst >> 6) & 0x7; - DO_DISS(statusMsg << "ldrsh r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]" << endl); + DO_DISS(statusMsg << "ldrsh r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]\n"); rb = read_register(rn) + read_register(rm); rc = read16(rb); rc &= 0xFFFF; @@ -2155,7 +2153,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x07; rm = (inst >> 3) & 0x07; rb = (inst >> 6) & 0x1F; - DO_DISS(statusMsg << "lsls r" << dec << rd << ",r" << dec << rm << ",#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "lsls r" << dec << rd << ",r" << dec << rm << ",#0x" << Base::HEX2 << rb << '\n'); rc = read_register(rm); if(rb == 0) { @@ -2179,7 +2177,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::lsl2: { rd = (inst >> 0) & 0x07; rs = (inst >> 3) & 0x07; - DO_DISS(statusMsg << "lsls r" << dec << rd << ",r" << dec << rs << endl); + DO_DISS(statusMsg << "lsls r" << dec << rd << ",r" << dec << rs << '\n'); rc = read_register(rd); rb = read_register(rs); rb &= 0xFF; @@ -2212,7 +2210,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x07; rm = (inst >> 3) & 0x07; rb = (inst >> 6) & 0x1F; - DO_DISS(statusMsg << "lsrs r" << dec << rd << ",r" << dec << rm << ",#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "lsrs r" << dec << rd << ",r" << dec << rm << ",#0x" << Base::HEX2 << rb << '\n'); rc = read_register(rm); if(rb == 0) { @@ -2234,7 +2232,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::lsr2: { rd = (inst >> 0) & 0x07; rs = (inst >> 3) & 0x07; - DO_DISS(statusMsg << "lsrs r" << dec << rd << ",r" << dec << rs << endl); + DO_DISS(statusMsg << "lsrs r" << dec << rd << ",r" << dec << rs << '\n'); rc = read_register(rd); rb = read_register(rs); rb &= 0xFF; @@ -2266,7 +2264,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::mov1: { rb = (inst >> 0) & 0xFF; rd = (inst >> 8) & 0x07; - DO_DISS(statusMsg << "movs r" << dec << rd << ",#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "movs r" << dec << rd << ",#0x" << Base::HEX2 << rb << '\n'); write_register(rd, rb); do_znflags(rb); return 0; @@ -2276,7 +2274,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::mov2: { rd = (inst >> 0) & 7; rn = (inst >> 3) & 7; - DO_DISS(statusMsg << "movs r" << dec << rd << ",r" << dec << rn << endl); + DO_DISS(statusMsg << "movs r" << dec << rd << ",r" << dec << rn << '\n'); rc = read_register(rn); //fprintf(stderr,"0x%08X\n",rc); write_register(rd, rc); @@ -2291,7 +2289,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rd |= (inst >> 4) & 0x8; rm = (inst >> 3) & 0xF; - DO_DISS(statusMsg << "mov r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "mov r" << dec << rd << ",r" << dec << rm << '\n'); rc = read_register(rm); if((rd == 14) && (rm == 15)) { @@ -2311,7 +2309,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::mul: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "muls r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "muls r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rd); rb = read_register(rm); #ifdef DEBUGGER_SUPPORT @@ -2342,7 +2340,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::mvn: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "mvns r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "mvns r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rm); rc = (~ra); write_register(rd, rc); @@ -2354,7 +2352,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::neg: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "negs r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "negs r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rm); rc = 0 - ra; write_register(rd, rc); @@ -2367,7 +2365,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::orr: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "orrs r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "orrs r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rd); rb = read_register(rm); rc = ra | rb; @@ -2394,7 +2392,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) if(rc) statusMsg << ","; statusMsg << "pc"; } - statusMsg << "}" << endl; + statusMsg << "}\n"; #endif bool first = true; @@ -2454,7 +2452,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) if(rc) statusMsg << ","; statusMsg << "lr"; } - statusMsg << "}" << endl; + statusMsg << "}\n"; #endif sp = read_register(13); @@ -2515,7 +2513,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::rev: { rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "rev r" << dec << rd << ",r" << dec << rn << endl); + DO_DISS(statusMsg << "rev r" << dec << rd << ",r" << dec << rn << '\n'); ra = read_register(rn); rc = ((ra >> 0) & 0xFF) << 24; rc |= ((ra >> 8) & 0xFF) << 16; @@ -2529,7 +2527,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::rev16: { rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "rev16 r" << dec << rd << ",r" << dec << rn << endl); + DO_DISS(statusMsg << "rev16 r" << dec << rd << ",r" << dec << rn << '\n'); ra = read_register(rn); rc = ((ra >> 0) & 0xFF) << 8; rc |= ((ra >> 8) & 0xFF) << 0; @@ -2543,7 +2541,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::revsh: { rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "revsh r" << dec << rd << ",r" << dec << rn << endl); + DO_DISS(statusMsg << "revsh r" << dec << rd << ",r" << dec << rn << '\n'); ra = read_register(rn); rc = ((ra >> 0) & 0xFF) << 8; rc |= ((ra >> 8) & 0xFF) << 0; @@ -2557,7 +2555,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::ror: { rd = (inst >> 0) & 0x7; rs = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "rors r" << dec << rd << ",r" << dec << rs << endl); + DO_DISS(statusMsg << "rors r" << dec << rd << ",r" << dec << rs << '\n'); rc = read_register(rd); ra = read_register(rs); ra &= 0xFF; @@ -2589,7 +2587,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::sbc: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "sbc r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "sbc r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rd); rb = read_register(rm); rc = ra - rb; @@ -2604,7 +2602,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) #ifndef UNSAFE_OPTIMIZATIONS //SETEND case Op::setend: { - statusMsg << "setend not implemented" << endl; + statusMsg << "setend not implemented\n"; return 1; } #endif @@ -2623,7 +2621,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rc++; } } - statusMsg << "}" << endl; + statusMsg << "}\n"; #endif bool first = true; @@ -2656,7 +2654,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rn = (inst >> 3) & 0x07; rb = (inst >> 6) & 0x1F; rb <<= 2; - DO_DISS(statusMsg << "str r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]" << endl); + DO_DISS(statusMsg << "str r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]\n"); rb = read_register(rn) + rb; rc = read_register(rd); write32(rb, rc); @@ -2669,7 +2667,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; rm = (inst >> 6) & 0x7; - DO_DISS(statusMsg << "str r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]" << endl); + DO_DISS(statusMsg << "str r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]\n"); rb = read_register(rn) + read_register(rm); rc = read_register(rd); write32(rb, rc); @@ -2682,7 +2680,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rb = (inst >> 0) & 0xFF; rd = (inst >> 8) & 0x07; rb <<= 2; - DO_DISS(statusMsg << "str r" << dec << rd << ",[SP,#0x" << Base::HEX2 << rb << "]" << endl); + DO_DISS(statusMsg << "str r" << dec << rd << ",[SP,#0x" << Base::HEX2 << rb << "]\n"); rb = read_register(13) + rb; //fprintf(stderr,"0x%08X\n",rb); rc = read_register(rd); @@ -2696,7 +2694,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x07; rn = (inst >> 3) & 0x07; rb = (inst >> 6) & 0x1F; - DO_DISS(statusMsg << "strb r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX8 << rb << "]" << endl); + DO_DISS(statusMsg << "strb r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX8 << rb << "]\n"); rb = read_register(rn) + rb; rc = read_register(rd); #ifndef UNSAFE_OPTIMIZATIONS @@ -2724,7 +2722,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; rm = (inst >> 6) & 0x7; - DO_DISS(statusMsg << "strb r" << dec << rd << ",[r" << dec << rn << ",r" << rm << "]" << endl); + DO_DISS(statusMsg << "strb r" << dec << rd << ",[r" << dec << rn << ",r" << rm << "]\n"); rb = read_register(rn) + read_register(rm); rc = read_register(rd); #ifndef UNSAFE_OPTIMIZATIONS @@ -2753,7 +2751,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rn = (inst >> 3) & 0x07; rb = (inst >> 6) & 0x1F; rb <<= 1; - DO_DISS(statusMsg << "strh r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]" << endl); + DO_DISS(statusMsg << "strh r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]\n"); rb = read_register(rn) + rb; rc= read_register(rd); write16(rb, rc & 0xFFFF); @@ -2766,7 +2764,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; rm = (inst >> 6) & 0x7; - DO_DISS(statusMsg << "strh r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]" << endl); + DO_DISS(statusMsg << "strh r" << dec << rd << ",[r" << dec << rn << ",r" << dec << rm << "]\n"); rb = read_register(rn) + read_register(rm); rc = read_register(rd); write16(rb, rc & 0xFFFF); @@ -2779,7 +2777,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; rb = (inst >> 6) & 0x7; - DO_DISS(statusMsg << "subs r" << dec << rd << ",r" << dec << rn << ",#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "subs r" << dec << rd << ",r" << dec << rn << ",#0x" << Base::HEX2 << rb << '\n'); ra = read_register(rn); rc = ra - rb; write_register(rd, rc); @@ -2792,7 +2790,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::sub2: { rb = (inst >> 0) & 0xFF; rd = (inst >> 8) & 0x07; - DO_DISS(statusMsg << "subs r" << dec << rd << ",#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "subs r" << dec << rd << ",#0x" << Base::HEX2 << rb << '\n'); ra = read_register(rd); rc = ra - rb; write_register(rd, rc); @@ -2806,7 +2804,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) rd = (inst >> 0) & 0x7; rn = (inst >> 3) & 0x7; rm = (inst >> 6) & 0x7; - DO_DISS(statusMsg << "subs r" << dec << rd << ",r" << dec << rn << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "subs r" << dec << rd << ",r" << dec << rn << ",r" << dec << rm << '\n'); ra = read_register(rn); rb = read_register(rm); rc = ra - rb; @@ -2820,7 +2818,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::sub4: { rb = inst & 0x7F; rb <<= 2; - DO_DISS(statusMsg << "sub SP,#0x" << Base::HEX2 << rb << endl); + DO_DISS(statusMsg << "sub SP,#0x" << Base::HEX2 << rb << '\n'); ra = read_register(13); ra -= rb; write_register(13, ra); @@ -2830,7 +2828,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) //SWI case Op::swi: { // never used // rb = inst & 0xFF; // NOLINT: clang-analyzer-deadcode.DeadStores -// DO_DISS(statusMsg << "swi 0x" << Base::HEX2 << rb << endl); +// DO_DISS(statusMsg << "swi 0x" << Base::HEX2 << rb << '\n'); // // if(rb == 0xCC) // { @@ -2840,7 +2838,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) // else // { //#if defined(THUMB_DISS) -// statusMsg << endl << endl << "swi 0x" << Base::HEX2 << rb << endl; +// statusMsg << "\n\nswi 0x" << Base::HEX2 << rb << '\n'; //#endif return 1; // } @@ -2850,7 +2848,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::sxtb: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "sxtb r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "sxtb r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rm); rc = ra & 0xFF; if(rc & 0x80) @@ -2863,7 +2861,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::sxth: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "sxth r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "sxth r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rm); rc = ra & 0xFFFF; if(rc & 0x8000) @@ -2876,7 +2874,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::tst: { rn = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "tst r" << dec << rn << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "tst r" << dec << rn << ",r" << dec << rm << '\n'); ra = read_register(rn); rb = read_register(rm); rc = ra & rb; @@ -2888,7 +2886,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::uxtb: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "uxtb r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "uxtb r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rm); rc = ra & 0xFF; write_register(rd, rc); @@ -2899,7 +2897,7 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) case Op::uxth: { rd = (inst >> 0) & 0x7; rm = (inst >> 3) & 0x7; - DO_DISS(statusMsg << "uxth r" << dec << rd << ",r" << dec << rm << endl); + DO_DISS(statusMsg << "uxth r" << dec << rd << ",r" << dec << rm << '\n'); ra = read_register(rm); rc = ra & 0xFFFF; write_register(rd, rc); @@ -2920,7 +2918,8 @@ FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size) } #ifndef UNSAFE_OPTIMIZATIONS - statusMsg << "invalid instruction " << Base::HEX8 << pc << " " << Base::HEX4 << inst << endl; + statusMsg << "invalid instruction " << Base::HEX8 << pc << " " + << Base::HEX4 << inst << '\n'; #endif return 1; } diff --git a/src/emucore/tia/AnalogReadout.cxx b/src/emucore/tia/AnalogReadout.cxx index 9ba885b6d..fe8ad2d52 100644 --- a/src/emucore/tia/AnalogReadout.cxx +++ b/src/emucore/tia/AnalogReadout.cxx @@ -134,7 +134,7 @@ bool AnalogReadout::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA_AnalogReadout::save" << endl; + cerr << "ERROR: TIA_AnalogReadout::save\n"; return false; } @@ -159,7 +159,7 @@ bool AnalogReadout::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA_AnalogReadout::load" << endl; + cerr << "ERROR: TIA_AnalogReadout::load\n"; return false; } @@ -176,7 +176,7 @@ bool AnalogReadout::Connection::save(Serializer& out) const } catch(...) { - cerr << "ERROR: AnalogReadout::Connection::save" << endl; + cerr << "ERROR: AnalogReadout::Connection::save\n"; return false; } @@ -193,7 +193,7 @@ bool AnalogReadout::Connection::load(const Serializer& in) } catch(...) { - cerr << "ERROR: AnalogReadout::Connection::load" << endl; + cerr << "ERROR: AnalogReadout::Connection::load\n"; return false; } diff --git a/src/emucore/tia/Audio.cxx b/src/emucore/tia/Audio.cxx index a04bebfa9..44c39ebc8 100644 --- a/src/emucore/tia/Audio.cxx +++ b/src/emucore/tia/Audio.cxx @@ -120,7 +120,7 @@ bool Audio::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA_Audio::save" << endl; + cerr << "ERROR: TIA_Audio::save\n"; return false; } @@ -157,7 +157,7 @@ bool Audio::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA_Audio::load" << endl; + cerr << "ERROR: TIA_Audio::load\n"; return false; } diff --git a/src/emucore/tia/AudioChannel.cxx b/src/emucore/tia/AudioChannel.cxx index eb69880bb..219e27653 100644 --- a/src/emucore/tia/AudioChannel.cxx +++ b/src/emucore/tia/AudioChannel.cxx @@ -160,7 +160,7 @@ bool AudioChannel::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA_AudioChannel::save" << endl; + cerr << "ERROR: TIA_AudioChannel::save\n"; return false; } @@ -187,7 +187,7 @@ bool AudioChannel::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA_AudioChannel::load" << endl; + cerr << "ERROR: TIA_AudioChannel::load\n"; return false; } diff --git a/src/emucore/tia/Background.cxx b/src/emucore/tia/Background.cxx index 8f9dd8082..23b6ac335 100644 --- a/src/emucore/tia/Background.cxx +++ b/src/emucore/tia/Background.cxx @@ -82,7 +82,7 @@ bool Background::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA_BK::save" << endl; + cerr << "ERROR: TIA_BK::save\n"; return false; } @@ -103,7 +103,7 @@ bool Background::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA_BK::load" << endl; + cerr << "ERROR: TIA_BK::load\n"; return false; } diff --git a/src/emucore/tia/Ball.cxx b/src/emucore/tia/Ball.cxx index 2e4d4f1f8..8a76b13a5 100644 --- a/src/emucore/tia/Ball.cxx +++ b/src/emucore/tia/Ball.cxx @@ -271,7 +271,7 @@ bool Ball::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA_Ball::save" << endl; + cerr << "ERROR: TIA_Ball::save\n"; return false; } @@ -314,7 +314,7 @@ bool Ball::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA_Ball::load" << endl; + cerr << "ERROR: TIA_Ball::load\n"; return false; } diff --git a/src/emucore/tia/DelayQueue.hxx b/src/emucore/tia/DelayQueue.hxx index 30d841c7f..934c7aef2 100644 --- a/src/emucore/tia/DelayQueue.hxx +++ b/src/emucore/tia/DelayQueue.hxx @@ -134,7 +134,7 @@ bool DelayQueue::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA_DelayQueue::save" << endl; + cerr << "ERROR: TIA_DelayQueue::save\n"; return false; } @@ -157,7 +157,7 @@ bool DelayQueue::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA_DelayQueue::load" << endl; + cerr << "ERROR: TIA_DelayQueue::load\n"; return false; } diff --git a/src/emucore/tia/DelayQueueMember.hxx b/src/emucore/tia/DelayQueueMember.hxx index be546acb5..c339b8d85 100644 --- a/src/emucore/tia/DelayQueueMember.hxx +++ b/src/emucore/tia/DelayQueueMember.hxx @@ -120,7 +120,7 @@ bool DelayQueueMember::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA_DelayQueueMember::save" << endl; + cerr << "ERROR: TIA_DelayQueueMember::save\n"; return false; } @@ -144,7 +144,7 @@ bool DelayQueueMember::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA_DelayQueueMember::load" << endl; + cerr << "ERROR: TIA_DelayQueueMember::load\n"; return false; } diff --git a/src/emucore/tia/LatchedInput.cxx b/src/emucore/tia/LatchedInput.cxx index 7870fd822..76360fc06 100644 --- a/src/emucore/tia/LatchedInput.cxx +++ b/src/emucore/tia/LatchedInput.cxx @@ -58,7 +58,7 @@ bool LatchedInput::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA_LatchedInput::save" << endl; + cerr << "ERROR: TIA_LatchedInput::save\n"; return false; } @@ -75,7 +75,7 @@ bool LatchedInput::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA_LatchedInput::load" << endl; + cerr << "ERROR: TIA_LatchedInput::load\n"; return false; } diff --git a/src/emucore/tia/Missile.cxx b/src/emucore/tia/Missile.cxx index 786b606b7..85f5f2f4d 100644 --- a/src/emucore/tia/Missile.cxx +++ b/src/emucore/tia/Missile.cxx @@ -296,7 +296,7 @@ bool Missile::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA_Missile::save" << endl; + cerr << "ERROR: TIA_Missile::save\n"; return false; } @@ -340,7 +340,7 @@ bool Missile::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA_Missile::load" << endl; + cerr << "ERROR: TIA_Missile::load\n"; return false; } diff --git a/src/emucore/tia/Player.cxx b/src/emucore/tia/Player.cxx index 212465b97..1add2c46e 100644 --- a/src/emucore/tia/Player.cxx +++ b/src/emucore/tia/Player.cxx @@ -443,7 +443,7 @@ bool Player::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA_Player::save" << endl; + cerr << "ERROR: TIA_Player::save\n"; return false; } @@ -493,7 +493,7 @@ bool Player::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA_Player::load" << endl; + cerr << "ERROR: TIA_Player::load\n"; return false; } diff --git a/src/emucore/tia/Playfield.cxx b/src/emucore/tia/Playfield.cxx index 700058427..5ef656ac0 100644 --- a/src/emucore/tia/Playfield.cxx +++ b/src/emucore/tia/Playfield.cxx @@ -306,7 +306,7 @@ bool Playfield::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA_Playfield::save" << endl; + cerr << "ERROR: TIA_Playfield::save\n"; return false; } @@ -352,7 +352,7 @@ bool Playfield::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA_Playfield::load" << endl; + cerr << "ERROR: TIA_Playfield::load\n"; return false; } diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 2aa54e39e..38023efc3 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -319,7 +319,7 @@ bool TIA::save(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA::save" << endl; + cerr << "ERROR: TIA::save\n"; return false; } @@ -397,7 +397,7 @@ bool TIA::load(Serializer& in) } catch(...) { - cerr << "ERROR: TIA::load" << endl; + cerr << "ERROR: TIA::load\n"; return false; } @@ -910,7 +910,7 @@ bool TIA::saveDisplay(Serializer& out) const } catch(...) { - cerr << "ERROR: TIA::saveDisplay" << endl; + cerr << "ERROR: TIA::saveDisplay\n"; return false; } @@ -930,7 +930,7 @@ bool TIA::loadDisplay(const Serializer& in) } catch(...) { - cerr << "ERROR: TIA::loadDisplay" << endl; + cerr << "ERROR: TIA::loadDisplay\n"; return false; } diff --git a/src/emucore/tia/frame-manager/AbstractFrameManager.cxx b/src/emucore/tia/frame-manager/AbstractFrameManager.cxx index 73a7c2831..48c316660 100644 --- a/src/emucore/tia/frame-manager/AbstractFrameManager.cxx +++ b/src/emucore/tia/frame-manager/AbstractFrameManager.cxx @@ -126,7 +126,7 @@ bool AbstractFrameManager::save(Serializer& out) const } catch(...) { - cerr << "ERROR: AbstractFrameManager::save" << endl; + cerr << "ERROR: AbstractFrameManager::save\n"; return false; } } @@ -149,7 +149,7 @@ bool AbstractFrameManager::load(Serializer& in) } catch(...) { - cerr << "ERROR: AbstractFrameManager::load" << endl; + cerr << "ERROR: AbstractFrameManager::load\n"; return false; } } diff --git a/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx b/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx index 20b503761..8a51f033f 100644 --- a/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx +++ b/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx @@ -46,7 +46,7 @@ FrameLayout FrameLayoutDetector::detectedLayout(bool detectPal60, bool detectNtsc50, string_view name) const { #if 0 // debug - cerr << endl << name << endl; + cerr << '\n' << name << '\n'; int i = 0; for(auto count : myColorCount) { @@ -54,11 +54,11 @@ FrameLayout FrameLayoutDetector::detectedLayout(bool detectPal60, cerr << std::uppercase << std::setw(2) << std::hex << (i >> 3) << "x: "; cerr << std::setw(6) << std::dec << count; if(++i % 8 == 0) - cerr << endl; + cerr << '\n'; else cerr << ", "; } - cerr << endl; + cerr << '\n'; #endif #if 0 // save sampled color values std::ofstream file; @@ -126,7 +126,7 @@ FrameLayout FrameLayoutDetector::detectedLayout(bool detectPal60, const double overRuleFactor = 1.0 + (OVERRULE_FACTOR - 1.0) * 2 * (std::max(myNtscFrameSum, myPalFrameSum) / (myNtscFrameSum + myPalFrameSum) - 0.5); // 1.0 .. OVERRULE_FACTOR - //cerr << overRuleFactor << " * PAL:" << paCollSum << "/NTSC:" << ntscColSum << endl; + //cerr << overRuleFactor << " * PAL:" << paCollSum << "/NTSC:" << ntscColSum << '\n'; if(detectPal60 && layout == FrameLayout::ntsc && ntscColSum * overRuleFactor < paCollSum) { layout = FrameLayout::pal60; @@ -243,5 +243,5 @@ void FrameLayoutDetector::finalizeFrame() / static_cast(frameLinesPAL - frameLinesNTSC), 0.0, 1.0); myPalFrameSum += palFrame; myNtscFrameSum += 1.0 - palFrame; - //cerr << myCurrentFrameFinalLines << ", " << palFrame << ", " << myPalFrameSum << ", " << myNtscFrameSum << endl; + //cerr << myCurrentFrameFinalLines << ", " << palFrame << ", " << myPalFrameSum << ", " << myNtscFrameSum << '\n'; } diff --git a/src/emucore/tia/frame-manager/FrameManager.cxx b/src/emucore/tia/frame-manager/FrameManager.cxx index eebf43c3a..47742a079 100644 --- a/src/emucore/tia/frame-manager/FrameManager.cxx +++ b/src/emucore/tia/frame-manager/FrameManager.cxx @@ -247,7 +247,7 @@ void FrameManager::recalculateMetrics() { // TODO: why "- 1" here: ??? myMaxVcenter = BSPF::clamp(ystartBase + (baseHeight - static_cast(myHeight)) / 2 - 1, 0, TIAConstants::maxVcenter); - //cout << "myVSizeAdjust " << myVSizeAdjust << " " << myHeight << endl << std::flush; + //cout << "myVSizeAdjust " << myVSizeAdjust << " " << myHeight << '\n' << std::flush; myJitterEmulation.setYStart(myYStart); } diff --git a/src/emucore/tia/frame-manager/JitterEmulation.cxx b/src/emucore/tia/frame-manager/JitterEmulation.cxx index 0f6ecca23..c3cc11c6b 100644 --- a/src/emucore/tia/frame-manager/JitterEmulation.cxx +++ b/src/emucore/tia/frame-manager/JitterEmulation.cxx @@ -58,7 +58,7 @@ void JitterEmulation::frameComplete(Int32 scanlineCount, Int32 vsyncCycles) { //#ifdef DEBUG_BUILD // const int vsyncLines = round((vsyncCycles - 2) / 76.0); -// cerr << "TV jitter " << myJitter << " - " << scanlineCount << ", " << vsyncCycles << ", " << vsyncLines << endl; +// cerr << "TV jitter " << myJitter << " - " << scanlineCount << ", " << vsyncCycles << ", " << vsyncLines << '\n'; //#endif // Check if current frame size is stable compared to previous frame @@ -147,7 +147,7 @@ bool JitterEmulation::save(Serializer& out) const } catch(...) { - cerr << "ERROR: JitterEmulation::save" << endl; + cerr << "ERROR: JitterEmulation::save\n"; return false; } @@ -170,7 +170,7 @@ bool JitterEmulation::load(Serializer& in) } catch (...) { - cerr << "ERROR: JitterEmulation::load" << endl; + cerr << "ERROR: JitterEmulation::load\n"; return false; } diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 0f42a1299..44728a9ce 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -243,7 +243,7 @@ string Dialog::getHelpURL() const void Dialog::openHelp() { if(hasHelp() && !MediaFactory::openURL(getHelpURL())) - cerr << "error opening URL " << getHelpURL() << endl; + cerr << "error opening URL " << getHelpURL() << '\n'; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -336,7 +336,7 @@ void Dialog::redraw(bool force) void Dialog::render() { #ifdef DEBUG_BUILD - //cerr << " render " << typeid(*this).name() << endl; + //cerr << " render " << typeid(*this).name() << '\n'; #endif // Update dialog surface; also render any extra surfaces @@ -539,13 +539,13 @@ void Dialog::drawDialog() if(isDirty()) { #ifdef DEBUG_BUILD - //cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl; - cerr << endl << "d"; + //cerr << "*** draw dialog " << typeid(*this).name() << " ***\n"; + cerr << "\nd"; #endif if(clearsBackground()) { - // cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl; + // cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << "\n\n"; if(hasBackground()) s.fillRect(_x, _y + _th, _w, _h - _th, kDlgColor); @@ -561,7 +561,7 @@ void Dialog::drawDialog() else { s.invalidate(); #ifdef DEBUG_BUILD - //cerr << "invalidate " << typeid(*this).name() << endl; + //cerr << "invalidate " << typeid(*this).name() << '\n'; #endif } if(hasBorder()) // currently only used by Dialog itself @@ -574,7 +574,7 @@ void Dialog::drawDialog() } #ifdef DEBUG_BUILD else - cerr << endl; + cerr << '\n'; #endif // Draw all children diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx index a8fc92c43..73634f1c7 100644 --- a/src/gui/DialogContainer.cxx +++ b/src/gui/DialogContainer.cxx @@ -98,7 +98,7 @@ void DialogContainer::draw(bool full) if(myDialogStack.empty()) return; #ifdef DEBUG_BUILD - //cerr << "draw " << full << " " << typeid(*this).name() << endl; + //cerr << "draw " << full << " " << typeid(*this).name() << '\n'; #endif // Draw and render all dirty dialogs @@ -123,7 +123,7 @@ void DialogContainer::render() if(myDialogStack.empty()) return; #ifdef DEBUG_BUILD - //cerr << "full re-render " << typeid(*this).name() << endl; + //cerr << "full re-render " << typeid(*this).name() << '\n'; #endif // Make sure we start in a clean state (with zero'ed buffers) @@ -178,7 +178,7 @@ void DialogContainer::removeDialog() if(!myDialogStack.empty()) { #ifdef DEBUG_BUILD - //cerr << "remove dialog " << typeid(*myDialogStack.top()).name() << endl; + //cerr << "remove dialog " << typeid(*myDialogStack.top()).name() << '\n'; #endif myDialogStack.pop(); diff --git a/src/gui/RomImageWidget.cxx b/src/gui/RomImageWidget.cxx index 3cd75d10e..ecd575be4 100644 --- a/src/gui/RomImageWidget.cxx +++ b/src/gui/RomImageWidget.cxx @@ -56,7 +56,7 @@ void RomImageWidget::setProperties(const FSNode& node, #ifdef DEBUGGER_SUPPORT else { - cerr << "RomImageWidget::setProperties: else!" << endl; + cerr << "RomImageWidget::setProperties: else!\n"; Logger::debug("RomImageWidget::setProperties: else!"); } #endif @@ -75,7 +75,7 @@ void RomImageWidget::clearProperties() #ifdef DEBUGGER_SUPPORT else { - cerr << "RomImageWidget::clearProperties: else!" << endl; + cerr << "RomImageWidget::clearProperties: else!\n"; Logger::debug("RomImageWidget::clearProperties: else!"); } #endif diff --git a/src/gui/RomInfoWidget.cxx b/src/gui/RomInfoWidget.cxx index 719e905dc..31436fcd4 100644 --- a/src/gui/RomInfoWidget.cxx +++ b/src/gui/RomInfoWidget.cxx @@ -51,7 +51,7 @@ void RomInfoWidget::setProperties(const FSNode& node, #ifdef DEBUGGER_SUPPORT else { - cerr << "RomInfoWidget::setProperties: else!" << endl; + cerr << "RomInfoWidget::setProperties: else!\n"; Logger::debug("RomInfoWidget::setProperties: else!"); } #endif @@ -68,7 +68,7 @@ void RomInfoWidget::clearProperties() #ifdef DEBUGGER_SUPPORT else { - cerr << "RomInfoWidget::clearProperties: else!" << endl; + cerr << "RomInfoWidget::clearProperties: else!\n"; Logger::debug("RomInfoWidget::clearProperties: else!"); } #endif diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index 979020be0..db38af6ed 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -101,7 +101,7 @@ void Widget::draw() if(isDirty()) { #ifdef DEBUG_BUILD - //cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl; + //cerr << " *** draw widget " << typeid(*this).name() << " ***" << '\n'; cerr << "w"; #endif @@ -518,7 +518,7 @@ void Widget::setDirtyInChain(Widget* start) while(start) { #ifdef DEBUG_BUILD - //cerr << "setDirtyInChain " << typeid(*start).name() << endl; + //cerr << "setDirtyInChain " << typeid(*start).name() << '\n'; #endif start->setDirty(); start = start->_next; diff --git a/src/os/macos/OSystemMACOS.cxx b/src/os/macos/OSystemMACOS.cxx index 747585226..a9264e5a7 100644 --- a/src/os/macos/OSystemMACOS.cxx +++ b/src/os/macos/OSystemMACOS.cxx @@ -27,7 +27,7 @@ void OSystemMACOS::getBaseDirectories(string& basedir, string& homedir, #if 0 // Check to see if basedir overrides are active if(useappdir) - cout << "ERROR: base dir in app folder not supported" << endl; + cout << "ERROR: base dir in app folder not supported\n"; else if(usedir != "") basedir = FSNode(usedir).getPath(); #endif diff --git a/src/os/unix/OSystemUNIX.cxx b/src/os/unix/OSystemUNIX.cxx index 04bf4744e..31a53073d 100644 --- a/src/os/unix/OSystemUNIX.cxx +++ b/src/os/unix/OSystemUNIX.cxx @@ -32,7 +32,7 @@ void OSystemUNIX::getBaseDirectories(string& basedir, string& homedir, // Check to see if basedir overrides are active if(useappdir) - cout << "ERROR: base dir in app folder not supported" << endl; + cout << "ERROR: base dir in app folder not supported\n"; else if(!usedir.empty()) basedir = FSNode(usedir).getPath(); } diff --git a/src/tools/check-sig.cxx b/src/tools/check-sig.cxx index c616f1ddd..c42b5171b 100644 --- a/src/tools/check-sig.cxx +++ b/src/tools/check-sig.cxx @@ -67,9 +67,9 @@ int main(int ac, char* av[]) while(buf >> hex >> c) { sig[s_size++] = (uInt8)c; -// cerr << "character = " << hex << (int)sig[s_size-1] << endl; +// cerr << "character = " << hex << (int)sig[s_size-1] << '\n'; } -// cerr << "sig size = " << hex << s_size << endl; +// cerr << "sig size = " << hex << s_size << '\n'; list locations; int result = searchForBytes(image.get()+offset, i_size-offset, sig.get(), s_size, locations); @@ -78,7 +78,7 @@ int main(int ac, char* av[]) cout << setw(3) << result << " hits: \'" << av[2] << "\' - \"" << av[1] << "\" @"; for(const auto& it: locations) cout << ' ' << hex << (it + offset); - cout << endl; + cout << '\n'; } return 0; diff --git a/src/tools/romtohex.cxx b/src/tools/romtohex.cxx index f5bb9c602..f7c625616 100644 --- a/src/tools/romtohex.cxx +++ b/src/tools/romtohex.cxx @@ -17,11 +17,9 @@ int main(int ac, char* av[]) { if(ac < 2) { - cout << av[0] << " [values per line = 8] [startpos = 0]" << endl - << endl - << " Read data from INPUT_FILE, and convert to unsigned char" << endl - << " (in hex format), writing to standard output." << endl - << endl; + cout << av[0] << " [values per line = 8] [startpos = 0]\n\n" + << " Read data from INPUT_FILE, and convert to unsigned char\n" + << " (in hex format), writing to standard output.\n\n"; return 0; } @@ -39,7 +37,7 @@ int main(int ac, char* av[]) in.read((char*)data.get(), len); in.close(); - cout << "SIZE = " << len << endl << " "; + cout << "SIZE = " << len << "\n "; // Skip first 'offset' bytes; they shouldn't be used for(int t = offset; t < len; ++t) @@ -48,8 +46,8 @@ int main(int ac, char* av[]) if(t < len - 1) cout << ", "; if(((t-offset) % values_per_line) == (values_per_line-1)) - cout << endl << " "; + cout << "\n "; } - cout << endl; + cout << '\n'; } }