From 6359fe16719922e85ca547a0b2b6159659a57fb7 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 15 Jul 2001 22:17:18 +0000 Subject: [PATCH] * automake.in (usage): Rewrote code to handle columnization. From Alexey Mahotkin and Maxim Sinev. --- ChangeLog | 3 +++ THANKS | 2 ++ automake.in | 40 +++++++++++++++++++++++++--------------- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index e39f0a28..c5dd148f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2001-07-15 Tom Tromey + * automake.in (usage): Rewrote code to handle columnization. + From Alexey Mahotkin and Maxim Sinev. + Report from Ralf Corsepius: * automake.in (TARGET_PATTERN): Add `+' as valid character. (SUFFIX_RULE_PATTERN): Likewise. diff --git a/THANKS b/THANKS index 96291e92..9d970907 100644 --- a/THANKS +++ b/THANKS @@ -7,6 +7,7 @@ Akim Demaille akim@freefriends.org Alex Hornby alex@anvil.co.uk Alexandre Duret-Lutz duret_g@epita.fr Alexander V. Lukyanov lav@yars.free.net +Alexey Mahotkin alexm@hsys.msk.ru Andreas Schwab schwab@lamothe.informatik.uni-dortmund.de Andrew Cagney cagney@tpgi.com.au Andris Pavenis pavenis@lanet.lv @@ -93,6 +94,7 @@ Markus F.X.J. Oberhumer k3040e4@wildsau.idv-edu.uni-linz.ac.at Matt Leach mleach@cygnus.com Matthew D. Langston langston@SLAC.Stanford.EDU Matthias Clasen clasen@mathematik.uni-freiburg.de +Maxim Sinev good@goods.ru Michael Brantley Michael-Brantley@deshaw.com Michel de Ruiter mdruiter@cs.vu.nl Miles Bader miles@ccs.mt.nec.co.jp diff --git a/automake.in b/automake.in index 63f33920..471a2350 100755 --- a/automake.in +++ b/automake.in @@ -7878,31 +7878,41 @@ EOF $last = $iter; } - my ($one, $two, $three, $four, $max); + my @four; print "\nFiles which are automatically distributed, if found:\n"; format USAGE_FORMAT = @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< - $one, $two, $three, $four + $four[0], $four[1], $four[2], $four[3] . $~ = "USAGE_FORMAT"; - $max = int (($#lcomm + 1) / 4); - for (my $i = 0; $i < $max; ++$i) + my $cols = 4; + my $rows = int(@lcomm / $cols); + my $rest = @lcomm % $cols; + + if ($rest) { - $one = $lcomm[$i]; - $two = $lcomm[$max + $i]; - $three = $lcomm[2 * $max + $i]; - $four = $lcomm[3 * $max + $i]; - write; + $rows++; + } + else + { + $rest = $cols; } - my $mod = ($#lcomm + 1) % 4; - if ($mod != 0) + for (my $y = 0; $y < $rows; $y++) { - $one = $lcomm[$max]; - $two = ($mod > 1) ? $lcomm[2 * $max] : ''; - $three = ($mod > 2) ? $lcomm[3 * $max] : ''; - $four = ($mod > 3) ? $lcomm[4 * $max] : ''; + @four = ("", "", "", ""); + for (my $x = 0; $x < $cols; $x++) + { + last if $y + 1 == $rows && $x == $rest; + + my $idx = (($x > $rest) + ? ($rows * $rest + ($rows - 1) * ($x - $rest)) + : ($rows * $x)); + + $idx += $y; + $four[$x] = $lcomm[$idx]; + } write; } -- 2.43.5