X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gedcom%2Fgedcom.y;h=f853e7d3b85c4160662bb898047c3e7ecf97bce4;hb=659013d3a740e6735ade47b082ed6574361c1000;hp=ef95178d08664ece62d34a5cc91a6ced0adb1415;hpb=9b401c855f1eb0cf21c99a9ad8b67aee16e06be6;p=gedcom-parse.git diff --git a/gedcom/gedcom.y b/gedcom/gedcom.y index ef95178..f853e7d 100644 --- a/gedcom/gedcom.y +++ b/gedcom/gedcom.y @@ -1234,6 +1234,8 @@ indi_addr_sect : OPEN DELIM TAG_ADDR opt_line_item = 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, $$); } else { START(ADDR, $1, NULL) } @@ -1243,8 +1245,9 @@ indi_addr_sect : OPEN DELIM TAG_ADDR opt_line_item CLOSE { if (compat_mode(C_INDI_ADDR)) { Gedcom_ctxt par = PARENT; + char* complete = get_buf_string(&concat_buffer); end_element(ELT_SUB_ADDR, par, $5, - GEDCOM_MAKE_NULL(val1)); + GEDCOM_MAKE_STRING(val1, complete)); CHECK0; compat_generate_resi_end(PARENT, par); } @@ -2282,7 +2285,14 @@ cont_sect : OPEN DELIM TAG_CONT mand_line_item { $$ = 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, $$) } @@ -3997,7 +4007,7 @@ Gedcom_ctxt ctxt_stack[MAXGEDCLEVEL+1]; 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); @@ -4007,7 +4017,7 @@ void push_countarray(int level) 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")); @@ -4054,14 +4064,14 @@ int check_occurrence(int tag) 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; } @@ -4069,7 +4079,7 @@ void pop_countarray() void clean_up() { - gedcom_debug_print("Cleanup countarrays\n"); + gedcom_debug_print("Cleanup countarrays"); while (count_level > 0) { pop_countarray(); --count_level;