Update flex destroy routines to work for version 2.6 and greater

This commit is contained in:
Cary R 2017-11-16 19:03:34 -08:00
parent d1487c10f1
commit f03033e612
9 changed files with 27 additions and 15 deletions

View File

@ -4,7 +4,7 @@
%{ %{
/* /*
* Copyright (c) 2001-2016 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2017 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -252,7 +252,7 @@ void destroy_lexor(void)
{ {
# ifdef FLEX_SCANNER # ifdef FLEX_SCANNER
# if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5 # if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
# if defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9 # if YY_FLEX_MINOR_VERSION > 5 || defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
yylex_destroy(); yylex_destroy();
# endif # endif
# endif # endif

View File

@ -2119,7 +2119,7 @@ void destroy_lexor(void)
{ {
# ifdef FLEX_SCANNER # ifdef FLEX_SCANNER
# if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5 # if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
# if defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9 # if YY_FLEX_MINOR_VERSION > 5 || defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
yylex_destroy(); yylex_destroy();
# endif # endif
# endif # endif

View File

@ -1628,7 +1628,7 @@ void destroy_lexor()
{ {
# ifdef FLEX_SCANNER # ifdef FLEX_SCANNER
# if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5 # if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
# if defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9 # if YY_FLEX_MINOR_VERSION > 5 || defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
yylex_destroy(); yylex_destroy();
# endif # endif
# endif # endif

View File

@ -6,7 +6,7 @@
%{ %{
/* /*
* Copyright (C) 2011-2013 Stephen Williams (steve@icarus.com) * Copyright (C) 2011-2017 Stephen Williams (steve@icarus.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -79,11 +79,14 @@ void init_fp_lexor(FILE*fd)
yyrestart(fd); yyrestart(fd);
} }
/*
* Modern version of flex (>=2.5.9) can clean up the scanner data.
*/
void destroy_fp_lexor() void destroy_fp_lexor()
{ {
# ifdef FLEX_SCANNER # ifdef FLEX_SCANNER
# if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5 # if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
# if defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9 # if YY_FLEX_MINOR_VERSION > 5 || defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
yylex_destroy(); yylex_destroy();
# endif # endif
# endif # endif

View File

@ -6,7 +6,7 @@
%{ %{
/* /*
* Copyright (c) 2011 Stephen Williams (steve@icarus.com) * Copyright (c) 2011-2017 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -748,7 +748,16 @@ yyscan_t prepare_lexor(FILE*fd)
return scanner; return scanner;
} }
/*
* Modern version of flex (>=2.5.9) can clean up the scanner data.
*/
void destroy_lexor(yyscan_t scanner) void destroy_lexor(yyscan_t scanner)
{ {
# ifdef FLEX_SCANNER
# if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
# if YY_FLEX_MINOR_VERSION > 5 || defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
yylex_destroy(scanner); yylex_destroy(scanner);
# endif
# endif
# endif
} }

View File

@ -5,7 +5,7 @@
%{ %{
/* /*
* Copyright (c) 2007-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2007-2017 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -217,7 +217,7 @@ static void destroy_sdf_lexor(void)
{ {
# ifdef FLEX_SCANNER # ifdef FLEX_SCANNER
# if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5 # if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
# if defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9 # if YY_FLEX_MINOR_VERSION > 5 || defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
yylex_destroy(); yylex_destroy();
# endif # endif
# endif # endif

View File

@ -4,7 +4,7 @@
%{ %{
/* /*
* Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2017 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -199,7 +199,7 @@ void destroy_readmem_lexor(void)
{ {
# ifdef FLEX_SCANNER # ifdef FLEX_SCANNER
# if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5 # if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
# if defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9 # if YY_FLEX_MINOR_VERSION > 5 || defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
yylex_destroy(); yylex_destroy();
# endif # endif
# endif # endif

View File

@ -6,7 +6,7 @@
%{ %{
/* /*
* Copyright (C) 2011-2013 Cary R. (cygcary@yahoo.com) * Copyright (C) 2011-2017 Cary R. (cygcary@yahoo.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -154,7 +154,7 @@ void destroy_tblmod_lexor(void)
{ {
# ifdef FLEX_SCANNER # ifdef FLEX_SCANNER
# if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5 # if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
# if defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9 # if YY_FLEX_MINOR_VERSION > 5 || defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
yylex_destroy(); yylex_destroy();
# endif # endif
# endif # endif

View File

@ -4,7 +4,7 @@
%{ %{
/* /*
* Copyright (c) 2001-2016 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2017 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -333,7 +333,7 @@ void destroy_lexor()
{ {
# ifdef FLEX_SCANNER # ifdef FLEX_SCANNER
# if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5 # if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
# if defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9 # if YY_FLEX_MINOR_VERSION > 5 || defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
yylex_destroy(); yylex_destroy();
# endif # endif
# endif # endif