X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gedcom%2Fgedcom_lex_common.c;h=68db840b4f645da43fcbd372fd474111bd95d99c;hb=31fb8432ef01f9d5a08cc801a785a07b4e9d12bd;hp=f2fe44afeebf40290175267f3dedefdc4fc33a80;hpb=177218adadc7aa92a1c14e6b8b33080dc77d6e4e;p=gedcom-parse.git diff --git a/gedcom/gedcom_lex_common.c b/gedcom/gedcom_lex_common.c index f2fe44a..68db840 100644 --- a/gedcom/gedcom_lex_common.c +++ b/gedcom/gedcom_lex_common.c @@ -26,6 +26,7 @@ #include "gedcom_internal.h" #include "multilex.h" #include "encoding.h" +#include "encoding_state.h" #include "gedcom.h" #include "gedcom.tabgen.h" #include "compat.h" @@ -46,7 +47,6 @@ static struct conv_buffer* str_buffer = NULL; #ifdef LEXER_TEST YYSTYPE gedcom_lval; int line_no = 1; -int compat_at = 0; int gedcom_lex(); @@ -92,9 +92,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() +static void error_line_too_long(const char *line) { - gedcom_error(_("Line too long, max %d characters allowed"), MAXGEDCLINELEN); + gedcom_error(_("Line too long, max %d characters allowed: %s"), + MAXGEDCLINELEN, line); } static void error_level_leading_zero() @@ -156,7 +157,7 @@ static int dummy_conv = 0; { if (line_len != (size_t)-1) { \ line_len += strlen(yytext); \ if (line_len > MAXGEDCLINELEN * encoding_width) { \ - error_line_too_long(); \ + error_line_too_long(yytext); \ line_len = (size_t)-1; \ return BADTOKEN; \ } \ @@ -336,6 +337,8 @@ static int dummy_conv = 0; #define ACTION_TERMINATOR \ { CHECK_LINE_LEN; \ INIT_LINE_LEN; \ + if (line_no == 1) \ + set_read_encoding_terminator(TO_INTERNAL(yytext, str_buffer)); \ BEGIN(INITIAL); \ } @@ -361,7 +364,7 @@ static int dummy_conv = 0; } #define ACTION_NORMAL_AT \ - { if (compat_at) { \ + { if (compat_mode(C_NO_DOUBLE_AT)) { \ int i, j; \ char *yycopy = strdup(yytext); \ if (yycopy) { \