From 0f5c2c89f20dc07c1e0f8e8a619850629825c9c3 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 14 Feb 2013 03:54:55 +0100 Subject: option for q-reg spec state machine to allocate (insert) new q-registers * enabled for all modifying Q-Reg commands --- src/qregisters.h | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src/qregisters.h') diff --git a/src/qregisters.h b/src/qregisters.h index 2e1772a..c5740f6 100644 --- a/src/qregisters.h +++ b/src/qregisters.h @@ -256,14 +256,17 @@ public: class QRegSpecMachine : public MicroStateMachine { StringBuildingMachine string_machine; + bool initialize; bool is_local; gint nesting; gchar *name; public: - QRegSpecMachine() : MicroStateMachine(), - is_local(false), nesting(0), name(NULL) {} + QRegSpecMachine(bool _init = false) + : MicroStateMachine(), + initialize(_init), + is_local(false), nesting(0), name(NULL) {} ~QRegSpecMachine() { @@ -286,7 +289,7 @@ class StateExpectQReg : public State { QRegSpecMachine machine; public: - StateExpectQReg(); + StateExpectQReg(bool initialize = false); private: State *custom(gchar chr) throw (Error, ReplaceCmdline); @@ -302,11 +305,17 @@ private: }; class StatePopQReg : public StateExpectQReg { +public: + StatePopQReg() : StateExpectQReg(true) {} + private: State *got_register(QRegister ®) throw (Error); }; class StateEQCommand : public StateExpectQReg { +public: + StateEQCommand() : StateExpectQReg(true) {} + private: State *got_register(QRegister ®) throw (Error); }; @@ -317,6 +326,9 @@ private: }; class StateCtlUCommand : public StateExpectQReg { +public: + StateCtlUCommand() : StateExpectQReg(true) {} + private: State *got_register(QRegister ®) throw (Error); }; @@ -324,6 +336,7 @@ private: class StateSetQRegString : public StateExpectString { public: StateSetQRegString() : StateExpectString(false) {} + private: State *done(const gchar *str) throw (Error); }; @@ -339,11 +352,17 @@ private: }; class StateSetQRegInteger : public StateExpectQReg { +public: + StateSetQRegInteger() : StateExpectQReg(true) {} + private: State *got_register(QRegister ®) throw (Error); }; class StateIncreaseQReg : public StateExpectQReg { +public: + StateIncreaseQReg() : StateExpectQReg(true) {} + private: State *got_register(QRegister ®) throw (Error); }; @@ -354,6 +373,9 @@ private: }; class StateCopyToQReg : public StateExpectQReg { +public: + StateCopyToQReg() : StateExpectQReg(true) {} + private: State *got_register(QRegister ®) throw (Error); }; -- cgit v1.2.3