parent
d6d994f11e
commit
afe3b0cd54
|
@ -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;
|
|
@ -123,6 +123,7 @@ LPICONINFO16
|
|||
LPINT16
|
||||
LPJOYCAPS16
|
||||
LPJOYINFO16
|
||||
LPJOYINFOEX
|
||||
LPKERNINGPAIR16
|
||||
LPLOGFONT16
|
||||
LPMALLOC16 *
|
||||
|
@ -172,6 +173,7 @@ LPVOID
|
|||
LPVOID *
|
||||
LPWAVEFILTER
|
||||
LPWAVEFORMATEX
|
||||
LPWAVEHDR
|
||||
LPWAVEINCAPS16
|
||||
LPWAVEOUTCAPS16
|
||||
LPWIN32SINFO
|
||||
|
|
|
@ -341,6 +341,8 @@ LPDIRECTPLAYLOBBYA *
|
|||
LPDIRECTSOUND *
|
||||
LPDISCDLGSTRUCTA
|
||||
LPDISCDLGSTRUCTW
|
||||
LPDISPLAY_DEVICEA
|
||||
LPDISPLAY_DEVICEW
|
||||
LPDPENUMDPCALLBACKA
|
||||
LPDPENUMDPCALLBACKW
|
||||
LPDRAWITEMSTRUCT
|
||||
|
@ -547,6 +549,7 @@ LPVARSTRING
|
|||
LPVOID
|
||||
LPVOID *
|
||||
LPWAVEFORMATEX
|
||||
LPWAVEHDR
|
||||
LPWAVEINCAPSA
|
||||
LPWAVEINCAPSW
|
||||
LPWAVEOUTCAPSA
|
||||
|
@ -641,6 +644,8 @@ PLUID
|
|||
PNOTIFYICONDATAA
|
||||
POBJECT_ATTRIBUTES
|
||||
POINT *
|
||||
PPOLYTEXTA
|
||||
PPOLYTEXTW
|
||||
PPRIVILEGE_SET
|
||||
PREAD_PROCESS_MEMORY_ROUTINE
|
||||
PRTL_HEAP_DEFINITION
|
||||
|
|
|
@ -84,10 +84,11 @@ sub read_spec_files {
|
|||
my $proto = shift;
|
||||
my $class = ref($proto) || $proto;
|
||||
|
||||
my $path = shift;
|
||||
my $win16api = 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);
|
||||
if($type eq "win16") {
|
||||
$win16api->parse_spec_file($file);
|
||||
|
|
|
@ -4,13 +4,28 @@
|
|||
|
||||
use strict;
|
||||
|
||||
my $wine_dir;
|
||||
my $winapi_check_dir;
|
||||
BEGIN {
|
||||
require "tools/winapi_check/winapi.pm";
|
||||
require "tools/winapi_check/nativeapi.pm";
|
||||
require "tools/winapi_check/winapi_local.pm";
|
||||
require "tools/winapi_check/winapi_global.pm";
|
||||
require "tools/winapi_check/winapi_options.pm";
|
||||
require "tools/winapi_check/winapi_parser.pm";
|
||||
|
||||
if($0 =~ /^((.*?)\/?tools\/winapi_check)\/winapi_check$/)
|
||||
{
|
||||
$winapi_check_dir = $1;
|
||||
if($2 ne "")
|
||||
{
|
||||
$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 nativeapi;
|
||||
|
@ -26,11 +41,11 @@ if($options->help) {
|
|||
exit;
|
||||
}
|
||||
|
||||
my $win16api = 'winapi'->new("win16", "tools/winapi_check/win16api.dat");
|
||||
my $win32api = 'winapi'->new("win32", "tools/winapi_check/win32api.dat");
|
||||
'winapi'->read_spec_files($win16api, $win32api);
|
||||
my $win16api = 'winapi'->new("win16", "$winapi_check_dir/win16api.dat");
|
||||
my $win32api = 'winapi'->new("win32", "$winapi_check_dir/win32api.dat");
|
||||
'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) {
|
||||
my $module16 = $win16api->function_module($name);
|
||||
|
|
|
@ -2,7 +2,6 @@ package winapi_options;
|
|||
|
||||
use strict;
|
||||
|
||||
|
||||
sub parser_comma_list {
|
||||
my $prefix = shift;
|
||||
my $value = shift;
|
||||
|
@ -89,6 +88,7 @@ sub new {
|
|||
my $module = \${$self->{MODULE}};
|
||||
my $global = \${$self->{GLOBAL}};
|
||||
|
||||
$$global = 0;
|
||||
while(defined($_ = shift @ARGV)) {
|
||||
if(/^-([^=]*)(=(.*))?$/) {
|
||||
my $name;
|
||||
|
@ -157,15 +157,19 @@ sub new {
|
|||
}
|
||||
}
|
||||
|
||||
my $paths;
|
||||
if($#$files == -1) {
|
||||
@$files = map {
|
||||
s/^.\/(.*)$/$1/;
|
||||
$_;
|
||||
} split(/\n/, `find . -name \\*.c`);
|
||||
$paths = ".";
|
||||
$$global = 1;
|
||||
} else {
|
||||
$$global = 0
|
||||
$paths = join(" ",@$files);
|
||||
}
|
||||
|
||||
|
||||
@$files = map {
|
||||
s/^.\/(.*)$/$1/;
|
||||
$_;
|
||||
} split(/\n/, `find $paths -name \\*.c`);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
|
|
@ -129,9 +129,20 @@ sub parse_c_file {
|
|||
my @arguments32 = ("HDC", "INT");
|
||||
&$function_found_callback("INT16", "WINAPI", $2 . "16", \@arguments16);
|
||||
&$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) {
|
||||
$_ = $'; $again = 1;
|
||||
print "$_";
|
||||
if($1 eq "1") {
|
||||
my @arguments16 = ("HWAVEOUT16", $4);
|
||||
my @arguments32 = ("HWAVEOUT", $4);
|
||||
|
|
Loading…
Reference in New Issue