winapi: Introduce a pseudo-loop in parse_c_variable() to get rid of the $finished variable.

This commit is contained in:
Francois Gouget 2009-07-09 09:52:08 +02:00 committed by Alexandre Julliard
parent 3ce23c9802
commit 6f5ae45846
1 changed files with 103 additions and 109 deletions

View File

@ -1710,13 +1710,11 @@ sub parse_c_variable($$$$$$$)
}
}
my $finished = 0;
return 0 if(/^$/);
if($finished) {
# Nothing
} elsif(/^$/) {
return 0;
} elsif (s/^(enum\s+|interface\s+|struct\s+|union\s+)((?:MSVCRT|WS)\(\s*\w+\s*\)|\w+)?\s*\{\s*//s) {
finished: while (1)
{
if (s/^(enum\s+|interface\s+|struct\s+|union\s+)((?:MSVCRT|WS)\(\s*\w+\s*\)|\w+)?\s*\{\s*//s) {
my $kind = $1;
my $_name = $2;
$self->_update_c_position($&, \$line, \$column);
@ -1727,7 +1725,7 @@ sub parse_c_variable($$$$$$$)
$type = "$kind { }";
}
$finished = 1;
last finished;
} elsif(s/^((?:enum\s+|interface\s+|struct\s+|union\s+)?\w+\b(?:\s+DECLSPEC_ALIGN\(.*?\)|\s*(?:const\s*|volatile\s*)?\*)*)\s*(\w+)\s*(\[.*?\]$|:\s*(\d+)$|\{)?//s) {
$type = "$sign$1";
$name = $2;
@ -1746,39 +1744,37 @@ sub parse_c_variable($$$$$$$)
$type = $self->_format_c_type($type);
$finished = 1;
last finished;
} elsif(s/^((?:enum\s+|interface\s+|struct\s+|union\s+)?\w+\b(?:\s*\*)*)\s*:\s*(\d+)$//s) {
$type = "$sign$1:$2";
$name = "";
$type = $self->_format_c_type($type);
$finished = 1;
last finished;
} elsif(s/^((?:enum\s+|interface\s+|struct\s+|union\s+)?\w+\b(?:\s*\*)*\s*\(\s*(?:$CALL_CONVENTION)?(?:\s*\*)*)\s*(\w+)\s*(\)\s*\(.*?\))$//s) {
$type = $self->_format_c_type("$sign$1$3");
$name = $2;
$finished = 1;
last finished;
} elsif($self->_parse_c('DEFINE_GUID', \$_, \$line, \$column, \$match)) { # Windows specific
$type = $match;
$finished = 1;
last finished;
} else {
$self->_parse_c_warning($_, $line, $column, "variable", "'$_'");
$finished = 1;
last finished;
}
if($finished) {
# Nothing
} elsif($self->_parse_c('SEQ_DEFINEBUF', \$_, \$line, \$column, \$match)) { # Linux specific
if($self->_parse_c('SEQ_DEFINEBUF', \$_, \$line, \$column, \$match)) { # Linux specific
$type = $match;
$finished = 1;
last finished;
} elsif($self->_parse_c('DEFINE_REGS_ENTRYPOINT_\w+|DPQ_DECL_\w+|HANDLER_DEF|IX86_ONLY', # Wine specific
\$_, \$line, \$column, \$match))
{
$type = $match;
$finished = 1;
last finished;
} elsif($self->_parse_c('(?:struct\s+)?ICOM_VTABLE\s*\(\w+\)', \$_, \$line, \$column, \$match)) {
$type = $match;
$finished = 1;
last finished;
} elsif(s/^(enum|interface|struct|union)(?:\s+(\w+))?\s*\{.*?\}\s*//s) {
my $kind = $1;
my $_name = $2;
@ -1800,15 +1796,11 @@ sub parse_c_variable($$$$$$$)
# $self->_parse_c_warning($_, $line, $column, "variable2", "");
if($finished) {
# Nothing
} elsif(s/^WINAPI\s*//) {
if(s/^WINAPI\s*//) {
$self->_update_c_position($&, \$line, \$column);
}
if($finished) {
# Nothing
} elsif(s/^(\((?:$CALL_CONVENTION)?\s*\*?\s*(?:$CALL_CONVENTION)?\w+\s*(?:\[[^\]]*\]\s*)*\))\s*\(//) {
if(s/^(\((?:$CALL_CONVENTION)?\s*\*?\s*(?:$CALL_CONVENTION)?\w+\s*(?:\[[^\]]*\]\s*)*\))\s*\(//) {
$self->_update_c_position($&, \$line, \$column);
$name = $1;
@ -1831,6 +1823,8 @@ sub parse_c_variable($$$$$$$)
} else {
return 0;
}
last finished;
}
# $output->write("$type: $name: '$_'\n");