diff options
| author | 2004-04-30 00:18:04 +0000 | |
|---|---|---|
| committer | 2004-04-30 00:18:04 +0000 | |
| commit | 1e37d85e11b430c417100dc5ab198f6a19b22b7f (patch) | |
| tree | 60779995e5227ba0b873562670470fad8d5a2a6e | |
| parent | 4cc664850ac27f907478e9fa947744aea604d1d7 (diff) | |
updated gen_todo script
| -rwxr-xr-x | gen_todo.pl | 43 |
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 | ||
| 17 | use strict; | 17 | use strict; |
| 18 | 18 | my $rootdir = "."; | |
| 19 | opendir(MYDIR, ".") or die "Unable to open directory"; | 19 | opendir(MYDIR, $rootdir) or die "Unable to open directory"; |
| 20 | print "Building TODO file for source directory\n"; | 20 | print "Building TODO file for source directory\n"; |
| 21 | 21 | my $todo_header = "* Things TODO *\n\n"; | |
| 22 | open ( TODOFILE, "TODO.in"); | 22 | if (open ( TODOFILE, "TODO.in")) { |
| 23 | my $todo_header = do { local $/; <TODOFILE> }; | 23 | $todo_header = do { local $/; <TODOFILE> }; |
| 24 | close (TODOFILE); | 24 | close (TODOFILE); |
| 25 | } | ||
| 25 | open (TODOFILE, "> TODO"); | 26 | open (TODOFILE, "> TODO"); |
| 26 | print TODOFILE $todo_header; | 27 | print TODOFILE $todo_header; |
| 27 | print "Parsing..."; | 28 | print "Parsing..."; |
| 28 | while (my $entry = readdir(MYDIR)) { | 29 | while (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 | } |
