| 1 |
|
| 2 |
@c %start of fragment |
| 3 |
|
| 4 |
@node Version Information |
| 5 |
@chapter Version Information |
| 6 |
Compile-time and run-time version checks. |
| 7 |
|
| 8 |
@section Overview |
| 9 |
Cairo has a three-part version number scheme. In this scheme, we use |
| 10 |
even vs. odd numbers to distinguish fixed points in the software vs. |
| 11 |
in-progress development, (such as from git instead of a tar file, or as |
| 12 |
a "snapshot" tar file as opposed to a "release" tar file). |
| 13 |
|
| 14 |
@example |
| 15 |
|
| 16 |
_____ Major. Always 1, until we invent a new scheme. |
| 17 |
/ ___ Minor. Even/Odd = Release/Snapshot (tar files) or Branch/Head (git) |
| 18 |
| / _ Micro. Even/Odd = Tar-file/git |
| 19 |
| | / |
| 20 |
1.0.0 |
| 21 |
@end example |
| 22 |
|
| 23 |
Here are a few examples of versions that one might see. |
| 24 |
|
| 25 |
@example |
| 26 |
|
| 27 |
Releases |
| 28 |
-------- |
| 29 |
1.0.0 - A major release |
| 30 |
1.0.2 - A subsequent maintenance release |
| 31 |
1.2.0 - Another major release |
| 32 |
|
| 33 |
Snapshots |
| 34 |
--------- |
| 35 |
1.1.2 - A snapshot (working toward the 1.2.0 release) |
| 36 |
|
| 37 |
In-progress development (eg. from git) |
| 38 |
-------------------------------------- |
| 39 |
1.0.1 - Development on a maintenance branch (toward 1.0.2 release) |
| 40 |
1.1.1 - Development on head (toward 1.1.2 snapshot and 1.2.0 release) |
| 41 |
@end example |
| 42 |
|
| 43 |
@section Compatibility |
| 44 |
The API/ABI compatibility guarantees for various versions are as |
| 45 |
follows. First, let's assume some cairo-using application code that is |
| 46 |
successfully using the API/ABI "from" one version of cairo. Then let's |
| 47 |
ask the question whether this same code can be moved "to" the API/ABI of |
| 48 |
another version of cairo. |
| 49 |
|
| 50 |
Moving from a release to any later version (release, snapshot, |
| 51 |
development) is always guaranteed to provide compatibility. |
| 52 |
|
| 53 |
Moving from a snapshot to any later version is not guaranteed to provide |
| 54 |
compatibility, since snapshots may introduce new API that ends up being |
| 55 |
removed before the next release. |
| 56 |
|
| 57 |
Moving from an in-development version (odd micro component) to any later |
| 58 |
version is not guaranteed to provide compatibility. In fact, there's not |
| 59 |
even a guarantee that the code will even continue to work with the same |
| 60 |
in-development version number. This is because these numbers don't |
| 61 |
correspond to any fixed state of the software, but rather the many |
| 62 |
states between snapshots and releases. |
| 63 |
|
| 64 |
@section Examining the version |
| 65 |
Cairo provides the ability to examine the version at either compile-time |
| 66 |
or run-time and in both a human-readable form as well as an encoded form |
| 67 |
suitable for direct comparison. Cairo also provides the macro |
| 68 |
@code{cairo-version-encode} to perform the encoding. |
| 69 |
|
| 70 |
@example |
| 71 |
|
| 72 |
Compile-time |
| 73 |
------------ |
| 74 |
CAIRO_VERSION_STRING Human-readable |
| 75 |
CAIRO_VERSION Encoded, suitable for comparison |
| 76 |
|
| 77 |
Run-time |
| 78 |
-------- |
| 79 |
cairo_version_string() Human-readable |
| 80 |
cairo_version() Encoded, suitable for comparison |
| 81 |
@end example |
| 82 |
|
| 83 |
For example, checking that the cairo version is greater than or equal to |
| 84 |
1.0.0 could be achieved at compile-time or run-time as follows: |
| 85 |
|
| 86 |
@example |
| 87 |
|
| 88 |
##if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 0, 0) |
| 89 |
printf ("Compiling with suitable cairo version: %s\n", %CAIRO_VERSION_STRING); |
| 90 |
##endif |
| 91 |
|
| 92 |
if (cairo_version() >= CAIRO_VERSION_ENCODE(1, 0, 0)) |
| 93 |
printf ("Running with suitable cairo version: %s\n", cairo_version_string ()); |
| 94 |
@end example |
| 95 |
|
| 96 |
@section Usage |
| 97 |
@include defuns-cairo-version.xml.texi |
| 98 |
|
| 99 |
@c %end of fragment |