# look for files to parse
my $mani = maniread;
-my @files = grep /\.(c|im|h)$/, keys %$mani;
+my @files = sort grep /\.(c|im|h)$/, keys %$mani;
# scan each file for =item <func>\b
my $func;
$category = $1;
}
elsif (/^=synopsis (.*)/) {
+ unless (length $synopsis) {
+ push @funcdocs, "\n";
+ }
$synopsis .= "$1\n";
+ push @funcdocs, " $1\n";
}
elsif (/^=order (.*)$/) {
$order = $1;
open OUT, "> $outname"
or die "Cannot open $outname: $!";
+# I keep this file in git and as part of the dist, make sure newlines
+# don't mess me up
+binmode OUT;
+
print OUT <<'EOS';
Do not edit this file, it is generated automatically by apidocs.perl
from Imager's source files.
for my $cat (sort { lc $a cmp lc $b } keys %cats) {
print OUT "\n # $cat\n";
- for my $func (grep $funcsyns{$_}, sort { $order{$a} <=> $order{$b} } @{$cats{$cat}}) {
+ 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;
sub make_func_list {
- my @funcs = qw(i_img i_color i_fcolor i_fill_t mm_log i_img_color_channels i_img_has_alpha i_img_dim);
+ my @funcs = qw(i_img i_color i_fcolor i_fill_t mm_log i_img_color_channels i_img_has_alpha i_img_dim i_DF i_DFc i_DFp i_DFcp i_psamp_bits i_gsamp_bits i_psamp i_psampf);
open FUNCS, "< imexttypes.h"
or die "Cannot open imexttypes.h: $!\n";
my $in_struct;
while (<FUNCS>) {
/^typedef struct/ && ++$in_struct;
- if ($in_struct && /\(\*f_(i_\w+)/) {
- push @funcs, $1;
+ if ($in_struct && /\(\*f_(io?_\w+)/) {
+ my $name = $1;
+ $name =~ s/_imp$//;
+ push @funcs, $name;
}
if (/^\} im_ext_funcs;$/) {
$in_struct