X-Loop: help-debbugs@HIDDEN Subject: bug#10825: Better bison support in Automake (was: Re: FYI: master: calc++: rely on Automake) Resent-From: Stefano Lattarini <stefano.lattarini@HIDDEN> Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org Resent-CC: bug-automake@HIDDEN Resent-Date: Thu, 16 Feb 2012 10:25:01 +0000 Resent-Message-ID: <handler.10825.B.132938785010441 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 10825 X-GNU-PR-Package: automake X-GNU-PR-Keywords: To: Akim Demaille <akim@HIDDEN> Cc: 10825 <at> debbugs.gnu.org, bison-patches@HIDDEN, automake-patches@HIDDEN X-Debbugs-Original-Cc: bug-automake@HIDDEN, Bison Patches <bison-patches@HIDDEN>, automake-patches@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.132938785010441 (code B ref -1); Thu, 16 Feb 2012 10:25:01 +0000 Received: (at submit) by debbugs.gnu.org; 16 Feb 2012 10:24:10 +0000 Received: from localhost ([127.0.0.1]:42243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1RxyVW-0002iL-Do for submit <at> debbugs.gnu.org; Thu, 16 Feb 2012 05:24:10 -0500 Received: from eggs.gnu.org ([140.186.70.92]:35100) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <stefano.lattarini@HIDDEN>) id 1RxyVT-0002i6-JP for submit <at> debbugs.gnu.org; Thu, 16 Feb 2012 05:24:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <stefano.lattarini@HIDDEN>) id 1RxyTd-0004GE-Tl for submit <at> debbugs.gnu.org; Thu, 16 Feb 2012 05:22:15 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:46688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <stefano.lattarini@HIDDEN>) id 1RxyTd-0004G8-Pv for submit <at> debbugs.gnu.org; Thu, 16 Feb 2012 05:22:13 -0500 Received: from eggs.gnu.org ([140.186.70.92]:58967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <stefano.lattarini@HIDDEN>) id 1RxyTY-0001uW-4Y for bug-automake@HIDDEN; Thu, 16 Feb 2012 05:22:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <stefano.lattarini@HIDDEN>) id 1RxyTR-0004Eo-Pq for bug-automake@HIDDEN; Thu, 16 Feb 2012 05:22:08 -0500 Received: from mail-bk0-f41.google.com ([209.85.214.41]:64025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <stefano.lattarini@HIDDEN>) id 1RxyT3-0004C9-VP; Thu, 16 Feb 2012 05:21:38 -0500 Received: by bkty12 with SMTP id y12so2125980bkt.0 for <multiple recipients>; Thu, 16 Feb 2012 02:21:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; bh=ChJZqfBM2y/wiKac+e/61Bb6ztnBbkk3BNxWcDOgDuA=; b=QjgqDydAhFWkDAkUE/wbQk1FphiEBq6QhP+6EvPkp6dflbqie28gfDiyu/S51HriYg /A+hcJZL61zWfegy0/gnz6jEkI2J2NU8G8vyJ9t+JcHWew/pO0qqBu8Kp5h+k828nIe3 ewDMW2X/igiMMMSEUkRs+PHA7jfDSQ6M5wqMQ= Received: by 10.204.128.146 with SMTP id k18mr827445bks.92.1329387696589; Thu, 16 Feb 2012 02:21:36 -0800 (PST) Received: from [87.0.95.92] (host92-95-dynamic.0-87-r.retail.telecomitalia.it. [87.0.95.92]) by mx.google.com with ESMTPS id x11sm11934893bkd.2.2012.02.16.02.21.33 (version=SSLv3 cipher=OTHER); Thu, 16 Feb 2012 02:21:35 -0800 (PST) Message-ID: <4F3CD8AB.6030605@HIDDEN> Date: Thu, 16 Feb 2012 11:21:31 +0100 From: Stefano Lattarini <stefano.lattarini@HIDDEN> MIME-Version: 1.0 References: <639EC8E7-E42F-478B-89ED-63ED3D2DE7B3@HIDDEN> <4F3BA288.4020802@HIDDEN> <78F5F00C-272C-46F2-8A4D-79983F196062@HIDDEN> In-Reply-To: <78F5F00C-272C-46F2-8A4D-79983F196062@HIDDEN> Content-Type: multipart/mixed; boundary="------------010101060100030609080502" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -3.4 (---) This is a multi-part message in MIME format. --------------010101060100030609080502 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit [CC:ing bug-automake, so that we won't forget about the issues raised here] Hi Akim. On 02/15/2012 01:31 PM, Akim Demaille wrote: > > Le 15 févr. 2012 à 13:18, Stefano Lattarini a écrit : > >> On 02/15/2012 11:36 AM, Akim Demaille wrote: >>> Rely on $(YACC) being the bison being built, and let Automake do the >>> rest. It turned out to be much more difficult than anticipated, for >>> various reasons, including some bad behavior from Automake 1.11.2 >>> which (i) generates calc++-parser.h instead of calc++-parser.hh, >>> >> FYI: this will be fixed in automake 1.12 -- the patch fixing it being >> already merged into master. > > Thanks Stefano! > > I can't clone automake right now (Savannah seems to be overloaded), > so I can't check the following typo in the current documentation. > It should take you only a couple of seconds to check. > >> ---------- Footnotes ---------- >> >> (1) Please note that `automake' recognizes `-d' in `AM_YFLAGS' only >> if it is not clustered with other options; for example, it won't be >> recognized if `AM_YFLAGS' is `-dt', but it will be if `AM_YFLAGS' is >> `-d -t' or `-d -t' > > I guess the latter is `-t -d', and the period is missing. > Thanks, fixed (see attached patch). > But maybe automake no longer needs this? > It still need it; without that, no header file will be generated from the '.y' files (this is a feature, not a bug). > If it does, it would be good to recognize also --defines. > Maybe; but then, it should be done right, i.e., automake should also understand hand handle the '--defines=my-hdr.h' usage. But I guess this would conflict with ylwrap in some way, sigh :-( Maybe it's truly time to introduce a new AM_PROG_BISON macro that will cause automake to drop all the cruft related to POSIX yacc compatibility ... As usual, patches welcome ;-) Regards, Stefano --------------010101060100030609080502 Content-Type: text/x-diff; name="0001-docs-fix-typo-in-description-of-AM_YFLAGS.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-docs-fix-typo-in-description-of-AM_YFLAGS.patch" From 22b28b638a2d7d9d05bf7f2741367fc36f8bb8c0 Mon Sep 17 00:00:00 2001 Message-Id: <22b28b638a2d7d9d05bf7f2741367fc36f8bb8c0.1329387643.git.stefano.lattarini@HIDDEN> From: Stefano Lattarini <stefano.lattarini@HIDDEN> Date: Thu, 16 Feb 2012 11:09:50 +0100 Subject: [PATCH] docs: fix typo in description of AM_YFLAGS Report by Akim Demaille. * doc/automake.texi (Program variables): Don't list "-d -t" twice in the examples of valid ways to specify the '-d' flag to Yacc; instead, use "-d -t" and "-t -d". Add missing period. --- doc/automake.texi | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/doc/automake.texi b/doc/automake.texi index da134ef..8b1a84b 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -6209,7 +6209,7 @@ adjust its rules to update and distribute the header file built by @option{-d} in @code{AM_YFLAGS} only if it is not clustered with other options; for example, it won't be recognized if @code{AM_YFLAGS} is @option{-dt}, but it will be if @code{AM_YFLAGS} is @option{-d -t} or -@option{-d -t}}. +@option{-t -d}.}. What Automake cannot guess, though, is where this header will be used: it is up to you to ensure the header gets built before it is first used. Typically this is necessary in order for -- 1.7.9 --------------010101060100030609080502--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Stefano Lattarini <stefano.lattarini@HIDDEN> Subject: bug#10825: Acknowledgement (Better bison support in Automake (was: Re: FYI: master: calc++: rely on Automake)) Message-ID: <handler.10825.B.132938785010441.ack <at> debbugs.gnu.org> References: <4F3CD8AB.6030605@HIDDEN> X-Gnu-PR-Message: ack 10825 X-Gnu-PR-Package: automake Reply-To: 10825 <at> debbugs.gnu.org Date: Thu, 16 Feb 2012 10:25:01 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-automake@HIDDEN If you wish to submit further information on this problem, please send it to 10825 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 10825: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D10825 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#10825: Better bison support in Automake (was: Re: FYI: master: calc++: rely on Automake) Resent-From: Akim Demaille <akim@HIDDEN> Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org Resent-CC: bug-automake@HIDDEN Resent-Date: Thu, 16 Feb 2012 17:10:02 +0000 Resent-Message-ID: <handler.10825.B.132941218226296 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 10825 X-GNU-PR-Package: automake X-GNU-PR-Keywords: To: Stefano Lattarini <stefano.lattarini@HIDDEN> Cc: 10825 <at> debbugs.gnu.org, bison-patches@HIDDEN, automake-patches@HIDDEN X-Debbugs-Original-Cc: bug-automake@HIDDEN, Bison Patches <bison-patches@HIDDEN>, automake-patches@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.132941218226296 (code B ref -1); Thu, 16 Feb 2012 17:10:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Feb 2012 17:09:42 +0000 Received: from localhost ([127.0.0.1]:42763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1Ry4px-0006q3-72 for submit <at> debbugs.gnu.org; Thu, 16 Feb 2012 12:09:42 -0500 Received: from eggs.gnu.org ([140.186.70.92]:59758) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <akim@HIDDEN>) id 1RxzVZ-0004BR-Sn for submit <at> debbugs.gnu.org; Thu, 16 Feb 2012 06:28:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <akim@HIDDEN>) id 1RxzTf-0007M2-RM for submit <at> debbugs.gnu.org; Thu, 16 Feb 2012 06:26:25 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:42471) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <akim@HIDDEN>) id 1RxzTf-0007Lv-Pd for submit <at> debbugs.gnu.org; Thu, 16 Feb 2012 06:26:19 -0500 Received: from eggs.gnu.org ([140.186.70.92]:37327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <akim@HIDDEN>) id 1RxzTb-0005mb-Ng for bug-automake@HIDDEN; Thu, 16 Feb 2012 06:26:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <akim@HIDDEN>) id 1RxzTT-0007KQ-Gx for bug-automake@HIDDEN; Thu, 16 Feb 2012 06:26:15 -0500 Received: from sao-paulo.lrde.epita.fr ([163.5.55.1]:37944 helo=kualalumpur.lrde.epita.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <akim@HIDDEN>) id 1RxzT4-0007Hf-Kd; Thu, 16 Feb 2012 06:25:42 -0500 Received: from tenochtitlan-eth.lrde.epita.fr ([192.168.101.154]) by kualalumpur.lrde.epita.fr with esmtpsa (TLS-1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.63) (envelope-from <akim@HIDDEN>) id 1RxzT2-0001D2-2a; Thu, 16 Feb 2012 12:25:40 +0100 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/mixed; boundary=Apple-Mail-7-1044505626 From: Akim Demaille <akim@HIDDEN> In-Reply-To: <4F3CD8AB.6030605@HIDDEN> Date: Thu, 16 Feb 2012 12:25:40 +0100 Message-Id: <07F1EE92-0749-422F-94FB-77F13748B038@HIDDEN> References: <639EC8E7-E42F-478B-89ED-63ED3D2DE7B3@HIDDEN> <4F3BA288.4020802@HIDDEN> <78F5F00C-272C-46F2-8A4D-79983F196062@HIDDEN> <4F3CD8AB.6030605@HIDDEN> X-Mailer: Apple Mail (2.1084) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Mailman-Approved-At: Thu, 16 Feb 2012 12:09:39 -0500 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -4.2 (----) --Apple-Mail-7-1044505626 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Le 16 f=E9vr. 2012 =E0 11:21, Stefano Lattarini a =E9crit : > Hi Akim. Hi! > Thanks, fixed (see attached patch). >=20 >> But maybe automake no longer needs this? >>=20 > It still need it; without that, no header file will be generated from > the '.y' files (this is a feature, not a bug). >=20 >> If it does, it would be good to recognize also --defines. >>=20 > Maybe; but then, it should be done right, i.e., automake should also > understand hand handle the '--defines=3Dmy-hdr.h' usage. But I guess > this would conflict with ylwrap in some way, sigh :-( >=20 > Maybe it's truly time to introduce a new AM_PROG_BISON macro that > will cause automake to drop all the cruft related to POSIX yacc > compatibility ... As usual, patches welcome ;-) One of the problems that you would face is that it's hard to know what files will be created by Bison. Actually, bison and only bison can know. For instance currently for C++ it generates stack.hh and other files that users find painful to deal with, so I plan to have them go into the generated *.cc file, upon user request. This is not something automake should know. What would be your preferred option? Would you like some sort of --dry-run option that would in addition send the list of created files on stdout? Or an option to generate an additional file with the list of the generated files during the normal run? Or a Makefile snippet a la -M. FWIW, I also use a wrapper around Bison, for several reasons: I like to see the diffs, I want to run xsltproc to get the HTML report, I want to keep old timestamps when possible, I'd like to "optimize" some part of the output, etc. Someone might find them useful, so here they are. --Apple-Mail-7-1044505626 Content-Disposition: attachment; filename=bison++.in Content-Type: application/octet-stream; name="bison++.in" Content-Transfer-Encoding: 7bit #! /bin/sh ## ## bison++.in: This file is part of build-aux. ## Copyright (C) 2006-2010, 2012, Gostai S.A.S. ## ## This software is provided "as is" without warranty of any kind, ## either expressed or implied, including but not limited to the ## implied warranties of fitness for a particular purpose. ## ## See the LICENSE file for more information. ## # Exit status. status=0 # Any tool failure is a failure of the script. set -e : ${BISON='@BISON@'} stderr () { local i for i do echo "$i" done | sed >&2 -e "s/^/$me: /" } verbose () { if "$verbose"; then stderr "$@" fi } fatal () { stderr "$@" exit 1 } usage () { cat <<EOF usage: bison++ OPTIONS... -- INPUT OUTPUT BISON-OPTIONS Options: -h, --help display this message and exit successfully --location-dir=DIR where to install position.hh and location.hh. E.g., "\$(top_srcdir)/include/foo" --location-prefix=DIR where #include must look for these headers. E.g., "foo" --verbose display diffs EOF exit 0 } me=$(basename $0) fuse_switch='@abs_srcdir@/fuse-switch' move_if_change='@abs_srcdir@/move-if-change --color' verbose=false ## ---------------------- ## ## Command line parsing. ## ## ---------------------- ## get_options () { while test $# != 0 do # Handle --option=value by splitting apart and putting back on argv. case $1 in (--*=*) opt=$(echo "$1" | sed -e 's/=.*//') val=$(echo "$1" | sed -e 's/[^=]*=//') shift set dummy "$opt" "$val" ${1+"$@"}; shift ;; esac case $1 in (-h | --help ) usage;; (--location-dir) shift; location_dir=$1;; (--location-prefix) shift; location_prefix=$1/;; (--verbose) verbose=: move_if_change="$move_if_change --verbose";; (--) shift; break;; (*) fatal "invalid argument: $1";; esac shift done input=$1 shift output=$1 shift bisonflags="$@" } ## ------ ## ## Main. ## ## ------ ## get_options "$@" input_base=$(basename "$input") input_dir=$(dirname "$input") output_base=$(basename "$output") output_base_noext=$(echo "$output_base" | sed -e 's/\.[^.]*//') output_dir=$(dirname "$output") : ${location_dir=$output_dir} # The namespace we are in. # FIXME: We need $srcdir to be able to compute it. namespace=parser if $BISON --xml --version >/dev/null 2>&1; then bisonflags="$bisonflags --xml" fi # Alexandre Duret-Lutz also notes that in VPATH-builds $(srcdir) can # be an absolute path depending on how ./configure is called ... # In that case # bison $(srcdir)/parsetiger.yy [...] # will hard code the path in the maintainer's tree. Hence, do not use # paths with Bison, chdir there. # A tmp dir. tmp=$output_base_noext.dir rm -rf $tmp mkdir $tmp # Compile in this dir. # Don't use `ln -s' as its semantics of paths sucks. cp $input $tmp cd $tmp set +e $BISON $bisonflags $input_base -o $output_base status=$? set -e # fix_bison_output FILE # --------------------- # Fixes in place. fix_bison_output () { local file="$1" local base base=$(basename "$file") local base_noext base_noext=$(echo "$file" | sed -e 's/\..*//') perl -pi -e " # Fix doxygen tags. s|\Q\\file $base\E\b|\\\\file $namespace/$base|g; # Fix sync lines for composite paths. s|(^#line.*)$base_noext|\$1$input_dir/$base_noext|g; # In case position.hh and location.hh were moved. s{include \"(position.hh|location.hh)\"} {include <$location_prefix\$1>}g; # Bison lacks a means to include headers in position.hh. print <<EOF if \$ARGV =~ /position.hh/ && /namespace yy/; # include <libport/symbol.hh> # include <libport/windows.hh> EOF # Kill all the trailing blanks. s/[ \t]+\$//; " "$1" # Fuse the switches of the parser. case $file in (*.cc) $fuse_switch $file # diff -uw $file.bak $file || true ;; esac } # compile_xml_file XML XSL OUT-EXT # -------------------------------- # By transforming XML = FILE.xml with XSL.xsl, create FILE.OUT-EXT if needed. # "Needed" means FILE.OUT-EXT does not exist, or XML was updated. compile_xml_file () { local xml="$1" local xsl="$2.xsl" local out out=$(basename "$xml" ".xml").$3 # "cmp NON-EXISTENT FILE" does what we want: fail. if ! cmp -s "$xml" "$(out "$xml")" \ || test ! -f "$(out "$out")"; then local compile="xsltproc $($BISON --print-datadir)/xslt/$xsl" if ! $compile "$xml" >"$(tmp "$out")"; then stderr "cannot convert $xml report to $out" # Produce a stub for the HTML for sake of the Makefile. cat >"$(tmp "$out")" <<EOF <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Cannot run xsltproc</title> </head> <body> <p>Cannot run xsltproc</p> </body> </html> EOF fi install "$out" fi } # out FILE # -------- # Return path name of FILE once installed in its destination directory. out () { local f f=$(basename "$1") case $f in (position.hh|location.hh) echo "$location_dir/$f";; (*) echo "$output_dir/$f";; esac } # out FILE # -------- # Return path name of FILE in the tmp directory. tmp () { echo "$tmp/$(basename "$1")" } # install FILE # ------------ # Install FILE in its destination directory. install () { local dest dest=$(out "$1") local dir dir=$(dirname "$dest") mkdir -p "$dir" || fatal "cannot create $dir" $move_if_change "$(tmp "$1")" "$dest" } # Go back to where we were and use relative paths instead of using # absolute file names. The messages look nicer. cd .. for file in $tmp/* do base=$(basename $file) base_noext=$(echo "$base" | sed -e 's/\.[^.]*//') case $status:$base in (*:$input_base) # Leave it here. ;; # Success or not, install it. (*:*.xml) # Computing the HTML is slow. Do it when the XML changed. fix_bison_output "$file" compile_xml_file "$file" "xml2xhtml" "html" # Compiling the dot output is quite long, it would be better # to do that from the Makefile, so that -j applies. # compile_xml_file "$file" "xml2dot" "dot" install "$file" ;; (0:*.hh) fix_bison_output "$file" # To save cycles, if the file differs only on sync lines, # update it (to be right), but keep the original timestamps. if test -r "$(out "$file")" && diff -I '^#line' -I '/\* Line .* of .* \*/' -q \ "$file" "$(out "$file")" then touch -r "$(out "$file")" "$file" cp "$(out "$file")" "$(out "$file").bak" verbose "kept the stamps of $file" fi install "$file" ;; (*:*.output) install "$file" ;; (0:*) fix_bison_output "$file" install "$file" ;; esac done # Get rid of the tmp dir. rm -rf $tmp exit $status --Apple-Mail-7-1044505626 Content-Disposition: attachment; filename=fuse-switch Content-Type: application/octet-stream; name="fuse-switch" Content-Transfer-Encoding: 7bit #! /usr/bin/perl -w # This script *tries* to fuse consecutive "switches" that have the # same body. # # Usage: $0 FILES # # Leaves a copy of the input files as FILE.bak. use strict; my $case_re = '^\s*(case\b.*|default)\s*:'; # Return the block of code with all the ignored parts removed. sub code ($) { local ($_) = @_; # print STDERR "CODE IN: $_"; s,//.*,,gm; s,/\*.*?.*\*/,,gm; s/#line .*//gm; # print STDERR "CODE OUT: $_"; return $_; } # Compare two case blocks against equality, ignoring the case label. sub case_eq($$) { my ($b1, $b2) = @_; return case_body(code($b1)) eq case_body(code($b2)); } # Return the line which contains the "case" this block of code. sub case_label($) { my ($case) = @_; my $res = ''; for my $line (split "\n", $case) { # We put no space at the end of '//-' not to introduce trailing # spaces. $res .= ($line !~ /$case_re/ && '//-') . $line . "\n" } return $res; } # Return the case-block without its case line. sub case_body($) { local ($_) = @_; # print STDERR "BODY IN: $_"; s/^.*$case_re.*\n//mg; # print STDERR "BODY OUT: $_"; return $_; } sub fuse($$) { my ($input, $output) = @_; use IO::File; my $in = new IO::File($input) or die; my $out = new IO::File(">$output") or die; # Something before the next $case. my $pre_case = ''; # The body of the case: from case/default to the next break; # There must be no break inside. my $case = ''; my $previous_case = ''; # Whether we are in the switch {}. my $in_switch = 0; while ($_ = $in->getline) { # print STDERR "\$_ = $_"; if (!$in_switch) { if (/^\s*switch\b/) { $in_switch = 1; } } else { # in switch. # # The "default: break" one a single line is output by # bison's lalr1.cc.. if (m/$case_re/ .. m/^\s*(?:default:\s*)?break/) { # Register the current case. $case .= $_; if (/break/) { if (case_eq($previous_case, $case)) { # print STDERR "== {{$previous_case}} {{$case}}\n"; $_ = case_label ($previous_case); } else { # The previous case is needed. # print STDERR "!= {{$previous_case}} {{$case}}\n"; $_ = $previous_case; } $previous_case = $case; $case = ""; $_ .= $pre_case; $pre_case = ''; } else { # Print nothing. $_ = ""; } } elsif (m/}/) { # The closing brace of the switch. $_ = $previous_case . $pre_case . $_; $pre_case = ''; $previous_case = ''; $in_switch = 0; } else { # Something in a switch, but not in a case. Keep it, # and output it before the forth coming output. Don't # put it in $case though, as it would be commented out, # which might be wrong (e.g., pragmas, or cpp # directives). $pre_case .= $_; $_ = ''; } } print $out $_; } die "could not insert $pre_case" if $pre_case; } use File::Copy; for my $file (@ARGV) { copy ($file, "$file.bak") or die; fuse("$file.bak", "$file"); } ### Setup "GNU" style for perl-mode and cperl-mode. ## Local Variables: ## perl-indent-level: 2 ## perl-continued-statement-offset: 2 ## perl-continued-brace-offset: 0 ## perl-brace-offset: 0 ## perl-brace-imaginary-offset: 0 ## perl-label-offset: -2 ## cperl-indent-level: 2 ## cperl-brace-offset: 0 ## cperl-continued-brace-offset: 0 ## cperl-label-offset: -2 ## cperl-extra-newline-before-brace: t ## cperl-merge-trailing-else: nil ## cperl-continued-statement-offset: 2 ## End: --Apple-Mail-7-1044505626--
Received: (at control) by debbugs.gnu.org; 20 Nov 2020 02:05:57 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 19 21:05:57 2020 Received: from localhost ([127.0.0.1]:41442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kfvoC-0007Lq-VN for submit <at> debbugs.gnu.org; Thu, 19 Nov 2020 21:05:57 -0500 Received: from freefriends.org ([96.88.95.60]:35774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <karl@HIDDEN>) id 1kfvoB-0007Lg-45 for control <at> debbugs.gnu.org; Thu, 19 Nov 2020 21:05:55 -0500 X-Envelope-From: karl@HIDDEN X-Envelope-To: <control <at> debbugs.gnu.org> Received: from freefriends.org (freefriends.org [96.88.95.60]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 0AK25rHr031578 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <control <at> debbugs.gnu.org>; Thu, 19 Nov 2020 19:05:54 -0700 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 0AK25rAg031577; Thu, 19 Nov 2020 19:05:53 -0700 Date: Thu, 19 Nov 2020 19:05:53 -0700 Message-Id: <202011200205.0AK25rAg031577@HIDDEN> From: Karl Berry <karl@HIDDEN> To: control <at> debbugs.gnu.org Subject: X-Spam-Score: -0.3 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.3 (-) tags 10825 + help tags 10825 + confirmed tags 9512 + help tags 9512 + confirmed tags 11863 + help tags 11863 + confirmed tags 13940 + help tags 13940 + confirmed tags 16341 + moreinfo
Received: (at control) by debbugs.gnu.org; 20 Nov 2020 02:05:57 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 19 21:05:57 2020 Received: from localhost ([127.0.0.1]:41442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kfvoC-0007Lq-VN for submit <at> debbugs.gnu.org; Thu, 19 Nov 2020 21:05:57 -0500 Received: from freefriends.org ([96.88.95.60]:35774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <karl@HIDDEN>) id 1kfvoB-0007Lg-45 for control <at> debbugs.gnu.org; Thu, 19 Nov 2020 21:05:55 -0500 X-Envelope-From: karl@HIDDEN X-Envelope-To: <control <at> debbugs.gnu.org> Received: from freefriends.org (freefriends.org [96.88.95.60]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 0AK25rHr031578 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <control <at> debbugs.gnu.org>; Thu, 19 Nov 2020 19:05:54 -0700 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 0AK25rAg031577; Thu, 19 Nov 2020 19:05:53 -0700 Date: Thu, 19 Nov 2020 19:05:53 -0700 Message-Id: <202011200205.0AK25rAg031577@HIDDEN> From: Karl Berry <karl@HIDDEN> To: control <at> debbugs.gnu.org Subject: X-Spam-Score: -0.3 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.3 (-) tags 10825 + help tags 10825 + confirmed tags 9512 + help tags 9512 + confirmed tags 11863 + help tags 11863 + confirmed tags 13940 + help tags 13940 + confirmed tags 16341 + moreinfo
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.