Stephen Pelc wrote:
>
> > 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?
>
> I think of applications in three basic groups:
> embedded
> mobile/PDA
> desktop
>
> This proposal is firmly in the desktop arena.
Yes. It's certainly not useful for programs that run on computers
without keyboards.
> IMHO it introduces
> unspecified linkages between KEY, KEY? and ACCEPT and EKEY,
> EKEY? and EKEY>CHAR. These linkages need to be explicit
> (defined).
No such linkages are intended. Why do you think that this proposal
introduces such linkages?
> Note that the original definition of EKEY talks about
> "keyboard events".
And?
> I suspect that the proposal is feasible because most desktops
> use the same keyboard mechanisms - common hardware chips?
This proposal is intended to be independent of specific hardware
chips, and of whatever mechanisms there may be between the keyboard
and the Forth program. The only mechamisms that are required for this
proposal to be useful are that there is a keyboard with at least some
of these keys attached to the system, and that the fact that the user
presses such a key is reported to the Forth system.
As an example, I have just started gforth on a computer called b3 (a
PC running Linux). I ran the following line:
ekey k-left = .
and then, when EKEY waited for input, I pressed the cursor left key.
The output of this line was:
-1 ok
I typed the key on my home machine (about 2km from the b3), and the
mechanisms involved were the keyboard, the Linux kernel, the X window
system, the xterm program, the ssh (all on my machine), some
networking stuff, the sshd (on b3), and gforth. And the key event was
translated from whatever code the keyboard uses internally to an X key
symbol (by X; maybe the Linux kernel does another translation
earlier), to an ESC sequence (by xterm), and the finally to the value
returned by K-LEFT (by Gforth). I think that demonstrates that the
proposal is not tied to specific hardware chips.
> I believe that this proposal needs more work in two areas:
> 1) domain specificity
What kind of work do you have in mind?
> 2) the assumptions and linkages with EKEY.
The only linkage intended by the proposal is that EKEY may return the
values returned by the proposed words. What assumptions and linkages
do you have in mind.
> The danger in the EKEY assumptions lies in inadvertently
> disenfranchising embedded apps.
I don't know how such a disenfranchisement is supposed to happen.
This is an optional extension, so there is no requirement for a system
to support it (although it's a good idea to do it where appropriate).
And there is certainly no requirement for an application to use it.
If an application does not use these words, it will still compile and
run.
This is just like floating-point or files. Not all systems support
these capabilities, but for those that do there is a common word set.
... I think of applications in three basic groups: embedded mobile/PDA desktop This proposal is firmly in the desktop arena. IMHO it introduces unspecified...
... 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@...
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...
... 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...
... 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...
... 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...
... 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 ...
... 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...
... 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@...
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...
... 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@...
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@...
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@...
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@...
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@...
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...
... 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@...
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@...
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...
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@...
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@...
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@...
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@...
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@...
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@...
Jun 19, 2006 8:42 pm
... okay by me....
Mitch Bradley
wmb@...
Jun 20, 2006 11:12 pm
... The normal case would be that KEY ignores the <cursor down>, so KEY? should return false. The abnormal case is if the <cursor down> is visible as escape...
Anton Ertl
anton@...
Jun 18, 2006 10:03 pm
... If you then use KEY and no further magic key events occur, what does/should EKEY? then return? Stephen...