-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaborted-question.fs
More file actions
41 lines (31 loc) · 968 Bytes
/
aborted-question.fs
File metadata and controls
41 lines (31 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
\ galope/aborted-question.fs
\ This file is part of Galope
\ http://programandala.net/en.program.galope.html
\ Author: Marcos Cruz (programandala.net), 2018
\ ==============================================================
: aborted? ( c -- f )
key? dup if key 2drop key = else nip then ;
\ Credit:
\
\ Code from Solo Forth
\ (http://programandala.net/en.program.solo_forth.html).
\ doc{
\
\ aborted? ( c -- f ) "aborted-question"
\
\ If no key is pressed return _false_. If a key is pressed,
\ discard it and wait for a second key. Then return _true_ if
\ it's _c_, else return _false_.
\
\ ``aborted?`` is a useful factor of `nuf?`.
\
\ Usage example:
\ ----
\ : listing ( -- )
\ begin ." bla " bl aborted? until ." Aborted" ;
\ ----
\ }doc
\ ==============================================================
\ Change log
\ 2018-05-13: Adapt from Solo Forth
\ (http://programandala.net/en.program.solo_forth.html).