Re: Override function fails
- Posted by Senator Oct 19, 2020
- 983 views
On Ubuntu 20.04 compile all compiles fail.
Interpreted runs fine Shroud works fine I didn't try bind
IT makes a somewhat better version of key.ex as is, I think.
Does this accomplish anything useful?
-- -- key2.ex -- ---------- key.ex with modifications derived from Irv Mullin's overide function get_key() code -- USE shroud -- DOES NOT COMPILE ON LINUX! -- -- -- Find out what numeric key code is generated by any key on the keyboard -- -- Usage -- {{{ -- eui key2.ex [keybindfile] -- eui key2.ex -- }}} -- If you supply a valid file containing key bindings, they will be set prior to -- testing the keycodes returned. include std/os.e include std/console.e include std/io.e include std/types.e without warning sequence cmd = command_line() integer OVERIDE if length(cmd) >= 3 then set_keycodes(cmd[3]) writefln("Testing keyboard codes on\n[1] using bindings from [2]", {uname(), cmd[3]}) OVERIDE = FALSE else writefln("Testing keyboard codes on [1]", {uname()}) OVERIDE = TRUE end if puts(1, "Press any key. I'll show you the key code. Press ESC (key=27) to quit\n") function overide_get_key() integer x = get_key() if x = 9 then puts(1, "TAB ") elsif x = 10 then puts(1, "ENTER/LF ") elsif x = 27 then puts(1, "ESC ") elsif x = 32 then puts(1, "SPACE ") elsif x = 127 then puts(1, "BACK ") end if return x end function integer key = 0 while 1 do if OVERIDE then key=overide_get_key() else key = get_key() end if if key = 27 then printf(1,"%d %s\n",{key,key}) exit elsif key > 0 then printf(1,"%d %s\n",{key,key}) end if end while
Regards, Ken