tools.deploy.embed: useful factors
Separate the embedding of an image into a VM executable (embed-image) from the copy-and-embed logic (make-embedded-image).db4
parent
de5cc96286
commit
19e1046479
|
@ -4,14 +4,18 @@ bootstrap.image.private destructors io io.directories
|
||||||
io.encodings.binary io.files locals system ;
|
io.encodings.binary io.files locals system ;
|
||||||
IN: tools.deploy.embed
|
IN: tools.deploy.embed
|
||||||
|
|
||||||
:: embed-image ( from-image to-executable -- )
|
:: embed-image ( image executable -- )
|
||||||
vm to-executable copy-file
|
executable binary <file-appender> [| out |
|
||||||
to-executable binary <file-appender> [| out |
|
|
||||||
out stream-tell :> offset
|
out stream-tell :> offset
|
||||||
from-image binary <file-reader> [| in |
|
image binary <file-reader> [| in |
|
||||||
in out stream-copy*
|
in out stream-copy*
|
||||||
] with-disposal
|
] with-disposal
|
||||||
image-magic uintptr_t <ref> out stream-write
|
image-magic uintptr_t <ref> out stream-write
|
||||||
offset uintptr_t <ref> out stream-write
|
offset uintptr_t <ref> out stream-write
|
||||||
] with-disposal ;
|
] with-disposal ;
|
||||||
|
|
||||||
|
: make-embedded-image* ( from-image from-executable to-executable -- )
|
||||||
|
swap [ copy-file ] keep embed-image ;
|
||||||
|
|
||||||
|
: make-embedded-image ( from-image to-executable -- )
|
||||||
|
vm swap make-embedded-image* ;
|
||||||
|
|
Loading…
Reference in New Issue