]> gitweb.factorcode.org Git - factor.git/commitdiff
Revert "alien.strings: change how string>{cpu,os} works."
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 2 Nov 2016 14:34:38 +0000 (07:34 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 2 Nov 2016 14:34:38 +0000 (07:34 -0700)
This reverts commit 84fe3deff8e2b454c3dc936515597c1335590ea4.

Probably doesn't work with deployed images that have stripped
word names, where name>> would return f.

core/alien/strings/strings.factor
core/system/system.factor

index d59a56e8f669bdce34d3722a47e27253855babd9..b5d92e02a0e90e7d6605f334df86c4effd183b8b 100644 (file)
@@ -87,19 +87,9 @@ M: byte-array symbol>string utf8 alien>string ;
 
 M: array symbol>string [ utf8 alien>string ] map ", " join ;
 
-<PRIVATE
-
 : special-object>string ( n -- str )
     special-object utf8 alien>string ;
 
-: string>cpu ( str -- cpu )
-    { x86.32 x86.64 arm ppc.32 ppc.64 } [ name>> = ] with find nip ;
-
-: string>os ( str -- os )
-    { windows macosx linux } [ name>> = ] with find nip ;
-
-PRIVATE>
-
 [
     OBJ-CPU special-object>string string>cpu \ cpu set-global
     OBJ-OS special-object>string string>os \ os set-global
index 2803b3f9bda34ed12cc11180f8fbfd6f331b1c99..99628b2b69d14855465f45adcccd318322378757 100644 (file)
@@ -36,6 +36,30 @@ UNION: unix macosx linux ;
 
 : vm-compile-time ( -- string ) \ vm-compile-time get-global ;
 
+<PRIVATE
+
+CONSTANT: string>cpu-hash H{
+    { "x86.32" x86.32 }
+    { "x86.64" x86.64 }
+    { "arm" arm }
+    { "ppc.32" ppc.32 }
+    { "ppc.64" ppc.64 }
+}
+
+CONSTANT: string>os-hash H{
+    { "windows" windows }
+    { "macosx" macosx }
+    { "linux" linux }
+}
+
+: string>cpu ( str -- class )
+    string>cpu-hash at ;
+
+: string>os ( str -- class )
+    string>os-hash at ;
+
+PRIVATE>
+
 : image-path ( -- path ) \ image-path get-global ;
 
 : vm-path ( -- path ) \ vm-path get-global ;