+/** This function starts a new model. It does this by parsing the \c new.ged
+ file in the data directory of the library (\c $PREFIX/share/gedcom-parse).
+ This can be used to start from an empty model, and to build up the model
+ by adding new records yourself.
+
+ \retval 0 on success
+ \retval nonzero on errors (mainly the errors from \ref gedcom_parse_file()).
+ */
+
+int gedcom_new_model()
+{
+ int result = 1;
+ FILE* file;
+
+ file = fopen(NEW_MODEL_FILE, "r");
+ if (file) {
+ fclose(file);
+ result = gedcom_parse_file(NEW_MODEL_FILE);
+ }
+ else {
+ char* filename = (char*) malloc(strlen(PKGDATADIR) + strlen(NEW_MODEL_FILE)
+ + 2);
+ if (!filename)
+ MEMORY_ERROR;
+ else {
+ sprintf(filename, "%s/%s", PKGDATADIR, NEW_MODEL_FILE);
+ result = gedcom_parse_file(filename);
+ free(filename);
+ }
+ }
+ 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;
+}