Fix circularity in hardware-info

db4
Slava Pestov 2008-01-30 02:46:39 -06:00
parent 837b89422b
commit 9f90cf6263
3 changed files with 20 additions and 18 deletions
extra/hardware-info/windows

8
extra/hardware-info/windows/ce/ce.factor Normal file → Executable file
View File

@ -1,8 +1,8 @@
USING: alien.c-types hardware-info hardware-info.windows
kernel math namespaces windows windows.kernel32
hardware-info.backend ;
USING: alien.c-types hardware-info kernel math namespaces
windows windows.kernel32 hardware-info.backend ;
IN: hardware-info.windows.ce
TUPLE: wince ;
T{ wince } os set-global
: memory-status ( -- MEMORYSTATUS )
@ -10,6 +10,8 @@ T{ wince } os set-global
"MEMORYSTATUS" heap-size over set-MEMORYSTATUS-dwLength
[ GlobalMemoryStatus ] keep ;
M: wince cpus ( -- n ) 1 ;
M: wince memory-load ( -- n )
memory-status MEMORYSTATUS-dwMemoryLoad ;

14
extra/hardware-info/windows/nt/nt.factor Normal file → Executable file
View File

@ -1,10 +1,18 @@
USING: alien alien.c-types hardware-info hardware-info.windows
kernel libc math namespaces hardware-info.backend
windows windows.advapi32 windows.kernel32 ;
USING: alien alien.c-types kernel libc math namespaces
hardware-info.backend windows windows.advapi32 windows.kernel32
;
IN: hardware-info.windows.nt
TUPLE: winnt ;
T{ winnt } os set-global
: system-info ( -- SYSTEM_INFO )
"SYSTEM_INFO" <c-object> [ GetSystemInfo ] keep ;
M: winnt cpus ( -- n )
system-info SYSTEM_INFO-dwNumberOfProcessors ;
: memory-status ( -- MEMORYSTATUSEX )
"MEMORYSTATUSEX" <c-object>
"MEMORYSTATUSEX" heap-size over set-MEMORYSTATUSEX-dwLength

View File

@ -1,22 +1,15 @@
USING: alien alien.c-types kernel libc math namespaces
windows windows.kernel32 windows.advapi32
words combinators vocabs.loader hardware-info.backend ;
words combinators vocabs.loader hardware-info.backend
system ;
IN: hardware-info.windows
TUPLE: wince ;
TUPLE: winnt ;
UNION: windows wince winnt ;
USE: system
: system-info ( -- SYSTEM_INFO )
"SYSTEM_INFO" <c-object> [ GetSystemInfo ] keep ;
: page-size ( -- n )
system-info SYSTEM_INFO-dwPageSize ;
M: windows cpus ( -- n )
system-info SYSTEM_INFO-dwNumberOfProcessors ;
! 386, 486, 586, 2200 (IA64), 8664 (AMD_X8664)
: processor-type ( -- n )
system-info SYSTEM_INFO-dwProcessorType ;
@ -70,8 +63,7 @@ M: windows cpus ( -- n )
: system-windows-directory ( -- str )
\ GetSystemWindowsDirectory get-directory ;
<< {
{
{ [ wince? ] [ "hardware-info.windows.ce" ] }
{ [ winnt? ] [ "hardware-info.windows.nt" ] }
{ [ t ] [ f ] }
} cond [ require ] when* >>
} cond [ require ] when*