From 1e37d85e11b430c417100dc5ab198f6a19b22b7f Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Fri, 30 Apr 2004 00:18:04 +0000 Subject: updated gen_todo script --- gen_todo.pl | 43 +++++++++++++++++++++++++++++++++---------- 1 file 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 @@ # limitations under the License. use strict; - -opendir(MYDIR, ".") or die "Unable to open directory"; +my $rootdir = "."; +opendir(MYDIR, $rootdir) or die "Unable to open directory"; print "Building TODO file for source directory\n"; - -open ( TODOFILE, "TODO.in"); -my $todo_header = do { local $/; }; -close (TODOFILE); +my $todo_header = "* Things TODO *\n\n"; +if (open ( TODOFILE, "TODO.in")) { + $todo_header = do { local $/; }; + close (TODOFILE); +} open (TODOFILE, "> TODO"); print TODOFILE $todo_header; print "Parsing..."; while (my $entry = readdir(MYDIR)) { next if (!($entry =~ /\.[ch]$/)); print "$entry..."; - open(DAFILE, $entry) or die "Unable to open file"; + open(DAFILE, $rootdir.'/'.$entry) or die "Unable to open file\n"; my $linenumber = 0; + my $status = 0; # 0=no comment 1=comment 2=in todo block while (my $line = ) { - $linenumber ++; - next if (!($line =~ /\/\* TODO: (.*)\*\//)); - print TODOFILE $entry.":".$linenumber.": ".$1."\n"; + $linenumber++; + if ($status==0) { + if ( ($line =~ /\/\/\s+TODO: (.*)/) || ($line =~ /\/\*\s+TODO: (.*)\s*\*\//) ){ + print TODOFILE $entry.":".$linenumber.": ".$1."\n"; + } else { + if ($line =~ /\/\*\*/) { + $status = 1; + } + } + } else { + if ($line =~ /\*\//) { + $status = 0; + } else { + if ($status==1) { + if ($line =~ /TODO:/) { + $status=2; + } + } else { + if ($line =~ /\* \s+-?\s*(.*)/) { + print TODOFILE $entry.":".$linenumber.": ".$1."\n"; + } + } + } + } } close(DAFILE); } -- cgit