Search the web
Sign In
New User? Sign Up
forth200x
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
RfD: EKEY return values   Message List  
Reply | Forward Message #52 of 425 |
The HTML version of this RfD is
<http://www.forth200x.org/ekeys.html>

Problem

How do I write a portable Forth program that reacts to key presses of cursor
keys (and possibly other keys not represented by ASCII), e.g., an editor?

Proposal

The following words produce the same values that EKEY produces when the user
presses the corresponding key.

K-LEFT ( -- u ) facility ext
The "cursor left" key

K-RIGHT ( -- u ) facility ext
The "cursor right" key

K-UP ( -- u ) facility ext
The "cursor up" key

K-DOWN ( -- u ) facility ext
The "cursor down" key

K-HOME ( -- u ) facility ext
The "home" or "Pos1" key

K-END ( -- u ) facility ext
The "End" key

K-PRIOR ( -- u ) facility ext
The "PgUp" or "Prior" key

K-NEXT ( -- u ) facility ext
The "PgDn" or "Next" key

Typical Use

... ekey case
k-up of ... endof
k-down of ... endof
...
endcase

Remarks

Other Keys

Gforth and PFE also have words K1...K10 for the function/keypad keys;
they also contain S-K1...S-K10 for shifted function/keypad keys, but
they don't work as widely. Moreover, Gforth (but not PFE) also has
K-INSERT K-DELETE K11 K12 S-K11 S-K12. Should any of these words be
added to this proposal?

Experience

These words have been implemented for several years in PFE and
Gforth. They are not used much; however, several editors have been
published in ANS Forth that would have profited from these
words. Also, the original version of the MiniSpreadsheet
<http://wiki.forthfreak.net/index.cgi?MiniSpreadsheet> hardcoded the
values for the keys for one platform; I then fixed it to use the words
proposed above.

Implementation and Tests

The implementation is closely tied to the implementation of EKEY, and
therefore unportable, so I don't provide a reference
implementation. However, you can look at the Gforth implementation of
EKEY and these words (based on ANSI terminal escape sequences)
<http://b2.complang.tuwien.ac.at/cgi-bin/cvsweb/~checkout~/gforth/ekey.fs?rev=HE\
AD;content-type=text%2Fplain;cvsroot=gforth
>.

Tests <http://www.forth200x.org/tests/ekeys.fs>

- anton



Sun May 21, 2006 10:03 am

anton@...
Send Email Send Email

Forward
Message #52 of 425 |
Expand Messages Author Sort by Date

The HTML version of this RfD is <http://www.forth200x.org/ekeys.html> Problem How do I write a portable Forth program that reacts to key presses of cursor keys...
Anton Ertl
anton@...
Send Email
May 21, 2006
10:03 am

... [ ... ] ... I would like to see them all added to this proposal. ... I *do* use them. It would be very desirable to have the same words available in...
Robert Epprecht
epprecht@...
Send Email
May 24, 2006
6:38 am

The HTML version of this RfD is <http://www.forth200x.org/ekeys.html> Change History 2006-05-28 Added K-INSERT, K-DELETE, K-F* and K-*-MASK. Added Sections ...
Anton Ertl
anton@...
Send Email
May 28, 2006
4:32 pm

... I think of applications in three basic groups: embedded mobile/PDA desktop This proposal is firmly in the desktop arena. IMHO it introduces unspecified...
Stephen Pelc
sfprem
Offline Send Email
May 30, 2006
11:18 am

... Yes. It's certainly not useful for programs that run on computers without keyboards. ... No such linkages are intended. Why do you think that this...
Anton Ertl
anton@...
Send Email
Jun 3, 2006
2:39 pm

... KEY is not just used for keyboards! On our systems, both desktop and embedded, KEY, EMIT and friends can be vectored on a task/thread/callback specific...
Stephen Pelc
sfprem
Offline Send Email
Jun 5, 2006
11:01 am

... Not really. The PC has a 8042 based keyboard, which is then translated to the X keyboard event (which is an abstraction for quite a number of different...
Bernd Paysan
berndpaysan
Offline Send Email
Jun 5, 2006
1:05 pm

... I take your point, but both start from the Linux kernel and libc. There are other operating systems. The point at issue is really that the proposal seems...
Stephen Pelc
sfprem
Offline Send Email
Jun 5, 2006
2:55 pm

... From VAX to zSeries: They all can work with X servers, by mapping key strokes to KeySyms. And the same works on Windows and Mac OS, which are again...
Bernd Paysan
berndpaysan
Offline Send Email
Jun 5, 2006
5:01 pm

... Not all desktops are PCs, or has this become a generic term for a desktop computer? ... My question was under the O/S API. I doubt if gForth does, and a ...
Stephen Pelc
sfprem
Offline Send Email
Jun 5, 2006
11:10 pm

... Well, originally a PC was a "personal computer", i.e. one for yourself, not one with a terminal attached. Seems to be similar to the term "desktop...
Bernd Paysan
berndpaysan
Offline Send Email
Jun 6, 2006
12:04 am

... EKEY? should return true if EKEY won't block. KEY? should return true if KEY won't block. If KEY just discards the PgUp key and then waits for you to type...
Anton Ertl
anton@...
Send Email
Jun 6, 2006
7:13 am

... But you're still assuming X or some OS intermediary between you and the chipset. There are purely native PC Forths, such as Greg Bailey's, not to mention...
Elizabeth D Rather
erather
Offline Send Email
Jun 6, 2006
12:19 am

... I don't see a problem there. Your EKEY will do on these devices whatever it has always done. If that does not include recognizing cursor and function...
Anton Ertl
anton@...
Send Email
Jun 6, 2006
7:05 am

... If I write a program, that uses certain keys, I want to know if they are there. If I want to make it usable on systems that don't provide them, I would use...
Robert Epprecht
epprecht@...
Send Email
Jun 6, 2006
3:18 pm

... The Forth system may not know if the keys are available. Gforth certainly does not know it (and even if they are available on the system, they might...
Anton Ertl
anton@...
Send Email
Jun 18, 2006
8:42 pm

... Valid points. ... I do. But I also use a lot of key bindings in my programs as they are often much more convenient then the 'other means'. So I often run...
Robert Epprecht
epprecht@...
Send Email
Jun 21, 2006
1:16 pm

... I may start to see what the point of this labeling stuff is: If you sell a Forth system for a keyboard-less embedded system to some customers, and they ask...
Anton Ertl
anton@...
Send Email
Jun 6, 2006
7:40 am

... Partly. Let's change desktop to PC from now on. The behaviour of KEY or EKEY on a PC depends on what they are connected to. The EKEY return value proposal...
Stephen Pelc
sfprem
Offline Send Email
Jun 6, 2006
10:36 am

... Yes. So I don't see what the problem is. ... Sounds fine to me. Although I wonder why you would need to change even that. What does it currently do if...
Anton Ertl
anton@...
Send Email
Jun 18, 2006
9:29 pm

... Or the Forth200x standard could make it clear somehow, that parts of it which are not relevant on a certain system and hardware can be omitted without...
Robert Epprecht
epprecht@...
Send Email
Jun 6, 2006
2:35 pm

... If you read the "Compliance and Labeling" sections of the current standard, you'll see that it bends over backwards to make this clear. The Core wordset is...
Elizabeth D Rather
erather
Offline Send Email
Jun 6, 2006
6:48 pm

In Open Firmware land, we stopped using the IEEE standardization process and starting labeling every new thing as a "Recommended Practice". That worked really...
Mitch Bradley
wmb@...
Send Email
Jun 6, 2006
9:10 pm

... Interesting. We have had some discussions on whether and how to work with an official standards body. - anton...
Anton Ertl
anton@...
Send Email
Jun 18, 2006
8:17 pm

A data point, for what it's worth: In Quartus Forth (for Palm Pilots), EKEY returns 'event_type', a value from a rather small set. To get anything...
Mitch Bradley
wmb@...
Send Email
Jun 6, 2006
9:23 pm

... Thanks for the info. I will contact Neal Bridges and as him what he thinks about the proposal. ... Yes, there were some discussions on comp.lang.forth...
Anton Ertl
anton@...
Send Email
Jun 18, 2006
8:10 pm

... What I meant by the note was that EKEY might be vectored, so that the user could point it at different keyboards with different extended code sets. The...
Mitch Bradley
wmb@...
Send Email
Jun 18, 2006
11:24 pm

... Well, that seems to be outside standardisation (at least at the moment), so if a system supports that, I would expect it to clarify what happens in this...
Anton Ertl
anton@...
Send Email
Jun 19, 2006
8:42 pm

... okay by me....
Mitch Bradley
wmb@...
Send Email
Jun 20, 2006
11:12 pm
First  | < Prev  |  Last 
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help