Add version ID, in addtion to existing version string.

Closes #253
This commit is contained in:
John McNamara 2019-12-15 13:34:54 +00:00
parent 373ff53382
commit 549076cac6
5 changed files with 36 additions and 3 deletions

View File

@ -122,7 +122,8 @@ function check_versions {
echo
echo "Latest file versions: "
grep -He "[0-9]\.[0-9]\.[0-9]" include/xlsxwriter.h libxlsxwriter.podspec | sed 's/:/ : /g' | awk '{printf " | %-24s %s\n", $1, $5}'
grep -He "[0-9]\.[0-9]\.[0-9]" include/xlsxwriter.h libxlsxwriter.podspec | sed 's/:/ : /g' | awk '{printf " | %-24s %s\n", $1, $5}'
grep -He "LXW_VERSION_ID [0-9][0-9]" include/xlsxwriter.h | sed 's/:/ : /g' | awk '{printf " | %-24s %s\n", $1, $5}'
echo
echo -n "Are the versions up to date? [y/N]: "

View File

@ -24,7 +24,15 @@ while (<>) {
}
my $new_version = $version->stringify();
s/(\d\.\d\.\d)/$new_version/;
s/\d\.\d\.\d/$new_version/;
}
# Increment the LXW_VERSION_ID number in xlsxwriter.h
if (m/LXW_VERSION_ID (\d+)/) {
my $version = $1;
my $new_version = $version + 1;
s/\d+/$new_version/;
}
print;

View File

@ -19,5 +19,6 @@
#include "xlsxwriter/utility.h"
#define LXW_VERSION "0.8.8"
#define LXW_VERSION_ID 88
#endif /* __LXW_XLSXWRITER_H__ */

View File

@ -103,6 +103,20 @@ extern "C" {
*/
const char *lxw_version(void);
/**
* @brief Retrieve the library version ID.
*
* @return The version ID.
*
* Get the library version such as "X.Y.Z" as a XYZ integer.
*
* @code
* printf("Libxlsxwriter version id = %d\n", lxw_version_id());
* @endcode
*
*/
uint16_t lxw_version_id(void);
/**
* @brief Converts a libxlsxwriter error number to a string.
*

View File

@ -562,7 +562,7 @@ lxw_sprintf_dbl(char *data, double number)
#endif
/*
* Retrieve runtime library version
* Retrieve runtime library version.
*/
const char *
lxw_version(void)
@ -570,6 +570,15 @@ lxw_version(void)
return LXW_VERSION;
}
/*
* Retrieve runtime library version ID.
*/
uint16_t
lxw_version_id(void)
{
return LXW_VERSION_ID;
}
/*
* Hash a worksheet password. Based on the algorithm provided by Daniel Rentz
* of OpenOffice.