Add a function to retrieve the run-time version info.

This commit is contained in:
Jef Driesen 2010-04-27 14:00:53 +00:00
parent e803369364
commit 0976932501
4 changed files with 46 additions and 0 deletions

View File

@ -48,6 +48,7 @@ libdivecomputer_la_LDFLAGS = \
-export-symbols libdivecomputer.exp
libdivecomputer_la_SOURCES = \
version.c \
device.h device-private.h device.c \
parser.h parser-private.h parser.c \
datetime.h datetime.c \

View File

@ -1,3 +1,5 @@
dc_version
dc_buffer_new
dc_buffer_free
dc_buffer_clear

33
src/version.c Normal file
View File

@ -0,0 +1,33 @@
/*
* libdivecomputer
*
* Copyright (C) 2010 Jef Driesen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#include "version.h"
void
dc_version (dc_version_t *version)
{
if (version) {
version->major = DC_VERSION_MAJOR;
version->minor = DC_VERSION_MINOR;
version->micro = DC_VERSION_MICRO;
version->extra = DC_VERSION_EXTRA;
}
}

View File

@ -31,6 +31,16 @@ extern "C" {
#define DC_VERSION_MICRO @DC_VERSION_MICRO@
#define DC_VERSION_EXTRA "@DC_VERSION_EXTRA@"
typedef struct dc_version_t {
unsigned int major;
unsigned int minor;
unsigned int micro;
const char *extra;
} dc_version_t;
void
dc_version (dc_version_t *version);
#ifdef __cplusplus
}
#endif /* __cplusplus */