--- /dev/null
+Makefile
+scanner.c
+scanner.h
+test-header-r
+
--- /dev/null
+# Makefile.in for a single TEST.
+#
+# By default this Makefile will build the target "$(TESTNAME)"
+# from the sources "scanner.l" and "parser.y".
+#
+# $(TESTNAME) is supplied by the calling Makefile.
+# "parser.y" is not necessary. You may delete this file
+# if you do not require a parser.
+# "scanner.l" is necessary. It should build "scanner.c".
+#
+
+@SET_MAKE@
+
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@ -I. -I"@srcdir@" -I..
+DEFS = @DEFS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+SHELL = /bin/sh
+srcdir = @srcdir@
+VPATH = @srcdir@
+LN_S = @LN_S@
+YACC = @YACC@
+CC = @CC@
+AR = ar
+RANLIB = @RANLIB@
+YACC = @YACC@
+
+# Edit these if necessary for your specific test.
+TESTNAME = test-header-r
+FLEX = ../../flex --header="scanner.h"
+YFLAGS = --defines --output-file="parser.c" --name-prefix="test"
+OBJS = scanner.o main.o
+
+# Force YACC to be bison (autoconf generates 'bison -y')
+YACC = @BISON@
+
+all: $(TESTNAME)
+
+$(TESTNAME): $(OBJS)
+ $(CC) $(CFLAGS) -o $(TESTNAME) $(OBJS) $(LDFLAGS) $(LIBS)
+
+scanner.c: $(srcdir)/scanner.l
+ $(FLEX) $(srcdir)/scanner.l
+
+scanner.o: scanner.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c scanner.c
+
+main.o: $(srcdir)/main.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/main.c
+
+test: check
+
+check: $(TESTNAME)
+ ./$(TESTNAME) < $(srcdir)/test.input
+
+distclean: clean
+ rm -f Makefile
+
+clean:
+ rm -f scanner.o scanner.c scanner.h main.o $(TESTNAME) OUTPUT
+
--- /dev/null
+#include "scanner.h"
+
+/* The scanner itself is not important here.
+ * We simply try to use all the functions that are exported in the
+ * header, to see if we get any compiler warnings.
+ */
+int
+main ( int argc, char** argv )
+{
+ yyscan_t scanner;
+ FILE *fp;
+ char * extra = "EXTRA";
+
+ testlex_init(&scanner);
+ testset_in(stdin,scanner);
+ testset_out(stdout,scanner);
+ testset_extra(extra,scanner);
+
+ fp = testget_in(scanner);
+ fp = testget_out(scanner);
+
+ while(testlex(scanner)) {
+ char * text;
+ int line;
+ line = testget_lineno(scanner);
+ text = testget_text(scanner);
+
+ if( (char*)testget_extra(scanner) != extra)
+ break;
+
+ if ( !text || line < 0)
+ continue;
+ }
+ testlex_destroy(scanner);
+ printf("TEST RETURNING OK.\n");
+ return 0;
+}
+
+
+/* vim:set tabstop=8 softtabstop=4 shiftwidth=4: */
--- /dev/null
+%{
+/* Build "scanner.c".
+ The scanner is not important.
+ This test is really about compilation. See "main.c".
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+
+%}
+
+%option reentrant
+%option 8bit outfile="scanner.c" prefix="test"
+%option nounput nomain noyywrap
+%option warn
+
+
+%%
+
+.|\n { }
+
+%%
+
--- /dev/null
+Any input is ok for this scanner.
+We only care if it links.
+