begin using new DEVICE: namespace for device id constants
FossilOrigin-Name: 899ef8eab4ff7e1ca87a340a3409cbdc09505f063aa863c19e350e3b01ac40cd
This commit is contained in:
parent
477d249b51
commit
fffe7170a2
10 changed files with 821 additions and 767 deletions
|
@ -60,6 +60,7 @@ ENABLED += -DENABLE_MALLOC
|
|||
ENABLED += -DENABLE_BLOCKS
|
||||
|
||||
DEVICES ?=
|
||||
DEVICES += interface/devices.retro
|
||||
DEVICES += interface/ll.retro
|
||||
DEVICES += interface/dedup.retro
|
||||
DEVICES += interface/sources.retro
|
||||
|
|
|
@ -13,7 +13,7 @@ The exposed word set is compact:
|
|||
|
||||
~~~
|
||||
{{
|
||||
:block:invoke #3 io:scan-for io:invoke ;
|
||||
:block:invoke DEVICE:BLOCKS io:scan-for io:invoke ;
|
||||
---reveal---
|
||||
:block:read (na-) #0 block:invoke ;
|
||||
:block:write (na-) #1 block:invoke ;
|
||||
|
|
|
@ -5,8 +5,8 @@ system clock.
|
|||
|
||||
~~~
|
||||
:clock:operation
|
||||
#5 io:scan-for
|
||||
dup n:negative? [ drop 'Error:_device_(0005)_not_found s:put nl ] if;
|
||||
DEVICE:CLOCK io:scan-for
|
||||
dup n:negative? [ drop 'Error:_clock_device_not_found s:put nl ] if;
|
||||
io:invoke ;
|
||||
|
||||
:clock:timestamp (-n) #0 clock:operation ;
|
||||
|
|
23
interface/devices.retro
Normal file
23
interface/devices.retro
Normal file
|
@ -0,0 +1,23 @@
|
|||
~~~
|
||||
#0 'DEVICE:OUTPUT const
|
||||
#1 'DEVICE:KEYBOARD const
|
||||
#2 'DEVICE:FLOATS const
|
||||
#4 'DEVICE:FILES const
|
||||
#3 'DEVICE:BLOCKS const
|
||||
#5 'DEVICE:CLOCK const
|
||||
#6 'DEVICE:RESERVED6 const
|
||||
#7 'DEVICE:SOCKET const
|
||||
#8 'DEVICE:UNIX const
|
||||
#9 'DEVICE:SCRIPTING const
|
||||
#10 'DEVICE:RNG const
|
||||
#11 'DEVICE:RESERVED11 const
|
||||
#12 'DEVICE:RESERVED12 const
|
||||
#13 'DEVICE:RESERVED13 const
|
||||
#14 'DEVICE:RESERVED14 const
|
||||
#15 'DEVICE:MALLOC const
|
||||
#1000 'DEVICE:IMAGE const
|
||||
#1234 'DEVICE:ERROR const
|
||||
#8000 'DEVICE:MULTICORE const
|
||||
#8100 'DEVICE:FFI const
|
||||
#8101 'DEVICE:UNSIGNED const
|
||||
~~~
|
|
@ -9,8 +9,8 @@ expectations.
|
|||
|
||||
~~~
|
||||
:file:operation
|
||||
#4 io:scan-for
|
||||
dup n:negative? [ drop 'Error:_device_(0004)_not_found s:put nl ] if;
|
||||
DEVICE:FILES io:scan-for
|
||||
dup n:negative? [ drop 'Error:_files_device_not_found s:put nl ] if;
|
||||
io:invoke ;
|
||||
~~~
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ point format.
|
|||
|
||||
~~~
|
||||
:float:operation
|
||||
#2 io:scan-for
|
||||
dup n:negative? [ drop 'Error:_device_(0002)_not_found s:put nl ] if;
|
||||
DEVICE:FLOATS io:scan-for
|
||||
dup n:negative? [ drop 'Error:_floating_point_device_not_found s:put nl ] if;
|
||||
io:invoke ;
|
||||
~~~
|
||||
|
||||
|
|
|
@ -58,7 +58,6 @@ startup flags passed.
|
|||
{{
|
||||
'EOT var
|
||||
FALSE 'Ignoring var-n
|
||||
(-f) :ignoring? @Ignoring ;
|
||||
(-nn) :version @Version #100 /mod ;
|
||||
(c-f) :done? dup !EOT
|
||||
[ ASCII:CR eq? ]
|
||||
|
@ -75,7 +74,7 @@ startup flags passed.
|
|||
(q-) :buffer [ TIB buffer:set call buffer:start ] buffer:preserve ;
|
||||
(-s) :read-token [ [ character check done? ] until ] buffer s:chop ;
|
||||
(-sf) :input read-token valid? ;
|
||||
(sf-) :process ignoring? [ drop-pair eol? [ &Ignoring v:off ] if ] if;
|
||||
(sf-) :process @Ignoring [ drop-pair eol? [ &Ignoring v:off ] if ] if;
|
||||
&interpret &drop choose ;
|
||||
---reveal---
|
||||
:// script:ignore-to-eol &Ignoring v:on ; immediate
|
||||
|
|
|
@ -7,8 +7,8 @@ that it is fairly low level.
|
|||
|
||||
~~~
|
||||
:socket:operation
|
||||
#7 io:scan-for dup n:negative?
|
||||
[ drop 'Error:_device_(0007)_not_found s:put nl
|
||||
DEVICE:SOCKET io:scan-for dup n:negative?
|
||||
[ drop 'Error:_socket_device_not_found s:put nl
|
||||
'See_https://retroforth.org/support/2022.1/SOCKETS.md
|
||||
s:put nl
|
||||
'for_instructions_on_enabling_sockets. s:put nl ] if;
|
||||
|
|
11
tools/generate-devices.retro
Normal file
11
tools/generate-devices.retro
Normal file
|
@ -0,0 +1,11 @@
|
|||
~~~
|
||||
'~~~ s:put nl
|
||||
:process (s-)
|
||||
dup s:length n:zero? [ drop ] if;
|
||||
#32 s:tokenize dup #1 a:fetch [ dup $_ eq? [ drop $: ] if ] s:map
|
||||
swap a:last s:to-number
|
||||
'#%n_'%s_const\n s:format s:put ;
|
||||
|
||||
'vm/nga-c/devices.h [ process ] file:for-each-line
|
||||
'~~~ s:put nl
|
||||
~~~
|
1532
vm/nga-c/image.c
1532
vm/nga-c/image.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue