summaryrefslogtreecommitdiffstats
path: root/grammar
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-07-05 08:21:04 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-07-05 08:21:04 +0200
commit641e383b8ad13ad6ee7fd9241214e24e6a983500 (patch)
treea8894d68d658c9863a82e88ab84fec4fcc774f50 /grammar
parent183641a091a3d7b5eabe4419db4ebd2b6f84934e (diff)
downloadrsyslog-641e383b8ad13ad6ee7fd9241214e24e6a983500.tar.gz
rsyslog-641e383b8ad13ad6ee7fd9241214e24e6a983500.tar.xz
rsyslog-641e383b8ad13ad6ee7fd9241214e24e6a983500.zip
milestone: grammar integrated in rsyslog build system
Diffstat (limited to 'grammar')
-rw-r--r--grammar/Makefile.am7
-rw-r--r--grammar/makefile.stand-alone (renamed from grammar/makefile)4
-rw-r--r--grammar/rscript-lex.l (renamed from grammar/rscript.l)12
-rw-r--r--grammar/utils.c4
4 files changed, 22 insertions, 5 deletions
diff --git a/grammar/Makefile.am b/grammar/Makefile.am
new file mode 100644
index 00000000..b2bd3430
--- /dev/null
+++ b/grammar/Makefile.am
@@ -0,0 +1,7 @@
+noinst_LTLIBRARIES = libgrammar.la
+
+libgrammar_la_SOURCES = \
+ utils.c \
+ utils.h \
+ rscript-lex.l \
+ rscript.y
diff --git a/grammar/makefile b/grammar/makefile.stand-alone
index eb6c9522..b998a39d 100644
--- a/grammar/makefile
+++ b/grammar/makefile.stand-alone
@@ -1,5 +1,5 @@
rscript: lex.yy.c utils.o rscript.tab.h utils.h
- gcc -g -o rscript lex.yy.c rscript.tab.c utils.o -lestr
+ gcc -DSTAND_ALONE -g -o rscript lex.yy.c rscript.tab.c utils.o -lestr
lex.yy.c: rscript.l rscript.tab.h
flex rscript.l
@@ -8,7 +8,7 @@ rscript.tab.h: rscript.y
bison -d rscript.y
utils.o: utils.c utils.h
- gcc -g -Wall -c utils.c
+ gcc -g -DSTAND_ALONE -Wall -c utils.c
clean:
rm *.o
diff --git a/grammar/rscript.l b/grammar/rscript-lex.l
index a7410b15..1c7b963e 100644
--- a/grammar/rscript.l
+++ b/grammar/rscript-lex.l
@@ -16,6 +16,10 @@
%option noyywrap nodefault case-insensitive yylineno
/*%option noyywrap nodefault case-insensitive */
+/* avoid compiler warning: `yyunput' defined but not used */
+%option nounput noinput
+
+
%x INOBJ
/* INOBJ is selected if we are inside an object (name/value pairs!) */
%x COMMENT
@@ -51,6 +55,9 @@ struct bufstack {
} *currbs = NULL;
char *currfn; /* name of currently processed file */
+
+int popfile(void);
+int cnfSetLexFile(char *fname);
%}
%%
@@ -163,7 +170,8 @@ char *currfn; /* name of currently processed file */
%%
/* set a new buffers. Returns 0 on success, something else otherwise. */
-int cnfSetLexFile(char *fname)
+int
+cnfSetLexFile(char *fname)
{
es_str_t *str = NULL;
FILE *fp;
@@ -192,7 +200,7 @@ int cnfSetLexFile(char *fname)
currbs->lineno = yylineno;
bs->prev = currbs;
bs->fn = strdup(fname);
- bs->bs = yy_scan_buffer(es_getBufAddr(str), es_strlen(str));
+ bs->bs = yy_scan_buffer((char*)es_getBufAddr(str), es_strlen(str));
currbs = bs;
currfn = bs->fn;
yylineno = 1;
diff --git a/grammar/utils.c b/grammar/utils.c
index 16cad201..e488ebda 100644
--- a/grammar/utils.c
+++ b/grammar/utils.c
@@ -389,7 +389,7 @@ cnfexprEval(struct cnfexpr *expr, struct exprret *ret)
}
inline static void
-doIndent(indent)
+doIndent(int indent)
{
int i;
for(i = 0 ; i < indent ; ++i)
@@ -611,6 +611,7 @@ cnffuncNew(es_str_t *fname, struct cnffparamlst* paramlst)
}
/* debug helper */
+#ifdef STAND_ALONE
void
cstrPrint(char *text, es_str_t *estr)
{
@@ -632,4 +633,5 @@ main(int argc, char *argv[])
printf("yyparse() returned %d\n", r);
return r;
}
+#endif /* #ifdef STAND_ALONE */