- Adapted to changes in Wine.

- Minor improvements.
This commit is contained in:
Patrik Stridvall 1999-09-29 10:22:00 +00:00 committed by Alexandre Julliard
parent d6d994f11e
commit afe3b0cd54
7 changed files with 57 additions and 203 deletions

View File

@ -1,184 +0,0 @@
package parser;
BEGIN {
use Exporter ();
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(&init
&transact &commit &rollback &token
&dump_state
&either &filter &many &many1 &separate &separate1 &sequence);
}
my @stack;
my $current;
my $next;
sub init {
@stack = ();
$current = [];
$next = shift;
@$next = grep {
$_->{type} !~ /^comment|preprocessor$/;
} @$next;
}
sub dump_state {
print "stack: [\n";
for my $tokens (@stack) {
print " [\n";
for my $token (@$tokens) {
print " " . $token->{type} . ": " . $token->{data} . "\n";
}
print " ]\n";
}
print "]\n";
print "current: [\n";
for my $token (@$current) {
print " " . $token->{type} . ": " . $token->{data} . "\n";
}
print "]\n";
print "next: [\n";
for my $token (@$next) {
print " " . $token->{type} . ": " . $token->{data} . "\n";
}
print "]\n";
}
sub token {
my $token = shift @$next;
push @$current, $token;
return $token;
};
sub transact {
push @stack, $current;
$current = [];
}
sub commit {
my $oldcurrent = $current;
$current = pop @stack;
push @$current, @$oldcurrent;
}
sub rollback {
unshift @$next, @$current;
$current = pop @stack;
}
sub filter {
my $parser = shift;
my $filter = shift;
transact;
my $r1 = &$parser;
if(defined($r1)) {
my $r2 = &$filter($r1);
if($r2) {
commit;
return $r1;
} else {
rollback;
return undef;
}
} else {
rollback;
return undef;
}
}
sub either {
for my $parser (@_) {
transact;
my $r = &$parser;
if(defined($r)) {
commit;
return $r;
} else {
rollback;
}
}
return undef;
}
sub sequence {
transact;
my $rs = [];
for my $parser (@_) {
my $r = &$parser;
if(defined($r)) {
push @$rs, $r;
} else {
rollback;
return undef;
}
}
commit;
return $rs;
}
sub separate {
my $parser = shift;
my $separator = shift;
my $rs = [];
while(1) {
my $r = &$parser;
if(defined($r)) {
push @$rs, $r;
} else {
last;
}
my $s = &$separator;
if(!defined($r)) {
last;
}
}
return $rs;
}
sub separate1 {
my $parser = shift;
my $separator = shift;
transact;
my $rs = separate($parser,$separator);
if($#$rs != -1) {
commit;
return $rs;
} else {
rollback;
return undef;
}
}
sub many {
my $parser = shift;
my $rs = [];
while(1) {
my $r = &$parser;
if(defined($r)) {
push @$rs, $r;
} else {
last;
}
}
return $rs;
}
sub many1 {
my $parser = shift;
transact;
my $rs = many($parser);
if($#$rs != -1) {
commit;
return $rs;
} else {
rollback;
return undef;
}
}
1;

View File

@ -123,6 +123,7 @@ LPICONINFO16
LPINT16 LPINT16
LPJOYCAPS16 LPJOYCAPS16
LPJOYINFO16 LPJOYINFO16
LPJOYINFOEX
LPKERNINGPAIR16 LPKERNINGPAIR16
LPLOGFONT16 LPLOGFONT16
LPMALLOC16 * LPMALLOC16 *
@ -172,6 +173,7 @@ LPVOID
LPVOID * LPVOID *
LPWAVEFILTER LPWAVEFILTER
LPWAVEFORMATEX LPWAVEFORMATEX
LPWAVEHDR
LPWAVEINCAPS16 LPWAVEINCAPS16
LPWAVEOUTCAPS16 LPWAVEOUTCAPS16
LPWIN32SINFO LPWIN32SINFO

View File

@ -341,6 +341,8 @@ LPDIRECTPLAYLOBBYA *
LPDIRECTSOUND * LPDIRECTSOUND *
LPDISCDLGSTRUCTA LPDISCDLGSTRUCTA
LPDISCDLGSTRUCTW LPDISCDLGSTRUCTW
LPDISPLAY_DEVICEA
LPDISPLAY_DEVICEW
LPDPENUMDPCALLBACKA LPDPENUMDPCALLBACKA
LPDPENUMDPCALLBACKW LPDPENUMDPCALLBACKW
LPDRAWITEMSTRUCT LPDRAWITEMSTRUCT
@ -547,6 +549,7 @@ LPVARSTRING
LPVOID LPVOID
LPVOID * LPVOID *
LPWAVEFORMATEX LPWAVEFORMATEX
LPWAVEHDR
LPWAVEINCAPSA LPWAVEINCAPSA
LPWAVEINCAPSW LPWAVEINCAPSW
LPWAVEOUTCAPSA LPWAVEOUTCAPSA
@ -641,6 +644,8 @@ PLUID
PNOTIFYICONDATAA PNOTIFYICONDATAA
POBJECT_ATTRIBUTES POBJECT_ATTRIBUTES
POINT * POINT *
PPOLYTEXTA
PPOLYTEXTW
PPRIVILEGE_SET PPRIVILEGE_SET
PREAD_PROCESS_MEMORY_ROUTINE PREAD_PROCESS_MEMORY_ROUTINE
PRTL_HEAP_DEFINITION PRTL_HEAP_DEFINITION

View File

@ -84,10 +84,11 @@ sub read_spec_files {
my $proto = shift; my $proto = shift;
my $class = ref($proto) || $proto; my $class = ref($proto) || $proto;
my $path = shift;
my $win16api = shift; my $win16api = shift;
my $win32api = shift; my $win32api = shift;
foreach my $file (split(/\n/, `find . -name \\*.spec`)) { foreach my $file (split(/\n/, `find $path -name \\*.spec`)) {
my $type = 'winapi'->get_spec_file_type($file); my $type = 'winapi'->get_spec_file_type($file);
if($type eq "win16") { if($type eq "win16") {
$win16api->parse_spec_file($file); $win16api->parse_spec_file($file);

View File

@ -4,13 +4,28 @@
use strict; use strict;
my $wine_dir;
my $winapi_check_dir;
BEGIN { BEGIN {
require "tools/winapi_check/winapi.pm";
require "tools/winapi_check/nativeapi.pm"; if($0 =~ /^((.*?)\/?tools\/winapi_check)\/winapi_check$/)
require "tools/winapi_check/winapi_local.pm"; {
require "tools/winapi_check/winapi_global.pm"; $winapi_check_dir = $1;
require "tools/winapi_check/winapi_options.pm"; if($2 ne "")
require "tools/winapi_check/winapi_parser.pm"; {
$wine_dir = $2;
} else {
$wine_dir = ".";
}
}
@INC = ($winapi_check_dir);
require "winapi.pm";
require "nativeapi.pm";
require "winapi_local.pm";
require "winapi_global.pm";
require "winapi_options.pm";
require "winapi_parser.pm";
import winapi; import winapi;
import nativeapi; import nativeapi;
@ -26,11 +41,11 @@ if($options->help) {
exit; exit;
} }
my $win16api = 'winapi'->new("win16", "tools/winapi_check/win16api.dat"); my $win16api = 'winapi'->new("win16", "$winapi_check_dir/win16api.dat");
my $win32api = 'winapi'->new("win32", "tools/winapi_check/win32api.dat"); my $win32api = 'winapi'->new("win32", "$winapi_check_dir/win32api.dat");
'winapi'->read_spec_files($win16api, $win32api); 'winapi'->read_spec_files($wine_dir, $win16api, $win32api);
my $nativeapi = 'nativeapi'->new("tools/winapi_check/nativeapi.dat"); my $nativeapi = 'nativeapi'->new("$winapi_check_dir/nativeapi.dat");
for my $name ($win32api->all_functions) { for my $name ($win32api->all_functions) {
my $module16 = $win16api->function_module($name); my $module16 = $win16api->function_module($name);

View File

@ -2,7 +2,6 @@ package winapi_options;
use strict; use strict;
sub parser_comma_list { sub parser_comma_list {
my $prefix = shift; my $prefix = shift;
my $value = shift; my $value = shift;
@ -89,6 +88,7 @@ sub new {
my $module = \${$self->{MODULE}}; my $module = \${$self->{MODULE}};
my $global = \${$self->{GLOBAL}}; my $global = \${$self->{GLOBAL}};
$$global = 0;
while(defined($_ = shift @ARGV)) { while(defined($_ = shift @ARGV)) {
if(/^-([^=]*)(=(.*))?$/) { if(/^-([^=]*)(=(.*))?$/) {
my $name; my $name;
@ -157,14 +157,18 @@ sub new {
} }
} }
my $paths;
if($#$files == -1) { if($#$files == -1) {
$paths = ".";
$$global = 1;
} else {
$paths = join(" ",@$files);
}
@$files = map { @$files = map {
s/^.\/(.*)$/$1/; s/^.\/(.*)$/$1/;
$_; $_;
} split(/\n/, `find . -name \\*.c`); } split(/\n/, `find $paths -name \\*.c`);
} else {
$$global = 0
}
return $self; return $self;
} }

View File

@ -129,9 +129,20 @@ sub parse_c_file {
my @arguments32 = ("HDC", "INT"); my @arguments32 = ("HDC", "INT");
&$function_found_callback("INT16", "WINAPI", $2 . "16", \@arguments16); &$function_found_callback("INT16", "WINAPI", $2 . "16", \@arguments16);
&$function_found_callback("INT", "WINAPI", $2, \@arguments32); &$function_found_callback("INT", "WINAPI", $2, \@arguments32);
} elsif(/WAVEIN_SHORTCUT_0\s*\(\s*(.*?)\s*,\s*(.*?)\s*\)/s) {
$_ = $'; $again = 1;
my @arguments16 = ("HWAVEIN16");
my @arguments32 = ("HWAVEIN");
&$function_found_callback("UINT16", "WINAPI", "waveIn" . $1 . "16", \@arguments16);
&$function_found_callback("UINT", "WINAPI", "waveIn" . $1, \@arguments32);
} elsif(/WAVEOUT_SHORTCUT_0\s*\(\s*(.*?)\s*,\s*(.*?)\s*\)/s) {
$_ = $'; $again = 1;
my @arguments16 = ("HWAVEOUT16");
my @arguments32 = ("HWAVEOUT");
&$function_found_callback("UINT16", "WINAPI", "waveOut" . $1 . "16", \@arguments16);
&$function_found_callback("UINT", "WINAPI", "waveOut" . $1, \@arguments32);
} elsif(/WAVEOUT_SHORTCUT_(1|2)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) { } elsif(/WAVEOUT_SHORTCUT_(1|2)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
print "$_";
if($1 eq "1") { if($1 eq "1") {
my @arguments16 = ("HWAVEOUT16", $4); my @arguments16 = ("HWAVEOUT16", $4);
my @arguments32 = ("HWAVEOUT", $4); my @arguments32 = ("HWAVEOUT", $4);