diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-07-21 00:19:52 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-07-21 00:33:13 +0300 |
commit | 48dcfd22f9c2db5cf6745eaec0ff28895858c638 (patch) | |
tree | 0eb2c9658df557b8418d4bbdc8b9aa25fb15cd6d /src/cmdline.h | |
parent | 9903c408f2ffc7a42f4fcead54eadc567c0f3669 (diff) | |
download | sciteco-48dcfd22f9c2db5cf6745eaec0ff28895858c638.tar.gz |
support <==> and <===> for printing octal and hexadecimal numbers
* These are famously in DEC TECO-11, but also in Video TECO.
* The implementation is tricky. They need to use lookahead states,
but this would be inacceptable during interactive execution.
Therefore only if executing from the end of the command line
`==` and `===` are allowed to print multiple values.
The number is therefore also not popped form the stack immediately
but only peeked. It's popped only when it has been decided that
the command has ended.
* This may break existing macros that use multiple `=` in a row
to print multiple values from the stack.
You will now e.g. have to insert whitespace to separate such `=` commands.
Diffstat (limited to 'src/cmdline.h')
-rw-r--r-- | src/cmdline.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cmdline.h b/src/cmdline.h index ebdf1e1..1a57db5 100644 --- a/src/cmdline.h +++ b/src/cmdline.h @@ -84,6 +84,13 @@ teco_cmdline_keymacro_c(gchar key, GError **error) return TRUE; } +/** Check whether we are executing directly from the end of the command line. */ +static inline gboolean +teco_cmdline_is_executing(teco_machine_main_t *ctx) +{ + return ctx == &teco_cmdline.machine && ctx->macro_pc == teco_cmdline.effective_len; +} + extern gboolean teco_quit_requested; /* |