retroforth/example/detect-devices.retro
crc 0e6474263d begin final prep for 2020.10 release
FossilOrigin-Name: d7d23e5d4eadc29362e87f247c855f748b48eb0e23b349abf063d8c57b81ac9d
2020-10-13 12:41:26 +00:00

23 lines
695 B
Text

This will iterate over the attached devices, displaying a short
description of each.
~~~
:id
#0 [ 'generic-output s:put nl ] case
#1 [ 'generic-input s:put nl ] case
#2 [ 'floating-point s:put nl ] case
#3 [ 'block-store s:put nl ] case
#4 [ 'filesystem s:put nl ] case
#5 [ 'clock s:put nl ] case
#6 [ 'reserved s:put nl ] case
#7 [ 'sockets s:put nl ] case
#8 [ 'unix-syscalls s:put nl ] case
#9 [ 'scripting s:put nl ] case
#10 [ 'random-number-generator s:put nl ] case
#1000 [ 'saving-image s:put nl ] case
'unknown:_ s:put n:put nl ;
'Detecting_devices... s:put nl
io:enumerate [ $# c:put I dup n:put io:query nip tab id ] indexed-times
'Complete. s:put nl
~~~