]> gitweb.factorcode.org Git - factor.git/blob - core/system/system.factor
7f0872b4642826bc518554d80043a67e2d3dc442
[factor.git] / core / system / system.factor
1 ! Copyright (C) 2007, 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel kernel.private sequences math namespaces
4 init splitting assocs system.private layouts words ;
5 IN: system
6
7 SINGLETONS: x86.32 x86.64 arm ppc.32 ppc.64 ;
8
9 UNION: x86 x86.32 x86.64 ;
10 UNION: ppc ppc.32 ppc.64 ;
11
12 : cpu ( -- class ) \ cpu get-global ; foldable
13
14 SINGLETONS: winnt wince ;
15
16 UNION: windows winnt wince ;
17
18 SINGLETONS: freebsd netbsd openbsd solaris macosx linux ;
19
20 SINGLETON: haiku
21
22 UNION: bsd freebsd netbsd openbsd macosx ;
23
24 UNION: unix bsd solaris linux haiku ;
25
26 : os ( -- class ) \ os get-global ; foldable
27
28 : vm-compiler ( -- string ) \ vm-compiler get-global ; foldable
29
30 <PRIVATE
31
32 : string>cpu ( str -- class )
33     H{
34         { "x86.32" x86.32 }
35         { "x86.64" x86.64 }
36         { "arm" arm }
37         { "ppc.32" ppc.32 }
38         { "ppc.64" ppc.64 }
39     } at ;
40
41 : string>os ( str -- class )
42     H{
43         { "winnt" winnt }
44         { "wince" wince }
45         { "freebsd" freebsd }
46         { "netbsd" netbsd }
47         { "openbsd" openbsd }
48         { "solaris" solaris }
49         { "macosx" macosx }
50         { "linux" linux }
51         { "haiku" haiku }
52     } at ;
53
54 PRIVATE>
55
56 : image ( -- path ) \ image get-global ;
57
58 : vm ( -- path ) \ vm get-global ;
59
60 : embedded? ( -- ? ) 15 special-object ;
61
62 : exit ( n -- * ) do-shutdown-hooks (exit) ;