correct the type of the im_decode_exif() data parameter
[imager.git] / doco.perl
CommitLineData
02d1d628 1#!/usr/bin/perl -w
d75a4e19 2use strict;
02d1d628
AMH
3
4use Cwd;
5
6# doco.perl - 24 Jan 18:09:40 EST 2001
7# Addi - (addi@umich.edu)
8#
9# Extract documentation and help from the source files
10#
11# -f <files> list FIXME comments for files
12# -f list FIXME comments for all files
13# -d <file> list pod comments from file
14
15my $comm = shift or USAGE();
16
d75a4e19 17my @files;
02d1d628 18if ($comm eq "-f") {
d75a4e19
TC
19 if (@ARGV) {
20 @files = @ARGV;
21 }
22 else {
23 @files = getfiles();
02d1d628
AMH
24 }
25
26 for my $file (@files) {
d75a4e19 27 local(*FH, $/); open(FH,"< $file") or die $!;
02d1d628
AMH
28 my $data = <FH>; close(FH);
29 while( $data =~ m/FIXME:(.*?)\*\//sg ) {
30 printf("%10.10s:%5d %s\n", $file, ptol($data, pos($data)), $1);
31 }
32 }
33 exit(0);
34}
35
36if ($comm eq "-d") {
37 USAGE() if !@ARGV;
38 my $file = shift;
39 getfiles();
d75a4e19 40 local(*FH, $/); open(FH, "< $file") or die $!;
02d1d628
AMH
41 my $data = <FH>; close(FH);
42 $data =~ s/^(=item)/\n$1/mg;
43 $data =~ s/^(=cut)/\n~~~~~~~~\n\n$1\n\n/mg;
44 print "\n";
45 open(FH,"|pod2text ") or die "Cannot run pod2text: $!\n";
46 print FH $data;
47 close(FH);
48 exit(2);
49}
50
51
52sub USAGE {
53
54print<<'EOF';
55doco.perl [-f files| stuff]
56
57 -f <files> list FIXME comments for files.
58 -f list FIXME comments for all files.
59
60EOF
61 exit;
62}
63
64sub getfiles {
d75a4e19 65 my $BASE=cwd;
02d1d628
AMH
66 local(*FH);
67 open(FH,"$BASE/MANIFEST") or die "Cannot open MANIFEST file: $!\n";
68 my @MANIFEST = <FH>;
69 chomp(@MANIFEST);
d75a4e19 70 return grep { m/\.(c|im)\s*$/ } @MANIFEST;
02d1d628
AMH
71}
72
73# string position to line number in string
74
75sub ptol {
76 my ($str, $pos) = @_;
77 my $lcnt=1;
78 $lcnt++ while(substr($str,0,$pos)=~m/\n/g);
79 $lcnt;
80}