From d519434c19d658838322ae95f28e7a19325eba0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mu=C5=BCy=C5=82o?= Date: Wed, 3 Aug 2011 02:51:29 +0200 Subject: Readd requred flex/bison stuff and fix it for autotools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Mużyło Signed-off-by: Matt Turner --- configure.ac | 2 ++ src/Makefile.am | 4 +++- src/laygram.y | 10 +++++++--- src/laylex.l | 25 ++++++++++++------------- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 80931fc..f70e53f 100644 --- a/configure.ac +++ b/configure.ac @@ -7,6 +7,8 @@ AC_CONFIG_SRCDIR([Makefile.am]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE +AC_PROG_LEX +AC_PROG_YACC # Initialize libtool AC_PROG_LIBTOOL diff --git a/src/Makefile.am b/src/Makefile.am index 7766657..1072bdd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -53,7 +53,9 @@ libXaw3d_la_SOURCES = \ Xaw3dP.c \ XawI18n.c \ XawIm.c \ - XawInit.c + XawInit.c \ + laygram.y \ + laylex.l libXaw3d_la_CFLAGS = \ $(CWARNFLAGS) diff --git a/src/laygram.y b/src/laygram.y index b17dc17..1ac05a0 100644 --- a/src/laygram.y +++ b/src/laygram.y @@ -1,3 +1,5 @@ +%name-prefix "LayYY" +%defines %{ #include #include @@ -10,6 +12,9 @@ #include #include "LayoutP.h" +#define yysetdest LayYYsetdest +#define yywrap LayYYwrap + static LayoutPtr *dest; %} @@ -251,13 +256,12 @@ orientation : VERTICAL ; %% -int yywrap () +int yywrap (void) { return 1; } -void yysetdest (c) - LayoutPtr *c; +void yysetdest (LayoutPtr *c) { dest = c; } diff --git a/src/laylex.l b/src/laylex.l index c7dced9..8aa19ef 100644 --- a/src/laylex.l +++ b/src/laylex.l @@ -1,4 +1,5 @@ - +%option prefix="LayYY" +%option outfile="lex.yy.c" %{ #ifndef FLEX_SCANNER #undef input @@ -12,6 +13,11 @@ #include "LayoutP.h" #include "laygram.h" + +#define yylval LayYYlval +#define yyerror LayYYerror +#define yysetsource LayYYsetsource + static char *yysourcebase, *yysource; #ifndef FLEX_SCANNER @@ -23,9 +29,7 @@ static void my_yyinput(char *buf, int *result, int max_size); #define YY_INPUT(buf, res, max) my_yyinput(buf, &(res), max) #endif -#ifdef __STDC__ -static int count (); -#endif +static int count (char *s, char c); %} %% vertical return VERTICAL; @@ -75,9 +79,7 @@ height return HEIGHT; %% static int -count (s, c) - char *s; - char c; +count (char *s, char c) { int i = 0; while (*s) @@ -86,14 +88,12 @@ count (s, c) return i; } -yysetsource(s) - char *s; +void yysetsource(char *s) { yysourcebase = yysource = s; } -yyerror(s) - char *s; +void yyerror(char *s) { char *t; @@ -115,8 +115,7 @@ yyerror(s) #ifdef FLEX_SCANNER static void -my_yyinput(buf, result, max_size) - char *buf; int *result; int max_size; +my_yyinput(char *buf, int *result, int max_size) { int size = max_size < strlen(yysource) ? max_size : strlen(yysource); -- cgit v1.2.3