X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gedcom%2Fgedcom_lex_common.c;h=06c1f77a8a5fefb51696d6fb7ac63e9b1c7f917c;hb=d2dbc2834cae06a5de0dec22c0e7a530b7dd1589;hp=149a8a8bda9630855cb7fed8115ac38bd1fdfcec;hpb=9d87c36948e5cc9c90c14bd09b5007c519ed8b4b;p=gedcom-parse.git diff --git a/gedcom/gedcom_lex_common.c b/gedcom/gedcom_lex_common.c index 149a8a8..06c1f77 100644 --- a/gedcom/gedcom_lex_common.c +++ b/gedcom/gedcom_lex_common.c @@ -33,9 +33,10 @@ static size_t encoding_width; static int current_level = -1; -static int level_diff=MAXGEDCLEVEL; +static int level_diff = MAXGEDCLEVEL; static size_t line_len = 0; static int tab_space = 0; +static int current_tag = -1; static struct conv_buffer* ptr_buffer = NULL; static struct conv_buffer* tag_buffer = NULL; @@ -93,10 +94,10 @@ int test_loop(ENCODING enc, const char* code) /* These are defined as functions here, because xgettext has trouble extracting the strings out of long pre-processor defined */ -static void error_line_too_long(const char *line) +static void error_line_too_long() { - gedcom_error(_("Line too long, max %d characters allowed: %s"), - MAXGEDCLINELEN, line); + gedcom_error(_("Line too long, max %d characters allowed"), + MAXGEDCLINELEN); } static void error_level_leading_zero() @@ -162,8 +163,9 @@ static int dummy_conv = 0; #define CHECK_LINE_LEN \ { if (line_len != (size_t)-1) { \ line_len += strlen(yytext); \ - if (line_len > MAXGEDCLINELEN * encoding_width) { \ - error_line_too_long(yytext); \ + if (line_len > MAXGEDCLINELEN * encoding_width \ + && ! compat_long_line(current_level, current_tag)) { \ + error_line_too_long(); \ line_len = (size_t)-1; \ return BADTOKEN; \ } \ @@ -179,10 +181,11 @@ static int dummy_conv = 0; #define MKTAGACTION(THETAG) \ { CHECK_LINE_LEN; \ gedcom_lval.tag.string = TO_INTERNAL(yytext, tag_buffer); \ - gedcom_lval.tag.value = TAG_##THETAG; \ + current_tag = TAG_##THETAG; \ + gedcom_lval.tag.value = current_tag; \ BEGIN(NORMAL); \ line_no++; \ - return TAG_##THETAG; \ + return current_tag; \ } /* The GEDCOM level number is converted into a sequence of opening