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
fb9e4afd
Commit
fb9e4afd
authored
May 26, 2009
by
Francois Gouget
Committed by
Alexandre Julliard
May 26, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winapi_cleanup: There is not much point for this tool so remove it.
parent
a5924303
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
286 deletions
+0
-286
winapi_cleanup
tools/winapi/winapi_cleanup
+0
-231
winapi_cleanup_options.pm
tools/winapi/winapi_cleanup_options.pm
+0
-55
No files found.
tools/winapi/winapi_cleanup
deleted
100755 → 0
View file @
a5924303
#! /usr/bin/perl -w
# Copyright 2002 Patrik Stridvall
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#
use
strict
;
BEGIN
{
$0
=~
m%^(.*?/?tools)/winapi/winapi_cleanup$%
;
require
"$1/winapi/setup.pm"
;
}
use
config
qw($current_dir $wine_dir file_absolutize file_directory)
;
use
output
qw($output)
;
use
winapi_cleanup_options
qw($options)
;
use
nativeapi
qw($nativeapi)
;
use
util
qw(edit_file)
;
if
(
$options
->
progress
)
{
$output
->
enable_progress
;
}
else
{
$output
->
disable_progress
;
}
########################################################################
# cleanup_file
sub
cleanup_file
($$$)
{
local
*
IN
=
shift
;
local
*
OUT
=
shift
;
my
$file
=
shift
;
my
$dir
=
do
{
my
$file2
=
file_absolutize
(
$file
);
my
$dir
=
file_directory
(
$file2
);
"$wine_dir/$dir"
;
};
my
$indent
;
my
@comments
=
();
my
$format_comments
=
sub
{
local
$_
=
""
;
if
(
$#comments
==
0
)
{
my
$comment
=
$comments
[
0
];
$_
=
"$indent/*$comment */"
;
}
elsif
(
$#comments
>
0
)
{
$_
=
"$indent/*\n"
;
foreach
my
$comment
(
@comments
)
{
$_
.=
"$indent *$comment\n"
;
}
$_
.=
"$indent */"
;
}
$indent
=
""
;
@comments
=
();
return
$_
;
};
my
$in_comment
=
0
;
my
$modified
=
0
;
while
(
<
IN
>
)
{
chomp
;
if
(
$options
->
trailing_whitespace
)
{
s/(.*?)\s+$/$1/
&&
do
{
$modified
=
1
;
};
}
else
{
s/(.*?)\r$/$1/
&&
do
{
$modified
=
1
;
};
}
if
(
$options
->
cpp_comments
)
{
if
(
$in_comment
)
{
if
(
/^.*?\*\//
)
{
$in_comment
=
0
;
}
}
elsif
(
/^([^\"\/]*?(?:\"[^\"]*?\"[^\"]*?)*?)\/\*(.*?)$/
)
{
my
$indent2
=
$1
;
my
$comment
=
$2
;
if
(
$comment
!~
/^.*?\*\//
)
{
$in_comment
=
1
;
}
}
elsif
(
/^([^\"\/]*?(?:\"[^\"]*?\"[^\"]*?)*?)\/\/(.*?)\s*$/
)
{
my
$indent2
=
$1
;
my
$comment
=
$2
;
if
(
$indent2
=~
/^\s*$/
)
{
if
(
!
$indent
||
$indent
eq
$indent2
)
{
$indent
=
$indent2
;
push
@comments
,
$comment
;
next
;
}
else
{
$_
.=
"$indent2/*$comment */"
;
}
}
else
{
my
$comments
=
&
$format_comments
();
if
(
$comments
)
{
$_
=
"$comments\n$indent2/*$comment */"
;
}
else
{
$_
=
"$indent2/*$comment */"
;
}
$modified
=
1
;
}
}
else
{
my
$comments
=
&
$format_comments
();
if
(
$comments
)
{
$_
=
"$comments\n$_"
;
$modified
=
1
;
}
}
}
if
(
$options
->
include_quotes
)
{
my
$module
=
""
;
if
(
$dir
=~
m%^$wine_dir/dlls/(.*?)/.*?$%
)
{
$module
=
$1
;
}
if
(
/^(\s*\#\s*include\s+)(?:<(.*?)>|\"(.*?)\")(.*?)\s*$/
)
{
my
$prefix
=
$1
;
my
$header
=
$2
||
$3
;
my
$local
=
!
defined
(
$2
)
&&
defined
(
$3
);
my
$suffix
=
$4
;
my
$exists_system
=
0
;
{
my
@system_paths
=
qw(/usr/include /usr/local/include /usr/X11R6/include)
;
foreach
my
$path
(
@system_paths
)
{
$exists_system
||=
(
-
e
"$path/$header"
||
0
);
}
$exists_system
||=
$nativeapi
->
is_conditional_header
(
$header
);
}
my
$exists_windows
=
0
;
{
if
(
$header
!~
m%^wine/%
&&
$header
ne
"config.h"
)
{
$exists_windows
||=
(
-
e
"$wine_dir/include/$header"
||
0
);
}
}
my
$exists_wine
=
0
;
{
$exists_wine
||=
(
$header
eq
"config.h"
);
if
(
$header
=~
m%^wine/%
)
{
$exists_wine
||=
(
-
e
"$wine_dir/include/$header"
||
0
);
}
}
my
$exists_local
=
0
;
{
$exists_local
||=
(
$header
eq
"y.tab.h"
);
my
@local_paths
=
();
push
@local_paths
,
"$dir"
if
$dir
!~
m%^$wine_dir/include%
;
push
@local_paths
,
"$wine_dir/dlls/$module"
if
$module
;
foreach
my
$path
(
@local_paths
)
{
$exists_local
||=
(
-
e
"$path/$header"
||
0
);
}
}
if
(
!
$exists_system
&&
!
$exists_windows
&&
!
$exists_wine
&&
!
$exists_local
)
{
$output
->
write
(
"warning: header '$header': doesn't exist\n"
);
}
elsif
((
$exists_system
+
$exists_windows
+
$exists_wine
+
$exists_local
)
>
1
)
{
if
(
$header
!~
/^(?:async\.h|comcat\.h|sql(?:ext|types)?\.h|thread\.h|user\.h)$/
)
{
$output
->
write
(
"warning: header '$header': more than one possibillity\n"
);
}
}
if
(
!
$local
&&
$exists_local
)
{
$_
=
"$prefix\"$header\"$suffix"
;
$modified
=
1
;
}
elsif
(
$local
&&
!
$exists_local
&&
(
$exists_system
||
$exists_windows
||
$exists_wine
))
{
$_
=
"$prefix<$header>$suffix"
;
$modified
=
1
;
}
}
}
print
OUT
"$_\n"
;
}
my
$comments
=
&
$format_comments
();
if
(
$comments
)
{
print
OUT
"$comments\n"
;
$modified
=
1
;
}
return
$modified
;
}
########################################################################
# main
my
@h_files
=
$options
->
h_files
;
my
@c_files
=
$options
->
c_files
;
my
$progress_output
;
my
$progress_current
=
0
;
my
$progress_max
=
scalar
(
@h_files
)
+
scalar
(
@c_files
);
foreach
my
$file
(
@h_files
)
{
$progress_current
++
;
$output
->
progress
(
"$file (file $progress_current of $progress_max)"
);
$output
->
prefix
(
"$file: "
);
if
(
edit_file
(
$file
,
\&
cleanup_file
,
@_
,
$file
))
{
$output
->
write
(
"$file: modified\n"
);
}
}
foreach
my
$file
(
@c_files
)
{
$progress_current
++
;
$output
->
progress
(
"$file (file $progress_current of $progress_max)"
);
$output
->
prefix
(
"$file: "
);
if
(
edit_file
(
$file
,
\&
cleanup_file
,
$file
))
{
$output
->
write
(
"$file: modified\n"
);
}
}
tools/winapi/winapi_cleanup_options.pm
deleted
100644 → 0
View file @
a5924303
#
# Copyright 2002 Patrik Stridvall
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#
package
winapi_cleanup_options
;
use
base
qw(options)
;
use
strict
;
use
vars
qw($VERSION @ISA @EXPORT @EXPORT_OK)
;
require
Exporter
;
@ISA
=
qw(Exporter)
;
@EXPORT
=
qw()
;
@EXPORT_OK
=
qw($options)
;
use
options
qw($options)
;
my
%
options_long
=
(
"debug"
=>
{
default
=>
0
,
description
=>
"debug mode"
},
"help"
=>
{
default
=>
0
,
description
=>
"help mode"
},
"verbose"
=>
{
default
=>
0
,
description
=>
"verbose mode"
},
"progress"
=>
{
default
=>
1
,
description
=>
"show progress"
},
"cpp-comments"
=>
{
default
=>
1
,
description
=>
"convert C++ comments to C comments"
},
"include-quotes"
=>
{
default
=>
0
,
description
=>
"convert #include \"\" to <> or the reverse where appropriate"
},
"trailing-whitespace"
=>
{
default
=>
0
,
description
=>
"remove trailing whitespace"
},
);
my
%
options_short
=
(
"d"
=>
"debug"
,
"?"
=>
"help"
,
"v"
=>
"verbose"
);
my
$options_usage
=
"usage: winapi_cleanup [--help] [<files>]\n"
;
$options
=
'_options'
->
new
(
\%
options_long
,
\%
options_short
,
$options_usage
);
1
;
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