summaryrefslogtreecommitdiff
path: root/cogl/cogl-util.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2012-04-23 14:09:19 +0100
committerRobert Bragg <robert@linux.intel.com>2012-08-06 14:27:40 +0100
commitb6b9ac0b85da47874086899ea11770587b0686fb (patch)
tree60e32206db406c09ef4f85b0bba54aad0509fab3 /cogl/cogl-util.h
parent8b22b0da65531b59cad6cc9e95c306c25b4a85ec (diff)
downloadcogl-b6b9ac0b85da47874086899ea11770587b0686fb.tar.gz
Add a cogl-version header
This adds a version header which contains macros to define which version of Cogl the application is being compiled against. This helps applications that want to support multiple incompatible versions of Cogl at compile time. The macros are called COGL_VERSION_{MAJOR,MINOR,MICRO}. This does not match Clutter which names them CLUTTER_{MAJOR,MINOR,MICRO}_VERSION but I think the former is nicer and it at least matches Cairo and Pango. The values of the macro are defined to COGL_VERSION_*_INTERNAL which is generated by the configure script into cogl-defines.h. There is also a macro for the entire version as a string called COGL_VERSION_STRING. The internal utility macros for encoding a 3 part version number into a single integer have been moved into the new header so they can be used publicly as a convenient way to check if the version is within a particular range. There is also a COGL_VERSION_CHECK macro for the very common case that a feature will be used since a particular version of Cogl. There is a macro called COGL_VERSION which contains the pre-encoded version of Cogl being compiled against for convenience. Unlike in Clutter this patch does not add any runtime version identification mechanism. A test case is also added which just contains static asserts to sanity check the macros. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 3480cf140dc355fa87ab3fbcf0aeeb0124798a8f)
Diffstat (limited to 'cogl/cogl-util.h')
-rw-r--r--cogl/cogl-util.h21
1 files changed, 0 insertions, 21 deletions
diff --git a/cogl/cogl-util.h b/cogl/cogl-util.h
index 698391a0..44589857 100644
--- a/cogl/cogl-util.h
+++ b/cogl/cogl-util.h
@@ -52,27 +52,6 @@
#define COGL_EXPORT
#endif
-/* Macros to handle compacting a 3-component version number into an
- int for quick comparison. This assumes all of the components are
- <= 1023 */
-#define COGL_VERSION_COMPONENT_BITS 10
-#define COGL_VERSION_MAX_COMPONENT_VALUE \
- ((1 << COGL_VERSION_COMPONENT_BITS) - 1)
-
-#define COGL_VERSION_ENCODE(major, minor, micro) \
- (((major) << (COGL_VERSION_COMPONENT_BITS * 2)) | \
- ((minor) << COGL_VERSION_COMPONENT_BITS) \
- | (micro))
-
-#define COGL_VERSION_GET_MAJOR(version) \
- (((version) >> 20) & COGL_VERSION_MAX_COMPONENT_VALUE)
-
-#define COGL_VERSION_GET_MINOR(version) \
- (((version) >> 10) & COGL_VERSION_MAX_COMPONENT_VALUE)
-
-#define COGL_VERSION_GET_MICRO(version) \
- ((version) & COGL_VERSION_MAX_COMPONENT_VALUE)
-
int
_cogl_util_next_p2 (int a);