/+junk/libbreezy

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/libbreezy

« back to all changes in this revision

Viewing changes to src/libbreezy-version.h.in

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-13 15:54:51 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210113155451-b8bj2e5saxiysvqc
the start of this dumb experiment

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* libbreezy-version.h.in
 
2
 *
 
3
 * Copyright 2021 Gustav Hartvigsson
 
4
 *
 
5
 * This program is free software: you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation, either version 3 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#pragma once
 
20
 
 
21
#if !defined(LIBBREEZY_INSIDE) && !defined(LIBBREEZY_COMPILATION)
 
22
# error "Only <libbreezy.h> can be included directly."
 
23
#endif
 
24
 
 
25
/**
 
26
 * SECTION:libbreezyversion
 
27
 * @short_description: libbreezy version checking
 
28
 *
 
29
 * libbreezy provides macros to check the version of the library
 
30
 * at compile-time
 
31
 */
 
32
 
 
33
/**
 
34
 * LIBBREEZY_MAJOR_VERSION:
 
35
 *
 
36
 * libbreezy major version component (e.g. 1 if %LIBBREEZY_VERSION is 1.2.3)
 
37
 */
 
38
#define LIBBREEZY_MAJOR_VERSION (@MAJOR_VERSION@)
 
39
 
 
40
/**
 
41
 * LIBBREEZY_MINOR_VERSION:
 
42
 *
 
43
 * libbreezy minor version component (e.g. 2 if %LIBBREEZY_VERSION is 1.2.3)
 
44
 */
 
45
#define LIBBREEZY_MINOR_VERSION (@MINOR_VERSION@)
 
46
 
 
47
/**
 
48
 * LIBBREEZY_MICRO_VERSION:
 
49
 *
 
50
 * libbreezy micro version component (e.g. 3 if %LIBBREEZY_VERSION is 1.2.3)
 
51
 */
 
52
#define LIBBREEZY_MICRO_VERSION (@MICRO_VERSION@)
 
53
 
 
54
/**
 
55
 * LIBBREEZY_VERSION
 
56
 *
 
57
 * libbreezy version.
 
58
 */
 
59
#define LIBBREEZY_VERSION (@VERSION@)
 
60
 
 
61
/**
 
62
 * LIBBREEZY_VERSION_S:
 
63
 *
 
64
 * libbreezy version, encoded as a string, useful for printing and
 
65
 * concatenation.
 
66
 */
 
67
#define LIBBREEZY_VERSION_S "@VERSION@"
 
68
 
 
69
#define LIBBREEZY_ENCODE_VERSION(major,minor,micro) \
 
70
        ((major) << 24 | (minor) << 16 | (micro) << 8)
 
71
 
 
72
/**
 
73
 * LIBBREEZY_VERSION_HEX:
 
74
 *
 
75
 * libbreezy version, encoded as an hexadecimal number, useful for
 
76
 * integer comparisons.
 
77
 */
 
78
#define LIBBREEZY_VERSION_HEX \
 
79
        (LIBBREEZY_ENCODE_VERSION (LIBBREEZY_MAJOR_VERSION, LIBBREEZY_MINOR_VERSION, LIBBREEZY_MICRO_VERSION))
 
80
 
 
81
/**
 
82
 * LIBBREEZY_CHECK_VERSION:
 
83
 * @major: required major version
 
84
 * @minor: required minor version
 
85
 * @micro: required micro version
 
86
 *
 
87
 * Compile-time version checking. Evaluates to %TRUE if the version
 
88
 * of libbreezy is greater than the required one.
 
89
 */
 
90
#define LIBBREEZY_CHECK_VERSION(major,minor,micro)   \
 
91
        (LIBBREEZY_MAJOR_VERSION > (major) || \
 
92
         (LIBBREEZY_MAJOR_VERSION == (major) && LIBBREEZY_MINOR_VERSION > (minor)) || \
 
93
         (LIBBREEZY_MAJOR_VERSION == (major) && LIBBREEZY_MINOR_VERSION == (minor) && \
 
94
          LIBBREEZY_MICRO_VERSION >= (micro)))