summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Edward Rudd 2004-04-30 00:18:04 +0000
committerGravatar Edward Rudd 2004-04-30 00:18:04 +0000
commit1e37d85e11b430c417100dc5ab198f6a19b22b7f (patch)
tree60779995e5227ba0b873562670470fad8d5a2a6e
parent4cc664850ac27f907478e9fa947744aea604d1d7 (diff)
updated gen_todo script
-rwxr-xr-xgen_todo.pl43
1 files changed, 33 insertions, 10 deletions
diff --git a/gen_todo.pl b/gen_todo.pl
index d90d2b2..20b0894 100755
--- a/gen_todo.pl
+++ b/gen_todo.pl
@@ -15,25 +15,48 @@
15# limitations under the License. 15# limitations under the License.
16 16
17use strict; 17use strict;
18 18my $rootdir = ".";
19opendir(MYDIR, ".") or die "Unable to open directory"; 19opendir(MYDIR, $rootdir) or die "Unable to open directory";
20print "Building TODO file for source directory\n"; 20print "Building TODO file for source directory\n";
21 21my $todo_header = "* Things TODO *\n\n";
22open ( TODOFILE, "TODO.in"); 22if (open ( TODOFILE, "TODO.in")) {
23my $todo_header = do { local $/; <TODOFILE> }; 23 $todo_header = do { local $/; <TODOFILE> };
24close (TODOFILE); 24 close (TODOFILE);
25}
25open (TODOFILE, "> TODO"); 26open (TODOFILE, "> TODO");
26print TODOFILE $todo_header; 27print TODOFILE $todo_header;
27print "Parsing..."; 28print "Parsing...";
28while (my $entry = readdir(MYDIR)) { 29while (my $entry = readdir(MYDIR)) {
29 next if (!($entry =~ /\.[ch]$/)); 30 next if (!($entry =~ /\.[ch]$/));
30 print "$entry..."; 31 print "$entry...";
31 open(DAFILE, $entry) or die "Unable to open file"; 32 open(DAFILE, $rootdir.'/'.$entry) or die "Unable to open file\n";
32 my $linenumber = 0; 33 my $linenumber = 0;
34 my $status = 0; # 0=no comment 1=comment 2=in todo block
33 while (my $line = <DAFILE>) { 35 while (my $line = <DAFILE>) {
34 $linenumber ++; 36 $linenumber++;
35 next if (!($line =~ /\/\* TODO: (.*)\*\//)); 37 if ($status==0) {
36 print TODOFILE $entry.":".$linenumber.": ".$1."\n"; 38 if ( ($line =~ /\/\/\s+TODO: (.*)/) || ($line =~ /\/\*\s+TODO: (.*)\s*\*\//) ){
39 print TODOFILE $entry.":".$linenumber.": ".$1."\n";
40 } else {
41 if ($line =~ /\/\*\*/) {
42 $status = 1;
43 }
44 }
45 } else {
46 if ($line =~ /\*\//) {
47 $status = 0;
48 } else {
49 if ($status==1) {
50 if ($line =~ /TODO:/) {
51 $status=2;
52 }
53 } else {
54 if ($line =~ /\* \s+-?\s*(.*)/) {
55 print TODOFILE $entry.":".$linenumber.": ".$1."\n";
56 }
57 }
58 }
59 }
37 } 60 }
38 close(DAFILE); 61 close(DAFILE);
39} 62}