cpu is now a singleton

db4
Doug Coleman 2008-04-02 16:32:58 -05:00
parent 7ec68e0aa7
commit d736a8660d
3 changed files with 33 additions and 4 deletions

View File

@ -14,7 +14,7 @@ IN: bootstrap.compiler
"alien.remote-control" require
] unless
"cpu." cpu append require
"cpu." cpu word-name append require
: enable-compiler ( -- )
[ optimized-recompile-hook ] recompile-hook set-global ;

View File

@ -12,7 +12,8 @@ io.encodings.binary ;
IN: bootstrap.image
: my-arch ( -- arch )
cpu dup "ppc" = [ >r os "-" r> 3append ] when ;
cpu word-name
dup "ppc" = [ >r os "-" r> 3append ] when ;
: boot-image-name ( arch -- string )
"boot." swap ".image" 3append ;

View File

@ -2,12 +2,40 @@
! See http://factorcode.org/license.txt for BSD license.
IN: system
USING: kernel kernel.private sequences math namespaces
splitting assocs system.private layouts ;
init splitting assocs system.private layouts words ;
: cpu ( -- cpu ) 8 getenv ; foldable
! : cpu ( -- cpu ) 8 getenv ; foldable
: os ( -- os ) 9 getenv ; foldable
SINGLETON: x86.32
SINGLETON: x86.64
SINGLETON: arm
SINGLETON: ppc
: cpu ( -- class ) \ cpu get ;
! SINGLETON: winnt
! SINGLETON: wince
! MIXIN: windows
! INSTANCE: winnt windows
! INSTANCE: wince windows
! SINGLETON: freebsd
! SINGLETON: netbsd
! SINGLETON: openbsd
! SINGLETON: solaris
! SINGLETON: macosx
! SINGLETON: linux
! : os ( -- class ) \ os get ;
[
8 getenv "system" lookup \ cpu set-global
! 9 getenv "system" lookup \ os set-global
] "system" add-init-hook
: image ( -- path ) 13 getenv ;
: vm ( -- path ) 14 getenv ;