+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)
+{
+ compat_enabled = enable_compat;
+}
+
+void set_compatibility(const char* program)
+{
+ /* Reinitialize compatibility */
+ default_charset = "";
+ compatibility = 0;
+
+ if (compat_enabled) {
+ if (! strncmp(program, "ftree", 6)) {
+ gedcom_warning(_("Enabling compatibility with 'ftree'"));
+ compatibility = C_FTREE;
+ }
+ else if (! strncmp(program, "LIFELINES", 9)) {
+ /* Matches "LIFELINES 3.0.2" */
+ gedcom_warning(_("Enabling compatibility with 'Lifelines'"));
+ compatibility = C_LIFELINES;
+ default_charset = "ANSI";
+ }
+ }
+}
+
+int compat_mode(Compat_rule rule)
+{
+ return (compat_matrix[rule] & compatibility);
+}
+