factor/core/system/system.factor

68 lines
1.3 KiB
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
! Copyright (C) 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
IN: system
USING: kernel kernel.private sequences math namespaces
2008-04-02 17:32:58 -04:00
init splitting assocs system.private layouts words ;
2007-09-20 18:09:08 -04:00
2008-04-02 17:32:58 -04:00
SINGLETON: x86.32
SINGLETON: x86.64
SINGLETON: arm
SINGLETON: ppc
UNION: x86 x86.32 x86.64 ;
: cpu ( -- class ) \ cpu get-global ; foldable
2008-04-02 17:32:58 -04:00
2008-04-02 19:25:33 -04:00
SINGLETON: winnt
SINGLETON: wince
UNION: windows winnt wince ;
SINGLETON: freebsd
SINGLETON: netbsd
SINGLETON: openbsd
SINGLETON: solaris
SINGLETON: macosx
SINGLETON: linux
UNION: bsd freebsd netbsd openbsd macosx ;
2008-04-02 17:32:58 -04:00
2008-04-02 19:25:33 -04:00
UNION: unix bsd solaris linux ;
2008-04-02 17:32:58 -04:00
: os ( -- class ) \ os get-global ; foldable
2008-04-02 17:32:58 -04:00
<PRIVATE
: string>cpu ( str -- class )
H{
{ "x86.32" x86.32 }
{ "x86.64" x86.64 }
{ "arm" arm }
{ "ppc" ppc }
} at ;
2008-04-02 19:25:33 -04:00
: string>os ( str -- class )
H{
{ "winnt" winnt }
{ "wince" wince }
{ "freebsd" freebsd }
{ "netbsd" netbsd }
{ "openbsd" openbsd }
{ "solaris" solaris }
{ "macosx" macosx }
{ "linux" linux }
} at ;
2008-04-02 19:25:33 -04:00
PRIVATE>
2008-04-02 17:32:58 -04:00
2008-09-18 23:08:12 -04:00
: image ( -- path ) \ image get-global ;
: vm ( -- path ) \ vm get-global ;
2008-04-02 17:32:58 -04:00
[
8 getenv string>cpu \ cpu set-global
2008-04-02 19:25:33 -04:00
9 getenv string>os \ os set-global
2008-04-02 17:32:58 -04:00
] "system" add-init-hook
2007-09-20 18:09:08 -04:00
: embedded? ( -- ? ) 15 getenv ;