summaryrefslogtreecommitdiff
path: root/regen/overload.pl
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-01-03 16:49:02 +0000
committerDavid Mitchell <davem@iabyn.com>2011-01-03 17:13:25 +0000
commitc4ac9b44187717c7530f3bc3c6329b26e61c1f0b (patch)
tree5f0e0c8a9791803382ea56038ae9b553a9db9c62 /regen/overload.pl
parent2c17609f30aa451f45b0a17ed14e5c53245180a3 (diff)
downloadperl-c4ac9b44187717c7530f3bc3c6329b26e61c1f0b.tar.gz
regen/overload.pl: add comments to overload.[ch]
In the auto-generated overload.c and overload.h files, add a comment to each line mapping from the method name to the enumeration name and vice-versa.
Diffstat (limited to 'regen/overload.pl')
-rw-r--r--regen/overload.pl22
1 files changed, 18 insertions, 4 deletions
diff --git a/regen/overload.pl b/regen/overload.pl
index 67a30cad0b..a41c820e3b 100644
--- a/regen/overload.pl
+++ b/regen/overload.pl
@@ -80,8 +80,8 @@ sub print_header {
*
* $file
*
- * Copyright (C) 1997, 1998, 2000, 2001, 2005, 2006, 2007 by Larry Wall
- * and others
+ * Copyright (C) 1997, 1998, 2000, 2001, 2005, 2006, 2007, 2011
+ * by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
@@ -102,7 +102,15 @@ print <<'EOF';
enum {
EOF
-print map " ${_}_amg,\n", @enums;
+for (0..$#enums) {
+ my $op = $names[$_];
+ $op = 'fallback' if $op eq '()';
+ $op =~ s/^\(//;
+ die if $op =~ m{\*/};
+ my $l = 3 - int((length($enums[$_]) + 9) / 8);
+ $l = 1 if $l < 1;
+ printf " %s_amg,%s/* %-8s */\n", $enums[$_], ("\t" x $l), $op;
+}
print <<'EOF';
max_amg_code
@@ -138,7 +146,13 @@ static const char * const PL_AMG_names[NofAMmeth] = {
overload.pm. */
EOT
-print $c map { s/(["\\"])/\\$1/g; " \"$_\",\n" } @names;
+for (0..$#names) {
+ my $n = $names[$_];
+ $n =~ s/(["\\])/\\$1/g;
+ my $l = 3 - int((length($n) + 7) / 8);
+ $l = 1 if $l < 1;
+ printf $c " \"%s\",%s/* %-10s */\n", $n, ("\t" x $l), $enums[$_];
+}
print $c <<"EOT";
"$last"