RRshell
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Realtime Roundrobin
Introduced first in SolidGeometry 3.5, Creation date: 2017-03-02, Last change: 2025-09-14
Runs an interpreter shell for a limited period of time to simulate a realtime system
Description
RRshell opens a figure and installs a new keyboard callback function "RRkeyboardCallback". The "RRkeyboardCallback" function writes pressed keyboard character into global variables "RRkeyboardLine" and "RRkeyboardCurs". As soon as CR is pressed, "RRkeyboardLine" contains the char chain. RRshell now analyzes some master keyowrds such as "STOP", EXIT', QUIT" and "END". In all other cases the "eval" function of Matlab is used to execute the string as command line.
The user has the feeling to control Matlab directly but in fact in parallel a set of functions runs as round robin task list
See Also: RRkeyboardCallback
, RRhelp
, RRcreateTasklist
Example Illustration
Syntax
RRshell([PROMPT,MAXTIME])
Input Parameter
PROMPT: | | Desired entry prompt; default is "RRshell" |
MAXTIME: | | Maximum time before exit the shell; default is 60 seconds |
Copyright 2017-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
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.
Input Parameters
- PROMPT: This parameter specifies the desired entry prompt displayed to the user. If not provided, the default prompt is "RRshell".
- MAXTIME: This parameter sets the maximum time in seconds before the shell exits automatically. The default value is 60 seconds.
Functionality
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.
Related Functions
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.
Algorithm explaination created using ChatGPT on 2025-08-19 00:18. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21