00001 /************************************************************** ggt-head beg 00002 * 00003 * GGT: Generic Graphics Toolkit 00004 * 00005 * Original Authors: 00006 * Allen Bierbaum 00007 * 00008 * ----------------------------------------------------------------- 00009 * File: $RCSfile: Version.h,v $ 00010 * Date modified: $Date: 2003/03/31 19:16:16 $ 00011 * Version: $Revision: 1.18 $ 00012 * ----------------------------------------------------------------- 00013 * 00014 *********************************************************** ggt-head end */ 00015 /*************************************************************** ggt-cpr beg 00016 * 00017 * GGT: The Generic Graphics Toolkit 00018 * Copyright (C) 2001,2002 Allen Bierbaum 00019 * 00020 * This library is free software; you can redistribute it and/or 00021 * modify it under the terms of the GNU Lesser General Public 00022 * License as published by the Free Software Foundation; either 00023 * version 2.1 of the License, or (at your option) any later version. 00024 * 00025 * This library is distributed in the hope that it will be useful, 00026 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00027 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00028 * Lesser General Public License for more details. 00029 * 00030 * You should have received a copy of the GNU Lesser General Public 00031 * License along with this library; if not, write to the Free Software 00032 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00033 * 00034 ************************************************************ ggt-cpr end */ 00035 #ifndef _GMTL_VERSION_H_ 00036 #define _GMTL_VERSION_H_ 00037 00051 // The major/minor/patch version (up to 3 digits each). 00052 #define GMTL_VERSION_MAJOR 0 00053 #define GMTL_VERSION_MINOR 2 00054 #define GMTL_VERSION_PATCH 2 00055 00056 //-------------------------------------------------------------------------- 00057 //-------------------------------------------------------------------------- 00058 // To update the version number, do not modify anything below this line!!!! 00059 //-------------------------------------------------------------------------- 00060 //-------------------------------------------------------------------------- 00061 00062 00063 //-------------------------------------------------------------------------- 00064 // Define the helper macros 00065 //-------------------------------------------------------------------------- 00066 00067 // These helper macros are used build up the GMTL_VERSION macro 00068 #define GMTL_GLUE(a,b) a ## b 00069 #define GMTL_XGLUE(a,b) GMTL_GLUE(a,b) 00070 00071 // These helper macros are used to stringify a given macro 00072 #define GMTL_STR(s) # s 00073 #define GMTL_XSTR(s) GMTL_STR(s) 00074 00075 // These helper macros are used to build up the GMTL_VERSION_STRING macro. 00076 #define GMTL_DOT(a,b) a ## . ## b 00077 #define GMTL_XDOT(a,b) GMTL_DOT(a,b) 00078 00079 // These helpr macros are used to facilitate a zero left fill 00080 #define GMTL_ZEROFILL(a) 0 ## a 00081 #define GMTL_XZEROFILL(a) GMTL_ZEROFILL(a) 00082 00083 // Fix up the major version by doing a zero left fill 00084 #if GMTL_VERSION_MAJOR < 10 00085 # define GMTL_VERSION_MAJOR_FILLED \ 00086 GMTL_XZEROFILL(GMTL_XZEROFILL(GMTL_VERSION_MAJOR)) 00087 #elif GMTL_VERSION_MAJOR < 100 00088 # define GMTL_VERSION_MAJOR_FILLED GMTL_XZEROFILL(GMTL_VERSION_MAJOR) 00089 #else 00090 # define GMTL_VERSION_MAJOR_FILLED GMTL_VERSION_MAJOR 00091 #endif 00092 00093 // Fix up the minor version by doing a zero left fill 00094 #if GMTL_VERSION_MINOR < 10 00095 # define GMTL_VERSION_MINOR_FILLED \ 00096 GMTL_XZEROFILL(GMTL_XZEROFILL(GMTL_VERSION_MINOR)) 00097 #elif GMTL_VERSION_MINOR < 100 00098 # define GMTL_VERSION_MINOR_FILLED GMTL_XZEROFILL(GMTL_VERSION_MINOR) 00099 #else 00100 # define GMTL_VERSION_MINOR_FILLED GMTL_VERSION_MINOR 00101 #endif 00102 00103 // Fix up the patch version by doing a zero left fill 00104 #if GMTL_VERSION_PATCH < 10 00105 # define GMTL_VERSION_PATCH_FILLED \ 00106 GMTL_XZEROFILL(GMTL_XZEROFILL(GMTL_VERSION_PATCH)) 00107 #elif GMTL_VERSION_PATCH < 100 00108 # define GMTL_VERSION_PATCH_FILLED GMTL_XZEROFILL(GMTL_VERSION_PATCH) 00109 #else 00110 # define GMTL_VERSION_PATCH_FILLED GMTL_VERSION_PATCH 00111 #endif 00112 00113 //-------------------------------------------------------------------------- 00114 // Define the GMTL_VERSION and GMTL_VERSION_STRING macros 00115 //-------------------------------------------------------------------------- 00116 00117 // Build up the GMTL_VERSION macro by pasting the individual parts together 00122 #define GMTL_VERSION \ 00123 GMTL_XGLUE( \ 00124 GMTL_XGLUE(GMTL_VERSION_MAJOR_FILLED, GMTL_VERSION_MINOR_FILLED), \ 00125 GMTL_VERSION_PATCH_FILLED \ 00126 ) 00127 00128 // Create the GMTL_VERSION_STRING macro 00129 #define GMTL_VERSION_STRING \ 00130 GMTL_XDOT( \ 00131 GMTL_XDOT(GMTL_VERSION_MAJOR, GMTL_VERSION_MINOR), \ 00132 GMTL_VERSION_PATCH \ 00133 ) 00134 00135 //-------------------------------------------------------------------------- 00136 // Declare a version string constant that can be used at runtime. 00137 //-------------------------------------------------------------------------- 00138 namespace gmtl 00139 { 00140 inline const char* getVersion() 00141 { 00142 return GMTL_XSTR(GMTL_VERSION_STRING); 00143 } 00144 } // end namespace gmtl 00145 00146 //-------------------------------------------------------------------------- 00147 // Cleanup after ourselves and undef all internal macros. 00148 //-------------------------------------------------------------------------- 00149 00150 // Undef the all helper macros 00151 #undef GMTL_XGLUE 00152 #undef GMTL_GLUE 00153 #undef GMTL_XSTR 00154 #undef GMTL_STR 00155 #undef GMTL_ZEROFILL 00156 #undef GMTL_XZEROFILL 00157 #undef GMTL_XDOT 00158 #undef GMTL_DOT 00159 00160 // Undef the GMTL_VERSION_STRING temporary macro 00161 #undef GMTL_VERSION_STRING 00162 00163 // Undef the XXX_FILLED temporary macros 00164 #undef GMTL_VERSION_MAJOR_FILLED 00165 #undef GMTL_VERSION_MINOR_FILLED 00166 #undef GMTL_VERSION_PATCH_FILLED 00167 00168 // Undef the macro for each version part 00169 #undef GMTL_VERSION_MAJOR 00170 #undef GMTL_VERSION_MINOR 00171 #undef GMTL_VERSION_PATCH 00172 00173 #endif