diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2018-07-26 14:41:14 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2018-07-26 14:41:14 -0400 |
commit | 8de41654fafdf4311034331e48a7e2723a3ea3ca (patch) | |
tree | b6a07258c35f189f137dbfe29a5034c89800bd88 /src/emu/debug/debugcpu.cpp | |
parent | 6024c958b978b9d470ac7261257e5d2312f92178 (diff) |
debugcpu.cpp: Move scripting functions down into console (nw)
Diffstat (limited to 'src/emu/debug/debugcpu.cpp')
-rw-r--r-- | src/emu/debug/debugcpu.cpp | 72 |
1 files changed, 2 insertions, 70 deletions
diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index cd17a1e40f7..bdb0928f926 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -25,9 +25,6 @@ #include "osdepend.h" #include "xmlfile.h" -#include <ctype.h> -#include <fstream> - const size_t debugger_cpu::NUM_TEMP_VARIABLES = 10; @@ -152,42 +149,13 @@ symbol_table* debugger_cpu::get_visible_symtable() } -/*------------------------------------------------- - source_script - specifies a debug command - script to execute --------------------------------------------------*/ - -void debugger_cpu::source_script(const char *file) -{ - // close any existing source file - m_source_file.reset(); - - // open a new one if requested - if (file != nullptr) - { - auto source_file = std::make_unique<std::ifstream>(file, std::ifstream::in); - if (source_file->fail()) - { - if (m_machine.phase() == machine_phase::RUNNING) - m_machine.debugger().console().printf("Cannot open command file '%s'\n", file); - else - fatalerror("Cannot open command file '%s'\n", file); - } - else - { - m_source_file = std::move(source_file); - } - } -} - - //************************************************************************** // MEMORY AND DISASSEMBLY HELPERS //************************************************************************** //------------------------------------------------- -// omment_save - save all comments for the given +// comment_save - save all comments for the given // machine //------------------------------------------------- @@ -641,42 +609,6 @@ void debugger_cpu::reset_transient_flags() } -/*------------------------------------------------- - process_source_file - executes commands from - a source file --------------------------------------------------*/ - -void debugger_cpu::process_source_file() -{ - std::string buf; - - // loop until the file is exhausted or until we are executing again - while (m_execution_state == exec_state::STOPPED - && m_source_file - && std::getline(*m_source_file, buf)) - { - // strip out comments (text after '//') - size_t pos = buf.find("//"); - if (pos != std::string::npos) - buf.resize(pos); - - // strip whitespace - strtrimrightspace(buf); - - // execute the command - if (!buf.empty()) - m_machine.debugger().console().execute_command(buf, true); - } - - if (m_source_file && !m_source_file->good()) - { - if (!m_source_file->eof()) - m_machine.debugger().console().printf("I/O error, script processing terminated\n"); - m_source_file.reset(); - } -} - - /*************************************************************************** EXPRESSION HANDLERS @@ -1718,7 +1650,7 @@ void device_debug::instruction_hook(offs_t curpc) } // check for commands in the source file - machine.debugger().cpu().process_source_file(); + machine.debugger().console().process_source_file(); // if an event got scheduled, resume if (machine.scheduled_event_pending()) |