RRshell([PROMPT,MAXTIME])
PROMPT : | Desired entry prompt; default is "RRshell" | |
MAXTIME : | Maximum time before exit the shell; default is 60 seconds |
The function RRshell
is designed to simulate a real-time system by running an interpreter shell for a limited period. It is part of the SG-Library and was created by Tim Lueth in 2017. The function primarily relies on the RRrun
function, passing all input arguments to it.
The RRshell
function opens a graphical figure and installs a new keyboard callback function named RRkeyboardCallback
. This callback function captures keyboard input and stores the pressed characters in global variables RRkeyboardLine
and RRkeyboardCurs
. When the Enter key (CR) is pressed, RRkeyboardLine
contains the complete input string.
The function then analyzes the input string for specific keywords such as "STOP", "EXIT", "QUIT", and "END". If any of these keywords are detected, the shell takes appropriate action to terminate or exit. For all other inputs, the function uses MATLAB's eval
function to execute the input string as a command line instruction.
This setup gives the user the impression of directly controlling MATLAB, while in reality, a set of functions is running concurrently as a round-robin task list.
RRkeyboardCallback
: Handles keyboard input and updates global variables.RRhelp
: Provides help or documentation related to the shell.RRcreateTasklist
: Manages the task list for round-robin execution.