X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gedcom%2Fcompat.c;fp=gedcom%2Fcompat.c;h=8b5ed50f3e1e8dd414651ee64d7ac9a7282ee89b;hb=a6ae7b8ee65f561b8ba9b189cf3e9504831621da;hp=507de09e6676b6ada5f306fa060081677fb1cd1a;hpb=b36e33a2c0f64b90622db8e59f5664b2a0b4dbc6;p=gedcom-parse.git diff --git a/gedcom/compat.c b/gedcom/compat.c index 507de09..8b5ed50 100644 --- a/gedcom/compat.c +++ b/gedcom/compat.c @@ -30,7 +30,6 @@ int compat_enabled = 1; int compatibility = 0; -int compat_at = 0; const char* default_charset = ""; #define SUBMITTER_LINK "@__COMPAT__SUBM__@" @@ -38,6 +37,11 @@ const char* default_charset = ""; #define DEFAULT_GEDCOM_VERS "5.5" #define DEFAULT_GEDCOM_FORM "LINEAGE-LINKED" +enum _COMPAT { + C_FTREE = 0x01, + C_LIFELINES = 0x02 +}; + /* Incompatibility list (with GEDCOM 5.5): - ftree: @@ -54,6 +58,18 @@ const char* default_charset = ""; - lots of missing required values */ +int compat_matrix[] = +{ + /* C_NO_SUBMITTER */ C_FTREE | C_LIFELINES, + /* C_INDI_ADDR */ C_FTREE, + /* C_NOTE_NO_VALUE */ C_FTREE, + /* C_NO_GEDC */ C_LIFELINES, + /* C_NO_CHAR */ C_LIFELINES, + /* C_HEAD_TIME */ C_LIFELINES, + /* C_NO_DOUBLE_AT */ C_LIFELINES, + /* C_NO_REQUIRED_VALUES */ C_LIFELINES +}; + /* Compatibility handling */ void gedcom_set_compat_handling(int enable_compat) @@ -64,7 +80,6 @@ void gedcom_set_compat_handling(int enable_compat) void set_compatibility(const char* program) { /* Reinitialize compatibility */ - compat_at = 0; default_charset = ""; compatibility = 0; @@ -78,14 +93,13 @@ void set_compatibility(const char* program) gedcom_warning(_("Enabling compatibility with 'Lifelines'")); compatibility = C_LIFELINES; default_charset = "ANSI"; - compat_at = 1; } } } -int compat_mode(int compat_flags) +int compat_mode(Compat_rule rule) { - return (compat_flags & compatibility); + return (compat_matrix[rule] & compatibility); } void compat_generate_submitter_link(Gedcom_ctxt parent)