VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
RetroShellAPI Struct Reference

RetroShell Public API. More...

#include <VirtualC64.h>

Public Member Functions

Querying the console
const char * text ()
 Returns a pointer to the text buffer.
 
isize cursorRel ()
 Returns the relative cursor position.
 
Typing characters and strings
void press (RetroShellKey key, bool shift=false)
 Informs RetroShell that a key has been typed.
 
void press (char c)
 Informs RetroShell that a key has been typed.
 
void press (const string &s)
 Informs RetroShell that multiple keys have been typed.
 
Controlling the output stream
void setStream (std::ostream &os)
 Assign an additional output stream.
 
Executing scripts
void execScript (std::stringstream &ss)
 Executes a script.
 
void execScript (const std::ifstream &fs)
 Executes a script.
 
void execScript (const string &contents)
 Executes a script.
 
void execScript (const MediaFile &file)
 Executes a script.
 

Detailed Description

RetroShell Public API.

Member Function Documentation

◆ cursorRel()

isize cursorRel ( )

Returns the relative cursor position.

The returned value is relative to the end of the input line. A value of 0 indicates that the cursor is at the rightmost position, that is, one character after the last character of the input line. If the cursor is at the front of the input line, the value matches the length of the input line.

◆ execScript() [1/4]

void execScript ( const MediaFile & file)

Executes a script.

The script is executes asynchroneously. However, RetroShell will send messages back to the GUI thread to inform about the execution state. After the last script command has been executed, MSG_SCRIPT_DONE is sent. If shell execution has been aborted due to an error, MSG_SCRIPT_ABORT is sent.

◆ execScript() [2/4]

void execScript ( const std::ifstream & fs)

Executes a script.

The script is executes asynchroneously. However, RetroShell will send messages back to the GUI thread to inform about the execution state. After the last script command has been executed, MSG_SCRIPT_DONE is sent. If shell execution has been aborted due to an error, MSG_SCRIPT_ABORT is sent.

◆ execScript() [3/4]

void execScript ( const string & contents)

Executes a script.

The script is executes asynchroneously. However, RetroShell will send messages back to the GUI thread to inform about the execution state. After the last script command has been executed, MSG_SCRIPT_DONE is sent. If shell execution has been aborted due to an error, MSG_SCRIPT_ABORT is sent.

◆ execScript() [4/4]

void execScript ( std::stringstream & ss)

Executes a script.

The script is executes asynchroneously. However, RetroShell will send messages back to the GUI thread to inform about the execution state. After the last script command has been executed, MSG_SCRIPT_DONE is sent. If shell execution has been aborted due to an error, MSG_SCRIPT_ABORT is sent.

◆ press() [1/3]

void press ( char c)

Informs RetroShell that a key has been typed.

Parameters
cThe pressed key

◆ press() [2/3]

void press ( const string & s)

Informs RetroShell that multiple keys have been typed.

Parameters
sThe typed text

◆ press() [3/3]

void press ( RetroShellKey key,
bool shift = false )

Informs RetroShell that a key has been typed.

Parameters
keyThe pressed key
shiftStatus of the shift key

◆ setStream()

void setStream ( std::ostream & os)

Assign an additional output stream.

In addition to writing the RetroShell output into the text buffer, RetroShell will write the output into the provides stream.

◆ text()

const char * text ( )

Returns a pointer to the text buffer.

The text buffer contains the complete contents of the console. It will be expanded when new output is generated. When the buffer grows too large, old contents is cropped.


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