version.h revision 263285
1295016Sjkim/**
2183234Ssimon * \file        lzma/version.h
3183234Ssimon * \brief       Version number
4183234Ssimon */
5183234Ssimon
6183234Ssimon/*
7183234Ssimon * Author: Lasse Collin
8183234Ssimon *
9183234Ssimon * This file has been put into the public domain.
10280304Sjkim * You can do whatever you want with this file.
11183234Ssimon *
12183234Ssimon * See ../lzma.h for information about liblzma as a whole.
13183234Ssimon */
14183234Ssimon
15183234Ssimon#ifndef LZMA_H_INTERNAL
16183234Ssimon#	error Never include this file directly. Use <lzma.h> instead.
17183234Ssimon#endif
18183234Ssimon
19183234Ssimon
20183234Ssimon/*
21183234Ssimon * Version number split into components
22183234Ssimon */
23183234Ssimon#define LZMA_VERSION_MAJOR 5
24183234Ssimon#define LZMA_VERSION_MINOR 0
25183234Ssimon#define LZMA_VERSION_PATCH 5
26183234Ssimon#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
27183234Ssimon
28183234Ssimon#ifndef LZMA_VERSION_COMMIT
29183234Ssimon#	define LZMA_VERSION_COMMIT ""
30183234Ssimon#endif
31183234Ssimon
32183234Ssimon
33183234Ssimon/*
34183234Ssimon * Map symbolic stability levels to integers.
35183234Ssimon */
36183234Ssimon#define LZMA_VERSION_STABILITY_ALPHA 0
37183234Ssimon#define LZMA_VERSION_STABILITY_BETA 1
38183234Ssimon#define LZMA_VERSION_STABILITY_STABLE 2
39183234Ssimon
40183234Ssimon
41183234Ssimon/**
42183234Ssimon * \brief       Compile-time version number
43183234Ssimon *
44183234Ssimon * The version number is of format xyyyzzzs where
45183234Ssimon *  - x = major
46183234Ssimon *  - yyy = minor
47183234Ssimon *  - zzz = revision
48183234Ssimon *  - s indicates stability: 0 = alpha, 1 = beta, 2 = stable
49183234Ssimon *
50183234Ssimon * The same xyyyzzz triplet is never reused with different stability levels.
51183234Ssimon * For example, if 5.1.0alpha has been released, there will never be 5.1.0beta
52183234Ssimon * or 5.1.0 stable.
53183234Ssimon *
54183234Ssimon * \note        The version number of liblzma has nothing to with
55183234Ssimon *              the version number of Igor Pavlov's LZMA SDK.
56183234Ssimon */
57280304Sjkim#define LZMA_VERSION (LZMA_VERSION_MAJOR * UINT32_C(10000000) \
58183234Ssimon		+ LZMA_VERSION_MINOR * UINT32_C(10000) \
59183234Ssimon		+ LZMA_VERSION_PATCH * UINT32_C(10) \
60183234Ssimon		+ LZMA_VERSION_STABILITY)
61183234Ssimon
62183234Ssimon
63183234Ssimon/*
64280304Sjkim * Macros to construct the compile-time version string
65183234Ssimon */
66183234Ssimon#if LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_ALPHA
67183234Ssimon#	define LZMA_VERSION_STABILITY_STRING "alpha"
68183234Ssimon#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_BETA
69183234Ssimon#	define LZMA_VERSION_STABILITY_STRING "beta"
70183234Ssimon#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_STABLE
71280304Sjkim#	define LZMA_VERSION_STABILITY_STRING ""
72183234Ssimon#else
73183234Ssimon#	error Incorrect LZMA_VERSION_STABILITY
74183234Ssimon#endif
75183234Ssimon
76183234Ssimon#define LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) \
77183234Ssimon		#major "." #minor "." #patch stability commit
78183234Ssimon
79183234Ssimon#define LZMA_VERSION_STRING_C(major, minor, patch, stability, commit) \
80183234Ssimon		LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit)
81183234Ssimon
82183234Ssimon
83183234Ssimon/**
84183234Ssimon * \brief       Compile-time version as a string
85183234Ssimon *
86280304Sjkim * This can be for example "4.999.5alpha", "4.999.8beta", or "5.0.0" (stable
87183234Ssimon * versions don't have any "stable" suffix). In future, a snapshot built
88183234Ssimon * from source code repository may include an additional suffix, for example
89280304Sjkim * "4.999.8beta-21-g1d92". The commit ID won't be available in numeric form
90183234Ssimon * in LZMA_VERSION macro.
91183234Ssimon */
92183234Ssimon#define LZMA_VERSION_STRING LZMA_VERSION_STRING_C( \
93183234Ssimon		LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, \
94183234Ssimon		LZMA_VERSION_PATCH, LZMA_VERSION_STABILITY_STRING, \
95183234Ssimon		LZMA_VERSION_COMMIT)
96183234Ssimon
97183234Ssimon
98183234Ssimon/* #ifndef is needed for use with windres (MinGW or Cygwin). */
99183234Ssimon#ifndef LZMA_H_INTERNAL_RC
100183234Ssimon
101280304Sjkim/**
102183234Ssimon * \brief       Run-time version number as an integer
103183234Ssimon *
104183234Ssimon * Return the value of LZMA_VERSION macro at the compile time of liblzma.
105183234Ssimon * This allows the application to compare if it was built against the same,
106183234Ssimon * older, or newer version of liblzma that is currently running.
107183234Ssimon */
108238405Sjkimextern LZMA_API(uint32_t) lzma_version_number(void)
109238405Sjkim		lzma_nothrow lzma_attr_const;
110183234Ssimon
111183234Ssimon
112183234Ssimon/**
113280304Sjkim * \brief       Run-time version as a string
114280304Sjkim *
115280304Sjkim * This function may be useful if you want to display which version of
116280304Sjkim * liblzma your application is currently using.
117280304Sjkim */
118280304Sjkimextern LZMA_API(const char *) lzma_version_string(void)
119		lzma_nothrow lzma_attr_const;
120
121#endif
122