From 1cfe37610253c20a4fcb0d937c29e70894ecc4f5 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 22 Nov 2024 16:59:07 +0300 Subject: the search mode and current radix are mapped to __local__ Q-Registers ^X and ^R now (refs #17) * This way the search mode and radix are local to the current macro frame, unless the macro was invoked with :Mq. If colon-modified, you can reproduce the same effect by calling [.^X 0^X ... ].^X * The radix register is cached in the Q-Reg table as an optimization. This could be done with the other "special" registers as well, but at the cost of larger stack frames. * In order to allow constructs like [.^X typed with upcarets, the Q-Register specification syntax has been extended: ^c is the corresponding control code instead of the register "^". --- src/qreg.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/qreg.h') diff --git a/src/qreg.h b/src/qreg.h index e9a9b1b..4a7c15c 100644 --- a/src/qreg.h +++ b/src/qreg.h @@ -144,9 +144,16 @@ struct teco_qreg_table_t { * b) The top-level local register table. */ gboolean must_undo; + + /** + * The radix register in this local Q-Register table or NULL. + * This is an optimization to avoid frequent table lookups. + */ + teco_qreg_t *radix; }; void teco_qreg_table_init(teco_qreg_table_t *table, gboolean must_undo); +void teco_qreg_table_init_locals(teco_qreg_table_t *table, gboolean must_undo); /** @memberof teco_qreg_table_t */ static inline teco_qreg_t * -- cgit v1.2.3