wxMaxima
Loading...
Searching...
No Matches
MaximaEvaluator.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2026 Gunter Königsmann <wxMaxima@physikbuch.de>
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19//
20// SPDX-License-Identifier: GPL-2.0+
21
35#ifndef MAXIMAEVALUATOR_H
36#define MAXIMAEVALUATOR_H
37
38#include <wx/string.h>
39#include "cells/CellPtr.h"
40
41class wxMaxima;
42class wxCommandEvent;
43class GroupCell;
44
51{
52public:
53 explicit MaximaEvaluator(wxMaxima &wxm) : m_wxMaxima(wxm) {}
54
57 void SendMaxima(wxString s, bool addToHistory = false, bool background = false);
58
60 void FirstOutput();
61
66 bool AbortOnError();
67
72 bool QueryVariableValue();
73
76 void EvaluateEvent(wxCommandEvent &event);
77
80 void TriggerEvaluation();
81
87 void SetupVariables();
88
94 void StartCommand(long start);
95
102 void AddCommandOutput(const wxString &text);
103
113 void MarkErrorStatement(GroupCell *cell);
114
121 void MarkSyntaxErrorSpot();
122
123private:
130 wxString LinelConfigCommand() const;
131
147 wxString CellIdConfigCommand(GroupCell *cell);
148
152 wxString m_lastSentCellId;
153
155 long m_commandStart = -1;
157 wxString m_commandOutput;
159 CellPtr<GroupCell> m_errorGroup;
161 bool m_errorSpotMarked = false;
162
165 wxMaxima &m_wxMaxima;
166};
167
168#endif // MAXIMAEVALUATOR_H
Implementation of an observing weak Cell pointer.
A weak non-owning pointer that becomes null whenever the observed object is destroyed.
Definition: CellPtr.h:539
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:88
The evaluation-queue driver / command protocol extracted from wxMaxima.
Definition: MaximaEvaluator.h:51
void SendMaxima(wxString s, bool addToHistory=false, bool background=false)
Sends a string to the Maxima process (optionally adding it to the history and/or marking it a backgro...
Definition: MaximaEvaluator.cpp:45
void AddCommandOutput(const wxString &text)
Collects what Maxima printed in reply to the current command.
Definition: MaximaEvaluator.cpp:586
void MarkErrorStatement(GroupCell *cell)
Marks the statement the current command came from as the one that caused an error,...
Definition: MaximaEvaluator.cpp:593
bool QueryVariableValue()
Queries the value of the next variable wxMaxima wants to know about.
Definition: MaximaEvaluator.cpp:138
void TriggerEvaluation()
If Maxima is idle and the queue is non-empty, sends the next command; otherwise settles the UI into i...
Definition: MaximaEvaluator.cpp:324
void SetupVariables()
Sends Maxima the one-time startup configuration.
Definition: MaximaEvaluator.cpp:695
void StartCommand(long start)
Remembers where in its cell the command that is being sent starts.
Definition: MaximaEvaluator.cpp:579
void MarkSyntaxErrorSpot()
If Maxima reported a syntax error for the current command, marks where in its statement it is,...
Definition: MaximaEvaluator.cpp:610
void EvaluateEvent(wxCommandEvent &event)
The "evaluate" menu/hotkey handler: queues the active/selected cells and starts evaluation (or sends ...
Definition: MaximaEvaluator.cpp:230
void FirstOutput()
Prepares the worksheet once Maxima's first prompt has been seen.
Definition: MaximaEvaluator.cpp:39
bool AbortOnError()
Reacts to a Maxima error: decides whether to keep evaluating the queue.
Definition: MaximaEvaluator.cpp:174
Definition: wxMaxima.h:76