From 617db8c6fc5e647c2daf45754a98f6792c15db03 Mon Sep 17 00:00:00 2001 From: Peter Verthez Date: Sun, 22 Sep 2002 09:19:18 +0000 Subject: [PATCH] Define init function for the lexer. Use lexer sections. --- gedcom/gedcom_1byte.lex | 18 +++++++----------- gedcom/gedcom_hilo.lex | 18 +++++++----------- gedcom/gedcom_lohi.lex | 18 +++++++----------- 3 files changed, 21 insertions(+), 33 deletions(-) diff --git a/gedcom/gedcom_1byte.lex b/gedcom/gedcom_1byte.lex index 6fa1d6b..938a97c 100644 --- a/gedcom/gedcom_1byte.lex +++ b/gedcom/gedcom_1byte.lex @@ -22,7 +22,8 @@ /* $Name$ */ %{ -#undef IN_LEX /* include only a specific part of the following file */ +#define LEX_SECTION 1 /* include only a specific part of the following file */ +#define yymyinit gedcom_1byte_myinit #include "gedcom_lex_common.c" static size_t encoding_width = 1; @@ -53,7 +54,8 @@ pointer @{alphanum}{non_at}+@ %% %{ -#define IN_LEX /* include only a specific part of the following file */ +#undef LEX_SECTION +#define LEX_SECTION 2 /* include only a specific part of the following file */ #include "gedcom_lex_common.c" ACTION_BEFORE_REGEXPS @@ -215,15 +217,9 @@ ACTION_BEFORE_REGEXPS . ACTION_UNEXPECTED %% - -static int exitfuncregistered = 0; - -int yywrap() -{ - if (! exitfuncregistered && atexit(yylex_cleanup) == 0) - exitfuncregistered = 1; - return 1; -} +#undef LEX_SECTION +#define LEX_SECTION 3 /* include only a specific part of the following file */ +#include "gedcom_lex_common.c" #ifdef LEXER_TEST int gedcom_lex() diff --git a/gedcom/gedcom_hilo.lex b/gedcom/gedcom_hilo.lex index a5216bb..a63b408 100644 --- a/gedcom/gedcom_hilo.lex +++ b/gedcom/gedcom_hilo.lex @@ -25,7 +25,8 @@ /* i.e. this is utf-16-be */ %{ -#undef IN_LEX /* include only a specific part of the following file */ +#define LEX_SECTION 1 /* include only a specific part of the following file */ +#define yymyinit gedcom_hilo_myinit #include "gedcom_lex_common.c" static size_t encoding_width = 2; @@ -56,7 +57,8 @@ pointer \x00@{alphanum}{non_at}+\x00@ %% %{ -#define IN_LEX /* include only a specific part of the following file */ +#undef LEX_SECTION +#define LEX_SECTION 2 /* include only a specific part of the following file */ #include "gedcom_lex_common.c" ACTION_BEFORE_REGEXPS @@ -218,15 +220,9 @@ ACTION_BEFORE_REGEXPS . ACTION_UNEXPECTED %% - -static int exitfuncregistered = 0; - -int yywrap() -{ - if (! exitfuncregistered && atexit(yylex_cleanup) == 0) - atexit(yylex_cleanup); - return 1; -} +#undef LEX_SECTION +#define LEX_SECTION 3 /* include only a specific part of the following file */ +#include "gedcom_lex_common.c" #ifdef LEXER_TEST int gedcom_lex() diff --git a/gedcom/gedcom_lohi.lex b/gedcom/gedcom_lohi.lex index a2f82a9..f656ba2 100644 --- a/gedcom/gedcom_lohi.lex +++ b/gedcom/gedcom_lohi.lex @@ -25,7 +25,8 @@ /* i.e. this is utf-16-le */ %{ -#undef IN_LEX /* include only a specific part of the following file */ +#define LEX_SECTION 1 /* include only a specific part of the following file */ +#define yymyinit gedcom_lohi_myinit #include "gedcom_lex_common.c" static size_t encoding_width = 2; @@ -56,7 +57,8 @@ pointer @\x00{alphanum}{non_at}+@\x00 %% %{ -#define IN_LEX /* include only a specific part of the following file */ +#undef LEX_SECTION +#define LEX_SECTION 2 /* include only a specific part of the following file */ #include "gedcom_lex_common.c" ACTION_BEFORE_REGEXPS @@ -218,15 +220,9 @@ ACTION_BEFORE_REGEXPS . ACTION_UNEXPECTED %% - -static int exitfuncregistered = 0; - -int yywrap() -{ - if (! exitfuncregistered && atexit(yylex_cleanup) == 0) - atexit(yylex_cleanup); - return 1; -} +#undef LEX_SECTION +#define LEX_SECTION 3 /* include only a specific part of the following file */ +#include "gedcom_lex_common.c" #ifdef LEXER_TEST int gedcom_lex() -- 2.30.2