NAME
Imager::APIRef - Imager's C API - reference.
SYNOPSIS
i_color color;
color.rgba.r = 255; color.rgba.g = 0; color.rgba.b = 255;
double x[] = { ... };
double y[] = { ... };
i_polygon_t poly;
poly.count = sizeof(x) / sizeof(*x);
poly.x = x;
poly.y = y;
EOS
for my $cat (sort { lc $a cmp lc $b } keys %cats) { print OUT "\n # $cat\n"; my @funcs = @{$cats{$cat}}; my %orig; @orig{@funcs} = 0 .. $#funcs; @funcs = sort { $order{$a} <=> $order{$b} || $orig{$a} <=> $orig{$b} } @funcs; for my $func (grep $funcsyns{$_}, @funcs) { my $syn = $funcsyns{$func}; $syn =~ s/^/ /gm; print OUT $syn; } }
print OUT <<'EOS';
DESCRIPTION
EOS
my %undoc = %funcs;
for my $cat (sort { lc $a cmp lc $b } keys %cats) { print OUT "=head2 $cat\n\n=over\n\n"; my @ordered_funcs = sort { $order{$a} <=> $order{$b} || lc $a cmp lc $b } @{$cats{$cat}}; for my $func (@ordered_funcs) { print OUT @{$alldocs{$func}}, "\n"; print OUT "=for comment\nFrom: $from{$func}\n\n"; delete $undoc{$func}; } print OUT "\n=back\n\n"; }
# see if we have an uncategorised section if (grep $alldocs{$_}, keys %undoc) { print OUT "=head2 Uncategorized functions\n\n=over\n\n"; #print join(",", grep !exists $order{$_}, @funcs), "\n"; for my $func (sort { $order{$a} <=> $order{$b} || $a cmp $b } grep $undoc{$_} && $alldocs{$_}, @funcs) { print OUT @{$alldocs{$func}}, "\n"; print OUT "=for comment\nFrom: $from{$func}\n\n"; delete $undoc{$func}; } print OUT "\n\n=back\n\n"; }
if (keys %undoc) { print OUT <<'EOS';
UNDOCUMENTED
The following API functions are undocumented so far, hopefully this will change:
EOS
print OUT "=item *\n\nB<$_>\n\n" for sort keys %undoc;
print OUT "\n\n=back\n\n";
}
print OUT <<'EOS';
AUTHOR
Tony Cook <tonyc@cpan.org>
SEE ALSO
Imager, Imager::API, Imager::ExtUtils, Imager::Inline
NAME
apidocs.perl - parse Imager's source for POD documenting the C API
SYNOPSIS
perl apidocs.perl lib/Imager/APIRef.pod
DESCRIPTION
Parses Imager's C sources, including .c, .h and .im files searching for function documentation.
Besides the normal POD markup, the following can be included:
- =category category-name
-
The category the function should be in.
- =synopsis sample-code
-
Sample code using the function to include in the Imager::APIRef SYNOPSIS
- =order integer
-
Allows a function to be listed out of order. If this isn't specified it defaults to 50, so a value of 10 will cause the function to be listed at the beginning of its category, or 90 to list at the end.
Functions with equal order are otherwise ordered by name.
AUTHOR
Tony Cook <tonyc@cpan.org>
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 181:
You forgot a '=back' before '=head1'