Add a script as a front-end for Flex, to work around various problems,
such as the fact that Flex strips all but the last component of the "-o" argument, and that it doesn't generate a header file to declare routines the generated lexical analyzer defines. Use that script when building lexical analyzers, and, for each lexical analyzer, include the generated header file in the generated analyzer. svn path=/trunk/; revision=22446
This commit is contained in:
parent
2d11b0813e
commit
5be4499ad1
|
@ -22,8 +22,4 @@
|
|||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
.l.c:
|
||||
@if [ ! -x "$(LEX)" ]; then \
|
||||
echo "Neither lex nor flex was found"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(LEX) -o$@ $<
|
||||
$(RUNLEX) "$(LEX)" -o$@ $<
|
||||
|
|
|
@ -24,4 +24,4 @@
|
|||
.SUFFIXES: .l
|
||||
|
||||
.l.c:
|
||||
$(LEX) -o$@ $<
|
||||
$(SH) $(RUNLEX) "$(LEX)" -o$@ $<
|
||||
|
|
|
@ -127,10 +127,22 @@ tvbtest: tvbtest.o tvbuff.o except.o strutil.o emem.o
|
|||
exntest: exntest.o except.o
|
||||
$(LINK) $^ $(GLIB_LIBS)
|
||||
|
||||
dtd_grammar.h: dtd_grammar.c
|
||||
RUNLEX=$(top_srcdir)/tools/runlex.sh
|
||||
|
||||
diam_dict_lex.h: diam_dict.c
|
||||
|
||||
dtd_parse_lex.h: dtd_parse.c
|
||||
|
||||
dtd_preparse_lex.h: dtd_preparse.c
|
||||
|
||||
radius_dict_lex.h: radius_dict.c
|
||||
|
||||
uat_load_lex.h: uat_load.c
|
||||
|
||||
LEMON=../tools/lemon
|
||||
|
||||
dtd_grammar.h: dtd_grammar.c
|
||||
|
||||
dtd_grammar.c: dtd_grammar.lemon $(LEMON)/lemon$(EXEEXT)
|
||||
$(LEMON)/lemon$(EXEEXT) t=$(srcdir)/$(LEMON)/lempar.c $(srcdir)/dtd_grammar.lemon
|
||||
|
||||
|
|
|
@ -111,10 +111,15 @@ LIBWIRESHARK_DISTCLEAN_GENERATED_SRC = \
|
|||
#
|
||||
LIBWIRESHARK_NODISTCLEAN_GENERATED_SRC = \
|
||||
diam_dict.c \
|
||||
diam_dict_lex.h \
|
||||
dtd_parse.c \
|
||||
dtd_parse_lex.h \
|
||||
dtd_preparse.c \
|
||||
dtd_preparse_lex.h \
|
||||
radius_dict.c \
|
||||
uat_load.c
|
||||
radius_dict_lex.h \
|
||||
uat_load.c \
|
||||
uat_load_lex.h
|
||||
|
||||
LIBWIRESHARK_GENERATED_SRC = \
|
||||
$(LIBWIRESHARK_DISTCLEAN_GENERATED_SRC) \
|
||||
|
|
|
@ -258,20 +258,26 @@ inet_pton.c: ..\inet_pton.c
|
|||
sminmpec.c: enterprise-numbers make-sminmpec.pl
|
||||
$(PERL) make-sminmpec.pl enterprise-numbers sminmpec.c
|
||||
|
||||
dtd_grammar.h: dtd_grammar.c
|
||||
|
||||
radius_dict.obj : radius_dict.c
|
||||
|
||||
RUNLEX=..\tools\runlex.sh
|
||||
|
||||
diam_dict_lex.h: diam_dict.c
|
||||
diam_dict.obj : diam_dict.c
|
||||
|
||||
dtd_parse_lex.h: dtd_parse.c
|
||||
dtd_parse.obj : dtd_parse.c
|
||||
|
||||
dtd_preparse.obj : dtd_preparse.c
|
||||
dtd_preparse_lex.h: dtd_preparse.c
|
||||
|
||||
radius_dict_lex.h: radius_dict.c
|
||||
radius_dict.obj : radius_dict.c
|
||||
|
||||
uat_load_lex.h: uat_load.c
|
||||
uat_load.obj : uat_load.c
|
||||
|
||||
LEMON=..\tools\lemon
|
||||
|
||||
dtd_grammar.h: dtd_grammar.c
|
||||
dtd_grammar.c: dtd_grammar.lemon $(LEMON)\lemon.exe
|
||||
$(LEMON)\lemon t=$(LEMON)\lempar.c dtd_grammar.lemon
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ DISTCLEANFILES = \
|
|||
|
||||
MAINTAINERCLEANFILES = \
|
||||
Makefile.in \
|
||||
scanner.c
|
||||
scanner.c \
|
||||
scanner_lex.h
|
||||
|
||||
INCLUDES = -I$(srcdir)/../.. -I$(srcdir)/.. -I$(srcdir)/$(LEMON)
|
||||
|
||||
|
@ -86,7 +87,8 @@ libdfilter_la_CFLAGS = $(AM_NON_GENERATED_CFLAGS)
|
|||
libdfilter_generated_la_SOURCES = \
|
||||
grammar.c \
|
||||
grammar.h \
|
||||
scanner.c
|
||||
scanner.c \
|
||||
scanner_lex.h
|
||||
|
||||
libdfilter_la_LIBADD = libdfilter_generated.la
|
||||
libdfilter_la_DEPENDENCIES = libdfilter_generated.la
|
||||
|
@ -96,7 +98,9 @@ EXTRA_DIST = \
|
|||
scanner.l \
|
||||
Makefile.nmake
|
||||
|
||||
scanner.o : scanner.c grammar.h
|
||||
RUNLEX=$(top_srcdir)/tools/runlex.sh
|
||||
|
||||
scanner_lex.h : scanner.c
|
||||
|
||||
LEMON=../../tools/lemon
|
||||
|
||||
|
|
|
@ -58,10 +58,13 @@ clean:
|
|||
# the same for now.
|
||||
#
|
||||
distclean: clean
|
||||
rm -f scanner.c grammar.c grammar.h grammar.out
|
||||
rm -f scanner.c scanner_lex.h grammar.c grammar.h grammar.out
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
RUNLEX=..\..\tools\runlex.sh
|
||||
|
||||
scanner_lex.h : scanner.c
|
||||
scanner.obj : scanner.c grammar.h
|
||||
|
||||
grammar.h : grammar.c
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "syntax-tree.h"
|
||||
#include "grammar.h"
|
||||
#include "dfunctions.h"
|
||||
#include "scanner_lex.h"
|
||||
|
||||
/*
|
||||
* GLib 1.2[.x] doesn't define G_MAXINT32 or G_MININT32; if they're not
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
#include <stdarg.h>
|
||||
#include "emem.h"
|
||||
#include "diam_dict.h"
|
||||
#include "diam_dict_lex.h"
|
||||
|
||||
typedef struct entity_t {
|
||||
char* name;
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "dtd.h"
|
||||
#include "dtd_grammar.h"
|
||||
#include "dtd_parse.h"
|
||||
#include "dtd_parse_lex.h"
|
||||
|
||||
struct _proto_xmlpi_attr {
|
||||
gchar* name;
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include "dtd.h"
|
||||
#include "dtd_preparse_lex.h"
|
||||
|
||||
#define ECHO g_string_append(current,yytext);
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include <errno.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/dissectors/packet-radius.h>
|
||||
#include "radius_dict_lex.h"
|
||||
#define ECHO
|
||||
#define MAX_INCLUDE_DEPTH 10
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
|
||||
#include <epan/emem.h>
|
||||
#include "uat-int.h"
|
||||
#include "uat_load_lex.h"
|
||||
|
||||
static uat_t* uat;
|
||||
static guint colnum;
|
||||
|
|
|
@ -122,6 +122,7 @@ DISTCLEANFILES = \
|
|||
MAINTAINERCLEANFILES = \
|
||||
Makefile.in \
|
||||
mate_parser.c \
|
||||
mate_parser_lex.h \
|
||||
plugin.c
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
@ -132,6 +133,10 @@ EXTRA_DIST = \
|
|||
moduleinfo.nmake \
|
||||
plugin.rc.in
|
||||
|
||||
RUNLEX = $(top_srcdir)/tools/runlex.sh
|
||||
|
||||
mate_parser_lex.h : mate_parser.c
|
||||
|
||||
LEMON = ../../tools/lemon
|
||||
|
||||
mate_grammar.h : mate_grammar.c
|
||||
|
|
|
@ -34,6 +34,7 @@ DISSECTOR_SRC = \
|
|||
DISSECTOR_INCLUDES = \
|
||||
mate.h \
|
||||
mate_grammar.h \
|
||||
mate_parser_lex.h \
|
||||
mate_util.h
|
||||
|
||||
# Dissector helpers. They're included in the source files in this
|
||||
|
|
|
@ -107,10 +107,14 @@ clean:
|
|||
# the same for now.
|
||||
#
|
||||
distclean: clean
|
||||
rm -f mate_parser.c mate_grammar.c mate_grammar.h mate_grammar.out
|
||||
rm -f mate_parser.c mate_parser_lex.h mate_grammar.c \
|
||||
mate_grammar.h mate_grammar.out
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
RUNLEX = ..\..\tools\runlex.sh
|
||||
|
||||
mate_parser_lex.h : mate_parser.c
|
||||
mate_parser.obj : mate_parser.c
|
||||
|
||||
mate_grammar.h : mate_grammar.c
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
|
||||
#include "mate.h"
|
||||
#include "mate_grammar.h"
|
||||
#include "mate_parser_lex.h"
|
||||
|
||||
void MateParser(void*,int, gchar*, mate_config* matecfg);
|
||||
void *MateParserAlloc(void *(*)(gulong));
|
||||
|
|
|
@ -96,6 +96,7 @@ EXTRA_DIST = \
|
|||
msnchat \
|
||||
netscreen2dump.py \
|
||||
pkt-from-core.py \
|
||||
runlex.sh \
|
||||
unix2dos.pl \
|
||||
win32-setup.sh \
|
||||
wireshark_be.py \
|
||||
|
|
|
@ -66,6 +66,7 @@ EXTRA_DIST = \
|
|||
config.h.win32 \
|
||||
Makefile.common \
|
||||
Makefile.nmake \
|
||||
runlex.sh \
|
||||
wtap.def \
|
||||
file_util.c \
|
||||
$(GENERATOR_SOURCES) \
|
||||
|
@ -74,6 +75,12 @@ EXTRA_DIST = \
|
|||
libwiretap_la_LIBADD = libwiretap_generated.la
|
||||
libwiretap_la_DEPENDENCIES = libwiretap_generated.la
|
||||
|
||||
RUNLEX = $(top_srcdir)/runlex.sh
|
||||
|
||||
ascend-scanner_lex.h : ascend-scanner.c
|
||||
|
||||
k12text_lex.h : k12text.c
|
||||
|
||||
ascend-grammar.c : ascend-grammar.y
|
||||
@if [ -z "$(YACC)" ]; then \
|
||||
echo "Neither bison nor byacc has been found"; \
|
||||
|
|
|
@ -123,7 +123,9 @@ GENERATED_C_FILES = \
|
|||
|
||||
# The header files that they generate.
|
||||
GENERATED_HEADER_FILES = \
|
||||
ascend-grammar.h
|
||||
ascend-grammar.h \
|
||||
ascend-scanner_lex.h \
|
||||
k12text_lex.h
|
||||
|
||||
# All the generated files.
|
||||
GENERATED_FILES = $(GENERATED_C_FILES) $(GENERATED_HEADER_FILES)
|
||||
|
|
|
@ -40,13 +40,17 @@ wiretap-$(WTAP_VERSION).dll : $(OBJECTS) wtap.def ..\image\wiretap.res
|
|||
|
||||
$(OBJECTS): config.h
|
||||
|
||||
ascend-grammar.c ascend-grammar.h : ascend-grammar.y
|
||||
$(YACC) $(YACC_OPTS) -d -p ascend ascend-grammar.y -o ascend-grammar.c
|
||||
RUNLEX = ..\runlex.sh
|
||||
|
||||
ascend-scanner_lex.h : ascend-scanner.c
|
||||
ascend-scanner.obj : ascend-scanner.c ascend-grammar.h
|
||||
|
||||
k12text_lex.h : k12text.c
|
||||
k12text.obj : k12text.c
|
||||
|
||||
ascend-grammar.c ascend-grammar.h : ascend-grammar.y
|
||||
$(YACC) $(YACC_OPTS) -d -p ascend ascend-grammar.y -o ascend-grammar.c
|
||||
|
||||
config.h : config.h.win32 ..\config.nmake
|
||||
sed -e s/@VERSION@/$(WTAP_VERSION)/ \
|
||||
-e "s/@HAVE_LIBZ@/$(ZLIB_CONFIG)/" \
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "ascend-grammar.h"
|
||||
#include "ascend-int.h"
|
||||
#include "file_wrappers.h"
|
||||
#include "ascend-scanner_lex.h""
|
||||
|
||||
FILE_T yy_fh;
|
||||
extern char *ascend_ra_ptr;
|
||||
|
@ -61,8 +62,6 @@ extern char *ascend_ra_last;
|
|||
#define YY_INPUT(buf,result,max_size) { int c = file_getc(yy_fh); \
|
||||
result = (c==EOF) ? YY_NULL : (buf[0] = c, 1); }
|
||||
|
||||
#define YY_NEVER_INTERACTIVE 1
|
||||
|
||||
int at_eof;
|
||||
int mul, scratch;
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include "file_wrappers.h"
|
||||
#include "buffer.h"
|
||||
#include "k12.h"
|
||||
#include "k12text_lex.h"
|
||||
|
||||
static guint h;
|
||||
static guint m;
|
||||
|
|
Loading…
Reference in New Issue