'set novalue on' /* force KEXX and its way of SIGNAL ON NOVALUE */ /* usage: [MACRO] keycodes [*] */ /* example: define C-K 'macro keycodes' */ /* see also: KHELP LASTKEY, KHELP READV */ /* requires: Kedit 5.0 (Frank Ellermann, 2002) */ /* shows lastkey.1(), the Kedit name of a key, or ASCII nnn macro */ /* shows lastkey.2(), the corresponding ASCII character (if any) */ /* shows lastkey.3(), the corresponding scan code or "key number" */ /* shows lastkey.4(), the corresponding shift-state, if KEYCODES */ /* was called with any non-blank argument, normally useless */ /* shows a one-line macro associated with the key, as far as it */ /* fits on message line, or one of the following messages: */ /* (modifiable macro) - long one-liner, 'mod macro key' ok. */ /* (multi-line macro) - a 'modify macro key' wouldn't work, */ /* (unmodifiable key) - no macro, e.g. composed characters. */ /* ... and so on, until you press the same key combination twice. */ K = 'press any key to decode' N = lastkey.1() lastkey.3() right( lastkey.4(), 4 ) do until O = N say K ; 'readv key' ; K = left( lastkey.1(), 10 ) O = N ; N = lastkey.1() lastkey.3() right( lastkey.4(), 4 ) if lastkey.2() == '' then K = K ' ' else K = K "'" || lastkey.2() || "'" K = K right( lastkey.3(), 3 ) if arg( 1 ) <> '' then K = K lastkey.4() if abbrev( lastkey.1(), 'ASCII' ) then K = K '(unmodifiable key)' else do 'sos save' ; 'nomsg modify macro' lastkey.1() if rc = 0 then do 'sos qc restore' ; 'nomsg query macro' lastkey.1() if length( K strip( lastmsg.1()) ) < lscreen.2() then K = K || ':' strip( lastmsg.1()) else K = K '(modifiable macro)' end else do 'sos qc restore' ; K = K '(multi-line macro)' end end say K ; K = 'press this key again to exit decoder' end