aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/expressions.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-11-22 16:59:07 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-11-23 02:33:49 +0300
commit1cfe37610253c20a4fcb0d937c29e70894ecc4f5 (patch)
treeac05844c25fc0918e8fd451d8912fd7f1964acb7 /src/expressions.h
parent07b52f78680858683acb4e40b158f8926285cae4 (diff)
downloadsciteco-1cfe37610253c20a4fcb0d937c29e70894ecc4f5.tar.gz
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 "^".
Diffstat (limited to 'src/expressions.h')
-rw-r--r--src/expressions.h15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/expressions.h b/src/expressions.h
index 68d8ddb..caea1d7 100644
--- a/src/expressions.h
+++ b/src/expressions.h
@@ -19,6 +19,7 @@
#include <glib.h>
#include "sciteco.h"
+#include "qreg.h"
#include "undo.h"
/**
@@ -101,14 +102,6 @@ teco_set_num_sign(gint sign)
teco_undo_gint(teco_num_sign) = sign;
}
-extern gint teco_radix;
-
-static inline void
-teco_set_radix(gint r)
-{
- teco_undo_gint(teco_radix) = r;
-}
-
void teco_expressions_push_int(teco_int_t number);
/** Push characters of a C-string. */
@@ -123,7 +116,7 @@ teco_int_t teco_expressions_peek_num(guint index);
teco_int_t teco_expressions_pop_num(guint index);
gboolean teco_expressions_pop_num_calc(teco_int_t *ret, teco_int_t imply, GError **error);
-void teco_expressions_add_digit(gunichar digit);
+void teco_expressions_add_digit(gunichar digit, teco_qreg_t *radix);
void teco_expressions_push_op(teco_operator_t op);
gboolean teco_expressions_push_calc(teco_operator_t op, GError **error);
@@ -155,8 +148,8 @@ gboolean teco_expressions_brace_close(GError **error);
void teco_expressions_clear(void);
-/** Maximum size required to format a number if teco_radix == 2 */
+/** Maximum size required to format a number if radix == 2 */
#define TECO_EXPRESSIONS_FORMAT_LEN \
(1 + sizeof(teco_int_t)*8 + 1)
-gchar *teco_expressions_format(gchar *buffer, teco_int_t number);
+gchar *teco_expressions_format(gchar *buffer, teco_int_t number, teco_qreg_t *radix);