openMSX
BreakPointBase.cc
Go to the documentation of this file.
1#include "BreakPointBase.hh"
2#include "CommandException.hh"
3#include "GlobalCliComm.hh"
4#include "ScopedAssign.hh"
5
6namespace openmsx {
7
8bool BreakPointBase::isTrue(GlobalCliComm& cliComm, Interpreter& interp) const
9{
10 if (condition.getString().empty()) {
11 // unconditional bp
12 return true;
13 }
14 try {
15 return condition.evalBool(interp);
16 } catch (CommandException& e) {
17 cliComm.printWarning(e.getMessage());
18 return false;
19 }
20}
21
23{
24 if (executing) {
25 // no recursive execution
26 return false;
27 }
28 ScopedAssign sa(executing, true);
29 if (isTrue(cliComm, interp)) {
30 try {
31 command.executeCommand(interp, true); // compile command
32 } catch (CommandException& e) {
33 cliComm.printWarning(e.getMessage());
34 }
35 return onlyOnce();
36 }
37 return false;
38}
39
40} // namespace openmsx
Assign new value to some variable and restore the original value when this object goes out of scope.
bool checkAndExecute(GlobalCliComm &cliComm, Interpreter &interp)
void printWarning(std::string_view message)
Definition CliComm.cc:12
TclObject executeCommand(Interpreter &interp, bool compile=false)
Interpret this TclObject as a command and execute it.
Definition TclObject.cc:248
bool evalBool(Interpreter &interp) const
Definition TclObject.cc:228
zstring_view getString() const
Definition TclObject.cc:141
constexpr auto empty() const
constexpr double e
Definition Math.hh:21
This file implemented 3 utility functions:
Definition Autofire.cc:11