source: projectionDesigner/trunk/projdesigner/include/gmtl/Version.h @ 407

Last change on this file since 407 was 4, checked in by Torben Dannhauer, 15 years ago
File size: 6.1 KB
RevLine 
[4]1/************************************************************** ggt-head beg
2 *
3 * GGT: Generic Graphics Toolkit
4 *
5 * Original Authors:
6 *   Allen Bierbaum
7 *
8 * -----------------------------------------------------------------
9 * File:          Version.h,v
10 * Date modified: 2006/11/10 21:55:50
11 * Version:       1.38.2.1
12 * -----------------------------------------------------------------
13 *
14 *********************************************************** ggt-head end */
15/*************************************************************** ggt-cpr beg
16*
17* GGT: The Generic Graphics Toolkit
18* Copyright (C) 2001,2002 Allen Bierbaum
19*
20* This library is free software; you can redistribute it and/or
21* modify it under the terms of the GNU Lesser General Public
22* License as published by the Free Software Foundation; either
23* version 2.1 of the License, or (at your option) any later version.
24*
25* This library is distributed in the hope that it will be useful,
26* but WITHOUT ANY WARRANTY; without even the implied warranty of
27* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28* Lesser General Public License for more details.
29*
30* You should have received a copy of the GNU Lesser General Public
31* License along with this library; if not, write to the Free Software
32* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33*
34 ************************************************************ ggt-cpr end */
35#ifndef _GMTL_VERSION_H_
36#define _GMTL_VERSION_H_
37
38/**
39 * This file contains two useful items.
40 *    1. The preprocessor friendly GMTL_VERSION "string". It is in the form
41 *       <major><minor><patch> where each part has exactly 3 digits.
42 *    2. The C++ friendly variable, version, that contains the version as a
43 *       string. It is in the form of <major>.<minor>.<patch> where each part
44 *       has anywhere from 1 to 3 digits.
45 */
46
47/**
48 * This is the "human-readable" GMTL version _string_. It is of the form
49 * <major><minor><patch>. Each part has exactly 3 digits.
50 */
51// The major/minor/patch version (up to 3 digits each).
52#define GMTL_VERSION_MAJOR    0
53#define GMTL_VERSION_MINOR    4
54#define GMTL_VERSION_PATCH    12
55
56//--------------------------------------------------------------------------
57//--------------------------------------------------------------------------
58// To update the version number, do not modify anything below this line!!!!
59//--------------------------------------------------------------------------
60//--------------------------------------------------------------------------
61
62
63//--------------------------------------------------------------------------
64// Define the helper macros
65//--------------------------------------------------------------------------
66
67// These helper macros are used build up the GMTL_VERSION macro
68#define GMTL_GLUE(a,b)        a ## b
69#define GMTL_XGLUE(a,b)       GMTL_GLUE(a,b)
70
71// These helper macros are used to stringify a given macro
72#define GMTL_STR(s)           # s
73#define GMTL_XSTR(s)          GMTL_STR(s)
74
75// These helper macros are used to build up the GMTL_VERSION_STRING macro.
76#define GMTL_DOT(a,b)         a ## . ## b
77#define GMTL_XDOT(a,b)        GMTL_DOT(a,b)
78
79// These helpr macros are used to facilitate a zero left fill
80#define GMTL_ZEROFILL(a)      0 ## a
81#define GMTL_XZEROFILL(a)     GMTL_ZEROFILL(a)
82
83// Fix up the major version by doing a zero left fill
84#if GMTL_VERSION_MAJOR < 10
85#  define GMTL_VERSION_MAJOR_FILLED \
86               GMTL_XZEROFILL(GMTL_XZEROFILL(GMTL_VERSION_MAJOR))
87#elif GMTL_VERSION_MAJOR < 100
88#  define GMTL_VERSION_MAJOR_FILLED GMTL_XZEROFILL(GMTL_VERSION_MAJOR)
89#else
90#  define GMTL_VERSION_MAJOR_FILLED GMTL_VERSION_MAJOR
91#endif
92
93// Fix up the minor version by doing a zero left fill
94#if GMTL_VERSION_MINOR < 10
95#  define GMTL_VERSION_MINOR_FILLED \
96               GMTL_XZEROFILL(GMTL_XZEROFILL(GMTL_VERSION_MINOR))
97#elif GMTL_VERSION_MINOR < 100
98#  define GMTL_VERSION_MINOR_FILLED GMTL_XZEROFILL(GMTL_VERSION_MINOR)
99#else
100#  define GMTL_VERSION_MINOR_FILLED GMTL_VERSION_MINOR
101#endif
102
103// Fix up the patch version by doing a zero left fill
104#if GMTL_VERSION_PATCH < 10
105#  define GMTL_VERSION_PATCH_FILLED \
106               GMTL_XZEROFILL(GMTL_XZEROFILL(GMTL_VERSION_PATCH))
107#elif GMTL_VERSION_PATCH < 100
108#  define GMTL_VERSION_PATCH_FILLED GMTL_XZEROFILL(GMTL_VERSION_PATCH)
109#else
110#  define GMTL_VERSION_PATCH_FILLED GMTL_VERSION_PATCH
111#endif
112
113//--------------------------------------------------------------------------
114// Define the GMTL_VERSION and GMTL_VERSION_STRING macros
115//--------------------------------------------------------------------------
116
117// Build up the GMTL_VERSION macro by pasting the individual parts together
118/**
119 * The is the preprocessor-friendly version string. It is in the form of
120 * <major><minor><patch>. Each part has exactly 3 digits.
121 */
122#define GMTL_VERSION \
123   GMTL_XGLUE( \
124      GMTL_XGLUE(GMTL_VERSION_MAJOR_FILLED, GMTL_VERSION_MINOR_FILLED), \
125      GMTL_VERSION_PATCH_FILLED \
126   )
127
128// Create the GMTL_VERSION_STRING macro
129#define GMTL_VERSION_STRING \
130   GMTL_XDOT( \
131      GMTL_XDOT(GMTL_VERSION_MAJOR, GMTL_VERSION_MINOR), \
132      GMTL_VERSION_PATCH \
133   )
134
135//--------------------------------------------------------------------------
136// Declare a version string constant that can be used at runtime.
137//--------------------------------------------------------------------------
138namespace gmtl
139{
140   inline const char* getVersion()
141   {
142      return GMTL_XSTR(GMTL_VERSION_STRING);
143   }
144} // end namespace gmtl
145
146//--------------------------------------------------------------------------
147// Cleanup after ourselves and undef all internal macros.
148//--------------------------------------------------------------------------
149
150// Undef the all helper macros
151#undef GMTL_XGLUE
152#undef GMTL_GLUE
153#undef GMTL_XSTR
154#undef GMTL_STR
155#undef GMTL_ZEROFILL
156#undef GMTL_XZEROFILL
157#undef GMTL_XDOT
158#undef GMTL_DOT
159
160// Undef the GMTL_VERSION_STRING temporary macro
161#undef GMTL_VERSION_STRING
162
163// Undef the XXX_FILLED temporary macros
164#undef GMTL_VERSION_MAJOR_FILLED
165#undef GMTL_VERSION_MINOR_FILLED
166#undef GMTL_VERSION_PATCH_FILLED
167
168// Undef the macro for each version part
169#undef GMTL_VERSION_MAJOR
170#undef GMTL_VERSION_MINOR
171#undef GMTL_VERSION_PATCH
172
173#endif
Note: See TracBrowser for help on using the repository browser.