From b6778a0546b1a6ee457b440197121294967c7fc5 Mon Sep 17 00:00:00 2001 From: crc Date: Wed, 4 Sep 2019 15:13:58 +0000 Subject: [PATCH] new example of probing the devices FossilOrigin-Name: 70d09831db15ed3595ebc761f09f9ec0c7ca0e6b398c2b0c92f3dc92e9c9720f --- example/detect-devices.retro | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 example/detect-devices.retro diff --git a/example/detect-devices.retro b/example/detect-devices.retro new file mode 100644 index 0000000..1e2a9ea --- /dev/null +++ b/example/detect-devices.retro @@ -0,0 +1,22 @@ +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 [ 'reserved 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 + #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 ] times +'Complete. s:put nl +~~~