How to detect type of OS
[1/11] from: oliva::david::seznam::cz at: 2-Jul-2002 15:50
Hello rebol-list,
does anybody has/know some script for detecting type of operating
system rebol is running in?
I would like to update my %win-maker.r file that makes window
without standard window borders but I've found that it's not working
on some other platforms (for sure at MacOS) so I would like to have
possibility to make it available only on windows (at least until I
will find way how to fix it for all platforms - but it's quite
dificult when one can see the other OS once per month for a few
minutes)
thanks Oldes
[2/11] from: greggirwin:mindspring at: 2-Jul-2002 23:16
Hi Oldes,
<< does anybody has/know some script for detecting type of operating
system rebol is running in? >>
There are win? and unix? system words, but I don't know what context they
live in to make use of them.
--Gregg
[3/11] from: al:bri:xtra at: 3-Jul-2002 19:50
Oldes wrote:
> does anybody has/know some script for detecting type of operating system
rebol is running in?
>> rebol/version
== 2.5.0.3.1
http://www.rebol.com/platforms.html
So, I must be running Windows 95/98/NT (or perhaps XP).
The last two numbers as Operation System Major and Minor Version numbers.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[4/11] from: dockimbel:free at: 3-Jul-2002 10:47
Hi,
switch system/version/4 [
1 [print "I'm on AmigaOS"]
2 [print "I'm on MacOS"]
3 [print "I'm on Windows"]
4 [print "I'm on Linux Libc6"]
...
]
See http://www.rebol.com/platforms.html for a complete list.
HTH,
-DocKimbel.
Gregg Irwin wrote:
[5/11] from: anton:lexicon at: 3-Jul-2002 14:35
Hi Oldes,
system/version can tell you.
It looks like the platform is encoded into the
version tuple at positions four and (usually) five.
MS Windows is 3.1
If you go to
http://www.rebol.com/view-platforms.html
you can see:
Microsoft Windows (All) iX86 1.2.1.3.1 view-pro031.zip
So a test for windows platform could be:
"" = find/last/tail form system/version ".3.1"
or
all [system/version/4 = 3 system/version/5 = 1]
(but you have to be careful that there is a five element
in the tuple in that case.)
Anton
[6/11] from: joel:neely:fedex at: 3-Jul-2002 7:13
Hi, Oldes,
RebOldes wrote:
> Hello rebol-list,
>
> does anybody has/know some script for detecting type of operating
> system rebol is running in?
>
I think the following information will help you. It was snarfed
from the REBOL script embedded in
http://www.rebol.com/releases.html
which is fetched when you use UPGRADE from the console.
platforms: [
[Group System-Name Hardware Status Version File]
["Amiga" "Amiga V2.0-3.1" "68020+" Released 2.5.0.1.1 core011.lha]
["" "Amiga V2.0-3.1" "68000" Released 2.5.0.1.2 core012.lha]
["Apple" "Macintosh" "PPC" Released 2.5.0.2.1 core021.sit.hqx]
["" "Macintosh" "68K" Released 2.5.0.2.2 core022.sit.hqx]
["" "Macintosh, FAT" "PPC, 68K" Released 2.5.0.2.3 core023.sit.hqx]
["" "Macintosh, OSX" "PPC" Released 2.5.0.2.4 core024.tar.gz]
["Be" "BeOS R4" "PPC" Released 2.5.0.5.1 core051.tar.gz]
["" "BeOS R5" "iX86" Released 2.5.0.5.2 core052.tar.gz]
["BSD" "BSDi" "iX86" Released 2.5.0.6.1 core061.tar.gz]
["" "Free BSD" "iX86" Released 2.5.0.7.1 core071.tar.gz]
["" "NetBSD" "iX86" Released 2.5.0.8.1 core081.tar.gz]
["" "NetBSD" "PPC" Released 2.5.0.8.2 core082.tar.gz]
["" "NetBSD" "68K" Released 2.5.0.8.3 core083.tar.gz]
["" "NetBSD" "DEC Alpha" Released 2.5.0.8.4 core084.tar.gz]
["" "NetBSD" "Sparc" Released 2.5.0.8.5 core085.tar.gz]
["" "OpenBSD" "iX86" Released 2.5.0.9.1 core091.tar.gz]
["" "OpenBSD" "PPC" Pending 0.0.0.9.2 core092.tar.gz]
["" "OpenBSD" "68K" Released 2.5.0.9.3 core093.tar.gz]
["" "OpenBSD" "DEC Alpha" Pending 0.0.0.9.4 core094.tar.gz]
["" "OpenBSD" "Sparc" Released 2.5.0.9.5 core095.tar.gz]
["HP" "MPE/iX" "HP 3000" Pending 0.0.0.26 core260.tar.gz]
["" "HP-UX" "HP" Released 2.5.0.12 core120.tar.gz]
["IBM" "AIX" "RS6000" Released 2.5.0.17 core170.tar.gz]
["" "OS/2" "iX86" Pending 0.0.0.16 core160.tar.gz]
["" "OS/400" "AS400" Pending 0.0.0.18 core180.tar.gz]
["Linux" "Linux, Libc5" "iX86" Released 2.5.0.4.1 core041.tar.gz]
["" "Linux, Libc6" "iX86" Released 2.5.0.4.2 core042.tar.gz]
["" "Linux" "DEC Alpha" Released 2.5.0.4.3 core043.tar.gz]
["" "Linux" "PPC" Released 2.5.0.4.4 core044.tar.gz]
["" "Linux" "68K" Released 2.5.0.4.5 core045.tar.gz]
["" "Linux" "Sparc" Released 2.5.0.4.6 core046.tar.gz]
["" "Linux" "UltraSparc" Released 2.5.0.4.7 core047.tar.gz]
["" "Linux Netwinder" "Strong ARM" Released 2.5.0.4.8
core048.tar.gz]
["" "Linux Cobalt Qube" "MIPS" Released 2.5.0.4.9 core049.tar.gz]
["Microsoft" "Windows 95/98/NT" "iX86" Released 2.5.0.3.1
core031.zip]
["" "Windows Alpha NT" "DEC Alpha" Released 2.5.0.3.2 core032.zip]
["" "Windows CE 2.0" "SH3" Released 2.5.0.15.1 core151.zip]
["" "Windows CE 2.0" "MIPS" Released 2.5.0.15.2 core152.zip]
["" "Windows CE 2.0" "PPC" Pending 0.0.0.15.3 core153.zip]
["" "Windows CE 2.0" "Strong ARM, HP820" Released 2.5.0.15.5
core155.zip]
["" "Windows CE 2.0" "SH4" Released 2.5.0.15.6 core156.zip]
["QNX" "RTOS" "iX86" Released 2.5.0.22 core220.tar.gz]
["" "Neutrino" "iX86" Pending 0.0.0.23.1 core231.tar.gz]
["" "Neutrino" "MIPS" Pending 0.0.0.23.2 core232.tar.gz]
["" "RTP" "iX86" Released 2.5.0.28 core280.tar.gz]
["SCO" "SCO Unix" "iX86" Released 2.5.0.19 core190.tar.gz]
["" "SCO Open Server" "iX86" Released 2.5.0.24 core240.tar.gz]
["SGI" "IRIX" "SGI" Released 2.5.0.11 core110.tar.gz]
["Sun" "Solaris" "Sparc" Released 2.5.0.10.1 core101.tar.gz]
["" "Solaris" "iX86" Released 2.5.0.10.2 core102.tar.gz]
["Tao" "Elate/Intent" "VP" Released 2.5.0.27.1 core271.tar.gz]
]
view-pro-platforms: [
[Group System-Name Hardware Status Version File]
["Amiga" "Amiga V2.x/3.x" "68020+" Released 1.2.0.1.1
view-pro011.lha
]
["Apple" "Macintosh" "PPC" Pending 1.2.0.2.1 "view-pro021.tar.gz"]
["" "OSX" "PPC" Pending 1.2.0.2.4 "view-pro024.tar.gz"]
["Be" "BeOS R5" "PPC" Released 1.2.0.5.1 "view-pro051.tar.gz"]
["" "BeOS R5" "iX86" Released 1.2.0.5.2 "view-pro052.tar.gz"]
["BSD" "BSDi" "iX86" Released 1.2.0.6.1 "view-pro061.tar.gz"]
["" "Free BSD" "iX86" Released 1.2.0.7.1 "view-pro071.tar.gz"]
["" "NetBSD" "iX86" Released 1.2.0.8.1 "view-pro081.tar.gz"]
["" "NetBSD" "PPC" Released 1.2.0.8.2 "view-pro082.tar.gz"]
["" "NetBSD" "68K" Released 1.2.0.8.3 "view-pro083.tar.gz"]
["" "NetBSD" "DEC Alpha" Released 1.2.0.8.4 "view-pro084.tar.gz"]
["" "NetBSD" "Sparc" Released 1.2.0.8.5 "view-pro085.tar.gz"]
["" "OpenBSD" "iX86" Released 1.2.0.9.1 "view-pro091.tar.gz"]
["" "OpenBSD" "68K" Released 1.2.0.9.3 "view-pro093.tar.gz"]
["" "OpenBSD" "Sparc" Released 1.2.0.9.5 "view-pro095.tar.gz"]
["HP" "HP-UX" "HP" Releases 1.2.0.12 "view-pro120.tar.gz"]
["IBM" "AIX" "RS6000" Released 1.2.0.17 "view-pro170.tar.gz"]
["Linux" "Linux, Libc5" "iX86" Released 1.2.0.4.1
view-pro041.tar.gz
]
["" "Linux, Libc6" "iX86" Released 1.2.0.4.2 "view-pro042.tar.gz"]
["" "Linux" "DEC Alpha" Released 1.2.0.4.3 "view-pro043.tar.gz"]
["" "Linux" "PPC" Released 1.2.0.4.4 "view-pro044.tar.gz"]
["" "Linux" "68K" Released 1.2.0.4.5 "view-pro045.tar.gz"]
["" "Linux" "Sparc" Released 1.2.0.4.6 "view-pro046.tar.gz"]
["" "Linux" "UltraSparc" Released 1.2.0.4.7 "view-pro047.tar.gz"]
["" "Linux Netwinder" "Strong ARM" Released 1.2.0.4.8
view-pro048.tar.gz
]
["Microsoft" "Windows 9x/NT/2000/ME" "iX86" Released 1.2.0.3.1
view-pro031.zip
]
["SCO" "SCO Open Server" "iX86" Released 1.2.0.24
view-pro240.tar.gz
]
["SGI" "IRIX" "SGI" Released 1.2.0.11 "view-pro110.tar.gz"]
["Sun" "Solaris" "Sparc" Released 1.2.0.10.1 "view-pro101.tar.gz"]
["" "Solaris" "iX86" Released 1.2.0.10.2 "view-pro102.tar.gz"]
]
--
; Joel Neely joeldotneelyatfedexdotcom
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]
[7/11] from: rotenca:telvia:it at: 8-Jul-2002 1:21
Hi Gregg
> There are win? and unix? system words, but I don't know what context they
> live in to make use of them.
ctx-prefs
is-win?: does [system/version/4 = 3]
is-mac?: does [all [system/version/4 = 2 system/version/5 <= 3]]
is-unix?: does [not any [is-win? is-mac?]]
win?: func [val] [if is-win? [val/data]]
unix?: func [val] [if is-unix? [val/data]]
---
Ciao
Romano
[8/11] from: g:santilli:tiscalinet:it at: 8-Jul-2002 2:30
Hi Romano,
On Monday, July 08, 2002, 1:21:49 AM, you wrote:
RPT> is-unix?: does [not any [is-win? is-mac?]]
Oh well, is the Amiga Unix? ;-)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[9/11] from: chalz:earthlink at: 7-Jul-2002 23:45
[10/11] from: greggirwin:mindspring at: 8-Jul-2002 11:38
Thanks Romano!
My object browser's sliders sometimes make it hard to get to every item in
the list (if it's a long list like system/words), so I missed ctx-prefs.
Now, the other question is, does ctx-prefs get turned into an object
automatically, and what causes that? I tried a couple quick tests, but it
stayed a block. It's easy enough to make an object from the spec, but I'm
sure you shouldn't have to.
Thanks again!
--Gregg
[11/11] from: rotenca:telvia:it at: 8-Jul-2002 20:40
Hi Gregg,
> Now, the other question is, does ctx-prefs get turned into an object
> automatically, and what causes that? I tried a couple quick tests, but it
> stayed a block. It's easy enough to make an object from the spec, but I'm
> sure you shouldn't have to.
This is where become an object:
system/words/set-user:
func [/wait][
if block? ctx-prefs [ctx-prefs: context ctx-prefs]
ctx-prefs/view-prefs/wait
]
>From a rapid read of the source of the block, i see only function definitions,
word initializations and many layout creations (!). Perhaps is a better thing
to copy the source of functions. Or finding it at run time with something like
(but it should do more error check):
parse ctx-prefs [thru is-win?: to block! set x skip (is-win?: func [] x)]
---
Ciao
Romano