diff options
author | Francois Perrad <francois.perrad@gadz.org> | 2011-07-01 22:38:32 +0200 |
---|---|---|
committer | Francois Perrad <francois.perrad@gadz.org> | 2011-07-01 22:38:32 +0200 |
commit | 2528c7f26c45dd50df2eca7a63e51eb3aea8231f (patch) | |
tree | a2be917d64cef689c8e3073da7f31ef19d2bea97 | |
parent | add LinkedIn API (diff) | |
download | api-description-2528c7f26c45dd50df2eca7a63e51eb3aea8231f.tar.gz |
spore2dot: split long list of arguments
-rw-r--r-- | utils/spore2dot.pl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/spore2dot.pl b/utils/spore2dot.pl index f7e0e7e..e522099 100644 --- a/utils/spore2dot.pl +++ b/utils/spore2dot.pl @@ -34,6 +34,7 @@ if ($has_interface) { } +my $MAX_LEN = 90; my %meth; foreach my $spec (@specs) { my $name = $spec->{meta}->{module} || $spec->{name}; @@ -46,29 +47,47 @@ foreach my $spec (@specs) { $meth{$name} = 1; my $desc = $spec->{methods}->{$name}; print $name, "("; + my $len = length $name; my $first = 1; if ($desc->{required_payload}) { print "payload"; + $len += 7; $first = 0; } for (@{$desc->{required_params}}) { print ", " unless $first; + $len += 2; + if ($len > $MAX_LEN) { + print "\\l "; + $len = 4; + } print $_; + $len += length $_; $first = 0; } if ($desc->{optional_params}) { print " " unless $first; } for (@{$desc->{optional_params}}) { + if ($len > $MAX_LEN) { + print "\\l "; + $len = 4; + } print "\\["; print ", " unless $first; print $_, "\\]"; + $len += 4 + length $_; $first = 0; } if ($desc->{optional_payload}) { + if ($len > $MAX_LEN) { + print "\\l "; + $len = 4; + } print "\\["; print ", " unless $first; print "payload\\]"; + $len += 11; $first = 0; } if ($desc->{unattended_params} || $spec->{unattended_params}) { |