File: ctpl-version.c

package info (click to toggle)
ctpl 0.3.4%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,360 kB
  • sloc: sh: 12,160; ansic: 5,879; python: 159; makefile: 124; sed: 16
file content (89 lines) | stat: -rw-r--r-- 2,626 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* 
 * 
 * Copyright (C) 2009-2011 Colomban Wendling <ban@herbesfolles.org>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

#include "ctpl-version.h"
#include <glib.h>


/**
 * SECTION: version
 * @short_description: Variables and functions to check the CTPL version
 * @include: ctpl/ctpl.h
 * 
 * Provides CTPL version checks.
 */


/**
 * ctpl_major_version:
 * 
 * Major version of the CTPL library the application is running with.
 * 
 * Since: 0.3
 */
const guint ctpl_major_version = CTPL_MAJOR_VERSION;
/**
 * ctpl_minor_version:
 * 
 * Minor version of the CTPL library the application is running with.
 * 
 * Since: 0.3
 */
const guint ctpl_minor_version = CTPL_MINOR_VERSION;
/**
 * ctpl_micro_version:
 * 
 * Micro version of the CTPL library the application is running with.
 * 
 * Since: 0.3
 */
const guint ctpl_micro_version = CTPL_MICRO_VERSION;

/**
 * ctpl_check_version:
 * @major: CTPL major version required
 * @minor: CTPL minor version required
 * @micro: CTPL micro version required
 * 
 * Checks whether the CTPL library in use is presumably compatible with the
 * given version. You would generally pass in the constants
 * #CTPL_MAJOR_VERSION, #CTPL_MINOR_VERSION, #CTPL_MICRO_VERSION as the three
 * arguments to this function; that produces a check that the library in use is
 * compatible with the version of CTPL the application was built against.
 * 
 * This function currently simply checks whether the actual CTPL version is
 * equal or newer than the passed in version.
 * 
 * This provides a run-time check, unlike %CTPL_CHECK_VERSION that does a
 * compile-time check.
 * 
 * Returns: %TRUE if the version is compatible, %FALSE otherwise.
 * 
 * Since: 0.3
 */
gboolean
ctpl_check_version (guint major,
                    guint minor,
                    guint micro)
{
  return (ctpl_major_version > major ||
          (ctpl_major_version == major && \
           (ctpl_minor_version > minor || \
            (ctpl_minor_version == minor && ctpl_micro_version >= micro))));
}