[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/4] ylwrap: refactoring: don't rely on the file order
From: |
Akim Demaille |
Subject: |
[PATCH 2/4] ylwrap: refactoring: don't rely on the file order |
Date: |
Sat, 14 Jul 2012 10:32:07 +0200 |
Forthcoming changes will make us iterate over the files in a different
order.
lib/ylwrap (first): Remove, replaced by...
(parser): this.
---
lib/ylwrap | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/ylwrap b/lib/ylwrap
index 725b388..4ad820d 100755
--- a/lib/ylwrap
+++ b/lib/ylwrap
@@ -117,6 +117,9 @@ if test -f y_tab.c || test -f y_tab.h; then
y_tab_nodot=true
fi
+# The parser itself, the first file, is the destination of the .y.c
+# rule in the Makefile.
+parser=$1
# The list of file to rename: FROM TO...
pairlist=
# A sed program to s/FROM/TO/g for all the FROM/TO so that, for
@@ -173,7 +176,6 @@ ret=$?
if test $ret -eq 0; then
set X $pairlist
shift
- first=yes
input_rx=`get_dirname "$input" | quote_for_sed`
@@ -207,8 +209,8 @@ if test $ret -eq 0; then
sed -e "/^#/!b" -e "s|$input_rx|$input_sub_rx|" -e "$rename_sed" \
-e "s|$FROM|$TARGET|" "$from" >"$target" || ret=$?
- # Check whether header files must be updated.
- if test $first = no; then
+ # Check whether files must be updated.
+ if test "$from" != "$parser"; then
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
echo "$to is unchanged"
rm -f "$target"
@@ -218,17 +220,15 @@ if test $ret -eq 0; then
fi
fi
else
- # A missing file is only an error for the first file. This
- # is a blatant hack to let us support using "yacc -d". If -d
- # is not specified, we don't want an error when the header
- # file is "missing".
- if test $first = yes; then
+ # A missing file is only an error for the parser. This is a
+ # blatant hack to let us support using "yacc -d". If -d is not
+ # specified, don't fail when the header file is "missing".
+ if test "$from" = "$parser"; then
ret=1
fi
fi
shift
shift
- first=no
done
else
ret=$?
--
1.7.11.1
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, (continued)
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Stefano Lattarini, 2012/07/13
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Akim Demaille, 2012/07/14
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Akim Demaille, 2012/07/14
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Stefano Lattarini, 2012/07/14
- [PATCH 0/4] ylwrap: support C++ and others that generate several files, Akim Demaille, 2012/07/14
- [PATCH 1/4] tests: upgrade and fix Bison test case, Akim Demaille, 2012/07/14
- Re: [PATCH 1/4] tests: upgrade and fix Bison test case, Stefano Lattarini, 2012/07/14
- Re: [PATCH 1/4] tests: upgrade and fix Bison test case, Akim Demaille, 2012/07/14
- Re: [PATCH 1/4] tests: upgrade and fix Bison test case, Stefano Lattarini, 2012/07/14
- Re: [PATCH 1/4] tests: upgrade and fix Bison test case, Akim Demaille, 2012/07/14
- [PATCH 2/4] ylwrap: refactoring: don't rely on the file order,
Akim Demaille <=
- [PATCH 3/4] ylwrap: refactor: move loop invariant, Akim Demaille, 2012/07/14
- [PATCH 4/4] ylwrap: fix C++ support, Akim Demaille, 2012/07/14
- Re: [PATCH 4/4] ylwrap: fix C++ support, Stefano Lattarini, 2012/07/14
- Re: [PATCH 0/4] ylwrap: support C++ and others that generate several files, Stefano Lattarini, 2012/07/14
- Re: [PATCH 0/4] ylwrap: support C++ and others that generate several files, Stefano Lattarini, 2012/07/14
- yacc-work: rebased on maint, one more fixlet (was: Re: [PATCH 0/4] ylwrap: support C++ and others that generate several files), Stefano Lattarini, 2012/07/14
- Re: yacc-work: rebased on maint, one more fixlet (was: Re: [PATCH 0/4] ylwrap: support C++ and others that generate several files), Akim Demaille, 2012/07/14
- Re: yacc-work: rebased on maint, one more fixlet, Stefano Lattarini, 2012/07/14
- Re: [PATCH 0/4] ylwrap: support C++ and others that generate several files, Akim Demaille, 2012/07/14
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Stefano Lattarini, 2012/07/14