bootstrap cleanup

cvs
Slava Pestov 2005-08-22 05:33:43 +00:00
parent beca0f9615
commit ad712e431d
4 changed files with 156 additions and 190 deletions

View File

@ -1,7 +1,8 @@
! Copyright (C) 2004, 2005 Slava Pestov. ! Copyright (C) 2004, 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license. ! See http://factor.sf.net/license.txt for BSD license.
USING: alien assembler command-line compiler errors generic USING: alien assembler command-line compiler compiler-backend
hashtables io kernel lists memory namespaces parser sequences words ; errors generic hashtables io io-internals kernel lists math
memory namespaces parser sequences words ;
: pull-in ( ? list -- ) : pull-in ( ? list -- )
swap [ swap [
@ -32,4 +33,148 @@ cpu "ppc" = [
"/library/compiler/ppc/alien.factor" "/library/compiler/ppc/alien.factor"
] pull-in ] pull-in
"/library/bootstrap/boot-stage3.factor" run-resource "Compiling base..." print
"statically-linked" get [
unix? [
"sdl" "libSDL.so" "cdecl" add-library
"sdl-gfx" "libSDL_gfx.so" "cdecl" add-library
"sdl-ttf" "libSDL_ttf.so" "cdecl" add-library
] when
win32? [
"kernel32" "kernel32.dll" "stdcall" add-library
"user32" "user32.dll" "stdcall" add-library
"gdi32" "gdi32.dll" "stdcall" add-library
"winsock" "ws2_32.dll" "stdcall" add-library
"mswsock" "mswsock.dll" "stdcall" add-library
"libc" "msvcrt.dll" "cdecl" add-library
"sdl" "SDL.dll" "cdecl" add-library
"sdl-gfx" "SDL_gfx.dll" "cdecl" add-library
"sdl-ttf" "SDL_ttf.dll" "cdecl" add-library
] when
] unless
: compile? "compile" get supported-cpu? and ;
compile? [
\ car compile
\ * compile
\ = compile
\ string>number compile
\ number>string compile
\ scan compile
\ (generate) compile
] when
"Loading more library code..." print
t [
"/library/alien/malloc.factor"
"/library/io/buffer.factor"
"/library/math/constants.factor"
"/library/math/pow.factor"
"/library/math/trig-hyp.factor"
"/library/math/arc-trig-hyp.factor"
"/library/math/random.factor"
"/library/in-thread.factor"
"/library/io/directories.factor"
"/library/io/binary.factor"
"/library/eval-catch.factor"
"/library/tools/listener.factor"
"/library/tools/word-tools.factor"
"/library/syntax/see.factor"
"/library/test/test.factor"
"/library/tools/walker.factor"
"/library/tools/annotations.factor"
"/library/tools/inspector.factor"
"/library/bootstrap/image.factor"
"/library/io/logging.factor"
"/library/tools/telnetd.factor"
"/library/tools/jedit.factor"
"/library/httpd/load.factor"
"/library/sdl/load.factor"
"/library/ui/load.factor"
"/library/help/tutorial.factor"
] pull-in
compile? [
unix? [
"/library/unix/types.factor"
] pull-in
os "freebsd" = [
"/library/unix/syscalls-freebsd.factor"
] pull-in
os "linux" = [
"/library/unix/syscalls-linux.factor"
] pull-in
os "macosx" = [
"/library/unix/syscalls-macosx.factor"
] pull-in
unix? [
"/library/unix/syscalls.factor"
"/library/unix/io.factor"
"/library/unix/sockets.factor"
"/library/unix/files.factor"
] pull-in
os "win32" = [
"/library/win32/win32-io.factor"
"/library/win32/win32-errors.factor"
"/library/win32/winsock.factor"
"/library/win32/win32-io-internals.factor"
"/library/win32/win32-stream.factor"
"/library/win32/win32-server.factor"
"/library/bootstrap/win32-io.factor"
] pull-in
] when
"Building cross-reference database..." print
recrossref
compile? [
"Compiling system..." print
compile-all
terpri
"Unless you're working on the compiler, ignore the errors above." print
"Not every word compiles, by design." print
terpri
"Initializing native I/O..." print
init-io
] when
[
boot
run-user-init
"shell" get [ "shells" ] search execute
0 exit
] set-boot
0 [ compiled? [ 1 + ] when ] each-word
number>string write " words compiled" print
0 [ drop 1 + ] each-word
number>string write " words total" print
"Total bootstrap GC time: " write gc-time
number>string write " ms" print
"Bootstrapping is complete." print
"Now, you can run ./f factor.image" print
"factor.image" save-image
0 exit
FORGET: pull-in
FORGET: compile?

View File

@ -1,131 +0,0 @@
! Copyright (C) 2004, 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
USING: alien assembler command-line compiler compiler-backend
compiler-frontend inference io-internals kernel lists math
namespaces parser sequences io words ;
"Compiling base..." print
"statically-linked" get [
unix? [
"sdl" "libSDL.so" "cdecl" add-library
"sdl-gfx" "libSDL_gfx.so" "cdecl" add-library
"sdl-ttf" "libSDL_ttf.so" "cdecl" add-library
] when
win32? [
"kernel32" "kernel32.dll" "stdcall" add-library
"user32" "user32.dll" "stdcall" add-library
"gdi32" "gdi32.dll" "stdcall" add-library
"winsock" "ws2_32.dll" "stdcall" add-library
"mswsock" "mswsock.dll" "stdcall" add-library
"libc" "msvcrt.dll" "cdecl" add-library
"sdl" "SDL.dll" "cdecl" add-library
"sdl-gfx" "SDL_gfx.dll" "cdecl" add-library
"sdl-ttf" "SDL_ttf.dll" "cdecl" add-library
] when
] unless
default-cli-args
parse-command-line
init-assembler
: compile? "compile" get supported-cpu? and ;
compile? [
\ car compile
\ * compile
\ = compile
\ string>number compile
\ number>string compile
\ scan compile
\ (generate) compile
] when
"Loading more library code..." print
t [
"/library/alien/malloc.factor"
"/library/io/buffer.factor"
"/library/math/constants.factor"
"/library/math/pow.factor"
"/library/math/trig-hyp.factor"
"/library/math/arc-trig-hyp.factor"
"/library/math/random.factor"
"/library/in-thread.factor"
"/library/io/directories.factor"
"/library/io/binary.factor"
"/library/eval-catch.factor"
"/library/tools/listener.factor"
"/library/tools/word-tools.factor"
"/library/syntax/see.factor"
"/library/test/test.factor"
"/library/tools/walker.factor"
"/library/tools/annotations.factor"
"/library/tools/inspector.factor"
"/library/bootstrap/image.factor"
"/library/io/logging.factor"
"/library/tools/telnetd.factor"
"/library/tools/jedit.factor"
"/library/httpd/load.factor"
"/library/sdl/load.factor"
"/library/ui/load.factor"
"/library/help/tutorial.factor"
] pull-in
compile? [
unix? [
"/library/unix/types.factor"
] pull-in
os "freebsd" = [
"/library/unix/syscalls-freebsd.factor"
] pull-in
os "linux" = [
"/library/unix/syscalls-linux.factor"
] pull-in
os "macosx" = [
"/library/unix/syscalls-macosx.factor"
] pull-in
unix? [
"/library/unix/syscalls.factor"
"/library/unix/io.factor"
"/library/unix/sockets.factor"
"/library/unix/files.factor"
] pull-in
os "win32" = [
"/library/win32/win32-io.factor"
"/library/win32/win32-errors.factor"
"/library/win32/winsock.factor"
"/library/win32/win32-io-internals.factor"
"/library/win32/win32-stream.factor"
"/library/win32/win32-server.factor"
"/library/bootstrap/win32-io.factor"
] pull-in
] when
"Building cross-reference database..." print
recrossref
compile? [
"Compiling system..." print
compile-all
"Initializing native I/O..." print
init-io
] when
FORGET: pull-in
FORGET: compile?
"/library/bootstrap/boot-stage4.factor" dup print run-resource

View File

@ -1,54 +0,0 @@
! Copyright (C) 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
IN: kernel
USING: alien assembler command-line compiler console errors
generic inference kernel-internals listener lists math memory
namespaces parser presentation prettyprint random io words ;
"Bootstrap stage 4..." print
: warm-boot ( -- )
#! A fully bootstrapped image has this as the boot
#! quotation.
init-assembler
init-error-handler
default-cli-args
parse-command-line
"null-stdio" get [ << null-stream f >> stdio set ] when ;
: shell ( str -- )
#! This handles the -shell:<foo> cli argument.
[ "shells" ] search execute ;
[
boot
warm-boot
run-user-init
"shell" get shell
0 exit
] set-boot
warm-boot
terpri
"Unless you're working on the compiler, ignore the errors above." print
"Not every word compiles, by design." print
terpri
0 [ compiled? [ 1 + ] when ] each-word
number>string write " words compiled" print
0 [ drop 1 + ] each-word
number>string write " words total" print
"Total bootstrap GC time: " write gc-time
number>string write " ms" print
"Bootstrapping is complete." print
"Now, you can run ./f factor.image" print
! Save a bit of space
global [ stdio off ] bind
"factor.image" save-image
0 exit

View File

@ -1,7 +1,8 @@
! Copyright (C) 2004, 2005 Slava Pestov. ! Copyright (C) 2004, 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license. ! See http://factor.sf.net/license.txt for BSD license.
IN: kernel IN: kernel
USING: io-internals namespaces parser io threads words ; USING: assembler command-line errors io io-internals namespaces
parser threads words ;
: boot ( -- ) : boot ( -- )
#! Initialize an interpreter with the basic services. #! Initialize an interpreter with the basic services.
@ -9,4 +10,9 @@ USING: io-internals namespaces parser io threads words ;
init-threads init-threads
init-io init-io
"HOME" os-env [ "." ] unless* "~" set "HOME" os-env [ "." ] unless* "~" set
init-search-path ; init-search-path
init-assembler
init-error-handler
default-cli-args
parse-command-line
"null-stdio" get [ << null-stream f >> stdio set ] when ;