bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: about keycodes


From: Thomas Dickey
Subject: Re: about keycodes
Date: Tue, 29 May 2007 08:29:45 -0400 (EDT)

On Tue, 29 May 2007, chinlu chinawa wrote:

I've been trying to find out how does curses do so the
keystroke-getting mechanism bypasses endianness
issues.

curses reads a stream of characters (and there should be no endianess
or byte-ordering issues in that).

I've been trying to make some sense out of this, for
example perhaps values on the fifo were summed, and/or
then (un)mettaed ((x) & (~0x80)), or (un)controlled as
keycodes seem to start over 256 decimal (MIN_KEY 0401)
have tried different things, though I don't seem to
get how it "magically" knows the keypress was
key_left.

It's matching strings - they're stored in a tree to make the matching
somewhat more efficient than a list.  As soon as it finds a match,
curses returns the corresponding keycode.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]