From 7cbefaec45b82eb0449465da19d38a89f2ff2cf3 Mon Sep 17 00:00:00 2001 From: Peter Verthez Date: Sun, 3 Nov 2002 10:10:23 +0000 Subject: [PATCH] Added function gedcom_check_version. --- gedcom/multilex.c | 16 ++++++++++++++++ include/gedcom.h.in | 3 +++ 2 files changed, 19 insertions(+) diff --git a/gedcom/multilex.c b/gedcom/multilex.c index 5b0aa4e..7556311 100644 --- a/gedcom/multilex.c +++ b/gedcom/multilex.c @@ -215,3 +215,19 @@ int gedcom_new_model() } return result; } + +int gedcom_check_version(int major, int minor, int patch) +{ + if (major < GEDCOM_PARSE_VERSION_MAJOR) + return 1; + else if (major > GEDCOM_PARSE_VERSION_MAJOR) + return 0; + else if (minor < GEDCOM_PARSE_VERSION_MINOR) + return 1; + else if (minor > GEDCOM_PARSE_VERSION_MINOR) + return 0; + else if (patch <= GEDCOM_PARSE_VERSION_PATCH) + return 1; + else { + return 0; +} diff --git a/include/gedcom.h.in b/include/gedcom.h.in index 263f9fb..f9a6bd4 100644 --- a/include/gedcom.h.in +++ b/include/gedcom.h.in @@ -37,9 +37,12 @@ extern "C" { #define GEDCOM_PARSE_VERSION_MAJOR @VERSION_MAJOR@ #define GEDCOM_PARSE_VERSION_MINOR @VERSION_MINOR@ +#define GEDCOM_PARSE_VERSION_PATCH 0 #define GEDCOM_PARSE_VERSION \ (GEDCOM_PARSE_VERSION_MAJOR * 1000 + GEDCOM_PARSE_VERSION_MINOR) +int gedcom_check_version(int major, int minor, int patch); + /**************************************************************************/ /*** First the records and elements to subscribe upon ***/ /**************************************************************************/ -- 2.30.2