From 9f90cf6263690e63f4966bd6c7b98287f998c455 Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@factorcode.org>
Date: Wed, 30 Jan 2008 02:46:39 -0600
Subject: [PATCH] Fix circularity in hardware-info

---
 extra/hardware-info/windows/ce/ce.factor   |  8 +++++---
 extra/hardware-info/windows/nt/nt.factor   | 14 +++++++++++---
 extra/hardware-info/windows/windows.factor | 16 ++++------------
 3 files changed, 20 insertions(+), 18 deletions(-)
 mode change 100644 => 100755 extra/hardware-info/windows/ce/ce.factor
 mode change 100644 => 100755 extra/hardware-info/windows/nt/nt.factor

diff --git a/extra/hardware-info/windows/ce/ce.factor b/extra/hardware-info/windows/ce/ce.factor
old mode 100644
new mode 100755
index 9fb15ef823..1592bad14c
--- a/extra/hardware-info/windows/ce/ce.factor
+++ b/extra/hardware-info/windows/ce/ce.factor
@@ -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 ;
 
diff --git a/extra/hardware-info/windows/nt/nt.factor b/extra/hardware-info/windows/nt/nt.factor
old mode 100644
new mode 100755
index f412754cdf..2003e689a7
--- a/extra/hardware-info/windows/nt/nt.factor
+++ b/extra/hardware-info/windows/nt/nt.factor
@@ -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
diff --git a/extra/hardware-info/windows/windows.factor b/extra/hardware-info/windows/windows.factor
index a49e4f254a..7876a890b6 100755
--- a/extra/hardware-info/windows/windows.factor
+++ b/extra/hardware-info/windows/windows.factor
@@ -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*