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
bd007ba1
Commit
bd007ba1
authored
Oct 04, 2004
by
Francois Gouget
Committed by
Alexandre Julliard
Oct 04, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'use strict'.
Add prototypes to all functions. Move 'main' to the end so we don't have to pre-declare all the functions.
parent
e22ae157
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
83 deletions
+72
-83
make_requests
tools/make_requests
+72
-83
No files found.
tools/make_requests
View file @
bd007ba1
...
...
@@ -19,8 +19,9 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
use
strict
;
%
formats
=
my
%
formats
=
(
"int"
=>
"%d"
,
"short int"
=>
"%d"
,
...
...
@@ -46,89 +47,11 @@ my %replies = ();
my
@trace_lines
=
();
# Get the server protocol version
my
$protocol
=
&
GET_PROTOCOL_VERSION
;
### Create server_protocol.h and print header
open
SERVER_PROT
,
">include/wine/server_protocol.h"
or
die
"Cannot create include/wine/server_protocol.h"
;
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"
;
print
SERVER_PROT
" */\n\n"
;
print
SERVER_PROT
"#ifndef __WINE_WINE_SERVER_PROTOCOL_H\n"
;
print
SERVER_PROT
"#define __WINE_WINE_SERVER_PROTOCOL_H\n"
;
### Parse requests to find request/reply structure definitions
&
PARSE_REQUESTS
;
### Build the request list and structures
print
SERVER_PROT
"\n\nenum request\n{\n"
;
foreach
$req
(
@requests
)
{
print
SERVER_PROT
" REQ_$req,\n"
;
}
print
SERVER_PROT
" REQ_NB_REQUESTS\n};\n\n"
;
print
SERVER_PROT
"union generic_request\n{\n"
;
print
SERVER_PROT
" struct request_max_size max_size;\n"
;
print
SERVER_PROT
" struct request_header request_header;\n"
;
foreach
$req
(
@requests
)
{
print
SERVER_PROT
" struct ${req}_request ${req}_request;\n"
;
}
print
SERVER_PROT
"};\n"
;
print
SERVER_PROT
"union generic_reply\n{\n"
;
print
SERVER_PROT
" struct request_max_size max_size;\n"
;
print
SERVER_PROT
" struct reply_header reply_header;\n"
;
foreach
$req
(
@requests
)
{
print
SERVER_PROT
" struct ${req}_reply ${req}_reply;\n"
;
}
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
;
### Output the dumping function tables
push
@trace_lines
,
"static const dump_func req_dumpers[REQ_NB_REQUESTS] = {\n"
;
foreach
$req
(
@requests
)
{
push
@trace_lines
,
" (dump_func)dump_${req}_request,\n"
;
}
push
@trace_lines
,
"};\n\n"
;
push
@trace_lines
,
"static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {\n"
;
foreach
$req
(
@requests
)
{
push
@trace_lines
,
" (dump_func)"
,
$replies
{
$req
}
?
"dump_${req}_reply,\n"
:
"0,\n"
;
}
push
@trace_lines
,
"};\n\n"
;
push
@trace_lines
,
"static const char * const req_names[REQ_NB_REQUESTS] = {\n"
;
foreach
$req
(
@requests
)
{
push
@trace_lines
,
" \"$req\",\n"
;
}
push
@trace_lines
,
"};\n"
;
REPLACE_IN_FILE
(
"server/trace.c"
,
@trace_lines
);
### Output the request handlers list
my
@request_lines
=
();
foreach
$req
(
@requests
)
{
push
@request_lines
,
"DECL_HANDLER($req);\n"
;
}
push
@request_lines
,
"\n#ifdef WANT_REQUEST_HANDLERS\n\n"
;
push
@request_lines
,
"typedef void (*req_handler)( const void *req, void *reply );\n"
;
push
@request_lines
,
"static const req_handler req_handlers[REQ_NB_REQUESTS] =\n{\n"
;
foreach
$req
(
@requests
)
{
push
@request_lines
,
" (req_handler)req_$req,\n"
;
}
push
@request_lines
,
"};\n#endif /* WANT_REQUEST_HANDLERS */\n"
;
REPLACE_IN_FILE
(
"server/request.h"
,
@request_lines
);
### Parse the request definitions
sub
PARSE_REQUESTS
sub
PARSE_REQUESTS
()
{
# states: 0 = header 1 = declarations 2 = inside @REQ 3 = inside @REPLY
my
$state
=
0
;
...
...
@@ -246,7 +169,7 @@ sub PARSE_REQUESTS
### Generate a dumping function
sub
DO_DUMP_FUNC
sub
DO_DUMP_FUNC
($$@)
{
my
$name
=
shift
;
my
$req
=
shift
;
...
...
@@ -288,7 +211,7 @@ sub DO_DUMP_FUNC
### Retrieve the server protocol version from the existing server_protocol.h file
sub
GET_PROTOCOL_VERSION
sub
GET_PROTOCOL_VERSION
()
{
my
$protocol
=
0
;
open
SERVER_PROT
,
"include/wine/server_protocol.h"
or
return
0
;
...
...
@@ -302,7 +225,7 @@ sub GET_PROTOCOL_VERSION
### Replace the contents of a file between ### make_requests ### marks
sub
REPLACE_IN_FILE
sub
REPLACE_IN_FILE
($@)
{
my
$name
=
shift
;
my
@data
=
@_
;
...
...
@@ -323,3 +246,69 @@ sub REPLACE_IN_FILE
print
FILE
@lines
;
close
(
FILE
);
}
### Main
# Get the server protocol version
my
$protocol
=
GET_PROTOCOL_VERSION
();
### Create server_protocol.h and print header
open
SERVER_PROT
,
">include/wine/server_protocol.h"
or
die
"Cannot create include/wine/server_protocol.h"
;
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"
;
print
SERVER_PROT
" */\n\n"
;
print
SERVER_PROT
"#ifndef __WINE_WINE_SERVER_PROTOCOL_H\n"
;
print
SERVER_PROT
"#define __WINE_WINE_SERVER_PROTOCOL_H\n"
;
### Parse requests to find request/reply structure definitions
PARSE_REQUESTS
();
### Build the request list and structures
print
SERVER_PROT
"\n\nenum request\n{\n"
;
foreach
my
$req
(
@requests
)
{
print
SERVER_PROT
" REQ_$req,\n"
;
}
print
SERVER_PROT
" REQ_NB_REQUESTS\n};\n\n"
;
print
SERVER_PROT
"union generic_request\n{\n"
;
print
SERVER_PROT
" struct request_max_size max_size;\n"
;
print
SERVER_PROT
" struct request_header request_header;\n"
;
foreach
my
$req
(
@requests
)
{
print
SERVER_PROT
" struct ${req}_request ${req}_request;\n"
;
}
print
SERVER_PROT
"};\n"
;
print
SERVER_PROT
"union generic_reply\n{\n"
;
print
SERVER_PROT
" struct request_max_size max_size;\n"
;
print
SERVER_PROT
" struct reply_header reply_header;\n"
;
foreach
my
$req
(
@requests
)
{
print
SERVER_PROT
" struct ${req}_reply ${req}_reply;\n"
;
}
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
;
### Output the dumping function tables
push
@trace_lines
,
"static const dump_func req_dumpers[REQ_NB_REQUESTS] = {\n"
;
foreach
my
$req
(
@requests
)
{
push
@trace_lines
,
" (dump_func)dump_${req}_request,\n"
;
}
push
@trace_lines
,
"};\n\n"
;
push
@trace_lines
,
"static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {\n"
;
foreach
my
$req
(
@requests
)
{
push
@trace_lines
,
" (dump_func)"
,
$replies
{
$req
}
?
"dump_${req}_reply,\n"
:
"0,\n"
;
}
push
@trace_lines
,
"};\n\n"
;
push
@trace_lines
,
"static const char * const req_names[REQ_NB_REQUESTS] = {\n"
;
foreach
my
$req
(
@requests
)
{
push
@trace_lines
,
" \"$req\",\n"
;
}
push
@trace_lines
,
"};\n"
;
REPLACE_IN_FILE
(
"server/trace.c"
,
@trace_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