mirror of
https://git.sr.ht/~crc_/retroforth
synced 2024-11-16 19:48:56 +01:00
c7d08e2e8a
FossilOrigin-Name: 7070b825aa90ec9ebb59af0d52a58dbf43892597b6f0afa2dab02971a5165fed
33 lines
655 B
Text
33 lines
655 B
Text
# 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] vm/nga-c/retro-unix.c
|
|
[2] vm/nga-c/retro-image.c
|
|
|
|
## Code
|
|
|
|
~~~
|
|
{{
|
|
:image:inline
|
|
'vm/nga-c/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
|
|
'vm/nga-c/retro-unix.c [ source:line ] file:for-each-line ;
|
|
}}
|
|
|
|
amalgamate
|
|
~~~
|