Improvements to comments etc.
[AROS.git] / tools / dtdesc / c_iff / autodoc.pl
blob49d01b0b069d4f603aed231e6632d43c0888d2ce
1 #! /usr/bin/perl
3 # autodoc.pl - an autodoc-replacement
5 # Copyright (C) 2000, 2001 Joerg Dietrich
7 # This is the AROS-version of autodoc.pl.
8 # It is distributed under the AROS Public License.
9 # But I reserve the right to distribute
10 # my own version under other licenses.
12 # This is a quick and dirty hack. It is just for internal use.
13 # But feel free to improve it.
15 # read in all commandline-specified files
16 # into one big array
17 for(@ARGV)
19 if(open(TMPFILE, "<".$_))
21 while(<TMPFILE>)
23 push(@Zeilen, $_);
25 close(TMPFILE);
29 # count rows
30 $nZeilen=0;
31 for(@Zeilen)
33 $nZeilen++;
36 # extract the autodocs
37 for($i=0; $i<$nZeilen; $i++)
39 # scans for /******
40 if($Zeilen[$i] =~ /\/\*{6}/)
42 # function-name as key of a hash-entry
43 $Key=substr($Zeilen[$i], 8, rindex($Zeilen[$i], " ")-8);
45 # Now put all following rows into the data of the hash-entry
46 $Value="";
47 while(1)
49 $i++;
50 if($Zeilen[$i] =~ /\*{6}/)
52 last;
55 $Value=$Value . substr($Zeilen[$i], 1);
58 $Data{$Key}=$Value;
62 #sort the keys alphabeticaly
63 @Keys=keys(%Data);
64 @KeysSorted=sort(@Keys);
66 #TOC
67 print("TABLE OF CONTENTS\n\n");
69 for(@KeysSorted)
71 print($_, "\n");
74 # print the functions
75 for(@KeysSorted)
77 $Space="";
79 for($i=0; $i<(77-2*length($_)); $i++)
81 $Space=$Space." ";
84 print($_, $Space, $_, "\n");
86 print($Data{$_});