 :  0,  0 >bignum '  0-offset fixup ;
 :  1,  1 >bignum '  1-offset fixup ;
 : -1, -1 >bignum ' -1-offset fixup ;
-
-! Beginning of the image
-: begin-image ( -- )
-    emit-header t, 0, 1, -1, ;
 
 ! Words
 

    fixup-header
    "Image length: " write image get length .
    "Object cache size: " write objects get assoc-size .
    \ word global delete-at ;

! Image output


        [ >le write ] curry each
    ] if ;

: write-image ( image -- )
    "Writing image to " write
    architecture get boot-image-name resource-path
    dup write "..." print flush
    <file-writer> [ (write-image) ] with-stream ;

PRIVATE>

: make-image ( arch -- )
    [
        architecture set
        bootstrapping? on
        load-help? off
        "resource:/core/bootstrap/stage1.factor" run-file
        build-image
        write-image
    ] with-scope ;

: make-images ( -- )
    images [ make-image ] each ;
