JimBoyd wrote:
JimBoyd wrote:
I may have given Fleet Forth's EXPECT nonstandard behavior.
The Forth-83 Standard states the following concerning EXPECT .
Code:
9.5.2 EXPECT
Control characters may be processed to allow system dependent
editing of the characters prior to receipt. Therefore, a
Standard Program may not anticipated that control characters can
be received.
It doesn't seem to say anything about intercepting function keys; however, I thought such a capability would be useful. I have found nothing in the Forth-83 Standard for or against this extra functionality in EXPECT .
The closest I've seen is this excerpt for the Forth 2012 Standard's ACCEPT .forth-standard.org wrote:
It is recommended that all non-graphic characters be reserved for editing or control functions and not be stored in the input string.
Forth-94 slightly generalized the Forth-83 EXPECT specification by specifying that author of Forth-94 source could not depend on being able to receive non-graphical characters, which is more explicit about setting aside what is returned by a function key unless it returns one or more graphical characters.
However, function keys themselves do not come into scope until Forth-2012, which is also when "a source cannot depend on non-graphical characters being stored" was strengthened to "it is recommended that a system refrain from storing non-graphical characters".
Quote:
Fleet Forth is a Forth-83 Standard Forth for the most part; however, when there is something not covered in the Forth-83 Standard I will check the other standards for the least objectionable approach to minimizing divergent behavior in my Forth when adding new functionality to the kernel. One such example is renaming Fleet Forth's UNDO to UNLOOP .
ACCEPT is the Forth 2012 Standard version of EXPECT with slightly different behavior. As such, where the Forth-83 Standard is quiet concerning the use of function keys in EXPECT , I'll accept the Forth 2012 Standard's recommendations for ACCEPT . The relevant phrase describing ACCEPT is "or control functions" which would indicate that it is acceptable for ACCEPT , and therefore EXPECT , to intercept function keys and use them for control purposes.
I'd say it is good for sanity if EXPECT is implemented in a way that allows a set of Forth-94 / Forth-2012 portability screens to define ACCEPT as "EXPECT SPAN @".