retroforth/interfaces/io/io_gopher.forth
crc 964c5ddce0 move io devices to a separate directory, build as .o files
FossilOrigin-Name: 78f3679efbab260adff023a06b0b3da7c86e0550f7afa718b2bbe82610363a8c
2019-01-11 21:51:21 +00:00

27 lines
407 B
Forth

# Gopher
RETRO has Gopher support via `gopher:get`.
Takes:
destination
server name
port
selector
Returns:
number of characters read
~~~
{{
'io:Gopher var
:identify
@io:Gopher n:zero? [
#5 io:scan-for dup n:negative?
[ drop 'IO_DEVICE_TYPE_0005_NOT_FOUND s:put nl ]
[ !io:Gopher ] choose ] if ;
---reveal---
:gopher:get identify #0 @io:Gopher io:invoke ;
}}
~~~