diff options
author | Rafał Mużyło <galtgendo@o2.pl> | 2011-08-03 02:51:29 +0200 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2011-08-03 17:15:28 -0400 |
commit | d519434c19d658838322ae95f28e7a19325eba0c (patch) | |
tree | 8f8d3b4202bff059e5613e7c2a900aa7b37c0633 | |
parent | 76c5f905c7178cf76cdf8a5817bb1575d8cdba82 (diff) |
Readd requred flex/bison stuff and fix it for autotools
Signed-off-by: Rafał Mużyło <galtgendo@o2.pl>
Signed-off-by: Matt Turner <mattst88@gmail.com>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/laygram.y | 10 | ||||
-rw-r--r-- | 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 <X11/Xlib.h> #include <X11/Xresource.h> @@ -10,6 +12,9 @@ #include <X11/Xmu/Converters.h> #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); |