[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
52-yacc-am.patch
From: |
Akim Demaille |
Subject: |
52-yacc-am.patch |
Date: |
Mon, 19 Mar 2001 10:21:02 +0100 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* automake.in (&condition_negate): New.
(&variable_conditions_permutations): Use it.
(&read_am_file, &file_contents): Use it on `else' clauses to
support `if FALSE'.
(&output_yacc_build_rule): Output this...
* yacc.am: New file.
Index: Makefile.am
--- Makefile.am Tue, 06 Mar 2001 00:51:06 +0100 akim (am/f/46_Makefile.a 1.16
644)
+++ Makefile.am Sun, 11 Mar 2001 20:15:07 +0100 akim (am/f/46_Makefile.a 1.16
644)
@@ -16,7 +16,7 @@
kr-extra.am library.am libs.am libtool.am lisp.am ltlib.am \
ltlibrary.am mans-vars.am mans.am multilib.am program.am progs.am \
python.am remake-hdr.am remake.am scripts.am subdirs.am tags.am \
-texi-vers.am texibuild.am texinfos.am
+texi-vers.am texibuild.am texinfos.am yacc.am
dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \
$(amfiles)
Index: Makefile.in
--- Makefile.in Sun, 11 Mar 2001 19:50:31 +0100 akim (am/h/16_Makefile.i 1.45
644)
+++ Makefile.in Sun, 11 Mar 2001 20:15:13 +0100 akim (am/h/16_Makefile.i 1.45
644)
@@ -90,7 +90,7 @@
kr-extra.am library.am libs.am libtool.am lisp.am ltlib.am \
ltlibrary.am mans-vars.am mans.am multilib.am program.am progs.am \
python.am remake-hdr.am remake.am scripts.am subdirs.am tags.am \
-texi-vers.am texibuild.am texinfos.am
+texi-vers.am texibuild.am texinfos.am yacc.am
dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \
Index: automake.in
--- automake.in Sun, 11 Mar 2001 19:50:31 +0100 akim (am/f/39_automake.i 1.170
755)
+++ automake.in Sun, 11 Mar 2001 20:10:34 +0100 akim (am/f/39_automake.i 1.170
755)
@@ -1500,23 +1500,10 @@ sub output_yacc_build_rule
push (@suffixes, $yacc_suffix, $c_suffix);
# Generate rule for c/c++.
- $output_rules .= "$yacc_suffix$c_suffix:\n\t";
-
- if ($use_ylwrap)
- {
- $output_rules .= ('$(SHELL) $(YLWRAP)'
- . ' "$(YACC)" $< y.tab.c $*' . $c_suffix
- . ' y.tab.h $*.h -- $(AM_YFLAGS) $(YFLAGS)');
- }
- else
- {
- $output_rules .= ('$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*'
- . $c_suffix . "\n"
- . "\tif test -f y.tab.h; then \\\n"
- . "\tif cmp -s y.tab.h \$*.h; then rm -f y.tab.h;
else mv y.tab.h \$*.h; fi; \\\n"
- . "\telse :; fi");
- }
- $output_rules .= "\n";
+ $output_rules .= &file_contents ('yacc',
+ ('YACC_SUFFIX' => $yacc_suffix,
+ 'C_SUFFIX' => $c_suffix,
+ 'YLWRAP' => $use_ylwrap));
}
sub output_lex_build_rule
@@ -5589,6 +5576,19 @@ sub conditionals_true_when (@@)
return 1;
}
+
+sub condition_negate ($)
+{
+ my ($cond) = @_;
+
+ $cond =~ s/TRUE$/TRUEO/;
+ $cond =~ s/FALSE$/TRUE/;
+ $cond =~ s/TRUEO$/FALSE/;
+
+ return $cond;
+}
+
+
# Check for an ambiguous conditional. This is called when a variable
# or target is being defined conditionally. If we already know about
# a definition that is true under the same conditions, then we have an
@@ -5967,10 +5967,8 @@ sub variable_conditions_permutations
my $comp = shift (@comps);
return &variable_conditions_permutations (@comps)
if $comp eq '';
- my $neg = $comp;
- $neg =~ s/TRUE$/TRUEO/;
- $neg =~ s/FALSE$/TRUE/;
- $neg =~ s/TRUEO$/FALSE/;
+ my $neg = condition_negate ($comp);
+
my @ret;
foreach my $sub (&variable_conditions_permutations (@comps))
{
@@ -6459,14 +6457,14 @@ sub read_am_file
{
&am_line_error ($., "else without if");
}
- elsif ($conditional_stack[$#conditional_stack] =~ /^(.*_)?FALSE$/)
+ elsif ($conditional_stack[$#conditional_stack] =~ /_FALSE$/)
{
&am_line_error ($., "else after else");
}
else
{
$conditional_stack[$#conditional_stack]
- =~ s/TRUE$/FALSE/;
+ = condition_negate ($conditional_stack[$#conditional_stack]);
$cond = conditional_string (@conditional_stack);
}
}
@@ -6827,14 +6825,15 @@ sub file_contents_internal ($%)
{
&am_error ("else without if");
}
- elsif ($cond_stack[$#cond_stack] =~ /^(.*_)?FALSE$/)
+ elsif ($cond_stack[$#cond_stack] =~ /_FALSE$/)
{
&am_error ("else after else");
}
else
{
- $cond_stack[$#cond_stack] =~ s/TRUE$/FALSE/;
- $cond = conditional_string (@cond_stack);
+ $cond_stack[$#cond_stack] =
+ condition_negate ($cond_stack[$#cond_stack]);
+ $cond = conditional_string (@cond_stack);
}
}
elsif (/$ENDIF_PATTERN/o)
Index: automake.in
--- automake.in Sun, 11 Mar 2001 20:15:57 +0100 akim (am/f/39_automake.i 1.171
755)
+++ automake.in Sun, 11 Mar 2001 20:20:45 +0100 akim (am/f/39_automake.i 1.171
755)
@@ -1495,9 +1495,7 @@ sub output_yacc_build_rule
{
my ($yacc_suffix, $use_ylwrap) = @_;
- my $c_suffix = $yacc_suffix;
- $c_suffix =~ tr/y/c/;
- push (@suffixes, $yacc_suffix, $c_suffix);
+ (my $c_suffix = $yacc_suffix) =~ tr/y/c/;
# Generate rule for c/c++.
$output_rules .= &file_contents ('yacc',
Index: yacc.am
--- yacc.am Sun, 11 Mar 2001 20:15:17 +0100 akim ()
+++ yacc.am Sun, 11 Mar 2001 19:59:21 +0100 akim (am/h/35_yacc.am 644)
@@ -0,0 +1,30 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright 1998, 1999, 2001 Free Software Foundation, Inc.
+
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+
+## Generate rule for c/c++.
+%YACC_SUFFIX%%C_SUFFIX%:
+if %?YLWRAP%
+ $(SHELL) $(YLWRAP) $(YACC) $< y.tab.c $*%C_SUFFIX% y.tab.h $*.h --
$(AM_YFLAGS) $(YFLAGS)
+else
+ $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*%C_SUFFIX%
+ if test -f y.tab.h; then \
+y if cmp -s y.tab.h $*.h; then \
+ rm -f y.tab.h; \
+ else mv y.tab.h $*.h; \
+ fi
+endif %?YLWRAP%
Index: yacc.am
--- yacc.am Sun, 11 Mar 2001 20:15:57 +0100 akim (am/h/35_yacc.am 1.1 644)
+++ yacc.am Tue, 13 Mar 2001 00:05:42 +0100 akim (am/h/35_yacc.am 1.1 644)
@@ -23,8 +23,10 @@
else
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*%C_SUFFIX%
if test -f y.tab.h; then \
-y if cmp -s y.tab.h $*.h; then \
+ if cmp -s y.tab.h $*.h; then \
rm -f y.tab.h; \
- else mv y.tab.h $*.h; \
+ else \
+ mv y.tab.h $*.h; \
+ fi \
fi
endif %?YLWRAP%
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 52-yacc-am.patch,
Akim Demaille <=