diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-06-29 16:46:19 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-06-29 17:10:03 +0200 |
commit | 95ebb1c7d7969fa642192ce8e6c9efa8249979d9 (patch) | |
tree | 8d768c2116b6ce6d013ff1517a38827eb3fe06b2 /src/cmdline.h | |
parent | cbcda49236665b3721ee9c3c66aa4bad08d777b8 (diff) | |
download | sciteco-95ebb1c7d7969fa642192ce8e6c9efa8249979d9.tar.gz |
<:Q> returns -1 for non-existent registers now
* added a new OPTIONAL behaviour for QRegSpecMachines
* allows you to implement commands that have an optional Q-Register
argument that should not be initialized if undefined.
* Using QRegSpecMachine::fail() you may still check for existence of
the register conditionally to emulate the QREG_REQUIRED behaviour.
* Using :Q for checking for register existence makes sense, because
usually you will want to check for both existence and non-emptyness
as in :Qq">. So in this common case, you no longer have to
keep in mind that the register may also be undefined.
* This finally allows us to create arrays in the Q-Register
tables without keeping a separate entry for the number of elements.
E.g. an array.0 to array.N can be iterated like this:
0Ui <:Q[array.^E\i]:; ! work with element i ! %i>
Diffstat (limited to 'src/cmdline.h')
-rw-r--r-- | src/cmdline.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmdline.h b/src/cmdline.h index 9a78605..05506fa 100644 --- a/src/cmdline.h +++ b/src/cmdline.h @@ -104,7 +104,7 @@ extern bool quit_requested; class StateSaveCmdline : public StateExpectQReg { public: - StateSaveCmdline() : StateExpectQReg(true) {} + StateSaveCmdline() : StateExpectQReg(QREG_OPTIONAL_INIT) {} private: State *got_register(QRegister *reg); |