Commit 6b11a3c3 authored by Alexandre Julliard's avatar Alexandre Julliard

winapi: Add some support for handling ifdefs, particularly ifdef _WIN64.

parent 701dd239
......@@ -330,30 +330,35 @@ sub new($$$)
sub align($)
{
my ($self) = @_;
return undef unless defined $self->{TYPE}->field_aligns();
return $self->{TYPE}->field_aligns()->[$self->{NUMBER}];
}
sub base_size($)
{
my ($self) = @_;
return undef unless defined $self->{TYPE}->field_base_sizes();
return $self->{TYPE}->field_base_sizes()->[$self->{NUMBER}];
}
sub name($)
{
my ($self) = @_;
return undef unless defined $self->{TYPE}->field_names();
return $self->{TYPE}->field_names()->[$self->{NUMBER}];
}
sub offset($)
{
my ($self) = @_;
return undef unless defined $self->{TYPE}->field_offsets();
return $self->{TYPE}->field_offsets()->[$self->{NUMBER}];
}
sub size($)
{
my ($self) = @_;
return undef unless defined $self->{TYPE}->field_sizes();
return $self->{TYPE}->field_sizes()->[$self->{NUMBER}];
}
......
......@@ -352,6 +352,7 @@ foreach my $file (@files) {
my $line;
my $type;
my @packs = (4);
my @ifdefs = ();
my $update_output = sub {
my $progress = "";
......@@ -384,19 +385,37 @@ foreach my $file (@files) {
#print "found_preprocessor: $begin_line: [$_]\n";
if ($preprocessor =~ /^\#\s*include\s+[\"<]pshpack(\d+)\.h[\">]$/) {
push @packs, $1;
push @packs, $1 unless @ifdefs && !$ifdefs[$#ifdefs];
#print "found pack $1 on line $begin_line\n";
} elsif($preprocessor =~ /^\#\s*include\s+[\"<]poppack\.h[\">]$/) {
pop @packs;
pop @packs unless @ifdefs && !$ifdefs[$#ifdefs];
#print "found poppack on line $begin_line\n";
}
} elsif ($preprocessor =~ /^\#\s*ifdef\s+_WIN64/) {
push @ifdefs, 0;
} elsif ($preprocessor =~ /^\#\s*ifndef\s+_WIN64/) {
push @ifdefs, 1;
} elsif ($preprocessor =~ /^\#\s*elif\s+defined(_WIN64)/) {
$ifdefs[$#ifdefs] = 0;
} elsif ($preprocessor =~ /^\#\s*ifdef\s/) {
push @ifdefs, 2;
} elsif ($preprocessor =~ /^\#\s*ifndef\s/) {
push @ifdefs, 2;
} elsif ($preprocessor =~ /^\#\s*if/) {
push @ifdefs, 2;
} elsif ($preprocessor =~ /^\#\s*else/) {
$ifdefs[$#ifdefs] = $ifdefs[$#ifdefs] ^ 1;
} elsif ($preprocessor =~ /^\#\s*elif/) {
$ifdefs[$#ifdefs] = 2;
} elsif ($preprocessor =~ /^\#\s*endif/) {
pop @ifdefs;
}
return 1;
};
$parser->set_found_preprocessor_callback($found_preprocessor);
my $found_type = sub {
$type = shift;
return if @ifdefs && !$ifdefs[$#ifdefs];
&$update_output();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment