mirror of
https://git.sr.ht/~crc_/retroforth
synced 2024-11-16 19:48:56 +01:00
rre: handle backspace; add -ic for cbreak mode, use -i for non-breaking mode
FossilOrigin-Name: 0835cc01bca5eece5d9d5036fffba44e01ed6ebd4c612c613c3f7764dce92e79
This commit is contained in:
parent
507398f431
commit
d9a5756151
4 changed files with 30 additions and 8 deletions
|
@ -1,5 +1,7 @@
|
|||
# Building RETRO
|
||||
|
||||
## Unix (BSD, Linux, macOS, Cygwin)
|
||||
|
||||
Requirements:
|
||||
|
||||
- a generic shell in `/bin/sh`
|
||||
|
@ -10,7 +12,22 @@ Requirements:
|
|||
|
||||
You can either use `make` or just run `./build.sh` directly.
|
||||
|
||||
The resulting files will be in the `bin` directory: `rre` and
|
||||
`repl`.
|
||||
|
||||
RETRO is known to build out of the box on FreeBSD, macOS, and
|
||||
Linux. It'll also build fine under Cygwin if you are using a
|
||||
Windows system.
|
||||
|
||||
## Windows
|
||||
|
||||
Requirements:
|
||||
|
||||
- .NET Framework
|
||||
|
||||
Process:
|
||||
|
||||
%windir%\Microsoft.NET\Framework\v2.0.50727\csc.exe implementations\repl.cs
|
||||
|
||||
Copy the resulting `repl.exe` and the `ngaImage` to the same directory
|
||||
and run the `repl.exe`
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -832,6 +832,8 @@ int main(int argc, char **argv) {
|
|||
if (argc > 1) {
|
||||
if (strcmp(argv[1], "-i") == 0) {
|
||||
execute(d_xt_for("listen", Dictionary));
|
||||
} else if (strcmp(argv[1], "-ic") == 0) {
|
||||
execute(d_xt_for("listen-cbreak", Dictionary));
|
||||
} else {
|
||||
include_file(argv[1]);
|
||||
}
|
||||
|
|
|
@ -331,23 +331,26 @@ once for each line in a file. This makes some things trivial. E.g., a simple
|
|||
# Interactive Listener
|
||||
|
||||
~~~
|
||||
:bye
|
||||
'stty_-cbreak unix:system #0 unix:exit ;
|
||||
|
||||
{{
|
||||
'CBreak var
|
||||
|
||||
:version (-) @Version #100 /mod putn $. putc putn ;
|
||||
:banner (-) 'RETRO_12_(rx- puts version $) putc nl
|
||||
EOM putn '_MAX,_TIB_@_1025,_Heap_@_ puts here putn nl ;
|
||||
:eol? (c-f) [ ASCII:CR eq? ] [ ASCII:LF eq? ] [ ASCII:SPACE eq? ] tri or or ;
|
||||
:valid? (s-sf) dup s:length n:-zero? ;
|
||||
:ok (-) compiling? [ nl 'Ok_ puts ] -if ;
|
||||
:check-eof (c-c) dup #4 eq? [ bye ] if ;
|
||||
:gets (-s) [ #1025 buffer:set
|
||||
[ getc dup buffer:add check-eof eol? ] until
|
||||
:check-eof (c-c) dup #4 eq? [ 'bye d:lookup d:xt fetch call ] if ;
|
||||
:check-bs (c-c) dup [ #8 eq? ] [ #127 eq? ] bi or [ buffer:get drop ] if ;
|
||||
:gets (-s) [ #1025 buffer:set
|
||||
[ getc dup buffer:add check-eof check-bs eol? ] until
|
||||
buffer:start s:chop ] buffer:preserve ;
|
||||
---reveal---
|
||||
:bye (-) @CBreak [ 'stty_-cbreak unix:system ] if #0 unix:exit ;
|
||||
:listen (-)
|
||||
'stty_cbreak unix:system
|
||||
banner ok repeat gets valid? [ interpret ok ] [ drop ] choose again ;
|
||||
:listen-cbreak (-)
|
||||
&CBreak v:on 'stty_cbreak unix:system listen ;
|
||||
}}
|
||||
~~~
|
||||
|
|
Loading…
Reference in a new issue