| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ! Copyright (C) 2007 Slava Pestov. | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							|  |  |  | IN: system | 
					
						
							| 
									
										
										
										
											2007-11-12 23:18:29 -05:00
										 |  |  | 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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-02 18:07:38 -04:00
										 |  |  | UNION: x86 x86.32 x86.64 ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-02 06:15:05 -04:00
										 |  |  | : 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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-02 06:15:05 -04:00
										 |  |  | : os ( -- class ) \ os get-global ; foldable
 | 
					
						
							| 
									
										
										
										
											2008-04-02 17:32:58 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-02 18:07:38 -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 18:07:38 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  | [ | 
					
						
							| 
									
										
										
										
											2008-04-02 18:07:38 -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 ;
 | 
					
						
							| 
									
										
										
										
											2008-11-19 02:50:05 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | : millis ( -- ms ) micros 1000 /i ;
 |