diff lib-src/make-mswin-unicode.pl @ 5920:0f2338afbabf cygwin

Minimum necessary to get started: sufficient to compile OK, run -nw, but not with window
author Henry Thompson <ht@markup.co.uk>
date Mon, 21 Apr 2014 11:42:50 +0100
parents 308d34e9f07d
children 2f34b59f451a
line wrap: on
line diff
--- a/lib-src/make-mswin-unicode.pl	Thu Dec 16 11:20:17 2021 +0000
+++ b/lib-src/make-mswin-unicode.pl	Mon Apr 21 11:42:50 2014 +0100
@@ -183,15 +183,15 @@
 # regexp matching a parenthesized argument list in a prototype
 my $args_re = "\\(((?:${ws_re}${arg_re}${ws_re},)*${ws_re}${arg_re}${ws_re})\\)";
 # regexp matching a return type in a protype
-my $rettype_re = "(SHSTDAPI_\\(${tok_ch}+\\)|${tok_ch}" . "[A-Za-z_0-9 \t\n\r\f]*?${tok_ch})";
+my $rettype_re = "(SHSTDAPI_\\([${tok_ch} *]+\\)|${tok_ch}" . "[A-Za-z_0-9 \t\n\r\f]*?${tok_ch})";
 # regexp matching a function name
 my $funname_re = "(${tok_ch}+)";
 # Regexp matching a function prototype, $1 = rettype, $2 = name, $3 = args
 my $fun_re = "${rettype_re}${ws_re}${funname_re}${ws_re}${args_re};";
 # Regexp matching a particular Unicode function (ending in ...W)
-my $wfun_re = "${rettype_re}${ws_re}${funname_re}W${ws_re}${args_re};";
+my $wfun_re = "(?:#endif|#ifndef ${tok_ch}+)?${ws_re}${rettype_re}${ws_re}${funname_re}W${ws_re}${args_re};";
 
-# print "regexp: $wfun_re\n";
+#print "regexp: $wfun_re\n";
 
 while (<>)
   {
@@ -250,6 +250,7 @@
 	      {
 		my ($fun, $reason) = split /\s+/, $parms, 2;
 		$files{$current_file}{$fun} = [$command, $reason];
+		#print "$current_file : $fun = $command, $reason\n";
 		$bracket{$current_file}{$fun} =
 		  $current_bracket[$#current_bracket];
 	      }
@@ -282,6 +283,7 @@
     while ($slurp =~ /$wfun_re/g)
       {
 	my ($rettype, $fun, $args) = ($1, $2, $3);
+	#print "slurped: $1 $2 $3\n";
 
 	if ($processed{$fun})
 	  {
@@ -298,6 +300,7 @@
 	# my ($command, $reason) = @$files{$file}{$fun};
 	# You have to use a temporary var.
 	my $filesarr = $files{$file}{$fun};
+	if (!defined ($filesarr)) {print "\nlosing: |$file|$fun|\n"; next}
 	my ($command, $reason) = @$filesarr;
 	if (!defined ($command))
 	  {