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
01b44d13
Commit
01b44d13
authored
Jun 07, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Generate thunks for callas functions using interpreted stubs.
parent
441f735f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
20 deletions
+98
-20
proxy.c
tools/widl/proxy.c
+66
-0
typegen.c
tools/widl/typegen.c
+31
-20
typegen.h
tools/widl/typegen.h
+1
-0
No files found.
tools/widl/proxy.c
View file @
01b44d13
...
@@ -513,6 +513,31 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
...
@@ -513,6 +513,31 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
print_proxy
(
"
\n
"
);
print_proxy
(
"
\n
"
);
}
}
static
void
gen_stub_thunk
(
type_t
*
iface
,
const
var_t
*
func
,
unsigned
int
proc_offset
)
{
int
has_ret
=
!
is_void
(
type_function_get_rettype
(
func
->
type
));
const
var_t
*
arg
,
*
callas
=
is_callas
(
func
->
attrs
);
const
var_list_t
*
args
=
type_get_function_args
(
func
->
type
);
indent
=
0
;
print_proxy
(
"void __RPC_API %s_%s_Thunk( PMIDL_STUB_MESSAGE pStubMsg )
\n
"
,
iface
->
name
,
get_name
(
func
)
);
print_proxy
(
"{
\n
"
);
indent
++
;
write_func_param_struct
(
proxy
,
iface
,
func
->
type
,
"pParamStruct"
);
print_proxy
(
"%s%s_%s_Stub( pParamStruct->This"
,
has_ret
?
"pParamStruct->_RetVal = "
:
""
,
iface
->
name
,
callas
->
name
);
indent
++
;
if
(
args
)
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
{
fprintf
(
proxy
,
",
\n
%*spParamStruct->%s"
,
4
*
indent
,
""
,
arg
->
name
);
}
fprintf
(
proxy
,
" );
\n
"
);
indent
--
;
indent
--
;
print_proxy
(
"}
\n\n
"
);
}
int
count_methods
(
const
type_t
*
iface
)
int
count_methods
(
const
type_t
*
iface
)
{
{
const
statement_t
*
stmt
;
const
statement_t
*
stmt
;
...
@@ -594,11 +619,33 @@ static int write_stub_methods(type_t *iface, int skip)
...
@@ -594,11 +619,33 @@ static int write_stub_methods(type_t *iface, int skip)
return
i
;
return
i
;
}
}
static
void
write_thunk_methods
(
type_t
*
iface
)
{
const
statement_t
*
stmt
;
int
i
=
0
;
STATEMENTS_FOR_EACH_FUNC
(
stmt
,
type_iface_get_stmts
(
iface
)
)
{
var_t
*
func
=
stmt
->
u
.
var
;
const
var_t
*
cas
=
is_callas
(
func
->
attrs
);
if
(
is_local
(
func
->
attrs
))
continue
;
if
(
i
)
fprintf
(
proxy
,
",
\n
"
);
if
(
cas
&&
is_interpreted_func
(
iface
,
func
))
print_proxy
(
"%s_%s_Thunk"
,
iface
->
name
,
func
->
name
);
else
print_proxy
(
"0"
);
i
++
;
}
fputc
(
'\n'
,
proxy
);
}
static
void
write_proxy
(
type_t
*
iface
,
unsigned
int
*
proc_offset
)
static
void
write_proxy
(
type_t
*
iface
,
unsigned
int
*
proc_offset
)
{
{
int
count
;
int
count
;
const
statement_t
*
stmt
;
const
statement_t
*
stmt
;
int
first_func
=
1
;
int
first_func
=
1
;
int
needs_stub_thunks
=
0
;
int
needs_inline_stubs
=
need_inline_stubs
(
iface
);
int
needs_inline_stubs
=
need_inline_stubs
(
iface
);
STATEMENTS_FOR_EACH_FUNC
(
stmt
,
type_iface_get_stmts
(
iface
))
{
STATEMENTS_FOR_EACH_FUNC
(
stmt
,
type_iface_get_stmts
(
iface
))
{
...
@@ -627,6 +674,11 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
...
@@ -627,6 +674,11 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
func
->
procstring_offset
=
*
proc_offset
;
func
->
procstring_offset
=
*
proc_offset
;
gen_proxy
(
iface
,
func
,
idx
,
*
proc_offset
);
gen_proxy
(
iface
,
func
,
idx
,
*
proc_offset
);
gen_stub
(
iface
,
func
,
cname
,
*
proc_offset
);
gen_stub
(
iface
,
func
,
cname
,
*
proc_offset
);
if
(
cas
&&
is_interpreted_func
(
iface
,
func
))
{
needs_stub_thunks
=
1
;
gen_stub_thunk
(
iface
,
func
,
*
proc_offset
);
}
*
proc_offset
+=
get_size_procformatstring_func
(
iface
,
func
);
*
proc_offset
+=
get_size_procformatstring_func
(
iface
,
func
);
}
}
}
}
...
@@ -654,6 +706,17 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
...
@@ -654,6 +706,17 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
indent
--
;
indent
--
;
print_proxy
(
"};
\n\n
"
);
print_proxy
(
"};
\n\n
"
);
/* stub thunk table */
if
(
needs_stub_thunks
)
{
print_proxy
(
"static const STUB_THUNK %s_StubThunkTable[] =
\n
"
,
iface
->
name
);
print_proxy
(
"{
\n
"
);
indent
++
;
write_thunk_methods
(
iface
);
indent
--
;
print_proxy
(
"};
\n\n
"
);
}
/* server info */
/* server info */
print_proxy
(
"static const MIDL_SERVER_INFO %s_ServerInfo =
\n
"
,
iface
->
name
);
print_proxy
(
"static const MIDL_SERVER_INFO %s_ServerInfo =
\n
"
,
iface
->
name
);
print_proxy
(
"{
\n
"
);
print_proxy
(
"{
\n
"
);
...
@@ -662,6 +725,9 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
...
@@ -662,6 +725,9 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
print_proxy
(
"0,
\n
"
);
print_proxy
(
"0,
\n
"
);
print_proxy
(
"__MIDL_ProcFormatString.Format,
\n
"
);
print_proxy
(
"__MIDL_ProcFormatString.Format,
\n
"
);
print_proxy
(
"&%s_FormatStringOffsetTable[-3],
\n
"
,
iface
->
name
);
print_proxy
(
"&%s_FormatStringOffsetTable[-3],
\n
"
,
iface
->
name
);
if
(
needs_stub_thunks
)
print_proxy
(
"&%s_StubThunkTable[-3],
\n
"
,
iface
->
name
);
else
print_proxy
(
"0,
\n
"
);
print_proxy
(
"0,
\n
"
);
print_proxy
(
"0,
\n
"
);
print_proxy
(
"0,
\n
"
);
print_proxy
(
"0,
\n
"
);
print_proxy
(
"0,
\n
"
);
...
...
tools/widl/typegen.c
View file @
01b44d13
...
@@ -4632,30 +4632,14 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
...
@@ -4632,30 +4632,14 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
}
}
int
write_expr_eval_routines
(
FILE
*
file
,
const
char
*
iface
)
void
write_func_param_struct
(
FILE
*
file
,
const
type_t
*
iface
,
const
type_t
*
func
,
const
char
*
var_name
)
{
{
static
const
char
*
var_name
=
"pS"
;
const
var_list_t
*
args
=
type_get_function_args
(
func
);
static
const
char
*
var_name_expr
=
"pS->"
;
int
result
=
0
;
struct
expr_eval_routine
*
eval
;
unsigned
short
callback_offset
=
0
;
LIST_FOR_EACH_ENTRY
(
eval
,
&
expr_eval_routines
,
struct
expr_eval_routine
,
entry
)
{
const
char
*
name
=
eval
->
name
;
result
=
1
;
print_file
(
file
,
0
,
"static void __RPC_USER %s_%sExprEval_%04u(PMIDL_STUB_MESSAGE pStubMsg)
\n
"
,
iface
,
name
,
callback_offset
);
print_file
(
file
,
0
,
"{
\n
"
);
if
(
type_get_type
(
eval
->
cont_type
)
==
TYPE_FUNCTION
)
{
const
var_list_t
*
args
=
type_get_function_args
(
eval
->
cont_type
);
const
var_t
*
arg
;
const
var_t
*
arg
;
print_file
(
file
,
1
,
"struct _PARAM_STRUCT
\n
"
);
print_file
(
file
,
1
,
"struct _PARAM_STRUCT
\n
"
);
print_file
(
file
,
1
,
"{
\n
"
);
print_file
(
file
,
1
,
"{
\n
"
);
if
(
is_object
(
eval
->
iface
))
print_file
(
file
,
2
,
"%s *This;
\n
"
,
eval
->
iface
->
name
);
if
(
is_object
(
iface
))
print_file
(
file
,
2
,
"%s *This;
\n
"
,
iface
->
name
);
if
(
args
)
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
if
(
args
)
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
{
{
...
@@ -4669,7 +4653,34 @@ int write_expr_eval_routines(FILE *file, const char *iface)
...
@@ -4669,7 +4653,34 @@ int write_expr_eval_routines(FILE *file, const char *iface)
else
else
fprintf
(
file
,
"%s DECLSPEC_ALIGN(%u);
\n
"
,
arg
->
name
,
pointer_size
);
fprintf
(
file
,
"%s DECLSPEC_ALIGN(%u);
\n
"
,
arg
->
name
,
pointer_size
);
}
}
print_file
(
file
,
1
,
"} *pS = (struct _PARAM_STRUCT *)pStubMsg->StackTop;
\n
"
);
if
(
!
is_void
(
type_function_get_rettype
(
func
)))
{
print_file
(
file
,
2
,
"%s"
,
""
);
write_type_decl
(
file
,
type_function_get_rettype
(
func
),
"_RetVal"
);
fprintf
(
file
,
";
\n
"
);
}
print_file
(
file
,
1
,
"} *%s = (struct _PARAM_STRUCT *)pStubMsg->StackTop;
\n\n
"
,
var_name
);
}
int
write_expr_eval_routines
(
FILE
*
file
,
const
char
*
iface
)
{
static
const
char
*
var_name
=
"pS"
;
static
const
char
*
var_name_expr
=
"pS->"
;
int
result
=
0
;
struct
expr_eval_routine
*
eval
;
unsigned
short
callback_offset
=
0
;
LIST_FOR_EACH_ENTRY
(
eval
,
&
expr_eval_routines
,
struct
expr_eval_routine
,
entry
)
{
const
char
*
name
=
eval
->
name
;
result
=
1
;
print_file
(
file
,
0
,
"static void __RPC_USER %s_%sExprEval_%04u(PMIDL_STUB_MESSAGE pStubMsg)
\n
"
,
iface
,
name
,
callback_offset
);
print_file
(
file
,
0
,
"{
\n
"
);
if
(
type_get_type
(
eval
->
cont_type
)
==
TYPE_FUNCTION
)
{
write_func_param_struct
(
file
,
eval
->
iface
,
eval
->
cont_type
,
"pS"
);
}
}
else
else
{
{
...
...
tools/widl/typegen.h
View file @
01b44d13
...
@@ -75,6 +75,7 @@ unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_
...
@@ -75,6 +75,7 @@ unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_
unsigned
int
get_size_typeformatstring
(
const
statement_list_t
*
stmts
,
type_pred_t
pred
);
unsigned
int
get_size_typeformatstring
(
const
statement_list_t
*
stmts
,
type_pred_t
pred
);
void
assign_stub_out_args
(
FILE
*
file
,
int
indent
,
const
var_t
*
func
,
const
char
*
local_var_prefix
);
void
assign_stub_out_args
(
FILE
*
file
,
int
indent
,
const
var_t
*
func
,
const
char
*
local_var_prefix
);
void
declare_stub_args
(
FILE
*
file
,
int
indent
,
const
var_t
*
func
);
void
declare_stub_args
(
FILE
*
file
,
int
indent
,
const
var_t
*
func
);
void
write_func_param_struct
(
FILE
*
file
,
const
type_t
*
iface
,
const
type_t
*
func
,
const
char
*
var_name
);
int
write_expr_eval_routines
(
FILE
*
file
,
const
char
*
iface
);
int
write_expr_eval_routines
(
FILE
*
file
,
const
char
*
iface
);
void
write_expr_eval_routine_list
(
FILE
*
file
,
const
char
*
iface
);
void
write_expr_eval_routine_list
(
FILE
*
file
,
const
char
*
iface
);
void
write_user_quad_list
(
FILE
*
file
);
void
write_user_quad_list
(
FILE
*
file
);
...
...
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