Augment existing CAIRO_VERSION_MAJOR/MINOR/MICRO and CAIRO_VERSION_STRING with CAIRO_VERSION_ENCODE and CAIRO_VERSION. Add functions for run-time access:

cairo_version cairo_version_string
This commit is contained in:
Carl Worth 2005-08-10 15:58:25 +00:00
parent bdd8cbddee
commit ae63b95211
3 changed files with 69 additions and 0 deletions

View file

@ -1,3 +1,14 @@
2005-08-10 Carl Worth <cworth@cworth.org>
* src/cairo.h:
* src/cairo.c: (cairo_version), (cairo_version_string):
Augment existing CAIRO_VERSION_MAJOR/MINOR/MICRO and
CAIRO_VERSION_STRING with CAIRO_VERSION_ENCODE and CAIRO_VERSION.
Add functions for run-time access:
cairo_version
cairo_version_string
2005-08-10 Carl Worth <cworth@cworth.org>
From Travis Spencer <tspencer@cs.pdx.edu>:

View file

@ -110,6 +110,48 @@ _cairo_set_error (cairo_t *cr, cairo_status_t status)
_cairo_error (status);
}
/**
* cairo_version:
*
* Returns the version of the cairo library encoded in a single
* integer as per CAIRO_VERSION_ENCODE. The encoding ensures that
* later versions compare greater than earlier versions.
*
* A run-time comparison to check that cairo's version is greater than
* or equal to version X.Y.Z could be performed as follows:
*
* <informalexample><programlisting>
* if (cairo_version() >= CAIRO_VERSION_ENCODE(X,Y,Z)) {...}
* </programlisting></informalexample>
*
* See also cairo_version_string() as well as the compile-time
* equivalents %CAIRO_VERSION and %CAIRO_VERSION_STRING.
*
* Return value: the encoded version.
**/
int
cairo_version (void)
{
return CAIRO_VERSION;
}
/**
* cairo_version_string:
*
* Returns the version of the cairo library as a human-readable string
* of the form "X.Y.Z".
*
* See also cairo_version() as well as the compile-time equivalents
* %CAIRO_VERSION_STRING and %CAIRO_VERSION.
*
* Return value: a string containing the version.
**/
const char*
cairo_version_string (void)
{
return CAIRO_VERSION_STRING;
}
/**
* cairo_create:
* @target: target surface for the context

View file

@ -42,6 +42,22 @@
CAIRO_BEGIN_DECLS
#define CAIRO_VERSION_ENCODE(major, minor, micro) ( \
((major) * 10000) \
+ ((minor) * 100) \
+ ((micro) * 1))
#define CAIRO_VERSION CAIRO_VERSION_ENCODE( \
CAIRO_VERSION_MAJOR, \
CAIRO_VERSION_MINOR, \
CAIRO_VERSION_MICRO)
int
cairo_version (void);
const char*
cairo_version_string (void);
/**
* cairo_bool_t:
*