aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ring.h
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-10-31 13:46:11 +0100
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-10-31 21:13:19 +0100
commit4aa2b717f9e050783b567540d9bb0193d692e3e9 (patch)
tree39b3734c464655e6d1c21390945209a66f952654 /src/ring.h
parente0bf13622b0922252439e3fa8b43df9877678d75 (diff)
support floating point numbers
* Extends the SciTECO type system. A number on the expression stack or in a Q-register can be either an integer or a float. * Floating point constants begin with a digit (like all other numbers), are followed by a `.` and an optional fractional part. Exponents cannot currently be written. E.g. `1.` == `1.0`. But `.0` would still be `.,0`. (!) To push an integer followed by dot, you must now write e.g. `1,.` or `1 .`. * All of the basic arithmetic operators operate like this: If both operands are integers, the result is also an integer (integer arithmetics). If at least one of the operands is a float, the result is also a float (float arithmetics). * All of the binary operators (AND, OR, XOR) always cast all operands to integer and the result is always an integer as well. * You can "cast" integers to float by `*1.` or `/1.`. You can "cast" floats to integers using `#0`. * Most commands still accept only integers. Floats are implicitly casted to integers. Float-aware commands are: =, \, ^W, Qq, Uq, %q and the conditionals. * `%q` will not change the current type of register q. * Numeric part of "lexer.font" is now a float (in points). * You cannot currently print octal and hexadecimal floats. `==` and `===` are identical to `=` on floats. * `===` is now printing hex integers in lower case. This is because SciTECO's coding style for hex constants is also lower case. * `--with-teco-integer` renamed to `--with-teco-number`.
Diffstat (limited to 'src/ring.h')
-rw-r--r--src/ring.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ring.h b/src/ring.h
index f5606d1..7f2db7c 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -159,7 +159,7 @@ teco_current_doc_must_undo(void)
* If there's no currently edited Q-Register
* we must be editing the current buffer
*/
- return !teco_qreg_current || teco_qreg_current->must_undo;
+ return !teco_qreg_current || teco_qreg_current->flags.must_undo;
}
/** update dot in the current document (Q-Register or buffer) */
@@ -167,7 +167,7 @@ static inline void
teco_current_doc_set_dot(teco_int_t dot)
{
if (teco_qreg_current) {
- if (teco_qreg_current->must_undo)
+ if (teco_qreg_current->flags.must_undo)
teco_undo_int(teco_qreg_current->string.dot);
teco_qreg_current->string.dot = dot;
} else {