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
37f3691f
Commit
37f3691f
authored
Dec 10, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: Re-use the file updating routines from make_makefiles in make_requests.
parent
517b2f62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
19 deletions
+55
-19
make_requests
tools/make_requests
+55
-19
No files found.
tools/make_requests
View file @
37f3691f
...
...
@@ -258,28 +258,57 @@ sub GET_ERROR_NAMES()
return
%
errors
;
}
### Replace the contents of a file between ### make_requests ### marks
# update a file if changed
sub
update_file
($)
{
my
$file
=
shift
;
my
$ret
=
!
(
-
f
$file
)
||
system
"cmp $file $file.new >/dev/null"
;
if
(
!
$ret
)
{
unlink
"$file.new"
;
}
else
{
rename
"$file.new"
,
"$file"
;
print
"$file updated\n"
;
}
return
$ret
;
}
sub
REPLACE_IN_FILE
($@)
# replace some lines in a file between two markers
sub
replace_in_file
($$$@)
{
my
$name
=
shift
;
my
@data
=
@_
;
my
@lines
=
();
open
(
FILE
,
$name
)
or
die
"Can't open $name"
;
while
(
<
FILE
>
)
my
$file
=
shift
;
my
$start
=
shift
;
my
$end
=
shift
;
open
NEW_FILE
,
">$file.new"
or
die
"cannot create $file.new"
;
if
(
defined
(
$start
))
{
push
@lines
,
$_
;
last
if
/\#\#\# make_requests begin \#\#\#/
;
open
OLD_FILE
,
"$file"
or
die
"cannot open $file"
;
while
(
<
OLD_FILE
>
)
{
print
NEW_FILE
$_
;
last
if
/$start/
;
}
}
push
@lines
,
"\n"
,
@data
;
while
(
<
FILE
>
)
print
NEW_FILE
"\n"
,
@_
,
"\n"
;
if
(
defined
(
$end
))
{
if
(
/\#\#\# make_requests end \#\#\#/
)
{
push
@lines
,
"\n"
,
$_
;
last
;
}
my
$skip
=
1
;
while
(
<
OLD_FILE
>
)
{
$skip
=
0
if
/$end/
;
print
NEW_FILE
$_
unless
$skip
;
}
}
push
@lines
,
<
FILE
>
;
open
(
FILE
,
">$name"
)
or
die
"Can't modify $name"
;
print
FILE
@lines
;
close
(
FILE
);
close
OLD_FILE
if
defined
(
$start
)
;
close
NEW_FILE
;
return
update_file
(
$file
);
}
### Main
...
...
@@ -291,7 +320,7 @@ my %errors = GET_ERROR_NAMES();
### Create server_protocol.h and print header
open
SERVER_PROT
,
">include/wine/server_protocol.h
"
or
die
"Cannot create include/wine/server_protocol.h
"
;
open
SERVER_PROT
,
">include/wine/server_protocol.h
.new"
or
die
"Cannot create include/wine/server_protocol.h.new
"
;
print
SERVER_PROT
"/*\n * Wine server protocol definitions\n *\n"
;
print
SERVER_PROT
" * This file is automatically generated; DO NO EDIT!\n"
;
print
SERVER_PROT
" * Edit server/protocol.def instead and re-run tools/make_requests\n"
;
...
...
@@ -324,6 +353,7 @@ print SERVER_PROT "};\n\n";
printf
SERVER_PROT
"#define SERVER_PROTOCOL_VERSION %d\n\n"
,
$protocol
+
1
;
print
SERVER_PROT
"#endif /* __WINE_WINE_SERVER_PROTOCOL_H */\n"
;
close
SERVER_PROT
;
update_file
(
"include/wine/server_protocol.h"
);
### Output the dumping function tables
...
...
@@ -360,7 +390,10 @@ foreach my $err (sort keys %errors)
push
@trace_lines
,
" { NULL, 0 }\n"
;
push
@trace_lines
,
"};\n"
;
REPLACE_IN_FILE
(
"server/trace.c"
,
@trace_lines
);
replace_in_file
(
"server/trace.c"
,
"### make_requests begin ###"
,
"### make_requests end ###"
,
@trace_lines
);
### Output the request handlers list
...
...
@@ -376,4 +409,7 @@ foreach my $req (@requests)
}
push
@request_lines
,
"};\n#endif /* WANT_REQUEST_HANDLERS */\n"
;
REPLACE_IN_FILE
(
"server/request.h"
,
@request_lines
);
replace_in_file
(
"server/request.h"
,
"### make_requests begin ###"
,
"### make_requests end ###"
,
@request_lines
);
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