Francois Gouget : winapi_check: Print the line number when an error or warning is found in the API files.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jan 26 07:47:08 CST 2007


Module: wine
Branch: master
Commit: 9b28bd0a3df971f7a36480fa673c1cd5545788e5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9b28bd0a3df971f7a36480fa673c1cd5545788e5

Author: Francois Gouget <fgouget at free.fr>
Date:   Fri Jan 26 13:21:54 2007 +0100

winapi_check: Print the line number when an error or warning is found in the API files.

---

 tools/winapi/winapi.pm |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/winapi/winapi.pm b/tools/winapi/winapi.pm
index 53b7465..8fcaa41 100644
--- a/tools/winapi/winapi.pm
+++ b/tools/winapi/winapi.pm
@@ -139,7 +139,9 @@ sub parse_api_file($$) {
 
     open(IN, "< $winapi_dir/$file") || die "$winapi_dir/$file: $!\n";
     $/ = "\n";
+    my $linenum=0;
     while(<IN>) {
+        $linenum++;
 	s/^\s*?(.*?)\s*$/$1/; # remove whitespace at begin and end of line
 	s/^(.*?)\s*#.*$/$1/;  # remove comments
 	/^$/ && next;         # skip empty lines
@@ -193,12 +195,12 @@ sub parse_api_file($$) {
 	    if(!$forbidden) {
 		if(defined($module)) {
 		    if($$allowed_modules_unlimited{$type}) {
-			$output->write("$file: type ($type) already specified as an unlimited type\n");
+			$output->write("$file:$linenum: type ($type) already specified as an unlimited type\n");
 		    } elsif(!$$allowed_modules{$type}{$module}) {
 			$$allowed_modules{$type}{$module} = 1;
 			$$allowed_modules_limited{$type} = 1;
 		    } else {
-			$output->write("$file: type ($type) already specified\n");
+			$output->write("$file:$linenum: type ($type) already specified\n");
 		    }
 		} else {
 		    $$allowed_modules_unlimited{$type} = 1;
@@ -207,14 +209,14 @@ sub parse_api_file($$) {
 		$$allowed_modules_limited{$type} = 1;
 	    }
 	    if(defined($$translate_argument{$type}) && $$translate_argument{$type} ne $kind) {
-		$output->write("$file: type ($type) respecified as different kind ($kind != $$translate_argument{$type})\n");
+		$output->write("$file:$linenum: type ($type) respecified as different kind ($kind != $$translate_argument{$type})\n");
 	    } else {
 		$$translate_argument{$type} = $kind;
 	    }
 
 	    $$type_format{$module}{$type} = $format;
 	} else {
-	    $output->write("$file: file must begin with %<type> statement\n");
+	    $output->write("$file:$linenum: file must begin with %<type> statement\n");
 	    exit 1;
 	}
     }




More information about the wine-cvs mailing list