Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
  2. /* cairo - a vector graphics library with display and print output
  3.  *
  4.  * Copyright © 2002 University of Southern California
  5.  * Copyright © 2005 Red Hat, Inc.
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it either under the terms of the GNU Lesser General Public
  9.  * License version 2.1 as published by the Free Software Foundation
  10.  * (the "LGPL") or, at your option, under the terms of the Mozilla
  11.  * Public License Version 1.1 (the "MPL"). If you do not alter this
  12.  * notice, a recipient may use your version of this file under either
  13.  * the MPL or the LGPL.
  14.  *
  15.  * You should have received a copy of the LGPL along with this library
  16.  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
  17.  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
  18.  * You should have received a copy of the MPL along with this library
  19.  * in the file COPYING-MPL-1.1
  20.  *
  21.  * The contents of this file are subject to the Mozilla Public License
  22.  * Version 1.1 (the "License"); you may not use this file except in
  23.  * compliance with the License. You may obtain a copy of the License at
  24.  * http://www.mozilla.org/MPL/
  25.  *
  26.  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
  27.  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
  28.  * the specific language governing rights and limitations.
  29.  *
  30.  * The Original Code is the cairo graphics library.
  31.  *
  32.  * The Initial Developer of the Original Code is University of Southern
  33.  * California.
  34.  *
  35.  * Contributor(s):
  36.  *      Carl D. Worth <cworth@cworth.org>
  37.  */
  38.  
  39. #define CAIRO_VERSION_H 1
  40.  
  41. #include "cairoint.h"
  42.  
  43. /* get the "real" version info instead of dummy cairo-version.h */
  44. #undef CAIRO_VERSION_H
  45. #include "../cairo-version.h"
  46.  
  47. /**
  48.  * SECTION:cairo-version
  49.  * @Title: Version Information
  50.  * @Short_Description: Compile-time and run-time version checks.
  51.  *
  52.  * Cairo has a three-part version number scheme. In this scheme, we use
  53.  * even vs. odd numbers to distinguish fixed points in the software
  54.  * vs. in-progress development, (such as from git instead of a tar file,
  55.  * or as a "snapshot" tar file as opposed to a "release" tar file).
  56.  *
  57.  * <informalexample><screen>
  58.  *  _____ Major. Always 1, until we invent a new scheme.
  59.  * /  ___ Minor. Even/Odd = Release/Snapshot (tar files) or Branch/Head (git)
  60.  * | /  _ Micro. Even/Odd = Tar-file/git
  61.  * | | /
  62.  * 1.0.0
  63.  * </screen></informalexample>
  64.  *
  65.  * Here are a few examples of versions that one might see.
  66.  * <informalexample><screen>
  67.  * Releases
  68.  * --------
  69.  * 1.0.0 - A major release
  70.  * 1.0.2 - A subsequent maintenance release
  71.  * 1.2.0 - Another major release
  72.  * &nbsp;
  73.  * Snapshots
  74.  * ---------
  75.  * 1.1.2 - A snapshot (working toward the 1.2.0 release)
  76.  * &nbsp;
  77.  * In-progress development (eg. from git)
  78.  * --------------------------------------
  79.  * 1.0.1 - Development on a maintenance branch (toward 1.0.2 release)
  80.  * 1.1.1 - Development on head (toward 1.1.2 snapshot and 1.2.0 release)
  81.  * </screen></informalexample>
  82.  * </para>
  83.  * <refsect2>
  84.  * <title>Compatibility</title>
  85.  * <para>
  86.  * The API/ABI compatibility guarantees for various versions are as
  87.  * follows. First, let's assume some cairo-using application code that is
  88.  * successfully using the API/ABI "from" one version of cairo. Then let's
  89.  * ask the question whether this same code can be moved "to" the API/ABI
  90.  * of another version of cairo.
  91.  *
  92.  * Moving from a release to any later version (release, snapshot,
  93.  * development) is always guaranteed to provide compatibility.
  94.  *
  95.  * Moving from a snapshot to any later version is not guaranteed to
  96.  * provide compatibility, since snapshots may introduce new API that ends
  97.  * up being removed before the next release.
  98.  *
  99.  * Moving from an in-development version (odd micro component) to any
  100.  * later version is not guaranteed to provide compatibility. In fact,
  101.  * there's not even a guarantee that the code will even continue to work
  102.  * with the same in-development version number. This is because these
  103.  * numbers don't correspond to any fixed state of the software, but
  104.  * rather the many states between snapshots and releases.
  105.  * </para>
  106.  * </refsect2>
  107.  * <refsect2>
  108.  * <title>Examining the version</title>
  109.  * <para>
  110.  * Cairo provides the ability to examine the version at either
  111.  * compile-time or run-time and in both a human-readable form as well as
  112.  * an encoded form suitable for direct comparison. Cairo also provides the
  113.  * macro CAIRO_VERSION_ENCODE() to perform the encoding.
  114.  *
  115.  * <informalexample><screen>
  116.  * Compile-time
  117.  * ------------
  118.  * CAIRO_VERSION_STRING    Human-readable
  119.  * CAIRO_VERSION           Encoded, suitable for comparison
  120.  * &nbsp;
  121.  * Run-time
  122.  * --------
  123.  * cairo_version_string()  Human-readable
  124.  * cairo_version()         Encoded, suitable for comparison
  125.  * </screen></informalexample>
  126.  *
  127.  * For example, checking that the cairo version is greater than or equal
  128.  * to 1.0.0 could be achieved at compile-time or run-time as follows:
  129.  *
  130.  * <informalexample><programlisting>
  131.  * ##if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 0, 0)
  132.  * printf ("Compiling with suitable cairo version: %s\n", %CAIRO_VERSION_STRING);
  133.  * ##endif
  134.  *
  135.  * if (cairo_version() >= CAIRO_VERSION_ENCODE(1, 0, 0))
  136.  *     printf ("Running with suitable cairo version: %s\n", cairo_version_string ());
  137.  * </programlisting></informalexample>
  138.  * </para>
  139.  * </refsect2>
  140.  **/
  141.  
  142. /**
  143.  * CAIRO_VERSION:
  144.  *
  145.  * The version of cairo available at compile-time, encoded using
  146.  * CAIRO_VERSION_ENCODE().
  147.  *
  148.  * Since: 1.0
  149.  **/
  150.  
  151. /**
  152.  * CAIRO_VERSION_MAJOR:
  153.  *
  154.  * The major component of the version of cairo available at compile-time.
  155.  *
  156.  * Since: 1.0
  157.  **/
  158.  
  159. /**
  160.  * CAIRO_VERSION_MINOR:
  161.  *
  162.  * The minor component of the version of cairo available at compile-time.
  163.  *
  164.  * Since: 1.0
  165.  **/
  166.  
  167. /**
  168.  * CAIRO_VERSION_MICRO:
  169.  *
  170.  * The micro component of the version of cairo available at compile-time.
  171.  *
  172.  * Since: 1.0
  173.  **/
  174.  
  175. /**
  176.  * CAIRO_VERSION_STRING:
  177.  *
  178.  * A human-readable string literal containing the version of cairo available
  179.  * at compile-time, in the form of "X.Y.Z".
  180.  *
  181.  * Since: 1.8
  182.  **/
  183.  
  184. /**
  185.  * CAIRO_VERSION_ENCODE:
  186.  * @major: the major component of the version number
  187.  * @minor: the minor component of the version number
  188.  * @micro: the micro component of the version number
  189.  *
  190.  * This macro encodes the given cairo version into an integer.  The numbers
  191.  * returned by %CAIRO_VERSION and cairo_version() are encoded using this macro.
  192.  * Two encoded version numbers can be compared as integers.  The encoding ensures
  193.  * that later versions compare greater than earlier versions.
  194.  *
  195.  * Returns: the encoded version.
  196.  *
  197.  * Since: 1.0
  198.  **/
  199.  
  200. /**
  201.  * CAIRO_VERSION_STRINGIZE:
  202.  * @major: the major component of the version number
  203.  * @minor: the minor component of the version number
  204.  * @micro: the micro component of the version number
  205.  *
  206.  * This macro encodes the given cairo version into an string.  The numbers
  207.  * returned by %CAIRO_VERSION_STRING and cairo_version_string() are encoded using this macro.
  208.  * The parameters to this macro must expand to numerical literals.
  209.  *
  210.  * Returns: a string literal containing the version.
  211.  *
  212.  * Since: 1.8
  213.  **/
  214.  
  215. /**
  216.  * cairo_version:
  217.  *
  218.  * Returns the version of the cairo library encoded in a single
  219.  * integer as per %CAIRO_VERSION_ENCODE. The encoding ensures that
  220.  * later versions compare greater than earlier versions.
  221.  *
  222.  * A run-time comparison to check that cairo's version is greater than
  223.  * or equal to version X.Y.Z could be performed as follows:
  224.  *
  225.  * <informalexample><programlisting>
  226.  * if (cairo_version() >= CAIRO_VERSION_ENCODE(X,Y,Z)) {...}
  227.  * </programlisting></informalexample>
  228.  *
  229.  * See also cairo_version_string() as well as the compile-time
  230.  * equivalents %CAIRO_VERSION and %CAIRO_VERSION_STRING.
  231.  *
  232.  * Return value: the encoded version.
  233.  *
  234.  * Since: 1.0
  235.  **/
  236. int
  237. cairo_version (void)
  238. {
  239.     return CAIRO_VERSION;
  240. }
  241.  
  242. /**
  243.  * cairo_version_string:
  244.  *
  245.  * Returns the version of the cairo library as a human-readable string
  246.  * of the form "X.Y.Z".
  247.  *
  248.  * See also cairo_version() as well as the compile-time equivalents
  249.  * %CAIRO_VERSION_STRING and %CAIRO_VERSION.
  250.  *
  251.  * Return value: a string containing the version.
  252.  *
  253.  * Since: 1.0
  254.  **/
  255. const char*
  256. cairo_version_string (void)
  257. {
  258.     return CAIRO_VERSION_STRING;
  259. }
  260. slim_hidden_def (cairo_version_string);
  261.