<feed xmlns='http://www.w3.org/2005/Atom'>
<title>sciteco/src, branch master-fmsbw-ci</title>
<subtitle>Scintilla-based Text Editor and COrrector</subtitle>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/'/>
<entry>
<title>^E at the end of a line in a string argument "swallows" the EOL character</title>
<updated>2026-09-26T22:12:30+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-09-26T22:12:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=e48f1a6b5319224a92a8e7d60cbf5a4098d14ff5'/>
<id>e48f1a6b5319224a92a8e7d60cbf5a4098d14ff5</id>
<content type='text'>
This is similar to `\` at the line end in many languages like C and
allows you to split a very long string argument over several lines without
adding the EOL characters themselves.
The TECO equivalent to `\` would be ^Q, but it would be a semantic exception since
^Q (escaping) is supposed to _preserve_ the value of the following character.
Therefore I decided to use ^E instead.
This works with DOS and Mac line breaks as well.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is similar to `\` at the line end in many languages like C and
allows you to split a very long string argument over several lines without
adding the EOL characters themselves.
The TECO equivalent to `\` would be ^Q, but it would be a semantic exception since
^Q (escaping) is supposed to _preserve_ the value of the following character.
Therefore I decided to use ^E instead.
This works with DOS and Mac line breaks as well.
</pre>
</div>
</content>
</entry>
<entry>
<title>instead of relying on Scintilla undo actions, use SciTECO undo tokens exclusively</title>
<updated>2026-09-24T23:43:56+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-09-24T23:43:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=e371b5fc710c597e175e6b7d7645b3a224a731a1'/>
<id>e371b5fc710c597e175e6b7d7645b3a224a731a1</id>
<content type='text'>
Previously we were using both Scintilla undo actions and our own undo tokens
and both had to be coordinated via `undo__teco_interface_ssm(SCI_UNDO, 0, 0)`.
This was error prone since we have to predict when an undo action is actually
generated. Furthermore, you had to update SCI_SETUNDOCOLLECTION on all buffers
and the Q-Reg view whenever switching to and from interactive mode.
Also, this probably wasted memory for the doubled undo bookkeeping.
Now, we always set SCI_SETUNDOCOLLECTION(FALSE), even in interactive mode.
teco_undo_view_insert() was introduced to undo text deletions.
While this saves almost no lines of code, it's just a clearer and simpler
architecture.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously we were using both Scintilla undo actions and our own undo tokens
and both had to be coordinated via `undo__teco_interface_ssm(SCI_UNDO, 0, 0)`.
This was error prone since we have to predict when an undo action is actually
generated. Furthermore, you had to update SCI_SETUNDOCOLLECTION on all buffers
and the Q-Reg view whenever switching to and from interactive mode.
Also, this probably wasted memory for the doubled undo bookkeeping.
Now, we always set SCI_SETUNDOCOLLECTION(FALSE), even in interactive mode.
teco_undo_view_insert() was introduced to undo text deletions.
While this saves almost no lines of code, it's just a clearer and simpler
architecture.
</pre>
</div>
</content>
</entry>
<entry>
<title>generate compile_flags.txt</title>
<updated>2026-09-22T22:24:23+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-09-22T22:24:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=207af96f4eb3220534ea06c2e107517372246544'/>
<id>207af96f4eb3220534ea06c2e107517372246544</id>
<content type='text'>
This can be read by clangd as an alternative to compile_commands.json
(which would be trickier to generate with Autotools).
However, since this is generated in the build directory, it may not always
be picked up automatically -- a build/ directory should work,
but otherwise you might have to pass --compile-commands-dir to clangd.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This can be read by clangd as an alternative to compile_commands.json
(which would be trickier to generate with Autotools).
However, since this is generated in the build directory, it may not always
be picked up automatically -- a build/ directory should work,
but otherwise you might have to pass --compile-commands-dir to clangd.
</pre>
</div>
</content>
</entry>
<entry>
<title>malloc replacement implements free_sized() and free_aligned_sized()</title>
<updated>2026-09-08T22:26:27+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-09-08T22:26:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=a0c46b02aaecef32bfef934e9e38e81a29655eda'/>
<id>a0c46b02aaecef32bfef934e9e38e81a29655eda</id>
<content type='text'>
* These are defined by C23 and jemalloc actually provides them
  beginning with FreeBSD 16.
  Since glib is using free_sized() when available, builds were broken
  on FreeBSD 16.
* Should be backported to the SciTECO 2.5.2 FreeBSD port to
  silence the fallout.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* These are defined by C23 and jemalloc actually provides them
  beginning with FreeBSD 16.
  Since glib is using free_sized() when available, builds were broken
  on FreeBSD 16.
* Should be backported to the SciTECO 2.5.2 FreeBSD port to
  silence the fallout.
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "optimize main state machine transitions with tail calls"</title>
<updated>2026-08-23T20:08:16+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-23T20:08:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=33bab281e27cf866e77fb3bba6e37f5a5edfef03'/>
<id>33bab281e27cf866e77fb3bba6e37f5a5edfef03</id>
<content type='text'>
For yet unknown reasons this does not improve performance on GCC 16
even though it also supports `__attribute__((musttail))`.
As long as I do not understand why, I don't want to risk any
unnecessary problems. I have reason to believe that the tail-call
optimized version still has subtle bugs.

See also the "tail-calls" branch.

This reverts commit 2e097cec409182c3cb39b74489387480bf8a278f.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For yet unknown reasons this does not improve performance on GCC 16
even though it also supports `__attribute__((musttail))`.
As long as I do not understand why, I don't want to risk any
unnecessary problems. I have reason to believe that the tail-call
optimized version still has subtle bugs.

See also the "tail-calls" branch.

This reverts commit 2e097cec409182c3cb39b74489387480bf8a278f.
</pre>
</div>
</content>
</entry>
<entry>
<title>curses/UNIX: improved error handling in teco_interface_{set,get}_clipboard()</title>
<updated>2026-08-23T10:27:44+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-23T10:27:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=6aa97a68a85b83267de597bfb30b70c04b7de97b'/>
<id>6aa97a68a85b83267de597bfb30b70c04b7de97b</id>
<content type='text'>
Now use the teco_spawn_check_wait_status(), which was previously in spawn.c,
so we no longer have to handle the UNIX-specific WEXITSTATUS() macros.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now use the teco_spawn_check_wait_status(), which was previously in spawn.c,
so we no longer have to handle the UNIX-specific WEXITSTATUS() macros.
</pre>
</div>
</content>
</entry>
<entry>
<title>introduced helper functions teco_qreg_table_get_string() and teco_qreg_table_get_integer()</title>
<updated>2026-08-22T22:28:23+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-22T22:28:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=32122651bdb51006edce2be3586dd09179bed52f'/>
<id>32122651bdb51006edce2be3586dd09179bed52f</id>
<content type='text'>
* Simplifies the common task of querying an integer or string from a Q-Register table.
* Undefined Q-Regs are reported as TECO_ERROR_QREGUNDEF, so you can theoretically
  handle this case. In practice however, it requires less boilerplating to
  just call teco_qreg_table_find() manually.
* It also doesn't make sense to use these functions when getting and setting
  a register at the same time as you will want to avoid repeated lookups.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Simplifies the common task of querying an integer or string from a Q-Register table.
* Undefined Q-Regs are reported as TECO_ERROR_QREGUNDEF, so you can theoretically
  handle this case. In practice however, it requires less boilerplating to
  just call teco_qreg_table_find() manually.
* It also doesn't make sense to use these functions when getting and setting
  a register at the same time as you will want to avoid repeated lookups.
</pre>
</div>
</content>
</entry>
<entry>
<title>optimize main state machine transitions with tail calls</title>
<updated>2026-08-22T20:27:33+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-22T20:27:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=2e097cec409182c3cb39b74489387480bf8a278f'/>
<id>2e097cec409182c3cb39b74489387480bf8a278f</id>
<content type='text'>
* On newer GCC (&gt;= 15) and Clang (&gt;= 13) versions we can tail call
  at the end of input_cb() implementations to the next state's input_cb(),
  which will be optimized to jumps (often direct jumps).
  That is, the compilers always optimized tail calls, but we can
  guarantee tail calls with the __attribute__((musttail)) statement
  attribute.
* Every `return &amp;teco_state_xxx` has to be replaced with
  `TECO_RETURN(ctx, &amp;teco_state_xxx, error)`.
* This speeds up `-O2 -flto` builds by 18%
  (e.g. tested on grosciteco for sciteco(7)).
  Part of the speed up could also be because of inlining through
  TECO_RETURN().
* The other state machines (stringbuilding and q-reg spec) cannot
  currently be optimized the same way since they get their characters
  passed in from the "main" state machine.
* All loops around callbacks could be optimized the same way.
  E.g. the undo token runner could also tail call into the next runner,
  but it's probably not important to optimize undo token executions.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* On newer GCC (&gt;= 15) and Clang (&gt;= 13) versions we can tail call
  at the end of input_cb() implementations to the next state's input_cb(),
  which will be optimized to jumps (often direct jumps).
  That is, the compilers always optimized tail calls, but we can
  guarantee tail calls with the __attribute__((musttail)) statement
  attribute.
* Every `return &amp;teco_state_xxx` has to be replaced with
  `TECO_RETURN(ctx, &amp;teco_state_xxx, error)`.
* This speeds up `-O2 -flto` builds by 18%
  (e.g. tested on grosciteco for sciteco(7)).
  Part of the speed up could also be because of inlining through
  TECO_RETURN().
* The other state machines (stringbuilding and q-reg spec) cannot
  currently be optimized the same way since they get their characters
  passed in from the "main" state machine.
* All loops around callbacks could be optimized the same way.
  E.g. the undo token runner could also tail call into the next runner,
  but it's probably not important to optimize undo token executions.
</pre>
</div>
</content>
</entry>
<entry>
<title>don't crash on `0N...$`, but always throw an error</title>
<updated>2026-08-18T19:32:03+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-18T19:32:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=3ae89e34f6a04dd553f3871856521334a4dbe62f'/>
<id>3ae89e34f6a04dd553f3871856521334a4dbe62f</id>
<content type='text'>
See also 8a8edaa2daf37f7c12e21b9199755b5de8e489f5.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
See also 8a8edaa2daf37f7c12e21b9199755b5de8e489f5.
</pre>
</div>
</content>
</entry>
<entry>
<title>curses: check for return values of newpad() and newwin()</title>
<updated>2026-08-12T23:04:41+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-12T22:49:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=64c8e378b251669241a3565adf2c8f2d792e1b8d'/>
<id>64c8e378b251669241a3565adf2c8f2d792e1b8d</id>
<content type='text'>
These can fail, so abort() just like glib does internally in case of OOM.
A special case is the pad allocation for autocompletion popups, which
can have excessively many lines. This is handled gracefully now
(the popup simply won't be displayed).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These can fail, so abort() just like glib does internally in case of OOM.
A special case is the pad allocation for autocompletion popups, which
can have excessively many lines. This is handled gracefully now
(the popup simply won't be displayed).
</pre>
</div>
</content>
</entry>
</feed>
