mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-03 00:48:02 +02:00
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:
parent
bdd8cbddee
commit
ae63b95211
3 changed files with 69 additions and 0 deletions
11
ChangeLog
11
ChangeLog
|
|
@ -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>:
|
||||
|
|
|
|||
42
src/cairo.c
42
src/cairo.c
|
|
@ -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
|
||||
|
|
|
|||
16
src/cairo.h
16
src/cairo.h
|
|
@ -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:
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue