Almetare 1.20
Alle meine Taschenrechner - Eine C++-Bibliothek zur Entwicklung von Taschenrechnern
calc_fx3600p.h
gehe zur Dokumentation dieser Datei
1//******************************************************************************
2// Copyright (c) 2002-2004 by Friedemann Seebass, Germany.
3// Dieses Programm ist freie Software. Siehe GNU GPL Notiz in Datei main.cpp.
4// This program is free software. See the GNU GPL notice in file main.cpp.
5// Projekt: Almetare - Alle meine Taschenrechner
6//******************************************************************************
11//******************************************************************************
12// Wann Wer Was
13// ---------- -------- ---------------------------------------------------------
14// 11.08.2003 fse ComputerFx3600p::qsimp(): neuer Parameter dif
15// 01.03.2003 fse erzeugt
16//******************************************************************************
17
18#ifndef CALC_FX3600P_H
19#define CALC_FX3600P_H
20
21#ifndef __cplusplus
22#error calc_fx3600p.h is only for C++!
23#endif
24
25//******************************************************************************
26
27#include "calc_casio_sci.h"
28
29using namespace std;
30
31//******************************************************************************
32
33class DisplayFx3600p;
35
36//******************************************************************************
37// Klasse ComputerFx3600p:
38//******************************************************************************
39
41
43{
50 string mPrgMem[2];
51 string mPrgMemOrg[2];
53 string mRunningPrg;
57 int mDigits;
59 bool preProcess(string& in);
60 bool checkOnPrgBreak();
61 void addPrgStep(const string& in);
62 double trapzd(double a, double b, int n);
63 double qsimp (double a, double b, int& n, double& dif); // fse, 11.08.03: dif
64 double f(double x);
65 bool storeMainPrgAndCheckOnRecursionError(bool isSubPrgRunning, const string& in, string& mainRunningPrg);
66public:
68// ~ComputerFx3600p();
69 bool map(string& sym);
70 bool getIsIdxMode() { return mIsIdxMode; }
71 bool getIsLrnMode() { return mIsLrnMode; }
72 bool getIsEntMode() { return mIsEntMode; }
73 bool getIsHltMode() { return mIsHltMode; }
74 int getActivePrg() { return mActivePrg; }
75 int getIsPrgBreak(){ return mIsPrgBreak;}
76 int getIdxStep() { return mIdxStep; }
77 string getRunningPrg(){ return mRunningPrg;}
78 string getPrgMem(int i) { return mPrgMem[i]; }
79 string getPrgMemOrg(int i) { return mPrgMemOrg[i]; }
80// void setCalcP(CalculatorFx3600p* calcP) { mCalcFx3600pP = calcP; }
81 void setIsIdxMode(bool isOn) { mIsIdxMode = isOn; }
82 void setIsLrnMode(bool isOn) { mIsLrnMode = isOn; }
83 void setIsEntMode(bool isOn) { mIsEntMode = isOn; }
84 void setIsHltMode(bool isOn) { mIsHltMode = isOn; }
85 void setActivePrg(int prg ) { mActivePrg = prg ; }
86 void setIsPrgBreak(bool b ) { mIsPrgBreak = b ; }
87 void setIdxStep (int i ) { mIdxStep = i ; }
88 void setPrgMem (int i, string str) { mPrgMem [i] = str; }
89 void setPrgMemOrg(int i, string str) { mPrgMemOrg[i] = str; }
90 void setRunningPrg(string prg) { mRunningPrg = prg; }
91 void resetRunningPrg() { mRunningPrg = mPrgMem[mActivePrg-1]; }
92 bool isPrgRunning() { return (mActivePrg == 1 || mActivePrg == 2) && !mIsLrnMode && !mIsEntMode && !mIsHltMode; }
93 void precedeRunningPrg(const string& pre) { mRunningPrg = pre + mRunningPrg; }
95 void intgrInputAb();
96 void integrate();
97 void aftProcess2(string& in);
98};
99
100//******************************************************************************
101// Klasse DisplayFx3600p:
102//******************************************************************************
103
105
107{
109
111 void makeSeven(string displayStr = "");
112 void setOn (bool on) { mOn = on ? "On" : ".." ; }
113 void setInv (bool on) { mInv = on ? "INV" : "..."; }
114 void setLrn (bool on) { mLrn = on ? "LRN" : "..."; }
115 void setEnt (bool on) { mEnt = on ? "ENT" : "..."; }
116 void setIdx (bool on) { mIdx = on ? "Idx" : "..."; }
117 void setP1 (bool on) { mP1 = on ? "P1" : ".." ; }
118 void setP2 (bool on) { mP2 = on ? "P2" : ".." ; }
119protected:
120 string mOn;
121 string mLrn;
122 string mIdx;
123 string mEnt;
124 string mP1;
125 string mP2;
126
127public:
129 void setModes();
130};
131
132//******************************************************************************
133// Klasse CalculatorFx3600p:
134//******************************************************************************
135
137
139{
140 ComputerFx3600p* mCompP;
141 const char mSep;
142 string nvRamToStr();
143 void restoreNvRam();
144 void restorePrg(int i, string prg);
145public:
146 CalculatorFx3600p(int argc, char** argv);
148// void setPrg(string prg) { mActivePrg = prg; }
149// string& getPrg() { return mActivePrg; }
150};
151
152//******************************************************************************
153// zusaetzliche Symbole im Casio fx-3600P:
154//************************* ************************* **************************
155
156
158
159class AcIdx : public SymAction
160
161{
162public:
163 AcIdx() : SymAction("idx", "set into integration mode") {}
164 void process();
165};
166
167//************************* ************************* **************************
168
170
171class AcLrn : public SymAction
172
173{
174public:
175 AcLrn() : SymAction("lrn", "set into programming mode") {}
176 void process();
177};
178
179//************************* ************************* **************************
180
182
183class AcRnm : public SymAction
184
185{
186public:
187 AcRnm() : SymAction("rnm", "set into normal run mode") {}
188 void process();
189};
190
191
192//************************* ************************* **************************
193
195
196class AcPcl : public SymAction
197{
198public:
199 AcPcl() : SymAction("pcl", "clear program(s)") {}
200 void process();
201};
202
203//************************* ************************* **************************
204
206
207class AcStrps : public SymAction
208{
209public:
210 AcStrps() : SymAction("strps", "set number of integration stripes (= 2^...)") {}
211 void process();
212};
213
214//************************* ************************* **************************
215
219
220class AcPrgCtrl : public SymAction
221{
222protected:
223// static CalculatorFx3600p* mCalcP;
224 void processP1P2(int actPrg);
225
226public:
227 explicit AcPrgCtrl(string sym = "", string hlp = "no help available")
228 : SymAction(sym, hlp) {}
229// static void setCalcP(CalculatorFx3600p* calcP) { mCalcP = calcP; }
230};
231
232//****************** ******************* ******************* *******************
233
235
236class PrgCtrlP1 : public AcPrgCtrl
237{
238public:
239 PrgCtrlP1() : AcPrgCtrl("p1", "choose/execute program no. 1") {}
240 void process();
241};
242
243//****************** ******************* ******************* *******************
244
246
247class PrgCtrlP2 : public AcPrgCtrl
248{
249public:
250 PrgCtrlP2() : AcPrgCtrl("p2", "choose/execute program no. 2") {}
251 void process();
252};
253
254//****************** ******************* ******************* *******************
255
257
258class PrgCtrlRun : public AcPrgCtrl
259{
260public:
261 PrgCtrlRun() : AcPrgCtrl("run", "continue the program") {}
262 void process();
263};
264
265//****************** ******************* ******************* *******************
266
268
269class PrgCtrlEnt : public AcPrgCtrl
270{
271public:
272 PrgCtrlEnt() : AcPrgCtrl("ent", "enter data into program") {}
273 void process();
274};
275
276//****************** ******************* ******************* *******************
277
279
280class PrgCtrlHlt : public AcPrgCtrl
281{
282public:
283 PrgCtrlHlt() : AcPrgCtrl("hlt", "halt program") {}
284 void process();
285};
286
287//************************* ************************* **************************
288
290
291class PrgCtrlXgt0 : public AcPrgCtrl
292{
293public:
294 PrgCtrlXgt0() : AcPrgCtrl("xgt0", "jumps to program start if x > 0") {}
295 void process();
296};
297
298//************************* ************************* **************************
299
301
302class PrgCtrlXleM : public AcPrgCtrl
303{
304public:
305 PrgCtrlXleM() : AcPrgCtrl("xlem", "jumps to program start if x <= M") {}
306
307 void process();
308};
309
310//************************* ************************* **************************
311
313
314class PrgCtrlRtn : public AcPrgCtrl
315{
316public:
317 PrgCtrlRtn() : AcPrgCtrl("rtn", "jumps to program start") {}
318 void process();
319};
320
321//******************************************************************************
322//************************************** ***************************************
323
324//************************* ************************* **************************
325
326#endif // !CALC_FX3600P_H
Gemeinsame Klassen fuer wissenschaftliche Casio-Rechner (Modul special).
DspMode
Winkelmodus Altgrad, Neugrad oder Rad.
Definition: calc_sci.h:35
Schaltet Rechner in Integrationsmodus.
Definition: calc_fx3600p.h:161
void process()
Schaltet den Rechner in den Integrations-Modus.
Definition: calc_fx3600p.cpp:1055
Schaltet Rechner in Programmiermodus.
Definition: calc_fx3600p.h:173
void process()
Schaltet den Rechner in den "Learn"-Modus, um ihn zu programmieren.
Definition: calc_fx3600p.cpp:1070
Loescht Programm.
Definition: calc_fx3600p.h:197
void process()
Loescht einen oder beide der Programmspeicher.
Definition: calc_fx3600p.cpp:1105
Klasse mit Unterklassen, die die Ausfuehrung von Programmen kontrollieren.
Definition: calc_fx3600p.h:221
void processP1P2(int actPrg)
Prozessiert die Tasten P1 und P2.
Definition: calc_fx3600p.cpp:1151
Schaltet Rechner in normalen Runmodus.
Definition: calc_fx3600p.h:185
void process()
Schaltet den Rechner in den normalen Run-Modus.
Definition: calc_fx3600p.cpp:1090
Gibt Streifenanzahl bei Integration vor.
Definition: calc_fx3600p.h:208
void process()
Ermittelt die beim Integrieren eingegebene Streifenanzahl.
Definition: calc_fx3600p.cpp:1128
Basisklasse aller Taschenrechner.
Definition: calculator.h:245
Die Klasse implementiert den Calculator des Casio fx-3600P.
Definition: calc_fx3600p.h:139
void restoreNvRam()
Der NV-RAM-String aus der Konfigurationsdatei wird geparsed und die Daten in die entsprechenden Varia...
Definition: calc_fx3600p.cpp:922
~CalculatorFx3600p()
Achtung: Aufraeumen wird im wesentlichen von ~CalculatorBase() uebernommen! Hier werden nur die persi...
Definition: calc_fx3600p.cpp:991
CalculatorFx3600p(int argc, char **argv)
Konstruktor des Calculators.
Definition: calc_fx3600p.cpp:890
const char mSep
Separator fuer nvRam-String in der Konf.datei.
Definition: calc_fx3600p.h:141
void restorePrg(int i, string prg)
Programme aus der Konfigurationsdatei werden in die einzeilige Darstellung umgewandelt,...
Definition: calc_fx3600p.cpp:975
string nvRamToStr()
Schreibt die permanenten Daten (K-Register, M-Speicher) in String.
Definition: calc_fx3600p.cpp:1008
Basisklasse aller Computer.
Definition: calculator.h:85
Gemeinsame Basisklasse aller wissenschaftlichen Casio-Rechner.
Definition: calc_casio_sci.h:44
Die Klasse implementiert den Computer des Casio fx-3600P.
Definition: calc_fx3600p.h:43
int mActivePrg
gerade aktives Programm
Definition: calc_fx3600p.h:52
bool mIsPrgBreak
Flag, ob laufendes Prg. durch "AC" unterbr. wurde.
Definition: calc_fx3600p.h:54
bool preProcess(string &in)
Fuehrt Pre-Processing des Symbols durch.
Definition: calc_fx3600p.cpp:252
bool storeMainPrgAndCheckOnRecursionError(bool isSubPrgRunning, const string &in, string &mainRunningPrg)
Falls gerade kein Unterprogramm laeuft, wird prophylaktisch das sich abbauende Hauptprogramm immer in...
Definition: calc_fx3600p.cpp:589
bool mIsEntMode
Rechner ist im "Enter"-Modus.
Definition: calc_fx3600p.h:48
bool mIsLrnMode
Rechner ist im Programmiermodus.
Definition: calc_fx3600p.h:47
double trapzd(double a, double b, int n)
Berechnet die n-te Verfeinerungsstufe der Erweiterten Trapezregel als Naeherungsformel der Integratio...
Definition: calc_fx3600p.cpp:809
int mIdxStep
aktueller Zustand des Integrationsprozesses
Definition: calc_fx3600p.h:55
bool map(string &sym)
Mapped das uebergebene Symbol gegebenenfalls auf ein anderes Symbol um.
Definition: calc_fx3600p.cpp:282
Number execPrg()
Fuehrt das Programm actPrg aus.
Definition: calc_fx3600p.cpp:461
bool mIsIdxMode
Rechner ist im Intagrationsmodus.
Definition: calc_fx3600p.h:46
string mPrgMem[2]
Speicher fuer zwei Programme.
Definition: calc_fx3600p.h:50
DspMode mDspMode
aktueller Display-Mode, zum Ruecksetzen nach Integration
Definition: calc_fx3600p.h:56
void intgrInputAb()
Eingabe der Integrationsgrenzen.
Definition: calc_fx3600p.cpp:648
void addPrgStep(const string &in)
Speichert im Programmiermodus den naechsten Programmschritt.
Definition: calc_fx3600p.cpp:355
bool mIsForceSciTypeB
true, wenn SCI erst bei Zahlen kleiner 1e-7
Definition: calc_fx3600p.h:45
double qsimp(double a, double b, int &n, double &dif)
Berechnet das Integral der Funktion funcP in den Grenzen a bis b nach der Simpson-Naeherung.
Definition: calc_fx3600p.cpp:768
ComputerFx3600p(CalculatorFx3600p *cP)
Konstruktor fuegt der Symboltabelle spezielle fx-3600P-Symbole hinzu.
Definition: calc_fx3600p.cpp:198
CalculatorFx3600p * mCalcFx3600pP
Zeiger auf den zugehoerigen Calculator.
Definition: calc_fx3600p.h:44
double f(double x)
Ermittelt den Funktionswert y der Funktion im aktuellen Programmspeicher an der Stelle x.
Definition: calc_fx3600p.cpp:842
void aftProcess2(string &in)
Fuehrt Aktionen nach Prozessierung des Symbols aus.
Definition: calc_fx3600p.cpp:868
string mRunningPrg
gerade ablaufendes Programm
Definition: calc_fx3600p.h:53
int mDigits
aktuelle Display-Genauigkeit, zum Ruecksetzen nach Integration
Definition: calc_fx3600p.h:57
bool mIsHltMode
Programm wurde durch "HLT"-Befehl unterbrochen.
Definition: calc_fx3600p.h:49
void addCasioFx3600SymsToSymTab()
Fuegt der Symboltabelle spezielle fx-3600P-Symbole hinzu.
Definition: calc_fx3600p.cpp:214
string mPrgMemOrg[2]
die beiden aktuellen Programme als Volltext
Definition: calc_fx3600p.h:51
bool checkOnPrgBreak()
Funktion dient zum Abbrechen eines laufenden Programmes.
Definition: calc_fx3600p.cpp:610
void integrate()
Funktion zur Berechnung von Bestimmten Integralen.
Definition: calc_fx3600p.cpp:707
Klasse der Anzeige aller wissenschaftlichen Casio-Rechner.
Definition: calc_casio_sci.h:103
Die Klasse implementiert die Anzeige des Casio fx-3600P.
Definition: calc_fx3600p.h:107
string mP2
String des Programmspeichers P2.
Definition: calc_fx3600p.h:125
void setModes()
Schaut im Computer, welche Modes gesetzt sind, und baut den Mode-String des Displays entsprechend zus...
Definition: calc_fx3600p.cpp:64
DisplayFx3600p(ComputerBase *cbP)
Konstruktor des Displays.
Definition: calc_fx3600p.cpp:51
void makeSeven(string displayStr="")
Erzeugt Anzeige-String.
Definition: calc_fx3600p.cpp:163
string mIdx
String des Integrations-Modus.
Definition: calc_fx3600p.h:122
void setModesCasioFx3600p()
Schaut im Computer, welche Modes gesetzt sind, und baut den Mode-String des Displays entsprechend zus...
Definition: calc_fx3600p.cpp:88
string mLrn
String des Programmiermodus "LRN".
Definition: calc_fx3600p.h:121
string mP1
String des Programmspeichers P1.
Definition: calc_fx3600p.h:124
ComputerFx3600p * mCompP
Zeiger auf den Computer des Rechners.
Definition: calc_fx3600p.h:108
string mOn
String des Power-Status "On".
Definition: calc_fx3600p.h:120
string mEnt
String des Enter-Modus.
Definition: calc_fx3600p.h:123
Die Klasse Number repraesentiert Zahlen.
Definition: number.h:49
Erlaubt Dateneingabe in Programmen.
Definition: calc_fx3600p.h:270
void process()
Prozessiert das "ent"-Symbol.
Definition: calc_fx3600p.cpp:1243
Unterbricht Programm.
Definition: calc_fx3600p.h:281
Waehlt Programm Nr. 1.
Definition: calc_fx3600p.h:237
void process()
Prozessiert die Taste P1.
Definition: calc_fx3600p.cpp:1181
Waehlt Programm Nr. 2.
Definition: calc_fx3600p.h:248
void process()
Prozessiert die Taste P2.
Definition: calc_fx3600p.cpp:1191
Verzweigt an Programmanfang.
Definition: calc_fx3600p.h:315
void process()
Prozessiert das rtn-Symbol.
Definition: calc_fx3600p.cpp:1319
Startet Programm oder setzt es fort.
Definition: calc_fx3600p.h:259
void process()
Prozessiert das "RUN"-Symbol.
Definition: calc_fx3600p.cpp:1211
Verzweigt an Programmanfang, wenn Anzeige > 0.
Definition: calc_fx3600p.h:292
void process()
Prozessiert das xgt0-Symbol.
Definition: calc_fx3600p.cpp:1281
Verzweigt an Programmanfang, wenn Anzeige <= M.
Definition: calc_fx3600p.h:303
void process()
Prozessiert das xlem-Symbol.
Definition: calc_fx3600p.cpp:1299
Basisklasse fuer alle Aktionen ("=", "%", ...).
Definition: symbols.h:278