OpenASIP  2.0
Public Member Functions | List of all members
CommandsCommand Class Reference

#include <CommandsCommand.hh>

Inheritance diagram for CommandsCommand:
Inheritance graph
Collaboration diagram for CommandsCommand:
Collaboration graph

Public Member Functions

 CommandsCommand ()
 
virtual ~CommandsCommand ()
 
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 "commands" command of the Simulator Control Language.

Definition at line 47 of file CommandsCommand.hh.

Constructor & Destructor Documentation

◆ CommandsCommand()

CommandsCommand::CommandsCommand ( )

Constructor.

Sets the name of the command to the base class.

Definition at line 52 of file CommandsCommand.cc.

52  :
53  SimControlLanguageCommand("commands") {
54 }

◆ ~CommandsCommand()

CommandsCommand::~CommandsCommand ( )
virtual

Destructor.

Does nothing.

Definition at line 61 of file CommandsCommand.cc.

61  {
62 }

Member Function Documentation

◆ execute()

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

Executes the "commands" command.

Displays the given count of entries in the command history log.

Parameters
argumentsThe count of entries to be printed.
Returns
True in case simulation is initialized and arguments are ok.
Exceptions
NumberFormatExceptionIs never thrown by this command.
Todo:
Use the count for the step.

Implements CustomCommand.

Definition at line 75 of file CommandsCommand.cc.

75  {
76  if (!checkArgumentCount(arguments.size() - 1, 0, 1)) {
77  return false;
78  }
79 
80  std::size_t commandCount = 10;
81  if (arguments.size() == 2) {
82  if (!checkPositiveIntegerArgument(arguments[1])) {
83  return false;
84  }
85  commandCount = arguments[1].integerValue();
86  }
87 
88  commandCount = std::min(
89  commandCount, interpreter()->lineReader()->inputsInHistory());
90 
91  for (int i = commandCount - 1; i >= 0; --i) {
92  outputStream()
94  interpreter()->lineReader()->inputHistoryEntry(i))
95  << std::endl;
96  }
97  return true;
98 }

References CustomCommand::checkArgumentCount(), CustomCommand::checkPositiveIntegerArgument(), CustomCommand::interpreter(), SimControlLanguageCommand::outputStream(), and StringTools::trim().

Here is the call graph for this function:

◆ helpText()

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

Returns the help text for this command.

Help text is searched from SimulatorTextGenerator.

Returns
The help text.
Todo:
Use SimulatorTextGenerator to get the help text.

Implements CustomCommand.

Definition at line 109 of file CommandsCommand.cc.

109  {
112 }

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

Here is the call graph for this function:

The documentation for this class was generated from the following files:
CustomCommand::checkArgumentCount
bool checkArgumentCount(int argumentCount, int minimum, int maximum)
Definition: CustomCommand.cc:82
SimControlLanguageCommand::outputStream
virtual std::ostream & outputStream()
Definition: SimControlLanguageCommand.cc:351
CustomCommand::checkPositiveIntegerArgument
bool checkPositiveIntegerArgument(const DataObject &argument)
Definition: CustomCommand.cc:134
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
SimControlLanguageCommand::SimControlLanguageCommand
SimControlLanguageCommand(const std::string &name)
Definition: SimControlLanguageCommand.cc:67
Texts::TXT_INTERP_HELP_COMMANDS
@ TXT_INTERP_HELP_COMMANDS
Help text for command "commands" of the CLI.
Definition: SimulatorTextGenerator.hh:73
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
CustomCommand::interpreter
ScriptInterpreter * interpreter() const
StringTools::trim
static std::string trim(const std::string &source)
Definition: StringTools.cc:55