wxMaxima
Loading...
Searching...
No Matches
Functions
MaximaProtocol.h File Reference

Pure helpers for the text protocol wxMaxima speaks with Maxima over the control socket: classifying the <PROMPT> labels Maxima sends, and deciding whether a command is empty enough that sending it would put nothing but a bare newline on the wire. More...

#include <wx/string.h>
Include dependency graph for MaximaProtocol.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool MaximaProtocol::IsDebuggerPrompt (const wxString &label)
 A Maxima high-level debugger prompt, e.g. "(dbm:1)". Maxima drops into this REPL on an error while debugmode is on, or at a breakpoint.
 
bool MaximaProtocol::IsLispReplPrompt (const wxString &label)
 A Maxima Lisp-REPL prompt ("MAXIMA> "), as seen after to_lisp(). The prompt may be preceded by a newline in the stream.
 
bool MaximaProtocol::IsNumberedInputPrompt (const wxString &label)
 A normal numbered Maxima input/label prompt, e.g. "(%i3) " or "(%o12) ". The character before the closing ")" is a digit (any ibase) or A-Z. Excludes the debugger prompt (which also parenthesizes but is not an input prompt).
 
bool MaximaProtocol::IsMainInputPrompt (const wxString &label, bool inLispMode)
 Does label mark a new main prompt - one where wxMaxima should advance its evaluation queue - as opposed to a question it must stop and answer?
 
bool MaximaProtocol::CommandIsBlank (const wxString &command)
 Would transmitting command send nothing but a bare newline? SendMaxima trims trailing whitespace and appends "\n", so an empty or all-whitespace string becomes a lone blank line on the wire. At a normal Maxima prompt that is a harmless no-op, but at the "(dbm:N)" debugger prompt a blank line means "repeat the last command" - so a caller that has nothing to send must not call SendMaxima at all. Uses the same trim SendMaxima does.
 

Detailed Description

Pure helpers for the text protocol wxMaxima speaks with Maxima over the control socket: classifying the <PROMPT> labels Maxima sends, and deciding whether a command is empty enough that sending it would put nothing but a bare newline on the wire.

Everything here is deliberately free of any GUI/state (only wxString) so it can be unit tested against captured prompt/command strings - see test/unit_tests/test_MaximaProtocol.cpp. The classification logic used to live inline in MaximaResponseReader::ReadPrompt.

Function Documentation

◆ IsMainInputPrompt()

bool MaximaProtocol::IsMainInputPrompt ( const wxString &  label,
bool  inLispMode 
)

Does label mark a new main prompt - one where wxMaxima should advance its evaluation queue - as opposed to a question it must stop and answer?

True for a numbered input prompt, for anything while wxMaxima is already in Lisp mode, and for a Lisp-REPL prompt. The debugger prompt "(dbm:N)" is the one exception to the Lisp-mode clause: it is ALWAYS a question, never a main prompt, so that every debugger command is answered rather than mis-recorded as worksheet input. (A debugger session turns Lisp mode on, which used to make every "(dbm:N)" after the first classify as a main prompt.)