wxMaxima
|
Interface to the Maxima process. More...
#include <Maxima.h>
Public Types | |
enum | EventCause { READ_PENDING , READ_MISC_TEXT , XML_PROMPT , XML_SUPPRESSOUTPUT , XML_WXXMLSYMBOLS , XML_VARIABLES , XML_WATCH_VARIABLES_ADD , XML_STATUSBAR , XML_HTML_MANUAL_KEYWORDS , XML_MATHS , XML_TOOLONGMATHS , XML_WXXML_KEY , DISCONNECTED , WRITE_PENDING , WRITE_ERROR , STRING_FOR_XMLINSPECTOR } |
Public Member Functions | |
Maxima (wxSocketBase *socket, Configuration *config) | |
Construct this object when a connection is received from Maxima. The argument should be socketServer.Accept();. | |
wxSocketBase * | Socket () const |
bool | IsConnected () const |
Are we connected to Maxima? | |
bool | Write (const void *buffer, std::size_t length) |
Write more data to be sent to maxima. | |
void | ReadSocket () |
Read whatever data is in the socket. This is normally handled by the event handler, but can be called manually to poll for data. Ideally, this should be private. | |
void | ClearFirstPrompt () |
Clear the first prompt state, based on what was read from maxima. This is called from prompt recognizer code in the wxMaxima class. | |
void | XmlInspectorActive (bool active) |
Interface to the Maxima process.
Eventually this class will be the entire stand-alone Maxima interface, factored out from wxMaxima. For now, it only provides socket I/O.
It is a source of EVT_MAXIMA events, used to asynchronously decouple the I/O from the front-end. In the future, more of this class could run on a worker thread perhaps.
What it already does do is that on incoming data it creates a worker thread that splits the incoming data into known XML tags maxima sends and misc text and sends each of these items in a separate EVT_MAXIMA to the wxMaxima main class
enum Maxima::EventCause |
Enumerator | |
---|---|
READ_PENDING | There's still pending data coming from Maxima. The Data member is empty at the moment. |
READ_MISC_TEXT | Maxima has sent non-XML text. |
DISCONNECTED | Maxima has disconnected (possibly because the process had died). |
WRITE_PENDING | A write to Maxima is still ongoing. We use this event to keep the traffic indicator alive. |
WRITE_ERROR | The transmission has failed - this is an unrecoverable error, most likely. |
bool Maxima::Write | ( | const void * | buffer, |
std::size_t | length | ||
) |
Write more data to be sent to maxima.
buffer | is the data's location, can be null if length is zero |
length | is number of bytes to be written, can be zero to resume sending any data still in the transmit buffer but unsent. This is done from the event handler and doesn't have to be cared for by the user. |