examples: shorten the name of the calc++ files

* doc/bison.texi: Turn the calc++- prefix into calc++/.
* examples/extexi (%file_wanted): Replace with
(&file_wanted): this.
* examples/calc++/local.mk: Adjust.
This commit is contained in:
Akim Demaille
2018-08-23 08:42:00 +02:00
parent 9645a2b20e
commit 3fda8335bf
5 changed files with 85 additions and 81 deletions

View File

@@ -2,18 +2,18 @@
/*.tmp
/.deps
/calc++
/calc++-driver.cc
/calc++-driver.hh
/calc++-parser.cc
/calc++-parser.hh
/calc++-parser.output
/calc++-parser.stamp
/calc++-parser.yy
/calc++-scanner.cc
/calc++-scanner.ll
/calc++.cc
/calc++.exe
/calc.stamp
/driver.cc
/driver.hh
/location.hh
/parser.cc
/parser.hh
/parser.output
/parser.stamp
/parser.yy
/position.hh
/scanner.cc
/scanner.ll
/stack.hh

View File

@@ -20,7 +20,7 @@
# Don't depend on $(BISON) otherwise we would rebuild these files
# in srcdir, including during distcheck, which is forbidden.
%D%/calc++-parser.stamp: $(BISON_IN)
%D%/parser.stamp: $(BISON_IN)
SUFFIXES += .yy .stamp
.yy.stamp:
$(AM_V_YACC)rm -f $@
@@ -28,14 +28,14 @@ SUFFIXES += .yy .stamp
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
$(AM_V_at)mv -f $@.tmp $@
$(calcxx_sources_generated): %D%/calc++-parser.stamp
@test -f $@ || rm -f %D%/calc++-parser.stamp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/calc++-parser.stamp
CLEANFILES += \
$(calcxx_sources_generated) \
%D%/calc++-parser.output \
%D%/calc++-parser.stamp \
%D%/calc++-scanner.cc
$(calcxx_sources_generated): %D%/parser.stamp
@test -f $@ || rm -f %D%/parser.stamp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/parser.stamp
CLEANFILES += \
$(calcxx_sources_generated) \
%D%/parser.output \
%D%/parser.stamp \
%D%/scanner.cc
## -------------------- ##
@@ -45,18 +45,18 @@ CLEANFILES += \
# Avoid using BUILT_SOURCES which is too global.
$(%C%_calc___OBJECTS): $(calcxx_sources_generated)
calcxx_sources_extracted = \
%D%/calc++-driver.cc \
%D%/calc++-driver.hh \
%D%/calc++-scanner.ll \
calcxx_sources_extracted = \
%D%/driver.cc \
%D%/driver.hh \
%D%/scanner.ll \
%D%/calc++.cc
calcxx_extracted = \
$(calcxx_sources_extracted) \
%D%/calc++-parser.yy
%D%/parser.yy
extracted += $(calcxx_extracted)
calcxx_sources_generated = \
%D%/calc++-parser.cc \
%D%/calc++-parser.hh \
%D%/parser.cc \
%D%/parser.hh \
%D%/location.hh \
%D%/position.hh \
%D%/stack.hh

View File

@@ -1,6 +0,0 @@
// Work around an Automake 1.11.2 bug: it asks for the creation of
// y.tab.c and y.tab.h and then renames them as calc++-parser.cc and
// calc++-parser.h, but in the former it does not convert the
// #include "y.tab.h". We don't want this to show in the
// documentation.
#include "calc++-parser.hh"

View File

@@ -65,8 +65,21 @@ sub message($)
}
}
# basename => full file name for files we should extract.
my %file_wanted;
# The list of files we should extract.
my @file_wanted;
# Whether we should extract that file, and then under which path.
sub file_wanted ($)
{
my ($f) = @_;
for my $file (@file_wanted)
{
# No endswith in Perl 5...
return $file if $f eq substr($file, -length($f));
}
undef
}
sub process ($)
{
@@ -89,9 +102,9 @@ sub process ($)
{
my $f = $1;
$block = $2 || 1;
if ($file_wanted{$f})
if (file_wanted($f))
{
$file = $file_wanted{$f};
$file = file_wanted($f);
message(" GEN $file");
}
else
@@ -142,8 +155,7 @@ for my $arg (@ARGV)
{
if ($seen_dash)
{
use File::Basename;
$file_wanted{basename($arg)} = $arg;
push @file_wanted, $arg;
}
elsif ($arg eq '--')
{