From 0976932501036f43a696fc22326d9c15909857a1 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 27 Apr 2010 14:00:53 +0000 Subject: [PATCH] Add a function to retrieve the run-time version info. --- src/Makefile.am | 1 + src/libdivecomputer.symbols | 2 ++ src/version.c | 33 +++++++++++++++++++++++++++++++++ src/version.h.in | 10 ++++++++++ 4 files changed, 46 insertions(+) create mode 100644 src/version.c diff --git a/src/Makefile.am b/src/Makefile.am index 7a80258..2074660 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 \ diff --git a/src/libdivecomputer.symbols b/src/libdivecomputer.symbols index 2434289..f6aa360 100644 --- a/src/libdivecomputer.symbols +++ b/src/libdivecomputer.symbols @@ -1,3 +1,5 @@ +dc_version + dc_buffer_new dc_buffer_free dc_buffer_clear diff --git a/src/version.c b/src/version.c new file mode 100644 index 0000000..ec0ef20 --- /dev/null +++ b/src/version.c @@ -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; + } +} diff --git a/src/version.h.in b/src/version.h.in index 1231cd0..e7c5491 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -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 */