From: Peter Verthez Date: Sun, 3 Nov 2002 10:10:23 +0000 (+0000) Subject: Added function gedcom_check_version. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=7cbefaec45b82eb0449465da19d38a89f2ff2cf3;hp=92e0840a09f9226d81a22aae95aa7f7d10f3d316;p=gedcom-parse.git Added function gedcom_check_version. --- 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 ***/ /**************************************************************************/