24#ifndef WXMAXIMA_MAXIMA_H
25#define WXMAXIMA_MAXIMA_H
35#include <wx/sckstrm.h>
36#include <wx/txtstrm.h>
44#include "Configuration.h"
77 static wxString
InvertCase(
const wxString &var);
81 wxSocketBase *Socket()
const {
return m_socket.get(); }
90 static bool GetPipeToStdErr() {
return m_pipeToStderr; }
100 bool Write(
const void *buffer, std::size_t length);
119 XML_WATCH_VARIABLES_ADD,
121 XML_WORKSHEET_EXPORT,
122 XML_HTML_MANUAL_KEYWORDS,
132 STRING_FOR_XMLINSPECTOR,
134 void XmlInspectorActive(
bool active){m_xmlInspector = active;}
137 std::atomic_bool m_xmlInspector{
false};
145 std::atomic_bool m_readPendingQueued;
148 void SocketEvent(wxSocketEvent &event);
150 void TimerEvent(wxTimerEvent &event);
152 void OnIdle(wxIdleEvent &event);
154 std::unique_ptr<wxSocketBase> m_socket;
156 std::mutex m_socketMutex;
158 wxSocketInputStream m_socketInput;
167 wxTextInputStream m_textInput;
173 wxString m_socketInputData;
178 wxString m_processingBuffer;
183 std::vector<std::vector<char>> m_outputQueue;
184 std::mutex m_outputQueueMutex;
188 struct InterpretedItem {
192 std::vector<InterpretedItem> m_interpretedQueue;
193 std::mutex m_interpretedQueueMutex;
200 wxMemoryBuffer m_socketOutputData;
203 bool m_firstPrompt =
true;
205 static bool m_pipeToStderr;
233 wxTimer m_readIdleTimer{
this};
235 static std::unordered_map<wxString, EventCause, wxStringHash> m_knownTags;
236 static std::mutex m_knownTagsMutex;
239wxDECLARE_EVENT(EVT_MAXIMA, wxThreadEvent);
Small C++ standard-library compatibility shims.
The configuration storage for the current worksheet.
Definition: Configuration.h:98
Interface to the Maxima process.
Definition: Maxima.h:63
EventCause
Definition: Maxima.h:110
@ WRITE_PENDING
A write to Maxima is still ongoing. We use this event to keep the traffic indicator alive.
Definition: Maxima.h:129
@ READ_PENDING
There's still pending data coming from Maxima. The Data member is empty at the moment.
Definition: Maxima.h:112
@ WRITE_ERROR
The transmission has failed - this is an unrecoverable error, most likely.
Definition: Maxima.h:131
@ DISCONNECTED
Maxima has disconnected (possibly because the process had died).
Definition: Maxima.h:127
@ READ_MISC_TEXT
Maxima has sent non-XML text.
Definition: Maxima.h:114
void ReadSocket()
Read whatever data is in the socket. This is normally handled by the event handler,...
Definition: Maxima.cpp:125
static void GetPipeToStdErr(bool pipe)
Tells if the user wants all data to maxima to be copied to StdErr.
Definition: Maxima.h:89
static wxString MaximaVarnameToLisp(wxString var)
Convert a human-readable maxima variable name to one lisp understands.
Definition: Maxima.cpp:387
static wxString InvertCase(const wxString &var)
Invert case of chars that have inverted case in lisp.
Definition: Maxima.cpp:310
static void SetPipeToStdErr(bool pipe)
Tells us if the user wants all data to maxima to be copied to StdErr.
Definition: Maxima.h:87
bool IsConnected() const
Are we connected to Maxima?
Definition: Maxima.h:84
static wxString EscapeVarnameForMaxima(wxString var)
Convert a human-readable maxima variable name to one maxima understands.
Definition: Maxima.cpp:325
bool Write(const void *buffer, std::size_t length)
Write more data to be sent to maxima.
Definition: Maxima.cpp:108
void ClearFirstPrompt()
Clear the first prompt state, based on what was read from maxima. This is called from prompt recogniz...
Definition: Maxima.h:108