Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
47a99e1a
Commit
47a99e1a
authored
Jul 08, 2001
by
Patrik Stridvall
Committed by
Alexandre Julliard
Jul 08, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several bug fixes and additions.
parent
14e690f4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
369 additions
and
169 deletions
+369
-169
config.pm
tools/winapi/config.pm
+1
-1
winapi_extract
tools/winapi/winapi_extract
+114
-29
winapi_fixup
tools/winapi/winapi_fixup
+0
-0
modules.dat
tools/winapi_check/modules.dat
+13
-4
gdi.api
tools/winapi_check/win16/gdi.api
+1
-1
oledlg.api
tools/winapi_check/win32/oledlg.api
+3
-0
quartz.api
tools/winapi_check/win32/quartz.api
+10
-0
winmm.api
tools/winapi_check/win32/winmm.api
+1
-1
wsock32.api
tools/winapi_check/win32/wsock32.api
+1
-4
winapi.pm
tools/winapi_check/winapi.pm
+96
-4
winapi_check
tools/winapi_check/winapi_check
+34
-14
winapi_documentation.pm
tools/winapi_check/winapi_documentation.pm
+77
-109
winapi_function.pm
tools/winapi_check/winapi_function.pm
+11
-0
winapi_local.pm
tools/winapi_check/winapi_local.pm
+1
-1
winapi_options.pm
tools/winapi_check/winapi_options.pm
+6
-1
No files found.
tools/winapi/config.pm
View file @
47a99e1a
...
...
@@ -119,7 +119,7 @@ sub translate_calling_convention16 {
if
(
/^__cdecl$/
)
{
return
"cdecl"
;
}
elsif
(
/^VFWAPIV|WINAPIV$/
)
{
return
"
varargs"
;
return
"
pascal"
;
# FIXME: Is this correct?
}
elsif
(
/^__stdcall|VFWAPI|WINAPI|CALLBACK$/
)
{
return
"pascal"
;
}
elsif
(
/^__asm$/
)
{
...
...
tools/winapi/winapi_extract
View file @
47a99e1a
...
...
@@ -118,23 +118,54 @@ foreach my $file (@files) {
local
$_
;
foreach
(
split
(
/\n/
,
$documentation
))
{
if
(
/^\s*\*\s*(\
w+|\@)\s*[\(\[]\s*(\w+)\s*\.\s*(\@|\d
+)\s*[\)\]]/
)
{
if
(
/^\s*\*\s*(\
S+)\s*[\(\[]\s*(\w+)\s*\.\s*(\S
+)\s*[\)\]]/
)
{
my
$external_name
=
$1
;
my
$module
=
lc
(
$2
);
my
$ordinal
=
$3
;
if
(
$ordinal
eq
"@"
)
{
$specifications
{
$module
}{
unfixed
}{
$external_name
}{
debug_channels
}
=
[
@debug_channels
];
$specifications
{
$module
}{
unfixed
}{
$external_name
}{
internal_name
}
=
$internal_name
;
$specifications
{
$module
}{
unfixed
}{
$external_name
}{
external_name
}
=
$external_name
;
$specifications
{
$module
}{
unfixed
}{
$external_name
}{
ordinal
}
=
$ordinal
;
$specifications
{
$module
}{
unfixed
}{
$external_name
}{
arguments
}
=
[
@argument_types
];
if
(
1
||
!
exists
(
$specifications
{
$module
}{
unfixed
}{
$external_name
}))
{
$specifications
{
$module
}{
unfixed
}{
$external_name
}{
debug_channels
}
=
[
@debug_channels
];
$specifications
{
$module
}{
unfixed
}{
$external_name
}{
internal_name
}
=
$internal_name
;
$specifications
{
$module
}{
unfixed
}{
$external_name
}{
external_name
}
=
$external_name
;
$specifications
{
$module
}{
unfixed
}{
$external_name
}{
ordinal
}
=
$ordinal
;
$specifications
{
$module
}{
unfixed
}{
$external_name
}{
return_type
}
=
$return_type
;
$specifications
{
$module
}{
unfixed
}{
$external_name
}{
argument_types
}
=
[
@argument_types
];
}
else
{
output
->
write
(
"$file: $external_name ($module.$ordinal) already exists\n"
);
}
}
elsif
(
$ordinal
=~
/^\d+$/
)
{
if
(
1
||
!
exists
(
$specifications
{
$module
}{
fixed
}{
$ordinal
}))
{
$specifications
{
$module
}{
fixed
}{
$ordinal
}{
debug_channels
}
=
[
@debug_channels
];
$specifications
{
$module
}{
fixed
}{
$ordinal
}{
ordinal
}
=
$ordinal
;
$specifications
{
$module
}{
fixed
}{
$ordinal
}{
internal_name
}
=
$internal_name
;
$specifications
{
$module
}{
fixed
}{
$ordinal
}{
external_name
}
=
$external_name
;
$specifications
{
$module
}{
fixed
}{
$ordinal
}{
return_type
}
=
$return_type
;
$specifications
{
$module
}{
fixed
}{
$ordinal
}{
argument_types
}
=
[
@argument_types
];
}
else
{
output
->
write
(
"$file: $external_name ($module.$ordinal) already exists\n"
);
}
}
elsif
(
$ordinal
eq
"init"
)
{
if
(
!
exists
(
$specifications
{
$module
}{
init
}))
{
$specifications
{
$module
}{
init
}{
debug_channels
}
=
[
@debug_channels
];
$specifications
{
$module
}{
init
}{
external_name
}
=
$external_name
;
$specifications
{
$module
}{
init
}{
internal_name
}
=
$internal_name
;
$specifications
{
$module
}{
init
}{
return_type
}
=
$return_type
;
$specifications
{
$module
}{
init
}{
argument_types
}
=
[
@argument_types
];
}
else
{
output
->
write
(
"$file: $external_name ($module.$ordinal) already exists\n"
);
}
}
else
{
$specifications
{
$module
}{
fixed
}{
$ordinal
}{
debug_channels
}
=
[
@debug_channels
];
$specifications
{
$module
}{
fixed
}{
$ordinal
}{
ordinal
}
=
$ordinal
;
$specifications
{
$module
}{
fixed
}{
$ordinal
}{
internal_name
}
=
$internal_name
;
$specifications
{
$module
}{
fixed
}{
$ordinal
}{
external_name
}
=
$external_name
;
$specifications
{
$module
}{
fixed
}{
$ordinal
}{
arguments
}
=
[
@argument_types
];
if
(
!
exists
(
$specifications
{
$module
}{
unknown
}{
$external_name
}))
{
$specifications
{
$module
}{
unknown
}{
$external_name
}{
debug_channels
}
=
[
@debug_channels
];
$specifications
{
$module
}{
unknown
}{
$external_name
}{
internal_name
}
=
$internal_name
;
$specifications
{
$module
}{
unknown
}{
$external_name
}{
external_name
}
=
$external_name
;
$specifications
{
$module
}{
unknown
}{
$external_name
}{
ordinal
}
=
$ordinal
;
$specifications
{
$module
}{
unknown
}{
$external_name
}{
return_type
}
=
$return_type
;
$specifications
{
$module
}{
unknown
}{
$external_name
}{
argument_types
}
=
[
@argument_types
];
}
else
{
output
->
write
(
"$file: $external_name ($module.$ordinal) already exists\n"
);
}
}
if
(
$options
->
debug
)
{
...
...
@@ -165,32 +196,52 @@ sub output_function {
my
$internal_name
=
$function
->
{
internal_name
};
my
$external_name
=
$function
->
{
external_name
};
my
$ordinal
=
$function
->
{
ordinal
};
my
@arguments
=
@
{
$function
->
{
arguments
}};
my
$return_type
=
$function
->
{
return_type
};
my
@argument_types
=
@
{
$function
->
{
argument_types
}};
my
$return_kind
;
if
(
$type
eq
"win16"
)
{
$return_kind
=
$win16api
->
translate_argument
(
$return_type
);
}
else
{
$return_kind
=
$win32api
->
translate_argument
(
$return_type
);
}
if
(
!
defined
(
$return_kind
))
{
$return_kind
=
"undef"
;
}
my
@argument
s2
;
foreach
my
$argument
(
@argument
s
)
{
my
$argument
2
;
my
@argument
_kinds
;
foreach
my
$argument
_kind
(
@argument_kind
s
)
{
my
$argument
_kind
;
if
(
$type
eq
"win16"
)
{
$argument
2
=
$win16api
->
translate_argument
(
$argument
);
$argument
_kind
=
$win16api
->
translate_argument
(
$argument_kind
);
}
else
{
$argument
2
=
$win32api
->
translate_argument
(
$argument
);
$argument
_kind
=
$win32api
->
translate_argument
(
$argument_kind
);
}
if
(
!
defined
(
$argument
2
))
{
$argument
2
=
"undef"
;
if
(
!
defined
(
$argument
_kind
))
{
$argument
_kind
=
"undef"
;
}
if
(
$argument
2
eq
"longlong"
)
{
push
@argument
s2
,
(
"long"
,
"long"
);
if
(
$argument
_kind
eq
"longlong"
)
{
push
@argument
_kinds
,
(
"long"
,
"long"
);
}
else
{
push
@argument
s2
,
$argument2
;
push
@argument
_kinds
,
$argument_kind
;
}
}
my
$calling_convention
;
if
(
$type
eq
"win16"
)
{
print
OUT
"$ordinal pascal $external_name(@arguments2) $internal_name\n"
;
if
(
$return_kind
=~
/^(?:void|s_word|word)$/
)
{
$calling_convention
=
"pascal16"
;
}
elsif
(
$return_kind
=~
/^(?:long|ptr|segptr|segstr|str|wstr)$/
)
{
$calling_convention
=
"pascal"
;
}
else
{
$calling_convention
=
"undef"
;
}
}
else
{
print
OUT
"$ordinal stdcall $external_name(@arguments2) $internal_name\n
"
;
$calling_convention
=
"stdcall
"
;
}
print
OUT
"$ordinal $calling_convention $external_name(@argument_kinds) $internal_name\n"
;
}
if
(
$options
->
spec_files
)
{
...
...
@@ -210,9 +261,19 @@ if($options->spec_files) {
print
OUT
"name $module\n"
;
print
OUT
"type $type\n"
;
if
(
exists
(
$specifications
{
$module
}{
init
}))
{
my
$init
=
$specifications
{
$module
}{
init
}{
internal_name
};
print
OUT
"init $init\n"
;
}
print
OUT
"\n"
;
my
%
debug_channels
;
if
(
exists
(
$specifications
{
$module
}{
init
}))
{
my
$function
=
$specifications
{
$module
}{
init
};
foreach
my
$debug_channel
(
@
{
$function
->
{
debug_channels
}})
{
$debug_channels
{
$debug_channel
}
++
;
}
}
foreach
my
$ordinal
(
sort
{
$a
<=>
$b
}
keys
(
%
{
$specifications
{
$module
}{
fixed
}}))
{
my
$function
=
$specifications
{
$module
}{
fixed
}{
$ordinal
};
foreach
my
$debug_channel
(
@
{
$function
->
{
debug_channels
}})
{
...
...
@@ -225,6 +286,12 @@ if($options->spec_files) {
$debug_channels
{
$debug_channel
}
++
;
}
}
foreach
my
$name
(
sort
(
keys
(
%
{
$specifications
{
$module
}{
unknown
}})))
{
my
$function
=
$specifications
{
$module
}{
unknown
}{
$name
};
foreach
my
$debug_channel
(
@
{
$function
->
{
debug_channels
}})
{
$debug_channels
{
$debug_channel
}
++
;
}
}
my
@debug_channels
=
sort
(
keys
(
%
debug_channels
));
if
(
$#debug_channels
>=
0
)
{
...
...
@@ -233,20 +300,38 @@ if($options->spec_files) {
}
my
$empty
=
1
;
foreach
my
$ordinal
(
sort
{
$a
<=>
$b
}
keys
(
%
{
$specifications
{
$module
}{
fixed
}}))
{
if
(
!
$empty
)
{
print
OUT
"\n"
;
$empty
=
1
;
}
foreach
my
$name
(
sort
(
keys
(
%
{
$specifications
{
$module
}{
unknown
}})))
{
my
$function
=
$specifications
{
$module
}{
unknown
}{
$name
};
print
OUT
"# "
;
output_function
(
\*
OUT
,
$type
,
$function
);
$empty
=
0
;
}
if
(
!
$empty
)
{
print
OUT
"\n"
;
$empty
=
1
;
}
foreach
my
$ordinal
(
sort
{
$a
<=>
$b
}
keys
(
%
{
$specifications
{
$module
}{
fixed
}}))
{
my
$function
=
$specifications
{
$module
}{
fixed
}{
$ordinal
};
output_function
(
\*
OUT
,
$type
,
$function
);
$empty
=
0
;
}
if
(
!
$empty
)
{
print
OUT
"\n"
;
$empty
=
1
;
}
foreach
my
$name
(
sort
(
keys
(
%
{
$specifications
{
$module
}{
unfixed
}})))
{
if
(
!
$empty
)
{
print
OUT
"\n"
;
$empty
=
1
;
}
my
$function
=
$specifications
{
$module
}{
unfixed
}{
$name
};
output_function
(
\*
OUT
,
$type
,
$function
);
$empty
=
0
;
}
close
(
OUT
);
}
}
...
...
tools/winapi/winapi_fixup
View file @
47a99e1a
This diff is collapsed.
Click to expand it.
tools/winapi_check/modules.dat
View file @
47a99e1a
...
...
@@ -98,6 +98,8 @@ dlls/imm32
% dlls/kernel/kernel.spec
dlls/kernel
dlls/shell32
dlls/win32s
files
loader/ne
loader
...
...
@@ -130,6 +132,7 @@ dlls/kernel
% dlls/kernel/system.spec
memory
misc
% dlls/kernel/toolhelp.spec
...
...
@@ -138,7 +141,6 @@ dlls/kernel
loader/ne
loader
memory
windows
% dlls/kernel/wprocs.spec
...
...
@@ -185,6 +187,7 @@ dlls/msvideo
% dlls/ntdll/ntdll.spec
dlls/ntdll
memory
misc
scheduler
...
...
@@ -262,6 +265,10 @@ dlls/opengl32
dlls/psapi
% dlls/quartz/quartz.spec
dlls/quartz
% dlls/rasapi32/rasapi16.spec
% dlls/rasapi32/rasapi32.spec
...
...
@@ -291,10 +298,12 @@ dlls/setupapi
% dlls/shell32/shell.spec
dlls/shell32
misc
% dlls/shell32/shell32.spec
dlls/shell32
memory
% dlls/shdocvw/shdocvw.spec
...
...
@@ -342,6 +351,7 @@ controls
dlls/kernel
dlls/user
memory
misc
windows
% dlls/user/user32.spec
...
...
@@ -350,6 +360,7 @@ controls
dlls/user
dlls/user/dde
loader
objects
windows
% dlls/version/ver.spec
...
...
@@ -366,14 +377,12 @@ dlls/win32s
% dlls/win32s/w32sys.spec
dlls/kernel
dlls/win32s
% dlls/win32s/win32s16.spec
dlls/kernel
dlls/win32s
memory
scheduler
% dlls/winaspi/winaspi.spec
...
...
tools/winapi_check/win16/gdi.api
View file @
47a99e1a
...
...
@@ -12,9 +12,9 @@ UINT
int
%ptr
BITMAP16 *
BITMAPINFO *
BITMAPINFOHEADER *
DEVMODEA *
DOCINFO16 *
FARPROC16 *
...
...
tools/winapi_check/win32/oledlg.api
View file @
47a99e1a
...
...
@@ -24,6 +24,7 @@ LPOLEUIEDITLINKSW
LPOLEUIINSERTOBJECTA
LPOLEUIINSERTOBJECTW
LPOLEUILINKCONTAINERA
LPOLEUILINKCONTAINERW
LPOLEUIOBJECTPROPSA
LPOLEUIOBJECTPROPSW
LPOLEUIPASTESPECIALA
...
...
@@ -38,3 +39,4 @@ LPSTR
%wstr
LPCWSTR
LPWSTR
\ No newline at end of file
tools/winapi_check/win32/quartz.api
0 → 100644
View file @
47a99e1a
%long
DWORD
HRESULT
%ptr
CLSID *
IID *
void **
tools/winapi_check/win32/winmm.api
View file @
47a99e1a
...
...
@@ -79,7 +79,7 @@ UINT *
WORD *
YIELDPROC
%ptr --forbidden
%ptr
#
--forbidden
LPMMIOPROC16
...
...
tools/winapi_check/win32/wsock32.api
View file @
47a99e1a
...
...
@@ -3,10 +3,7 @@
DWORD
INT
SOCKET
%long # --forbidden
long
UINT
%ptr
...
...
tools/winapi_check/winapi.pm
View file @
47a99e1a
...
...
@@ -2,6 +2,8 @@ package winapi;
use
strict
;
my
@winapis
;
sub
new
{
my
$proto
=
shift
;
my
$class
=
ref
(
$proto
)
||
$proto
;
...
...
@@ -28,6 +30,8 @@ sub new {
$self
->
parse_api_file
(
$file
,
$module
);
}
push
@winapis
,
$self
;
return
$self
;
}
...
...
@@ -285,7 +289,6 @@ sub parse_spec_file {
$ordinal
=
$1
;
# FIXME: Internal name existing more than once not handled properly
if
(
!
$$function_internal_name
{
$external_name
})
{
$$function_internal_name
{
$external_name
}
=
$internal_name
;
}
else
{
...
...
@@ -358,7 +361,7 @@ sub parse_spec_file {
$ordinal
=
$1
;
my
$internal_name
;
if
(
$type
eq
"win16"
)
{
if
(
0
&&
$type
eq
"win16"
)
{
if
(
$external_name
=~
/\d$/
)
{
$internal_name
=
$external_name
.
"_16"
;
}
else
{
...
...
@@ -368,8 +371,17 @@ sub parse_spec_file {
$internal_name
=
$external_name
;
}
# FIXME: Internal name existing more than once not handled properly
$$function_stub
{
$internal_name
}
=
1
;
$$function_stub
{
$external_name
}
=
1
;
if
(
!
$$function_internal_name
{
$external_name
})
{
$$function_internal_name
{
$external_name
}
=
$internal_name
;
}
else
{
$$function_internal_name
{
$external_name
}
.=
" & $internal_name"
;
}
if
(
!
$$function_external_name
{
$internal_name
})
{
$$function_external_name
{
$internal_name
}
=
$external_name
;
}
else
{
$$function_external_name
{
$internal_name
}
.=
" & $external_name"
;
}
if
(
!
$$function_internal_ordinal
{
$internal_name
})
{
$$function_internal_ordinal
{
$internal_name
}
=
$ordinal
;
}
else
{
...
...
@@ -802,4 +814,84 @@ sub internal_function_found {
return
$$function_found
{
$name
};
}
########################################################################
# class methods
#
sub
get_all_module_internal_ordinal
{
my
$internal_name
=
shift
;
my
@entries
=
();
foreach
my
$winapi
(
@winapis
)
{
my
@name
=
();
{
my
$name
=
$winapi
->
function_external_name
(
$internal_name
);
if
(
defined
(
$name
))
{
@name
=
split
(
/ & /
,
$name
);
}
}
my
@module
=
();
{
my
$module
=
$winapi
->
function_internal_module
(
$internal_name
);
if
(
defined
(
$module
))
{
@module
=
split
(
/ & /
,
$module
);
}
}
my
@ordinal
=
();
{
my
$ordinal
=
$winapi
->
function_internal_ordinal
(
$internal_name
);
if
(
defined
(
$ordinal
))
{
@ordinal
=
split
(
/ & /
,
$ordinal
);
}
}
my
$name
;
my
$module
;
my
$ordinal
;
while
(
defined
(
$name
=
shift
@name
)
&&
defined
(
$module
=
shift
@module
)
&&
defined
(
$ordinal
=
shift
@ordinal
))
{
push
@entries
,
[
$name
,
$module
,
$ordinal
];
}
}
return
@entries
;
}
sub
get_all_module_external_ordinal
{
my
$external_name
=
shift
;
my
@entries
=
();
foreach
my
$winapi
(
@winapis
)
{
my
@name
=
();
{
my
$name
=
$winapi
->
function_internal_name
(
$external_name
);
if
(
defined
(
$name
))
{
@name
=
split
(
/ & /
,
$name
);
}
}
my
@module
=
();
{
my
$module
=
$winapi
->
function_external_module
(
$external_name
);
if
(
defined
(
$module
))
{
@module
=
split
(
/ & /
,
$module
);
}
}
my
@ordinal
=
();
{
my
$ordinal
=
$winapi
->
function_external_ordinal
(
$external_name
);
if
(
defined
(
$ordinal
))
{
@ordinal
=
split
(
/ & /
,
$ordinal
);
}
}
my
$name
;
my
$module
;
my
$ordinal
;
while
(
defined
(
$name
=
shift
@name
)
&&
defined
(
$module
=
shift
@module
)
&&
defined
(
$ordinal
=
shift
@ordinal
))
{
push
@entries
,
[
$name
,
$module
,
$ordinal
];
}
}
return
@entries
;
}
1
;
tools/winapi_check/winapi_check
View file @
47a99e1a
...
...
@@ -352,6 +352,8 @@ foreach my $file (@c_files) {
my
@argument_documentations
=
@$refargument_documentations
;
my
$statements
=
shift
;
my
$documentation_line
=
$line
;
my
$external_name16
=
$win16api
->
function_external_name
(
$internal_name
);
my
$external_name32
=
$win32api
->
function_external_name
(
$internal_name
);
...
...
@@ -372,10 +374,14 @@ foreach my $file (@c_files) {
my
$module32
=
$win32api
->
function_internal_module
(
$internal_name
);
if
(
defined
(
$module16
))
{
$modules
->
found_module_in_dir
(
$module16
,
$file_dir
);
foreach
my
$module
(
split
(
/ & /
,
$module16
))
{
$modules
->
found_module_in_dir
(
$module
,
$file_dir
);
}
}
if
(
defined
(
$module32
))
{
$modules
->
found_module_in_dir
(
$module32
,
$file_dir
);
foreach
my
$module
(
split
(
/ & /
,
$module32
))
{
$modules
->
found_module_in_dir
(
$module
,
$file_dir
);
}
}
my
$previous_function
;
...
...
@@ -387,6 +393,7 @@ foreach my $file (@c_files) {
$functions
{
$internal_name
}
=
$function
;
$function
->
documentation
(
$documentation
);
$function
->
documentation_line
(
$documentation_line
);
$function
->
linkage
(
$linkage
);
$function
->
file
(
$file
);
$function
->
return_type
(
$return_type
);
...
...
@@ -428,33 +435,46 @@ foreach my $file (@c_files) {
}
if
(
$options
->
local
&&
$options
->
misplaced
&&
$linkage
ne
"extern"
&&
$statements
)
$linkage
ne
"extern"
&&
defined
(
$statements
)
)
{
if
(
$options
->
win16
&&
$options
->
report_module
(
$module16
))
{
my
$match
=
0
;
foreach
my
$module
(
split
(
/ & /
,
$module16
))
{
my
$match
=
0
;
foreach
my
$file_module
(
split
(
/ & /
,
$file_module16
))
{
if
(
$module
eq
$file_module
)
{
$match
++
;
$match
=
1
;
}
}
}
if
(
!
$match
&&
$file
ne
"library/port.c"
&&
!
$nativeapi
->
is_function
(
$internal_name
))
{
$output
->
write
(
"is misplaced\n"
);
if
(
!
$match
)
{
if
(
$file
ne
"library/port.c"
&&
!
$nativeapi
->
is_function
(
$internal_name
)
&&
!
$win16api
->
function_stub
(
$internal_name
))
{
$output
->
write
(
"is misplaced ($module)\n"
);
}
last
;
}
}
}
if
(
$options
->
win32
&&
$options
->
report_module
(
$module32
))
{
my
$match
=
0
;
foreach
my
$module
(
split
(
/ & /
,
$module32
))
{
my
$match
=
0
;
foreach
my
$file_module
(
split
(
/ & /
,
$file_module32
))
{
if
(
$module
eq
$file_module
)
{
$match
++
;
$match
=
1
;
}
}
}
if
(
!
$match
&&
$file
ne
"library/port.c"
&&
!
$nativeapi
->
is_function
(
$internal_name
))
{
$output
->
write
(
"is misplaced\n"
);
if
(
!
$match
)
{
if
(
$file
ne
"library/port.c"
&&
!
$nativeapi
->
is_function
(
$internal_name
)
&&
!
$win32api
->
function_stub
(
$internal_name
))
{
$output
->
write
(
"is misplaced ($module)\n"
);
}
last
;
}
}
}
}
...
...
@@ -527,7 +547,7 @@ foreach my $file (@c_files) {
if
(
$options
->
local
&&
$options
->
documentation
&&
!
defined
(
$previous_function
)
&&
(
defined
(
$module16
)
||
defined
(
$module32
))
&&
$linkage
ne
"extern"
&&
$statements
)
$linkage
ne
"extern"
&&
defined
(
$statements
)
)
{
winapi_documentation::
check_documentation
$options
,
$output
,
$win16api
,
$win32api
,
$function
;
}
...
...
tools/winapi_check/winapi_documentation.pm
View file @
47a99e1a
...
...
@@ -7,6 +7,8 @@ my %comment_indent;
my
%
comment_spacing
;
sub
check_documentation
{
local
$_
;
my
$options
=
shift
;
my
$output
=
shift
;
my
$win16api
=
shift
;
...
...
@@ -19,128 +21,94 @@ sub check_documentation {
my
$external_name32
=
$function
->
external_name32
;
my
$internal_name
=
$function
->
internal_name
;
my
$documentation
=
$function
->
documentation
;
my
$documentation_line
=
$function
->
documentation_line
;
my
@argument_documentations
=
@
{
$function
->
argument_documentations
};
# FIXME: Not correct
if
(
defined
(
$external_name16
))
{
$external_name16
=
(
split
(
/\s*&\s*/
,
$external_name16
))[
0
];
}
# FIXME: Not correct
if
(
defined
(
$external_name32
))
{
$external_name32
=
(
split
(
/\s*&\s*/
,
$external_name32
))[
0
];
}
my
$external_name
;
my
$name1
;
my
$name2
;
if
(
defined
(
$module16
)
&&
!
defined
(
$module32
))
{
my
@uc_modules16
=
split
(
/\s*\&\s*/
,
uc
(
$module16
));
push
@uc_modules16
,
"WIN16"
;
$name1
=
$internal_name
;
foreach
my
$uc_module16
(
@uc_modules16
)
{
if
(
$name1
=~
s/^$uc_module16\_//
)
{
last
;
}
}
$name2
=
$name1
;
$name2
=~
s/(?:_)?16$//
;
$name2
=~
s/16_fn/16_/
;
$external_name
=
$external_name16
;
}
elsif
(
!
defined
(
$module16
)
&&
defined
(
$module32
))
{
my
@uc_modules32
=
split
(
/\s*\&\s*/
,
uc
(
$module32
));
push
@uc_modules32
,
"wine"
;
foreach
my
$uc_module32
(
@uc_modules32
)
{
if
(
$uc_module32
=~
/^WS2_32$/
)
{
push
@uc_modules32
,
"WSOCK32"
;
}
}
$name1
=
$internal_name
;
foreach
my
$uc_module32
(
@uc_modules32
)
{
if
(
$name1
=~
s/^$uc_module32\_//
)
{
last
;
}
}
$name2
=
$name1
;
$name2
=~
s/AW$//
;
$external_name
=
$external_name32
;
}
else
{
my
@uc_modules
=
split
(
/\s*\&\s*/
,
uc
(
$module16
));
push
@uc_modules
,
split
(
/\s*\&\s*/
,
uc
(
$module32
));
$name1
=
$internal_name
;
foreach
my
$uc_module
(
@uc_modules
)
{
if
(
$name1
=~
s/^$uc_module\_//
)
{
last
;
}
}
$name2
=
$name1
;
$external_name
=
$external_name32
;
}
if
(
!
defined
(
$external_name
))
{
$external_name
=
$internal_name
;
}
if
(
$options
->
documentation_name
)
{
my
$n
=
0
;
if
((
++
$n
&&
defined
(
$module16
)
&&
defined
(
$external_name16
)
&&
$external_name16
ne
"@"
&&
$documentation
!~
/\b\Q$external_name16\E\b/
)
||
(
++
$n
&&
defined
(
$module16
)
&&
defined
(
$external_name16
)
&&
$external_name16
eq
"@"
&&
$documentation
!~
/\@/
)
||
(
++
$n
&&
defined
(
$module32
)
&&
defined
(
$external_name32
)
&&
$external_name32
ne
"@"
&&
$documentation
!~
/\b\Q$external_name32\E\b/
)
||
(
++
$n
&&
defined
(
$module32
)
&&
defined
(
$external_name32
)
&&
$external_name32
eq
"@"
&&
$documentation
!~
/\@/
))
if
(
$options
->
documentation_name
||
$options
->
documentation_ordinal
||
$options
->
documentation_pedantic
)
{
my
@winapis
=
(
$win16api
,
$win32api
);
my
@modules
=
(
$module16
,
$module32
);
my
@external_names
=
(
$external_name16
,
$external_name32
);
while
(
defined
(
my
$winapi
=
shift
@winapis
)
&&
defined
(
my
$external_name
=
shift
@external_names
)
&&
defined
(
my
$module
=
shift
@modules
))
{
my
$external_name
=
(
$external_name16
,
$external_name32
)[(
$n
-
1
)
/
2
];
if
(
$options
->
documentation_pedantic
||
$documentation
!~
/\b(?:$internal_name|$name1|$name2)\b/
)
{
$output
->
write
(
"documentation: wrong or missing name ($external_name) \\\n$documentation\n"
);
if
(
$winapi
->
function_stub
(
$internal_name
))
{
next
;
}
my
@external_name
=
split
(
/\s*\&\s*/
,
$external_name
);
my
@modules
=
split
(
/\s*\&\s*/
,
$module
);
my
@ordinals
=
split
(
/\s*\&\s*/
,
$winapi
->
function_internal_ordinal
(
$internal_name
));
my
$pedantic_failed
=
0
;
while
(
defined
(
my
$external_name
=
shift
@external_name
)
&&
defined
(
my
$module
=
shift
@modules
)
&&
defined
(
my
$ordinal
=
shift
@ordinals
))
{
my
$found_name
=
0
;
my
$found_ordinal
=
0
;
foreach
(
split
(
/\n/
,
$documentation
))
{
if
(
/^(\s*)\*(\s*)(\@|\S+)(\s*)([\(\[])(\w+)\.(\@|\d+)([\)\]])/
)
{
my
$external_name2
=
$3
;
my
$module2
=
$6
;
my
$ordinal2
=
$7
;
if
(
length
(
$1
)
!=
1
||
length
(
$2
)
<
1
||
length
(
$4
)
<
1
||
$5
ne
"("
||
$8
ne
")"
)
{
$pedantic_failed
=
1
;
}
if
(
$external_name
eq
$external_name2
)
{
$found_name
=
1
;
if
(
"\U$module\E"
eq
$module2
&&
$ordinal
eq
$ordinal2
)
{
$found_ordinal
=
1
;
}
}
}
}
if
((
$options
->
documentation_name
&&
!
$found_name
)
||
(
$options
->
documentation_ordinal
&&
!
$found_ordinal
))
{
$output
->
write
(
"documentation: expected $external_name (\U$module\E.$ordinal): \\\n$documentation\n"
);
}
}
if
(
$options
->
documentation_pedantic
&&
$pedantic_failed
)
{
$output
->
write
(
"documentation: pedantic failed: \\\n$documentation\n"
);
}
}
}
if
(
$options
->
documentation_ordinal
)
{
if
(
defined
(
$module16
))
{
my
@modules16
=
split
(
/\s*\&\s*/
,
$module16
);
my
@ordinals16
=
split
(
/\s*\&\s*/
,
$win16api
->
function_internal_ordinal
(
$internal_name
));
my
$module16
;
my
$ordinal16
;
while
(
defined
(
$module16
=
shift
@modules16
)
&&
defined
(
$ordinal16
=
shift
@ordinals16
))
{
if
(
$documentation
!~
/\b\U$module16\E\.\Q$ordinal16\E/
)
{
$output
->
write
(
"documentation: wrong or missing ordinal "
.
"expected (\U$module16\E.$ordinal16) \\\n$documentation\n"
);
if
(
$options
->
documentation_wrong
)
{
foreach
(
split
(
/\n/
,
$documentation
))
{
if
(
/^\s*\*\s*(\S+)\s*[\(\[]\s*(\w+)\s*\.\s*([^\s\)\]]*)\s*[\)\]].*?$/
)
{
my
$external_name
=
$1
;
my
$module
=
$2
;
my
$ordinal
=
$3
;
my
$found
=
0
;
foreach
my
$entry2
(
winapi::
get_all_module_internal_ordinal
(
$internal_name
))
{
(
my
$external_name2
,
my
$module2
,
my
$ordinal2
)
=
@$entry2
;
if
(
$external_name
eq
$external_name2
&&
lc
(
$module
)
eq
$module2
&&
$ordinal
eq
$ordinal2
)
{
$found
=
1
;
}
}
}
}
if
(
defined
(
$module32
))
{
my
@modules32
=
split
(
/\s*\&\s*/
,
$module32
);
my
@ordinals32
=
split
(
/\s*\&\s*/
,
$win32api
->
function_internal_ordinal
(
$internal_name
));
my
$module32
;
my
$ordinal32
;
while
(
defined
(
$module32
=
shift
@modules32
)
&&
defined
(
$ordinal32
=
shift
@ordinals32
))
{
if
(
$documentation
!~
/\b\U$module32\E\.\Q$ordinal32\E/
)
{
$output
->
write
(
"documentation: wrong or missing ordinal "
.
"expected (\U$module32\E.$ordinal32) \\\n$documentation\n"
);
if
(
!
$found
)
{
$output
->
write
(
"documentation: $external_name (\U$module\E.$ordinal) wrong\n"
);
}
}
}
}
# FIXME: Not correct
if
(
$options
->
documentation_pedantic
)
{
my
$ordinal
=
(
split
(
/\s*\&\s*/
,
$win16api
->
function_internal_ordinal
(
$internal_name
)))[
0
];
if
(
defined
(
$ordinal
)
&&
$documentation
!~
/^ \*\s+(?:\@|\w+)(?:\s+[\(\[]\w+\.(?:\@|\d+)[\)\]])+/m
)
{
$output
->
write
(
"documentation: pedantic check failed \\\n$documentation\n"
);
}
}
if
(
$options
->
documentation_comment_indent
)
{
if
(
$documentation
=~
/^ \*(\s*)\w+(\s*)([\(\[])\s*\w+\.\s*(?:\@|\d+)\s*([\)\]])/m
)
{
my
$indent
=
$1
;
...
...
tools/winapi_check/winapi_function.pm
View file @
47a99e1a
...
...
@@ -33,6 +33,17 @@ sub documentation {
return
$$documentation
;
}
sub
documentation_line
{
my
$self
=
shift
;
my
$documentation_line
=
\
$
{
$self
->
{
DOCUMENTATION_LINE
}};
local
$_
=
shift
;
if
(
defined
(
$_
))
{
$$documentation_line
=
$_
;
}
return
$$documentation_line
;
}
sub
linkage
{
my
$self
=
shift
;
my
$linkage
=
\
$
{
$self
->
{
LINKAGE
}};
...
...
tools/winapi_check/winapi_local.pm
View file @
47a99e1a
...
...
@@ -122,7 +122,7 @@ sub check_function {
$output
->
write
(
"function not implemented as vararg\n"
);
}
}
elsif
(
$#argument_types
!=
-
1
&&
$argument_types
[
$#argument_types
]
eq
"..."
)
{
if
(
$#argument_types
==
0
)
{
if
(
$#argument_types
==
0
||
$winapi
->
name
eq
"win16"
)
{
pop
@argument_types
;
}
else
{
$output
->
write
(
"function not declared as vararg\n"
);
...
...
tools/winapi_check/winapi_options.pm
View file @
47a99e1a
...
...
@@ -102,10 +102,15 @@ my %options = (
description
=>
"check for documentation name inconsistances\n"
},
"documentation-ordinal"
=>
{
default
=>
0
,
default
=>
1
,
parent
=>
"documentation"
,
description
=>
"check for documentation ordinal inconsistances\n"
},
"documentation-wrong"
=>
{
default
=>
1
,
parent
=>
"documentation"
,
description
=>
"check for wrong documentation\n"
},
"prototype"
=>
{
default
=>
0
,
parent
=>
[
"local"
,
"headers"
],
description
=>
"prototype checking"
},
"global"
=>
{
default
=>
1
,
description
=>
"global checking"
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment