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

#include <ProgCommand.hh>

Inheritance diagram for ProgCommand:
Inheritance graph
Collaboration diagram for ProgCommand:
Collaboration graph

Public Member Functions

 ProgCommand ()
 
virtual ~ProgCommand ()
 
virtual bool execute (const std::vector< DataObject > &arguments)
 
virtual std::string helpText () const
 
- Public Member Functions inherited from SimControlLanguageCommand
 SimControlLanguageCommand (const std::string &name)
 
virtual ~SimControlLanguageCommand ()
 
SimulatorFrontendsimulatorFrontend ()
 
const SimulatorFrontendsimulatorFrontendConst ()
 
virtual void printNextInstruction ()
 
virtual void printStopInformation ()
 
virtual void printStopReasons ()
 
virtual bool printBreakpointInfo (unsigned int breakpointHandle)
 
virtual void printSimulationTime ()
 
virtual std::ostream & outputStream ()
 
bool checkSimulationInitialized ()
 
bool checkSimulationNotAlreadyRunning ()
 
bool checkSimulationStopped ()
 
bool checkSimulationEnded ()
 
bool checkProgramLoaded ()
 
bool checkMachineLoaded ()
 
InstructionAddress parseInstructionAddressExpression (const std::string &expression)
 
TTAProgram::Address parseDataAddressExpression (const std::string &expression)
 
bool parseBreakpoint (const std::vector< DataObject > &arguments, Breakpoint &target)
 
bool askConditionFromUser (TclConditionScript &target)
 
bool askExpressionFromUser (ExpressionScript &target)
 
bool verifyBreakpointHandles (const std::vector< DataObject > &arguments, std::size_t startIndex=1)
 
void setErrorMessage (const TCEString &errorMsg)
 
- Public Member Functions inherited from CustomCommand
 CustomCommand (std::string name)
 
 CustomCommand (const CustomCommand &cmd)
 
virtual ~CustomCommand ()
 
std::string name () const
 
void setContext (InterpreterContext *context)
 
InterpreterContextcontext () const
 
void setInterpreter (ScriptInterpreter *si)
 
ScriptInterpreterinterpreter () const
 
bool checkArgumentCount (int argumentCount, int minimum, int maximum)
 
bool checkIntegerArgument (const DataObject &argument)
 
bool checkPositiveIntegerArgument (const DataObject &argument)
 
bool checkUnsignedIntegerArgument (const DataObject &argument)
 
bool checkDoubleArgument (const DataObject &argument)
 

Additional Inherited Members

- Protected Member Functions inherited from SimControlLanguageCommand
bool setMemoryAddress (const std::string &addressString, std::string &addressSpaceName, std::size_t &memoryAddress)
 
bool setMemoryPointer (MemorySystem::MemoryPtr &memory, const std::string &addressSpaceName)
 

Detailed Description

Implementation of the "prog" command of the Simulator Control Language.

Definition at line 46 of file ProgCommand.hh.

Constructor & Destructor Documentation

◆ ProgCommand()

ProgCommand::ProgCommand ( )

Constructor.

Sets the name of the command to the base class.

Definition at line 48 of file ProgCommand.cc.

◆ ~ProgCommand()

ProgCommand::~ProgCommand ( )
virtual

Destructor.

Does nothing.

Definition at line 56 of file ProgCommand.cc.

56 {
57}

Member Function Documentation

◆ execute()

bool ProgCommand::execute ( const std::vector< DataObject > &  arguments)
virtual

Executes the "prog" command.

Loads a new program file using the SimulatorFrontend.

Parameters
argumentsFilename is given as argument to the command.
Returns
True if loading the program was successful.
Exceptions
NumberFormatExceptionIs never thrown by this command.

Implements CustomCommand.

Definition at line 70 of file ProgCommand.cc.

70 {
71 assert(interpreter() != NULL);
72
74 if (arguments.size() < 2) {
75 DataObject* errorMessage = new DataObject();
76 errorMessage->setString(
78 interpreter()->setResult(errorMessage);
79 return false;
80 }
81
82 if (arguments.size() > 2) {
83 DataObject* errorMessage = new DataObject();
84 errorMessage->setString(
86 interpreter()->setResult(errorMessage);
87 return false;
88 }
89
90 SimulatorInterpreterContext& interpreterContext =
92
94 interpreterContext.simulatorFrontend();
95
96 try {
97 const std::string fileName =
98 FileSystem::expandTilde(arguments.at(1).stringValue());
100 } catch (const Exception& e) {
101 DataObject* errorMessage = new DataObject();
102 errorMessage->setString(e.errorMessage());
103 interpreter()->setResult(errorMessage);
104 return false;
105 }
106
108 outputStream()
110 << std::endl;
111
112 return true;
113}
#define assert(condition)
ScriptInterpreter * interpreter() const
virtual void setString(std::string value)
std::string errorMessage() const
Definition Exception.cc:123
static std::string expandTilde(const std::string &stringWithTilde)
virtual InterpreterContext & context() const =0
virtual void setResult(DataObject *result)
virtual std::ostream & outputStream()
bool automaticFinishImpossible() const
virtual void loadProgram(const std::string &fileName)
static SimulatorTextGenerator & textGenerator()
virtual boost::format text(int textId)
@ TXT_ONLY_ONE_FILENAME_EXPECTED
@ TXT_NO_FILENAME_DEFINED

References assert, SimulatorFrontend::automaticFinishImpossible(), ScriptInterpreter::context(), Exception::errorMessage(), FileSystem::expandTilde(), CustomCommand::interpreter(), SimulatorFrontend::loadProgram(), SimControlLanguageCommand::outputStream(), ScriptInterpreter::setResult(), DataObject::setString(), SimControlLanguageCommand::simulatorFrontend(), SimulatorInterpreterContext::simulatorFrontend(), Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), Texts::TXT_AUTOMATIC_FINISH_IMPOSSIBLE, Texts::TXT_NO_FILENAME_DEFINED, and Texts::TXT_ONLY_ONE_FILENAME_EXPECTED.

Here is the call graph for this function:

◆ helpText()

std::string ProgCommand::helpText ( ) const
virtual

Returns the help text for this command.

Help text is searched from SimulatorTextGenerator.

Returns
The help text.

Implements CustomCommand.

Definition at line 123 of file ProgCommand.cc.

123 {
126}
@ TXT_INTERP_HELP_PROG
Help text for command "prog" of the CLI.

References Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), and Texts::TXT_INTERP_HELP_PROG.

Here is the call graph for this function:

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