'set novalue on' /* force KEXX and its way of SIGNAL ON NOVALUE */ /* Usage: [MACRO] EURO */ /* Example: DEFine C-E EURO */ /* Purpose: Locate next PC-Multilingual-850+euro character. */ /* Actually the next char. in the file area below */ /* 9: TAB, between 9 and 32: SP, or above 126: '~' */ /* is located, including 127: DEL and 128-255 (any */ /* 8-bit character). */ /* Caveats: 10: LF and 13: CR are (intentionally) CLocated. */ /* Requires: Kedit 5.0 (Frank Ellermann, 2002) */ C = xrange( '00'x, '08'x ) ; 'extract /WRAP/STAY' C = C || xrange( '0A'x, '1F'x ) ; 'wrap on' C = C || xrange( '7F'x, 'FF'x ) ; 'stay on' if modifiable() <= command() + inprefix() then 'cursor column' LINE = cursor.3() ; L = LINE POS = cursor.4() ; CL = POS ; Z = 0 do N = 1 to length( C ) Y = delimit( substr( C, N, 1 )) ; 'nomsg clocate' Y X = rc ; if X = 2 then iterate if X <> 0 then do 'emsg FATAL' lastmsg.1() Y ; exit X end Y = target.1() ; X = target.2() ; Z = 1 'L :' || LINE ; 'cl :' || POS /* go back to start point */ if Y = LINE & X = POS then iterate if L > LINE | ( L = LINE & CL > POS ) then do if Y = L & X > CL then iterate if Y < LINE | L < Y then iterate if Y = LINE & X < POS then iterate end if L < LINE | ( L = LINE & CL < POS ) then do if Y < LINE & L < Y then iterate if Y < LINE & ( L = Y & CL < X ) then iterate if Y = LINE & X < POS then do if L < Y | ( L = Y & CL < X ) then iterate end end L = Y ; CL = X /* note new minimal target */ end 'wrap' WRAP.1 ; 'stay' STAY.1 if Z then do /* locating minimal target */ 'L :' || L ; X = substr( curline.3(), CL, 1 ) if CL > 1 then do 'cl :' || CL - 1 ; 'cl +' delimit( X ) end /* this +/- nonsense tries */ else do /* to THIGHlight the char. */ 'cl :' || CL + 1 ; 'cl -' delimit( X ) end say "'" || c2x( X ) || "'x" ; exit 0 end 'emsg all us-ascii (9 or 32..126)' ; exit 1