| Summary: | Add SDL_PlatformName() function to get name of the platform running on | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Edgar Simo <bobbens> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | enhancement | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | All | ||
Good idea, I added this to subversion. Thanks! |
I think it would be good to have a function like SDL_PlatformName() to get the name of the platform SDL is currently running on. There is sample code in test/testplatform.c which does this. This would help developers with making prettier debugging information containing what OS the application is running on. The function is pretty simple and would be added to the SDL_platform.h header. The currently used implementation in testplatform.c is the following: /** * @brief Gets the name of the platform. */ const char *SDL_PlatformName (void) { return #if __AIX__ "AIX" #elif __BEOS__ "BeOS" #elif __BSDI__ "BSDI" #elif __DREAMCAST__ "Dreamcast" #elif __FREEBSD__ "FreeBSD" #elif __HPUX__ "HP-UX" #elif __IRIX__ "Irix" #elif __LINUX__ "Linux" #elif __MINT__ "Atari MiNT" #elif __MACOS__ "MacOS Classic" #elif __MACOSX__ "Mac OS X" #elif __NETBSD__ "NetBSD" #elif __OPENBSD__ "OpenBSD" #elif __OS2__ "OS/2" #elif __OSF__ "OSF/1" #elif __QNXNTO__ "QNX Neutrino" #elif __RISCOS__ "RISC OS" #elif __SOLARIS__ "Solaris" #elif __WIN32__ #ifdef _WIN32_WCE "Windows CE" #else "Windows" #endif #elif __IPHONEOS__ "iPhone OS" #else "an unknown operating system! (see SDL_platform.h)" #endif ; }