From: Olivier Thauvin Date: Fri, 28 Jan 2005 16:53:11 +0000 (+0100) Subject: h2hp: 2 fix X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9e3b9e5a5d8bea4abb387fc616a73216b4d8c289;p=p5sagit%2Fp5-mst-13.2.git h2hp: 2 fix Message-Id: <200501281653.15708.olivier.thauvin@aerov.jussieu.fr> p4raw-id: //depot/perl@23899 --- diff --git a/utils/h2ph.PL b/utils/h2ph.PL index 81e23f6..8c574c3 100644 --- a/utils/h2ph.PL +++ b/utils/h2ph.PL @@ -276,6 +276,8 @@ while (defined (my $file = next_file())) { chomp $next; # drop "#define FOO FOO" in enums $next =~ s/^\s*#\s*define\s+(\w+)\s+\1\s*$//; + # #defines in enums (aliases) + $next =~ s/^\s*#\s*define\s+(\w+)\s+(\w+)\s*$/$1 = $2,/; $_ .= $next; print OUT "# $next\n" if $opt_D; } @@ -288,6 +290,7 @@ while (defined (my $file = next_file())) { my $enum_val = -1; foreach my $enum (@enum_subs) { my ($enum_name, $enum_value) = $enum =~ /^([a-zA-Z_]\w*)(=.+)?$/; + $enum_name or next; $enum_value =~ s/^=//; $enum_val = (length($enum_value) ? $enum_value : $enum_val + 1); if ($opt_h) {