24#ifndef WXMAXIMA_MAXIMA_H
25#define WXMAXIMA_MAXIMA_H
35#include <wx/sckstrm.h>
36#include <wx/txtstrm.h>
44#include "Configuration.h"
80 static wxString
InvertCase(
const wxString &var);
84 wxSocketBase *Socket()
const {
return m_socket.get(); }
93 static bool GetPipeToStdErr() {
return m_pipeToStderr; }
103 bool Write(
const void *buffer, std::size_t length);
127 XML_WATCH_VARIABLES_ADD,
129 XML_WORKSHEET_EXPORT,
130 XML_HTML_MANUAL_KEYWORDS,
150 STRING_FOR_XMLINSPECTOR,
157 void XmlInspectorActive(
bool active){m_xmlInspector = active;}
160 std::atomic_bool m_xmlInspector{
false};
169 void SocketEvent(wxSocketEvent &event);
171 void TimerEvent(wxTimerEvent &event);
173 void OnIdle(wxIdleEvent &event);
175 std::unique_ptr<wxSocketBase> m_socket;
177 std::mutex m_socketMutex;
179 wxSocketInputStream m_socketInput;
188 wxTextInputStream m_textInput;
194 wxString m_socketInputData;
199 wxString m_processingBuffer;
204 std::vector<std::vector<char>> m_outputQueue;
205 std::mutex m_outputQueueMutex;
210 void PushItems(std::vector<MaximaItemQueue::Item> &&items);
217 wxMemoryBuffer m_socketOutputData;
220 bool m_firstPrompt =
true;
222 static bool m_pipeToStderr;
231 void WorkerThread(
const stop_token& stopToken);
243 void ProcessData(
const stop_token& stopToken);
252 wxTimer m_readIdleTimer{
this};
254 static const std::unordered_map<wxString, EventCause, wxStringHash> &KnownTags();
257wxDECLARE_EVENT(EVT_MAXIMA, wxThreadEvent);
Small compatibility shims for older toolchains and older wxWidgets.
The hand-over of Maxima's output from the socket thread to the GUI (GH #2594).
The configuration storage for the current worksheet.
Definition: Configuration.h:102
Items Maxima sent, on their way from the socket thread to the GUI thread.
Definition: MaximaItemQueue.h:63
bool Take(Item &item)
Takes the oldest item, merged with the mergeable items that follow it.
Definition: MaximaItemQueue.cpp:42
Interface to the Maxima process.
Definition: Maxima.h:66
EventCause
Definition: Maxima.h:118
@ WRITE_PENDING
A write to Maxima is still ongoing. We use this event to keep the traffic indicator alive.
Definition: Maxima.h:147
@ DATA_AVAILABLE
There are items to take with TakeItem().
Definition: Maxima.h:155
@ READ_PENDING
There's still pending data coming from Maxima. The Data member is empty at the moment.
Definition: Maxima.h:120
@ XML_ASYNC_OUTPUT
Output from a background job, naming the cell it belongs to.
Definition: Maxima.h:143
@ WRITE_ERROR
The transmission has failed - this is an unrecoverable error, most likely.
Definition: Maxima.h:149
@ DISCONNECTED
Maxima has disconnected (possibly because the process had died).
Definition: Maxima.h:145
@ READ_MISC_TEXT
Maxima has sent non-XML text.
Definition: Maxima.h:122
@ XML_ASCIIMATH
Maxima has sent one complete block of ASCII-art 2D display output.
Definition: Maxima.h:135
static void GetPipeToStdErr(bool pipe)
Tells if the user wants all data to maxima to be copied to StdErr.
Definition: Maxima.h:92
static wxString MaximaVarnameToLisp(const wxString &var)
Convert a human-readable maxima variable name to one lisp understands.
Definition: Maxima.cpp:313
static wxString InvertCase(const wxString &var)
Invert case of chars that have inverted case in lisp.
Definition: Maxima.cpp:236
static void SetPipeToStdErr(bool pipe)
Tells us if the user wants all data to maxima to be copied to StdErr.
Definition: Maxima.h:90
bool TakeItem(MaximaItemQueue::Item &item)
Takes the next item Maxima sent.
Definition: Maxima.h:112
bool IsConnected() const
Are we connected to Maxima?
Definition: Maxima.h:87
static wxString EscapeVarnameForMaxima(wxString var)
Convert a human-readable maxima variable name to one maxima understands.
Definition: Maxima.cpp:251
bool Write(const void *buffer, std::size_t length)
Write more data to be sent to maxima.
Definition: Maxima.cpp:122
void ClearFirstPrompt()
Clear the first prompt state, based on what was read from maxima. This is called from prompt recogniz...
Definition: Maxima.h:116
One piece of Maxima's output: what it is, and its text.
Definition: MaximaItemQueue.h:66