• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Version.h

Go to the documentation of this file.
00001 // GMTL is (C) Copyright 2001-2010 by Allen Bierbaum
00002 // Distributed under the GNU Lesser General Public License 2.1 with an
00003 // addendum covering inlined code. (See accompanying files LICENSE and
00004 // LICENSE.addendum or http://www.gnu.org/copyleft/lesser.txt)
00005 
00006 #ifndef _GMTL_VERSION_H_
00007 #define _GMTL_VERSION_H_
00008 
00022 // The major/minor/patch version (up to 3 digits each).
00023 #define GMTL_VERSION_MAJOR    0
00024 #define GMTL_VERSION_MINOR    6
00025 #define GMTL_VERSION_PATCH    1
00026 
00027 //--------------------------------------------------------------------------
00028 //--------------------------------------------------------------------------
00029 // To update the version number, do not modify anything below this line!!!!
00030 //--------------------------------------------------------------------------
00031 //--------------------------------------------------------------------------
00032 
00033 
00034 //--------------------------------------------------------------------------
00035 // Define the helper macros
00036 //--------------------------------------------------------------------------
00037 
00038 // These helper macros are used build up the GMTL_VERSION macro
00039 #define GMTL_GLUE(a,b)        a ## b
00040 #define GMTL_XGLUE(a,b)       GMTL_GLUE(a,b)
00041 
00042 // These helper macros are used to stringify a given macro
00043 #define GMTL_STR(s)           # s
00044 #define GMTL_XSTR(s)          GMTL_STR(s)
00045 
00046 // These helper macros are used to build up the GMTL_VERSION_STRING macro.
00047 #define GMTL_DOT(a,b)         a ## . ## b
00048 #define GMTL_XDOT(a,b)        GMTL_DOT(a,b)
00049 
00050 // These helpr macros are used to facilitate a zero left fill
00051 #define GMTL_ZEROFILL(a)      0 ## a
00052 #define GMTL_XZEROFILL(a)     GMTL_ZEROFILL(a)
00053 
00054 // Fix up the major version by doing a zero left fill
00055 #if GMTL_VERSION_MAJOR < 10
00056 #  define GMTL_VERSION_MAJOR_FILLED \
00057                GMTL_XZEROFILL(GMTL_XZEROFILL(GMTL_VERSION_MAJOR))
00058 #elif GMTL_VERSION_MAJOR < 100
00059 #  define GMTL_VERSION_MAJOR_FILLED GMTL_XZEROFILL(GMTL_VERSION_MAJOR)
00060 #else
00061 #  define GMTL_VERSION_MAJOR_FILLED GMTL_VERSION_MAJOR
00062 #endif
00063 
00064 // Fix up the minor version by doing a zero left fill
00065 #if GMTL_VERSION_MINOR < 10
00066 #  define GMTL_VERSION_MINOR_FILLED \
00067                GMTL_XZEROFILL(GMTL_XZEROFILL(GMTL_VERSION_MINOR))
00068 #elif GMTL_VERSION_MINOR < 100
00069 #  define GMTL_VERSION_MINOR_FILLED GMTL_XZEROFILL(GMTL_VERSION_MINOR)
00070 #else
00071 #  define GMTL_VERSION_MINOR_FILLED GMTL_VERSION_MINOR
00072 #endif
00073 
00074 // Fix up the patch version by doing a zero left fill
00075 #if GMTL_VERSION_PATCH < 10
00076 #  define GMTL_VERSION_PATCH_FILLED \
00077                GMTL_XZEROFILL(GMTL_XZEROFILL(GMTL_VERSION_PATCH))
00078 #elif GMTL_VERSION_PATCH < 100
00079 #  define GMTL_VERSION_PATCH_FILLED GMTL_XZEROFILL(GMTL_VERSION_PATCH)
00080 #else
00081 #  define GMTL_VERSION_PATCH_FILLED GMTL_VERSION_PATCH
00082 #endif
00083 
00084 //--------------------------------------------------------------------------
00085 // Define the GMTL_VERSION and GMTL_VERSION_STRING macros
00086 //--------------------------------------------------------------------------
00087 
00088 // Build up the GMTL_VERSION macro by pasting the individual parts together
00093 #define GMTL_VERSION \
00094    GMTL_XGLUE( \
00095       GMTL_XGLUE(GMTL_VERSION_MAJOR_FILLED, GMTL_VERSION_MINOR_FILLED), \
00096       GMTL_VERSION_PATCH_FILLED \
00097    )
00098 
00099 // Create the GMTL_VERSION_STRING macro
00100 #define GMTL_VERSION_STRING \
00101    GMTL_XDOT( \
00102       GMTL_XDOT(GMTL_VERSION_MAJOR, GMTL_VERSION_MINOR), \
00103       GMTL_VERSION_PATCH \
00104    )
00105 
00106 //--------------------------------------------------------------------------
00107 // Declare a version string constant that can be used at runtime.
00108 //--------------------------------------------------------------------------
00109 namespace gmtl
00110 {
00111    inline const char* getVersion()
00112    {
00113       return GMTL_XSTR(GMTL_VERSION_STRING);
00114    }
00115 } // end namespace gmtl
00116 
00117 //--------------------------------------------------------------------------
00118 // Cleanup after ourselves and undef all internal macros.
00119 //--------------------------------------------------------------------------
00120 
00121 // Undef the all helper macros
00122 #undef GMTL_XGLUE
00123 #undef GMTL_GLUE
00124 #undef GMTL_XSTR
00125 #undef GMTL_STR
00126 #undef GMTL_ZEROFILL
00127 #undef GMTL_XZEROFILL
00128 #undef GMTL_XDOT
00129 #undef GMTL_DOT
00130 
00131 // Undef the GMTL_VERSION_STRING temporary macro
00132 #undef GMTL_VERSION_STRING
00133 
00134 // Undef the XXX_FILLED temporary macros
00135 #undef GMTL_VERSION_MAJOR_FILLED
00136 #undef GMTL_VERSION_MINOR_FILLED
00137 #undef GMTL_VERSION_PATCH_FILLED
00138 
00139 // Undef the macro for each version part
00140 #undef GMTL_VERSION_MAJOR
00141 #undef GMTL_VERSION_MINOR
00142 #undef GMTL_VERSION_PATCH
00143 
00144 #endif

Generated on Sun Sep 19 2010 14:35:14 for GenericMathTemplateLibrary by  doxygen 1.7.1