/* HEAD.SOUR */
head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item
- { set_compatibility($4);
+ { set_compatibility_program($4);
$<ctxt>$ = start_element(ELT_HEAD_SOUR, PARENT,
$1, $3, $4,
GEDCOM_MAKE_STRING(val1, $4));
head_sour_subs
{ CHECK0 }
CLOSE
- { end_element(ELT_HEAD_SOUR, PARENT, $<ctxt>5,
+ { compute_compatibility();
+ end_element(ELT_HEAD_SOUR, PARENT, $<ctxt>5,
GEDCOM_MAKE_NULL(val1)); }
;
;
head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item
- { $<ctxt>$ = start_element(ELT_HEAD_SOUR_VERS, PARENT,
+ { set_compatibility_version($4);
+ $<ctxt>$ = start_element(ELT_HEAD_SOUR_VERS, PARENT,
$1, $3, $4,
GEDCOM_MAKE_STRING(val1, $4));
START(VERS, $1, $<ctxt>$)
= start_element(ELT_SUB_ADDR,
par, $1 + 1, $3, $4,
GEDCOM_MAKE_NULL_OR_STRING(val2, $4));
+ reset_buffer(&concat_buffer);
+ safe_buf_append(&concat_buffer, $4);
START(ADDR, $1 + 1, $<ctxt>$);
}
else { START(ADDR, $1, NULL) }
CLOSE
{ if (compat_mode(C_INDI_ADDR)) {
Gedcom_ctxt par = PARENT;
+ char* complete = get_buf_string(&concat_buffer);
end_element(ELT_SUB_ADDR, par, $<ctxt>5,
- GEDCOM_MAKE_NULL(val1));
+ GEDCOM_MAKE_STRING(val1, complete));
CHECK0;
compat_generate_resi_end(PARENT, par);
}
{ $<ctxt>$ = start_element(ELT_SUB_CONT,
PARENT, $1, $3, $4,
GEDCOM_MAKE_STRING(val1, $4));
- SAFE_BUF_ADDCHAR(&concat_buffer, '\n');
+ if (compat_mode(C_NOTE_NO_VALUE)) {
+ char* str = get_buf_string(&concat_buffer);
+ if (str[0] != '\0')
+ SAFE_BUF_ADDCHAR(&concat_buffer, '\n');
+ }
+ else {
+ SAFE_BUF_ADDCHAR(&concat_buffer, '\n');
+ }
safe_buf_append(&concat_buffer, $4);
START(CONT, $1, $<ctxt>$)
}
&& compat_check_551_tag($4.string, &usertag_buffer)) {
$4.string = get_buf_string(&usertag_buffer);
}
+ else if (compat_mode(C_SUBM_COMM) &&
+ compat_check_subm_comm($4.string, get_parenttag(0),
+ &usertag_buffer)) {
+ $4.string = get_buf_string(&usertag_buffer);
+ }
else {
gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
$4);
CLOSE
{ end_element(ELT_USER, PARENT, $<ctxt>7,
GEDCOM_MAKE_NULL(val1));
+ if (compat_mode(C_SUBM_COMM))
+ compat_close_subm_comm();
}
;
user_sects : /* empty */ { }
| user_sects user_sect { }
+ | user_sects gen_sect
+ { if (compat_mode(C_SUBM_COMM)) {
+ }
+ else {
+ gedcom_error(_("Standard tag not allowed in user section"));
+ YYERROR;
+ }
+ }
;
opt_xref : /* empty */ { $$ = NULL; }
;
gen_sect : OPEN DELIM opt_xref anystdtag
- { INVALID_TAG($4.string); }
- opt_value opt_sects CLOSE
- { }
+ { if (compat_mode(C_SUBM_COMM)
+ && compat_check_subm_comm_cont($4.string)) {
+ /* Will pass here */
+ }
+ else {
+ INVALID_TAG($4.string);
+ }
+ }
+ opt_value
+ { if (compat_mode(C_SUBM_COMM)) {
+ $<ctxt>$ = compat_subm_comm_cont_start(PARENT, $6);
+ }
+ }
+ opt_sects CLOSE
+ { if (compat_mode(C_SUBM_COMM))
+ compat_subm_comm_cont_end(PARENT, $<ctxt>7);
+ }
;
gen_rec : gen_rec_top
void push_countarray(int level)
{
int *count = NULL;
- gedcom_debug_print("Push Count level: %d, level: %d\n", count_level, level);
+ gedcom_debug_print("Push Count level: %d, level: %d", count_level, level);
if (count_level != level + 1) {
gedcom_error(_("Internal error: count level mismatch"));
exit(1);
exit(1);
}
else {
- gedcom_debug_print("calloc countarray %d\n", count_level);
+ gedcom_debug_print("calloc countarray %d", count_level);
count = (int *)calloc(YYNTOKENS, sizeof(int));
if (count == NULL) {
gedcom_error(_("Internal error: count array calloc error"));
void pop_countarray()
{
int *count;
- gedcom_debug_print("Pop Count level: %d\n", count_level);
+ gedcom_debug_print("Pop Count level: %d", count_level);
if (count_level < 0) {
gedcom_error(_("Internal error: count array underflow"));
exit(1);
}
else {
count = count_arrays[count_level];
- gedcom_debug_print("free countarray %d\n", count_level);
+ gedcom_debug_print("free countarray %d", count_level);
free(count);
count_arrays[count_level] = NULL;
}
void clean_up()
{
- gedcom_debug_print("Cleanup countarrays\n");
+ gedcom_debug_print("Cleanup countarrays");
while (count_level > 0) {
pop_countarray();
--count_level;