OpenASIP 2.2
Loading...
Searching...
No Matches
Static Public Member Functions | Protected Member Functions | List of all members
ProximToolbox Class Reference

#include <ProximToolbox.hh>

Collaboration diagram for ProximToolbox:
Collaboration graph

Static Public Member Functions

static const TTAMachine::Machinemachine ()
 
static const TTAProgram::Programprogram ()
 
static ProximMainFramemainFrame ()
 
static ProximMachineStateWindowmachineStateWindow ()
 
static ProximDisassemblyWindowdisassemblyWindow ()
 
static void addFramedWindow (wxWindow *window, const wxString &title, bool stayOnTop=false, const wxSize &minSize=wxSize(100, 100))
 
static SimulatorInterpreterinterpreter ()
 
static TracedSimulatorFrontendfrontend ()
 
static ProximLineReaderlineReader ()
 
static bool testExpression (wxWindow *parent, const std::string &expression)
 
static bool testCondition (wxWindow *parent, const std::string &condition)
 

Protected Member Functions

 ProximToolbox ()
 Instantiation not allowed.
 

Detailed Description

Set of helper functions to access Proxim windows and simulation.

Definition at line 56 of file ProximToolbox.hh.

Constructor & Destructor Documentation

◆ ProximToolbox()

ProximToolbox::ProximToolbox ( )
protected

Instantiation not allowed.

The Constructor.

Definition at line 57 of file ProximToolbox.cc.

57 {
58}

Member Function Documentation

◆ addFramedWindow()

void ProximToolbox::addFramedWindow ( wxWindow *  window,
const wxString &  title,
bool  stayOnTop = false,
const wxSize &  minSize = wxSize(100, 100) 
)
static

Adds a new simulator window in it's own floating frame.

Parameters
windowWindow to add.
titleTitle of the frame.

Definition at line 176 of file ProximToolbox.cc.

178 {
179
180 // Create a new frame for the window.
181 long style = wxDEFAULT_FRAME_STYLE;
182 if (stayOnTop) {
183 style = (style | wxFRAME_FLOAT_ON_PARENT);
184 }
185
186 wxFrame* frame = new wxFrame(
187 mainFrame(), -1, title, wxDefaultPosition, wxDefaultSize, style);
188
189 window->Reparent(frame);
190 wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
191 sizer->Add(window, 1, wxGROW);
192 sizer->SetSizeHints(window);
193 frame->SetSizer(sizer);
194 frame->Fit();
195 frame->SetSizeHints(minSize.GetWidth(), minSize.GetHeight());
196 frame->Show();
197 return;
198}
static ProximMainFrame * mainFrame()

References mainFrame().

Referenced by ProximFindCmd::Do(), ProximNewPortWindowCmd::Do(), ProximNewRegisterWindowCmd::Do(), ProximShowPortsCmd::Do(), ProximShowRegistersCmd::Do(), and ProximMainFrame::onToggleWindow().

Here is the call graph for this function:

◆ disassemblyWindow()

ProximDisassemblyWindow * ProximToolbox::disassemblyWindow ( )
static

Returns pointer to the program disassembly window.

Returns NULL if the disassembly window does not exist.

Returns
Pointer to the disassembly window.

Definition at line 150 of file ProximToolbox.cc.

150 {
151
152 wxWindow* topWindow = wxGetApp().GetTopWindow();
153
154 if (topWindow == NULL) {
155 return NULL;
156 }
157
158 wxWindow* disasmWin = topWindow->FindWindowById(
160
161 if (disasmWin == NULL) {
162 return NULL;
163 }
164
165 return dynamic_cast<ProximDisassemblyWindow*>(disasmWin);
166}

References ProximConstants::ID_DISASSEMBLY_WINDOW.

Referenced by DisasmTopCountAttrProvider::DisasmTopCountAttrProvider(), ClearDisassemblyHighlightCmd::Do(), HighlightExecPercentageCmd::Do(), HighlightTopExecCountsCmd::Do(), ProximBreakpointWindow::onBreakpointLookup(), FindWindow::onFindNext(), FindWindow::onFindPrev(), FindWindow::onInputText(), and DisasmExecCountFrame::onSelection().

◆ frontend()

TracedSimulatorFrontend * ProximToolbox::frontend ( )
static

◆ interpreter()

SimulatorInterpreter * ProximToolbox::interpreter ( )
static

Returns pointer to the simulator control language interpreter used by the simulator backend.

Returns
Simulator control language interpreter of the simulator.

Definition at line 207 of file ProximToolbox.cc.

207 {
208
209 ProximSimulationThread* simulation = wxGetApp().simulation();
210 if (simulation == NULL) {
211 return NULL;
212 }
213
214 return simulation->interpreter();
215}
SimulatorInterpreter * interpreter()

References ProximSimulationThread::interpreter().

Referenced by testCondition(), and testExpression().

Here is the call graph for this function:

◆ lineReader()

ProximLineReader & ProximToolbox::lineReader ( )
static

Returns reference to the line reader used by the simulator engine.

Returns
Simulator linereader.

Definition at line 238 of file ProximToolbox.cc.

238 {
239 return wxGetApp().simulation()->lineReader();
240}

Referenced by ProximExecuteFileCmd::Do(), ProximQuitCmd::Do(), ProximSimulatorSettingsCmd::Do(), AddBreakpointDialog::onOK(), AddWatchDialog::onOK(), BreakpointPropertiesDialog::onOK(), WatchPropertiesDialog::onOK(), and ProximMainFrame::onToggleWindow().

◆ machine()

const TTAMachine::Machine & ProximToolbox::machine ( )
static

Returns the simulated machine.

Returns NullMachine, if a machine is not loaded in the simulator.

Returns
Reference to the simulated machine.

Definition at line 69 of file ProximToolbox.cc.

69 {
70
71 TracedSimulatorFrontend* frontend = wxGetApp().simulation()->frontend();
72 if (frontend == NULL) {
74 } else {
75 return frontend->machine();
76 }
77}
static TracedSimulatorFrontend * frontend()
const TTAMachine::Machine & machine() const
static NullMachine & instance()

References frontend(), TTAMachine::NullMachine::instance(), and SimulatorFrontend::machine().

Referenced by AddWatchDialog::initialize(), AddWatchDialog::onASChoice(), AddWatchDialog::onFUChoice(), AddWatchDialog::onRFChoice(), ProximMachineStateWindow::ProximMachineStateWindow(), and ProximMachineStateWindow::setUtilizationHighlights().

Here is the call graph for this function:

◆ machineStateWindow()

ProximMachineStateWindow * ProximToolbox::machineStateWindow ( )
static

Returns pointer to the machine state window.

Returns NULL if the machine state window does not exist.

Returns
Pointer to the machine state window.

Definition at line 123 of file ProximToolbox.cc.

123 {
124
125 wxWindow* topWindow = wxGetApp().GetTopWindow();
126
127 if (topWindow == NULL) {
128 return NULL;
129 }
130
131 wxWindow* machineWin = topWindow->FindWindowById(
133
134 if (machineWin == NULL) {
135 return NULL;
136 }
137
138 return dynamic_cast<ProximMachineStateWindow*>(machineWin);
139}

References ProximConstants::ID_MACHINE_STATE_WINDOW.

Referenced by ProximBusDetailsCmd::Do(), ProximComponentStatusCmd::Do(), ProximFUDetailsCmd::Do(), ProximFUPortDetailsCmd::Do(), ProximIUDetailsCmd::Do(), ProximRFDetailsCmd::Do(), ProximSetMachineWinStatusCmd::Do(), ProximSocketDetailsCmd::Do(), and ProximMachineCanvasTool::onMouseEvent().

◆ mainFrame()

ProximMainFrame * ProximToolbox::mainFrame ( )
static

Returns pointer to the application main frame.

Returns
Application main frame, or NULL if the main frame does not exist.

Definition at line 105 of file ProximToolbox.cc.

105 {
106 wxWindow* topWindow = wxGetApp().GetTopWindow();
107 if (topWindow != NULL) {
108 return dynamic_cast<ProximMainFrame*>(topWindow);
109 } else {
110 return NULL;
111 }
112}

Referenced by addFramedWindow(), ProximFindCmd::Do(), ProximNewPortWindowCmd::Do(), ProximNewRegisterWindowCmd::Do(), ProximOptionsCmd::Do(), ProximShowPortsCmd::Do(), ProximShowRegistersCmd::Do(), and ProximSimulatorWindow::~ProximSimulatorWindow().

◆ program()

const TTAProgram::Program & ProximToolbox::program ( )
static

Returns the simulated program.

Returns NullProgram, if a program is not loaded in the simulator.

Returns
Reference to the simulated program.

Definition at line 88 of file ProximToolbox.cc.

88 {
89
90 TracedSimulatorFrontend* frontend = wxGetApp().simulation()->frontend();
91 if (frontend == NULL) {
93 } else {
94 return frontend->program();
95 }
96}
const TTAProgram::Program & program() const
static NullProgram & instance()

References frontend(), TTAProgram::NullProgram::instance(), and SimulatorFrontend::program().

Referenced by ProximSetMachineWinStatusCmd::Do(), FindWindow::find(), ProximDebuggerWindow::onProgramLoaded(), ProximDisassemblyWindow::onProgramLoaded(), ProximDebuggerWindow::ProximDebuggerWindow(), and ProximDebuggerWindow::updateAnnotations().

Here is the call graph for this function:

◆ testCondition()

bool ProximToolbox::testCondition ( wxWindow *  parent,
const std::string &  condition 
)
static

Tests condition script validity.

An error dialog is displayed if the script is not legal.

Parameters
parentParent window for the possible error dialog to display.
conditionCondition script to test.

Definition at line 280 of file ProximToolbox.cc.

281 {
282
283 TclConditionScript conditionScript(interpreter(), condition);
284
285 // Check condition script validity using script interpreter.
286 try {
287 conditionScript.execute();
288 } catch (const ScriptExecutionFailure& sef) {
289 // Condition erroneous. Display error dialog.
290 wxString message = _T("Error in condition:\n");
291 message.Append(WxConversion::toWxString(sef.errorMessage()));
292 ErrorDialog dialog(parent, message);
293 dialog.ShowModal();
294 return false;
295 }
296 return true;
297}
std::string errorMessage() const
Definition Exception.cc:123
static SimulatorInterpreter * interpreter()
static wxString toWxString(const std::string &source)

References Exception::errorMessage(), Script::execute(), interpreter(), and WxConversion::toWxString().

Referenced by BreakpointPropertiesDialog::onOK(), and WatchPropertiesDialog::onOK().

Here is the call graph for this function:

◆ testExpression()

bool ProximToolbox::testExpression ( wxWindow *  parent,
const std::string &  expression 
)
static

Tests expression script validity.

An error dialog is displayed if the script is not legal.

Parameters
parentParent window for the possible error dialog to display.
expressionExpression script to test.

Definition at line 252 of file ProximToolbox.cc.

253 {
254
255 ExpressionScript expressionScript(interpreter(), expression);
256
257 // Check condition script validity using script interpreter.
258 try {
259 expressionScript.execute();
260 } catch (const ScriptExecutionFailure& sef) {
261 // Condition erroneous. Display error dialog.
262 wxString message = _T("Error in expression:\n");
263 message.Append(WxConversion::toWxString(sef.errorMessage()));
264 ErrorDialog dialog(parent, message);
265 dialog.ShowModal();
266 return false;
267 }
268 return true;
269}

References Exception::errorMessage(), Script::execute(), interpreter(), and WxConversion::toWxString().

Referenced by AddWatchDialog::onOK().

Here is the call graph for this function:

The documentation for this class was generated from the following files: