aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2007-08-04 02:13:52 +0000
committerGuy Harris <guy@alum.mit.edu>2007-08-04 02:13:52 +0000
commit5be4499ad19b66e1626f6c6eb1849803e08126d6 (patch)
tree5f15006cef3d366c1ffb3840f5fda428c28ed2ab
parent2d11b0813e23d01c27975755f39f2457e4da5c90 (diff)
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
-rw-r--r--Makefile.am.inc6
-rw-r--r--Makefile.nmake.inc2
-rw-r--r--epan/Makefile.am14
-rw-r--r--epan/Makefile.common7
-rw-r--r--epan/Makefile.nmake14
-rw-r--r--epan/dfilter/Makefile.am10
-rw-r--r--epan/dfilter/Makefile.nmake5
-rw-r--r--epan/dfilter/scanner.l1
-rw-r--r--epan/diam_dict.l1
-rw-r--r--epan/dtd_parse.l1
-rw-r--r--epan/dtd_preparse.l1
-rw-r--r--epan/radius_dict.l1
-rw-r--r--epan/uat_load.l1
-rw-r--r--plugins/mate/Makefile.am5
-rw-r--r--plugins/mate/Makefile.common1
-rw-r--r--plugins/mate/Makefile.nmake6
-rw-r--r--plugins/mate/mate_parser.l1
-rw-r--r--tools/Makefile.am1
-rw-r--r--wiretap/Makefile.am7
-rw-r--r--wiretap/Makefile.common4
-rw-r--r--wiretap/Makefile.nmake8
-rw-r--r--wiretap/ascend-scanner.l3
-rw-r--r--wiretap/k12text.l1
23 files changed, 79 insertions, 22 deletions
diff --git a/Makefile.am.inc b/Makefile.am.inc
index 00fd7d23f1..3c77dba0d8 100644
--- a/Makefile.am.inc
+++ b/Makefile.am.inc
@@ -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$@ $<
diff --git a/Makefile.nmake.inc b/Makefile.nmake.inc
index 8dc5e2ef0a..545e3c5026 100644
--- a/Makefile.nmake.inc
+++ b/Makefile.nmake.inc
@@ -24,4 +24,4 @@
.SUFFIXES: .l
.l.c:
- $(LEX) -o$@ $<
+ $(SH) $(RUNLEX) "$(LEX)" -o$@ $<
diff --git a/epan/Makefile.am b/epan/Makefile.am
index 402a81e280..1555c790f9 100644
--- a/epan/Makefile.am
+++ b/epan/Makefile.am
@@ -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
diff --git a/epan/Makefile.common b/epan/Makefile.common
index 3d7c12427d..3d5bbde894 100644
--- a/epan/Makefile.common
+++ b/epan/Makefile.common
@@ -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) \
diff --git a/epan/Makefile.nmake b/epan/Makefile.nmake
index dae50a16c2..fbd7c553d5 100644
--- a/epan/Makefile.nmake
+++ b/epan/Makefile.nmake
@@ -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
diff --git a/epan/dfilter/Makefile.am b/epan/dfilter/Makefile.am
index ad45ac4424..50589e2d6f 100644
--- a/epan/dfilter/Makefile.am
+++ b/epan/dfilter/Makefile.am
@@ -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
diff --git a/epan/dfilter/Makefile.nmake b/epan/dfilter/Makefile.nmake
index 3ea7f83037..ed7c50689a 100644
--- a/epan/dfilter/Makefile.nmake
+++ b/epan/dfilter/Makefile.nmake
@@ -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
diff --git a/epan/dfilter/scanner.l b/epan/dfilter/scanner.l
index 9dec41e808..2c0d036e29 100644
--- a/epan/dfilter/scanner.l
+++ b/epan/dfilter/scanner.l
@@ -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
diff --git a/epan/diam_dict.l b/epan/diam_dict.l
index e360672fa9..754bfd6af0 100644
--- a/epan/diam_dict.l
+++ b/epan/diam_dict.l
@@ -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;
diff --git a/epan/dtd_parse.l b/epan/dtd_parse.l
index 99537f6773..c29040ca62 100644
--- a/epan/dtd_parse.l
+++ b/epan/dtd_parse.l
@@ -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;
diff --git a/epan/dtd_preparse.l b/epan/dtd_preparse.l
index 9e558551a1..921b3fda31 100644
--- a/epan/dtd_preparse.l
+++ b/epan/dtd_preparse.l
@@ -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);
diff --git a/epan/radius_dict.l b/epan/radius_dict.l
index fe68cf867c..dcdd5c18a6 100644
--- a/epan/radius_dict.l
+++ b/epan/radius_dict.l
@@ -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
diff --git a/epan/uat_load.l b/epan/uat_load.l
index e82220e70f..e0b131a6f0 100644
--- a/epan/uat_load.l
+++ b/epan/uat_load.l
@@ -63,6 +63,7 @@
#include <epan/emem.h>
#include "uat-int.h"
+#include "uat_load_lex.h"
static uat_t* uat;
static guint colnum;
diff --git a/plugins/mate/Makefile.am b/plugins/mate/Makefile.am
index d4b3af143f..34f45d9347 100644
--- a/plugins/mate/Makefile.am
+++ b/plugins/mate/Makefile.am
@@ -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
diff --git a/plugins/mate/Makefile.common b/plugins/mate/Makefile.common
index 8003e753f4..73432c488f 100644
--- a/plugins/mate/Makefile.common
+++ b/plugins/mate/Makefile.common
@@ -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
diff --git a/plugins/mate/Makefile.nmake b/plugins/mate/Makefile.nmake
index 99f9f93eae..9043776cb1 100644
--- a/plugins/mate/Makefile.nmake
+++ b/plugins/mate/Makefile.nmake
@@ -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
diff --git a/plugins/mate/mate_parser.l b/plugins/mate/mate_parser.l
index 8d1089edee..7d99afcf11 100644
--- a/plugins/mate/mate_parser.l
+++ b/plugins/mate/mate_parser.l
@@ -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));
diff --git a/tools/Makefile.am b/tools/Makefile.am
index a8de4bb7e4..4bb4a22458 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -96,6 +96,7 @@ EXTRA_DIST = \
msnchat \
netscreen2dump.py \
pkt-from-core.py \
+ runlex.sh \
unix2dos.pl \
win32-setup.sh \
wireshark_be.py \
diff --git a/wiretap/Makefile.am b/wiretap/Makefile.am
index 982526e86b..ecfc04692f 100644
--- a/wiretap/Makefile.am
+++ b/wiretap/Makefile.am
@@ -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"; \
diff --git a/wiretap/Makefile.common b/wiretap/Makefile.common
index 4e2fbd5b55..1c67f09826 100644
--- a/wiretap/Makefile.common
+++ b/wiretap/Makefile.common
@@ -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)
diff --git a/wiretap/Makefile.nmake b/wiretap/Makefile.nmake
index 26170c68be..fdf2e627bd 100644
--- a/wiretap/Makefile.nmake
+++ b/wiretap/Makefile.nmake
@@ -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)/" \
diff --git a/wiretap/ascend-scanner.l b/wiretap/ascend-scanner.l
index a586078c63..0d63d63b94 100644
--- a/wiretap/ascend-scanner.l
+++ b/wiretap/ascend-scanner.l
@@ -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;
diff --git a/wiretap/k12text.l b/wiretap/k12text.l
index 6494c5fee9..f69b2d7197 100644
--- a/wiretap/k12text.l
+++ b/wiretap/k12text.l
@@ -62,6 +62,7 @@
#include "file_wrappers.h"
#include "buffer.h"
#include "k12.h"
+#include "k12text_lex.h"
static guint h;
static guint m;