From 9425ad37ec95a40dc039169031259161c92cc217 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 31 Aug 2025 02:24:11 +0300 Subject: support <:O>: if a label is not found, continue execution after the go-to statement * this is a SciTECO extension - it's not in TECO-11 * Allows for select-case-like constructs with default-clauses as in :Os.^EQa$ !* default *! !s.foo! !* ... *! !s.bar! !* ... *! * Consistent with nOlabel0,label1,...$ if is out of range. Unfortunately this form of computed goto is not applicable when "selecting" by strings or non-consecutive integers. * In order to continue after the <:O> statement, we must keep the program counter along with the label we were looking for. At the end of the macro, the PC is restored instead of throwing an error. * Since that would be very inefficient in loops - where potentially all iterations would result in rescanning till the end of the macro - we now store a completed-flag in the goto table. If it is set while trying to :O to an unknown label, we can just continue execution. --- TODO | 3 --- 1 file changed, 3 deletions(-) (limited to 'TODO') diff --git a/TODO b/TODO index 128fa6a..ddb5b76 100644 --- a/TODO +++ b/TODO @@ -729,9 +729,6 @@ Features: This would ease subscripting, e.g. to remove the last character: 0,:Qq-1Qq^Uq$ There should also be m,nA for consistency. - * :Olabel$ to avoid throwing an error if label is not defined. - This would be very useful when using computed Gotos as select-case - like constructs as the code after the Goto would act as a default-clause. * Sort order in Q-register autocompletions should be numeric, so ^A11 comes after ^A1. * FFI interface: There could be a command nFXlib$func$str$ -- cgit v1.2.3