]> git.imager.perl.org - imager.git/blobdiff - apidocs.perl
use non-deprecated encoding ids for freetype 2
[imager.git] / apidocs.perl
index 67f108f3159c0e6e9d52cac42ea130efa0a5b63b..927939a325868252040c524c458c0d8bc1cbf881 100644 (file)
@@ -10,7 +10,7 @@ my %funcs = map { $_ => 1 } @funcs;
 # 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;
@@ -58,7 +58,11 @@ for my $file (@files) {
         $category = $1;
       }
       elsif (/^=synopsis (.*)/) {
+       unless (length $synopsis) {
+         push @funcdocs, "\n";
+       }
         $synopsis .= "$1\n";
+       push @funcdocs, "  $1\n";
       }
       elsif (/^=order (.*)$/) {
        $order = $1;
@@ -79,6 +83,10 @@ for my $file (@files) {
 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.
@@ -94,12 +102,22 @@ Imager::APIRef - Imager's C API - reference.
 
   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";
-  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;
@@ -166,7 +184,7 @@ Tony Cook <tonyc@cpan.org>
 
 =head1 SEE ALSO
 
-Imager, Imager::ExtUtils, Imager::Inline
+Imager, Imager::API, Imager::ExtUtils, Imager::Inline
 
 =cut
 EOS
@@ -175,14 +193,21 @@ close OUT;
 
 
 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 mm_log i_color_model_t
+       im_context_t i_img_dim i_img_dim_u im_slot_t
+       i_polygon_t i_poly_fill_mode_t i_mutex_t
+       i_img_has_alpha 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 && !/SKIP/ && /\(\*f_(i[om]?_\w+)/) {
+      my $name = $1;
+      $name =~ s/_imp$//;
+      push @funcs, $name;
     }
     if (/^\} im_ext_funcs;$/) {
       $in_struct