retroforth/example/amalgamate.forth
crc 2c21a9b976 rx.muri: update word list for missing values
FossilOrigin-Name: d23dfc90931904a25b5c6be4a8e8d8c43aa7043d8cde2a9b38d3e71973f2aa76
2019-06-05 14:18:17 +00:00

33 lines
691 B
Forth

# Amalgamate
The standard RETRO system is built using the Nga VM[1] and a
copy of the image exported as a C source file[2]. I sometimes
prefer to have these as a single file for easier sharing. This
is a quick little tool to combine them.
Output will be written to stdout.
## References
[1] source/interfaces/retro-unix.c
[2] source/interfaces/retro-image.c
## Code
~~~
{{
:image:inline
'source/interfaces/retro-image.c [ s:put nl ] file:for-each-line ;
:source:line
dup '#include_"retro-image.c" s:eq?
[ drop image:inline ] [ s:put nl ] choose ;
---reveal---
:amalgamate
'source/interfaces/retro-unix.c [ source:line ] file:for-each-line ;
}}
amalgamate
~~~