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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
.TH LIBRECRYPT_VERSION_CMP_BUILD 3 LIBRECRYPT
.SH NAME
LIBRECRYPT_VERSION_CMP_BUILD - Compare version against compiled against version
.SH SYNOPSIS
.nf
#include <librecrypt.h>
#define \fBLIBRECRYPT_VERSION_MAJOR\fP /* version-dependent int value */
#define \fBLIBRECRYPT_VERSION_MINOR\fP /* version-dependent int value */
#define \fBLIBRECRYPT_VERSION_PATCH\fP /* version-dependent int value */
#define \fBLIBRECRYPT_VERSION_CMP_BUILD\fP(\fIMAJOR\fP, \fIMINOR\fP, \fIPATCH\fP) /* implementation omitted */
.fi
.SH DESCRIPTION
The
.BR LIBRECRYPT_VERSION_MAJOR ,
.BR LIBRECRYPT_VERSION_MINOR ,
and
.B LIBRECRYPT_VERSION_PATCH
macros are compile-time constant expression
describing the version number of the version of
.B librecrypt
that the application is compiled against.
Each of these are simple integer-literals of the
type
.IR int .
.PP
.B LIBRECRYPT_VERSION_MAJOR
is the major number. It is increased when there
are backwards incompatible changes, necessitating
the that the application is recompiled or even
rewritten
.PP
.B LIBRECRYPT_VERSION_MINOR
is the minor number. It is increased when the API
is extended. It is reset to zero when the major
number is modified.
.PP
.B LIBRECRYPT_VERSION_PATCH
is the patch number. It is increased when the
software is modified but the API and ABI are
unmodified. It is reset to zero when the major or
minor number is modified.
.PP
The
.B LIBRECRYPT_VERSION_CMP_BUILD
macro compares
.IR MAJOR ,
.IR MINOR ,
and
.I PATCH
against
.BR LIBRECRYPT_VERSION_MAJOR ,
.BR LIBRECRYPT_VERSION_MINOR ,
and
.BR LIBRECRYPT_VERSION_PATCH .
.PP
If the versions are the same, the macro expands to an
expression with the value 0 and the type
.IR int .
.PP
If the specified version is newer than the version
the application is compiled against, the macro expands
to an expression with a positive value of the type
.IR int .
.PP
If the specified version is older than the version
the application is compiled against, the macro expands
to an expression with a negative value of the type
.IR int .
.PP
If the versions are different, the most most significant
different number determines the absolute value of the
value the macro expands to. If the major numbers are
different, the absolute value is 3, otherwise if the
minor numbers are different, the absolute value is 3,
otherwise (if the patch numbers are different), the
absolute value is 1.
.SH APPLICATION USAGE
Use
.I #if !defined(LIBRECRYPT_VERSION_MAJOR)
to detect when the version number is lower than 1.2.
There are no macros defined between 1.0 and 1.2,
so getting the exact number is not possible.
.SH NOTES
The version number of
.B librecrypt
is formatted as
.IR major.minor.patch.revision ,
or
.IR major.minor.patch
when
.I reversion
is 0, or
.IR major.minor
when both
.I patch
and
.I revision
are 0.
.PP
.I revision
cannot be tested agaist since it is only incremented
when no changes are made to the library software but
for example only to documentation or build script
(or reset to 0 when any of the other numbers are modified).
.SH HISTORY
The
.BR LIBRECRYPT_VERSION_MAJOR ,
.BR LIBRECRYPT_VERSION_MINOR ,
.BR LIBRECRYPT_VERSION_PATCH ,
.BR LIBRECRYPT_VERSION_CMP_BUILD ,
macros were introduced in version 1.2 of
.BR librecrypt .
.SH SEE ALSO
.BR librecrypt (7),
.BR LIBRECRYPT_VERSION_CMP_LINK (3)
|