Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e2980976
Commit
e2980976
authored
Sep 12, 2002
by
Patrik Stridvall
Committed by
Alexandre Julliard
Sep 12, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Made remove trailing whitespace a default off option.
- Add support for C++ to C comment conversion.
parent
ee3fdd80
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
5 deletions
+80
-5
winapi_cleanup
tools/winapi/winapi_cleanup
+76
-4
winapi_cleanup_options.pm
tools/winapi/winapi_cleanup_options.pm
+4
-1
No files found.
tools/winapi/winapi_cleanup
View file @
e2980976
...
...
@@ -26,7 +26,7 @@ BEGIN {
use
config
qw($current_dir $wine_dir)
;
use
output
qw($output)
;
use
winapi_
extract
_options
qw($options)
;
use
winapi_
cleanup
_options
qw($options)
;
if
(
$options
->
progress
)
{
$output
->
enable_progress
;
...
...
@@ -66,17 +66,89 @@ sub cleanup_file {
local
*
IN
=
shift
;
local
*
OUT
=
shift
;
my
$modified
=
0
;
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
(
s/(.*?)\s+$/$1/
)
{
$modified
=
1
;
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
;
}
}
}
print
OUT
"$_\n"
;
}
my
$comments
=
&
$format_comments
();
if
(
$comments
)
{
print
OUT
"$comments\n"
;
$modified
=
1
;
}
return
$modified
;
}
...
...
tools/winapi/winapi_cleanup_options.pm
View file @
e2980976
...
...
@@ -16,7 +16,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
package
winapi_
extract
_options
;
package
winapi_
cleanup
_options
;
use
base
qw(options)
;
use
strict
;
...
...
@@ -36,6 +36,9 @@ my %options_long = (
"verbose"
=>
{
default
=>
0
,
description
=>
"verbose mode"
},
"progress"
=>
{
default
=>
1
,
description
=>
"show progress"
},
"cpp-comments"
=>
{
default
=>
1
,
description
=>
"converts C++ comments to C comments"
},
"trailing-whitespace"
=>
{
default
=>
0
,
description
=>
"remove trailing whitespace"
},
);
my
%
options_short
=
(
...
...
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