-#define MKTAGACTION(the_tag) \
- { gedcom_lval.tag = TO_INTERNAL(yytext); \
- BEGIN(NORMAL); \
- return TAG_##the_tag; \
+#define INIT_LINE_LEN \
+ line_len = 0;
+
+#define CHECK_LINE_LEN \
+ { if (line_len != (size_t)-1) \
+ line_len += strlen(yytext); \
+ if (line_len > MAXGEDCLINELEN * encoding_width) { \
+ gedcom_error("Line too long, max %d characters", \
+ MAXGEDCLINELEN); \
+ line_len = (size_t)-1; \
+ return BADTOKEN; \
+ } \