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
dc03ca5e
Commit
dc03ca5e
authored
Nov 09, 2018
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Write serialize function declarations in header.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ed117656
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
1 deletion
+71
-1
client.c
tools/widl/client.c
+23
-0
header.c
tools/widl/header.c
+46
-1
header.h
tools/widl/header.h
+2
-0
No files found.
tools/widl/client.c
View file @
dc03ca5e
...
...
@@ -287,6 +287,29 @@ static void write_function_stub( const type_t *iface, const var_t *func,
fprintf
(
client
,
"
\n
"
);
}
static
void
write_serialize_function
(
FILE
*
file
,
const
type_t
*
type
,
const
type_t
*
iface
,
const
char
*
func_name
,
const
char
*
ret_type
)
{
/* FIXME: Assuming explicit handle */
fprintf
(
file
,
"%s __cdecl %s_%s(handle_t IDL_handle, %s *IDL_type)%s
\n
"
,
ret_type
?
ret_type
:
"void"
,
type
->
name
,
func_name
,
type
->
name
,
iface
?
""
:
";"
);
}
void
write_serialize_functions
(
FILE
*
file
,
const
type_t
*
type
,
const
type_t
*
iface
)
{
if
(
is_attr
(
type
->
attrs
,
ATTR_ENCODE
))
{
write_serialize_function
(
file
,
type
,
iface
,
"AlignSize"
,
"SIZE_T"
);
write_serialize_function
(
file
,
type
,
iface
,
"Encode"
,
NULL
);
}
if
(
is_attr
(
type
->
attrs
,
ATTR_DECODE
))
{
write_serialize_function
(
file
,
type
,
iface
,
"Decode"
,
NULL
);
write_serialize_function
(
file
,
type
,
iface
,
"Free"
,
NULL
);
}
}
static
void
write_function_stubs
(
type_t
*
iface
,
unsigned
int
*
proc_offset
)
{
const
statement_t
*
stmt
;
...
...
tools/widl/header.c
View file @
dc03ca5e
...
...
@@ -716,6 +716,47 @@ void check_for_additional_prototype_types(const var_list_t *list)
}
}
static
int
write_serialize_function_decl
(
FILE
*
header
,
const
type_t
*
type
)
{
write_serialize_functions
(
header
,
type
,
NULL
);
return
1
;
}
static
int
serializable_exists
(
FILE
*
header
,
const
type_t
*
type
)
{
return
0
;
}
static
int
for_each_serializable
(
const
statement_list_t
*
stmts
,
FILE
*
header
,
int
(
*
proc
)(
FILE
*
,
const
type_t
*
))
{
statement_t
*
stmt
,
*
iface_stmt
;
statement_list_t
*
iface_stmts
;
const
type_list_t
*
type_entry
;
if
(
stmts
)
LIST_FOR_EACH_ENTRY
(
stmt
,
stmts
,
statement_t
,
entry
)
{
if
(
stmt
->
type
!=
STMT_TYPE
||
type_get_type
(
stmt
->
u
.
type
)
!=
TYPE_INTERFACE
)
continue
;
iface_stmts
=
type_iface_get_stmts
(
stmt
->
u
.
type
);
if
(
iface_stmts
)
LIST_FOR_EACH_ENTRY
(
iface_stmt
,
iface_stmts
,
statement_t
,
entry
)
{
if
(
iface_stmt
->
type
!=
STMT_TYPEDEF
)
continue
;
for
(
type_entry
=
iface_stmt
->
u
.
type_list
;
type_entry
;
type_entry
=
type_entry
->
next
)
{
if
(
!
is_attr
(
type_entry
->
type
->
attrs
,
ATTR_ENCODE
)
&&
!
is_attr
(
type_entry
->
type
->
attrs
,
ATTR_DECODE
))
continue
;
if
(
!
proc
(
header
,
type_entry
->
type
))
return
0
;
}
}
}
return
1
;
}
static
void
write_user_types
(
FILE
*
header
)
{
user_type_t
*
ut
;
...
...
@@ -1748,7 +1789,10 @@ void write_header(const statement_list_t *stmts)
fprintf
(
header
,
"#endif
\n\n
"
);
fprintf
(
header
,
"#include <rpc.h>
\n
"
);
fprintf
(
header
,
"#include <rpcndr.h>
\n\n
"
);
fprintf
(
header
,
"#include <rpcndr.h>
\n
"
);
if
(
!
for_each_serializable
(
stmts
,
NULL
,
serializable_exists
))
fprintf
(
header
,
"#include <midles.h>
\n
"
);
fprintf
(
header
,
"
\n
"
);
fprintf
(
header
,
"#ifndef COM_NO_WINDOWS_H
\n
"
);
fprintf
(
header
,
"#include <windows.h>
\n
"
);
...
...
@@ -1770,6 +1814,7 @@ void write_header(const statement_list_t *stmts)
fprintf
(
header
,
"/* Begin additional prototypes for all interfaces */
\n
"
);
fprintf
(
header
,
"
\n
"
);
for_each_serializable
(
stmts
,
header
,
write_serialize_function_decl
);
write_user_types
(
header
);
write_generic_handle_routines
(
header
);
write_context_handle_rundowns
(
header
);
...
...
tools/widl/header.h
View file @
dc03ca5e
...
...
@@ -54,6 +54,8 @@ extern const var_t *get_func_handle_var( const type_t *iface, const var_t *func,
extern
int
has_out_arg_or_return
(
const
var_t
*
func
);
extern
int
is_const_decl
(
const
var_t
*
var
);
extern
void
write_serialize_functions
(
FILE
*
file
,
const
type_t
*
type
,
const
type_t
*
iface
);
static
inline
int
is_ptr
(
const
type_t
*
t
)
{
return
type_get_type
(
t
)
==
TYPE_POINTER
;
...
...
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