1 ! copyright (c) 2007, 2010 slava pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs continuations init io kernel kernel.private make
4 math.parser namespaces sequences ;
7 SINGLETONS: x86.32 x86.64 arm ppc.32 ppc.64 ;
9 UNION: x86 x86.32 x86.64 ;
10 UNION: ppc ppc.32 ppc.64 ;
12 : cpu ( -- class ) \ cpu get-global ; foldable
14 SINGLETONS: windows macosx linux ;
16 UNION: unix macosx linux ;
18 : os ( -- class ) \ os get-global ; foldable
20 : vm-version ( -- string ) \ vm-version get-global ; foldable
22 : vm-git-label ( -- string ) \ vm-git-label get-global ; foldable
24 : vm-compiler ( -- string ) \ vm-compiler get-global ; foldable
26 : vm-compile-time ( -- string ) \ vm-compile-time get-global ; foldable
30 CONSTANT: string>cpu-hash H{
38 CONSTANT: string>os-hash H{
44 : key-for-value ( key hash -- val )
45 >alist [ second = ] with find nip first ;
47 : string>cpu ( str -- class )
50 : cpu>string ( class -- str )
51 string>cpu-hash key-for-value ;
53 : string>os ( str -- class )
56 : os>string ( class -- str )
57 string>os-hash key-for-value ;
61 : image ( -- path ) \ image get-global ;
63 : vm ( -- path ) \ vm get-global ;
65 : embedded? ( -- ? ) OBJ-EMBEDDED special-object ;
67 : version-info ( -- str )
68 ! formatting vocab not available in this context.
70 "Factor " % vm-version %
71 " " % cpu cpu>string %
72 " (" % build # ", " % vm-git-label % ", " %
73 vm-compile-time % ")\n[" %
74 vm-compiler % "] on " % os os>string %
78 [ do-shutdown-hooks (exit) ] ignore-errors
79 [ "Unexpected error during shutdown!" print ] ignore-errors