diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-07-16 12:45:04 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-07-16 12:45:04 -0700 |
commit | 06e9ce89328d9d04b2dd5693134f0ff0a14dec11 (patch) | |
tree | e8eb18bdbb01fa44002f18b890fad662433efcc0 /autodoc.pl | |
parent | 9e103e2695edf4f2a3c0c3d8a12299ebcd30e37a (diff) | |
download | perl-06e9ce89328d9d04b2dd5693134f0ff0a14dec11.tar.gz |
Improve wrapping of arguments in perlintern.pod
Commit dee6204dc made a huge improvement to the formatting of argument
lists in perlapi (except for one pesky little entry, namely caller_cx,
that is 81 columns).
But I forgot to look through perlintern.
This just looks comical:
struct refcounted_he * refcounted_he_new_pv(struct refcounted_he *parent,
const char *key,
U32 hash,
SV *value,
U32 flags)
On an eighty-column terminal that wraps like this:
struct refcounted_he * refcounted_he_new_pv(struct refcoun
ted_he *parent,
const char *k
ey,
U32 hash,
SV *value,
U32 flags)
Ugh!!
So, for entries with individual arguments that don’t fit, this commit
wraps them like this:
struct refcounted_he * refcounted_he_new_pv(
struct refcounted_he *parent,
const char *key, U32 hash,
SV *value, U32 flags
)
Diffstat (limited to 'autodoc.pl')
-rw-r--r-- | autodoc.pl | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/autodoc.pl b/autodoc.pl index 4c1d962802..89b36df9b5 100644 --- a/autodoc.pl +++ b/autodoc.pl @@ -195,8 +195,21 @@ removed without notice.\n\n" if $flags =~ /x/; +length($n) + 1; my $indent; print $fh "\t$ret" . ($large_ret ? ' ' : "\t") . "$n("; - my $args = $p ? @args ? "pTHX_ " : "pTHX" : ''; - my $first = 1; + my $long_args; + for (@args) { + if ($indent_size + 2 + length > 80) { + $long_args=1; + $indent_size -= length($n) - 3; + last; + } + } + my $args = ''; + if ($p) { + $args = @args ? "pTHX_ " : "pTHX"; + if ($long_args) { print $fh $args; $args = '' } + } + $long_args and print $fh "\n"; + my $first = !$long_args; while () { if (!@args or length $args @@ -206,7 +219,7 @@ removed without notice.\n\n" if $flags =~ /x/; $first ? '' : ( $indent //= "\t".($large_ret ? " " x (1+length $ret) : "\t") - ." "x(1 + length $n) + ." "x($long_args ? 4 : 1 + length $n) ), $args, (","x($args ne 'pTHX_ ') . "\n")x!!@args; $args = $first = ''; @@ -215,6 +228,7 @@ removed without notice.\n\n" if $flags =~ /x/; $args .= ", "x!!(length $args && $args ne 'pTHX_ ') . shift @args; } + if ($long_args) { print $fh "\n", substr $indent, 0, -4 } print $fh ")\n\n"; } print $fh "=for hackers\nFound in file $file\n\n"; |