Message-ID: <20131027055628.GD51845 at amaya.spiritsubstance.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Well, SDL_platform.h covers what I intended to do with #3, but not
really what I intended for an enum. But I did say that I didn’t see
many uses for the enum beyond what I was doing, so I withdraw that
from consideration.
I don’t think that the idea of sortable platform info is all that
outlandish, but I certainly wouldn’t want to get it via return. I’d
look at it more like this:
void SDL_CheckPlatform( const char * const * attributes, int
*check_result, size_t count );
To understand why you might do this, consider: someone has a copy of
your game installed onto a USB drive. The game was compiled for
Windows, and normally they play it there, but today they’re at a
friend’s place and want to show it off. The friend has a Linux box
with Wine, but no Windows. Do you want to just assume that it’s a
Windows box, or do you want to adjust e.g. the search directories in
accordance with the current platform? If the later, then you want to
be able to do the following:
SDL_CheckPlatform
(
{
“Microsoft”,
“Apple”,
“Linux Foundation”,
“BSD”,
"Windows7", /* Because "Windows" should be true for Wine as well. */
"Wine",
"Ubuntu",
"x86-32",
"x64"
},
check_results,
7
);
if( check_results[ 5 ] > 0 && check_results[ 6 ] > 0 )
{
fprintf( logfile, “Running in Wine, on Ubuntu.\n” );
}
I personally don’t see myself using this, but if you can get at the
under-lying platform (e.g. RedHat) from within Wine, then someone will
eventually want to write some dlls to do that, albeit with most of
them targetting Microsoft Windows instead of Wine-hosts.
SDL_GetPlatform doesn’t report an OS version at all. Let’s take the
output of “Windows” again. How useful is that? “Windows”. That
could mean:
- Windows 95 on an old 486
- Windows Mobile 5 (Windows CE!) on an old cell phone
- Windows RT on an ARM-based tablet
- Windows 7 on an x86_64
And, as I mentioned, what about Wine?> Date: Sat, 26 Oct 2013 22:56:28 -0700
From: “T. Joseph Carter”
To: SDL Development List
Subject: Re: [SDL] OS, version, CPU
Date: Sun, 27 Oct 2013 00:43:58 -0700
From: “T. Joseph Carter”
To: SDL Development List
Subject: Re: [SDL] OS, version, CPU
Message-ID: <20131027074358.GE51845 at amaya.spiritsubstance.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Shall I also have ifdefs for Darwin, for Linux, for BSD?? I can’t
imagine the number of times I’ve seen “portable” code assume that
there’s WIN32 or linux and if neither one?
#error “There are only 2 OSes in the universe, foolish human!”
I’d really rather not encourage people to write more of it.
Another convenience: if you’re using directory-access stuff, then you
can look in some particular directory for platform-customization
dynamic libraries, parse platform info out of their filenames, and use
matching comparisons to that to decide which you want to load (if
any), allowing you to add (or improve) support without releasing a
completely new base executable.
Date: Sun, 27 Oct 2013 03:56:15 -0400
From: Andre D
To: SDL Development List
Subject: Re: [SDL] OS, version, CPU
Message-ID:
Content-Type: text/plain; charset=windows-1252
The fact of the matter is, there is no portable way to do so. Thus,
why are you scoffing at ifdeffing various platform implementations.
“There is no portable way to do this” is a valid way to say “it might
be worthwhile for SDL to provide an API”. The question, of course,
being if it SHOULD.
Date: Sun, 27 Oct 2013 01:55:15 -0700
From: “T. Joseph Carter”
To: SDL Development List
Subject: Re: [SDL] OS, version, CPU
Message-ID: <20131027085515.GA62129 at amaya.spiritsubstance.com>
Content-Type: text/plain; charset=utf-8; format=flowed
A lot can be determined by the equivalent of uname -rs on systems
that have it.
Haiku 1 (x86)
That tells me very little. There might be more useful version
information on BeOS/Haiku available to a developer, but uname -rs on
the system just spits out “Haiku 1”. I did just about hit the floor
when I did a gcc --version on it: 2.95.3! O_O
Actually, you’ve got that slightly wrong: Haiku currently supports TWO
gcc versions. One is the primordial one that you noticed, the other is
a modern build. If you’re using a 2.., then you probably neede to
either update Haiku, or modify your build scripts for the modern
branch. Within a few (two? three?) major releases they’re apparently
planning to kill the 2.. compatibility (it only exists because BeOS
used C++ for it’s interfaces, and Haiku has been trying to give plenty
of migration and development time; THIS is why you should never build
OS APIs higher than the C level).
Date: Sun, 27 Oct 2013 11:43:41 +0100
From: Rainer Deyke
To: SDL Development List
Subject: Re: [SDL] OS, version, CPU
Message-ID: <526CEE5D.7000208 at eldwood.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
On 27.10.2013 10:16, Gerry JJ wrote:
You don’t have to infer these things on modern Linux distros. Parse
/etc/os-release =). It’s not on absolutely everything, but it’s pretty
standard.
/etc/os-release tells me I’m running Ubuntu, which is not entirely
accurate. (I’m running Linux Mint, which is Ubuntu-compatible and uses
Ubuntu packages, but which also adds its own packages on top of those
provided by Ubuntu.)
It should, however, be useful for programs wanting to know a
generalized subset of APIs that they can use…
Date: Sun, 27 Oct 2013 13:46:25 +0100
From: Rainer Deyke
To: sdl at libsdl.org
Subject: Re: [SDL] OS, version, CPU
Message-ID: <l4j1uo$mho$1 at ger.gmane.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
On 27.10.2013 12:18, Gerry JJ wrote:
Den 27. okt. 2013 11:43, skrev Rainer Deyke:
/etc/os-release tells me I’m running Ubuntu, which is not entirely
accurate. (I’m running Linux Mint, which is Ubuntu-compatible and uses
Ubuntu packages, but which also adds its own packages on top of those
provided by Ubuntu.)
Oh right, I forgot about that =/. Does Mint have some other file in
there with more correct info? lsb-release or something? I know there’s
some way to detect it (wish they’d fix their os-release though)
$ lsb_release -i
Distributor ID: LinuxMint
And this can be used to finish off the checking.
Date: Sun, 27 Oct 2013 22:53:18 -0400
From: Andre D
To: SDL Development List
Subject: Re: [SDL] OS, version, CPU
Message-ID:
<CAOOZ2gVzqFYfpxLQ9MrZekRgoUWKOet=8jAoGSyGSg6Ny9NZFg at mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”
Is there any other information you might want in a debug dump?
Date: Sun, 27 Oct 2013 22:54:06 -0400
From: Andre D
To: SDL Development List
Subject: Re: [SDL] OS, version, CPU
Message-ID:
<CAOOZ2gVjg-J+tFgKDai_niW3Ggw0jFNKwYh0J6e4HnE8WxKBEg at mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”
Aside from memory and more specific os info I mean. If someone were to
write a debug info module.
Just the ability to detect Wine as Windows (and similar such things),
and IF the host APIs can be accessed by the program, the ability to
detect the actual host, and distinguish between e.g. Wine, and what it
emulates.
It would also be good for any such thing to be in a dynamic library,
so that it can be updated as needed, instead of requiring a recompile
of the base executable.