\r
// Author: Andy Rushton\r
// Copyright: (c) Southampton University 1999-2004\r
-// (c) Andy Rushton 2004-2009\r
+// (c) Andy Rushton 2004 onwards\r
// License: BSD License, see ../docs/license.html\r
\r
+// report the platform-specific details of this build\r
+\r
////////////////////////////////////////////////////////////////////////////////\r
#include "build.hpp"\r
#include "version.hpp"\r
namespace stlplus\r
{\r
\r
- ////////////////////////////////////////////////////////////////////////////////\r
- // report the platform-specific details of this build\r
-\r
- std::string build(void)\r
+ // STLplus version in the form "STLplus v3.0" - see version.hpp for a way of getting just the version number\r
+ std::string stlplus_version(void)\r
{\r
- ////////////////////////////////////////////////////////////////////////////////\r
- // work out the platform\r
+ return std::string("STLplus v") + version();\r
+ }\r
\r
-#ifdef _WIN32\r
- std::string platform("Windows");\r
+ // platform is the target operating system in the form "Windows" or "Generic Unix"\r
+ std::string platform(void)\r
+ {\r
+#if defined _WIN32\r
+ return std::string("Windows");\r
#else\r
// at present there are no variations between different Unix platforms so\r
// they all map onto the generic Unix platform\r
- std::string platform("Generic Unix");\r
+ return std::string("Generic Unix");\r
#endif\r
+ }\r
\r
- ////////////////////////////////////////////////////////////////////////////////\r
- // work out the compiler\r
+ // compiler_name is the short name of the compiler, e.g. "gcc" or "MSVC"\r
+ std::string compiler_name(void)\r
+ {\r
+#if defined __GNUC__\r
+ return std::string("gcc");\r
+#elif defined _MSC_VER\r
+ return std::string("MSVC");\r
+#elif defined __BORLANDC__\r
+ return std::string("Borland");\r
+#else\r
+ return std::string("unknown compiler");\r
+#endif\r
+ }\r
\r
+ // compiler_version is the version string of the compiler e.g. "3.4" for gcc or "15.00" for MSVC\r
+ std::string compiler_version(void)\r
+ {\r
#if defined __GNUC__\r
- std::string compiler(dformat("gcc v%s",__VERSION__));\r
+ return dformat("%d.%d.%d",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);\r
#elif defined _MSC_VER\r
- std::string compiler(dformat("MSVC v%0.2f",((float)_MSC_VER)/100.0));\r
+ return dformat("%0.2f",((float)_MSC_VER)/100.0);\r
#elif defined __BORLANDC__\r
- std::string compiler(dformat("Borland v%d.%d",__BORLANDC__/256,__BORLANDC__/16%16));\r
+ return dformat("%d.%d%d",__BORLANDC__/256,__BORLANDC__/16%16,__BORLANDC__%16);\r
#else\r
- std::string compiler("unknown compiler");\r
+ return std::string();\r
#endif\r
+ }\r
\r
- ////////////////////////////////////////////////////////////////////////////////\r
- // work out the kind of build\r
- // there are two variants - debug and release\r
+ // compiler is the compilation system and version above combined into a human- readable form e.g. "gcc v3.4"\r
+ std::string compiler(void)\r
+ {\r
+ return compiler_name() + std::string(" v") + compiler_version();\r
+ }\r
\r
+ // variant is the kind of build - "debug" or "release"\r
+ std::string variant(void)\r
+ {\r
#ifndef NDEBUG\r
- std::string variant("debug");\r
+ return std::string("debug");\r
#else\r
- std::string variant("release");\r
+ return std::string("release");\r
#endif\r
\r
- return std::string("STLplus v") + version() + ", " + platform + ", " + compiler + ", " + variant;\r
+ }\r
+\r
+ std::string build(void)\r
+ {\r
+ return stlplus_version() + ", " + platform() + ", " + compiler() + ", " + variant();\r
}\r
\r
////////////////////////////////////////////////////////////////////////////////\r