aboutsummaryrefslogtreecommitdiffhomepage
path: root/TODO
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2017-03-07 19:23:25 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2017-03-07 19:23:25 +0100
commit892248991babb55366860488678632ab4ccdb0ba (patch)
treee2ed43f63c21dd7e70a62ff7cd6149cc150d54cc /TODO
parenta2e52ca49c6a5495f134648e91647008dca4a742 (diff)
downloadsciteco-892248991babb55366860488678632ab4ccdb0ba.tar.gz
refactored commandline key processing: rewritten Cmdline::process_edit_cmd() as State::process_edit_cmd() virtual methods
* Cmdline::process_edit_cmd() was much too long and deeply nested. It used RTTI excessively to implement the state-specific behaviour. It became apparent that the behaviour is largely state-specific and could be modelled much more elegantly as virtual methods of State. * Basically, a state can now implement a method to customize its commandline behaviour. In the case that the state does not define custom behaviour for the key pressed, it can "chain" to the parent class' process_edit_cmd(). This can be optimized to tail calls by the compiler. * The State::process_edit_cmd() implementations are still isolated in cmdline.cpp. This is not strictly necessary but allows us keep the already large compilations units like parser.cpp small. Also, the edit command processing has little to do with the rest of a state's functionality and is only used in interactive mode. * As a result, we have many small functions now which are much easier to maintain. This makes adding new and more complex context sensitive editing behaviour easier. * State-specific function key masking has been refactored by introducing State::get_fnmacro_mask(). * This allowed us to remove the States::is_*() functions which have always been a crutch to support context-sensitive key handling. * RTTI is almost completely eradicated, except for exception handling and StdError(). Both remaining cases can probably be avoided in the future, allowing us to compile smaller binaries.
Diffstat (limited to 'TODO')
-rw-r--r--TODO13
1 files changed, 4 insertions, 9 deletions
diff --git a/TODO b/TODO
index ff1568a..9748f6f 100644
--- a/TODO
+++ b/TODO
@@ -254,15 +254,6 @@ Optimizations:
using _msize() to measure the memory required by individual chunks.
This must be benchmarked.
* Add G_UNLIKELY to all error throws.
- * Instead of using RTTI to implement the immediate editing command
- behaviours in Cmdline::process_edit_cmd() depending on the current
- state, this could be modelled via virtual methods in State.
- This would almost eradicate Cmdline::process_edit_cmd() and the
- huge switch-case statement, would be more efficient (but who cares
- in this case?) and would allow us to -fno-rtti saving a few bytes.
- However, this would mean to make some more Cmdline methods public.
- The implementations of the States' commandline editing handlers
- could all be concentrated in cmdline.cpp.
* String::append() could be optimized by ORing a padding
into the realloc() size (e.g. 0xFF).
However, this has not proven effective on Linux/glibc
@@ -294,6 +285,10 @@ Optimizations:
exception types. By adding an error code to the error object
(which we will need anyway for supporting error handling in SciTECO
macros), we may even avoid RTTI.
+ Should also allow us to completely disable exceptions via -fno-exceptions.
+ * RTTI could be disabled (-fno-rtti). It's only still required
+ because of StdError() for handling arbitrary C++ exceptions.
+ This is probably not required.
* The position can be eliminated from UndoTokens by
rewriting the UndoStack into a stack of UndoToken lists.
Should be a significant memory reduction in interactive mode.