]> gitweb.factorcode.org Git - factor.git/blob - core/system/system.factor
Remove cruddy string encoding/decoding code from VM
[factor.git] / core / system / system.factor
1 ! Copyright (C) 2007, 2009 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 ;
8
9 UNION: x86 x86.32 x86.64 ;
10
11 : cpu ( -- class ) \ cpu get-global ; foldable
12
13 SINGLETONS: winnt wince ;
14
15 UNION: windows winnt wince ;
16
17 SINGLETONS: freebsd netbsd openbsd solaris macosx linux ;
18
19 SINGLETON: haiku
20
21 UNION: bsd freebsd netbsd openbsd macosx ;
22
23 UNION: unix bsd solaris linux haiku ;
24
25 : os ( -- class ) \ os get-global ; foldable
26
27 <PRIVATE
28
29 : string>cpu ( str -- class )
30     H{
31         { "x86.32" x86.32 }
32         { "x86.64" x86.64 }
33         { "arm" arm }
34         { "ppc" ppc }
35     } at ;
36
37 : string>os ( str -- class )
38     H{
39         { "winnt" winnt }
40         { "wince" wince }
41         { "freebsd" freebsd }
42         { "netbsd" netbsd }
43         { "openbsd" openbsd }
44         { "solaris" solaris }
45         { "macosx" macosx }
46         { "linux" linux }
47         { "haiku" haiku }
48     } at ;
49
50 PRIVATE>
51
52 : image ( -- path ) \ image get-global ;
53
54 : vm ( -- path ) \ vm get-global ;
55
56 : embedded? ( -- ? ) 15 getenv ;
57
58 : millis ( -- ms ) micros 1000 /i ;