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
bf011b0f
Commit
bf011b0f
authored
Sep 15, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Infrastructure for adding a prefix to local variable references.
parent
3bdaba2a
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
125 additions
and
117 deletions
+125
-117
client.c
tools/widl/client.c
+4
-4
expr.c
tools/widl/expr.c
+24
-20
expr.h
tools/widl/expr.h
+2
-1
header.c
tools/widl/header.c
+2
-2
proxy.c
tools/widl/proxy.c
+18
-18
server.c
tools/widl/server.c
+8
-8
typegen.c
tools/widl/typegen.c
+61
-60
typegen.h
tools/widl/typegen.h
+6
-4
No files found.
tools/widl/client.c
View file @
bf011b0f
...
...
@@ -204,7 +204,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
fprintf
(
client
,
"
\n
"
);
}
write_remoting_arguments
(
client
,
indent
,
func
,
PASS_IN
,
PHASE_BUFFERSIZE
);
write_remoting_arguments
(
client
,
indent
,
func
,
""
,
PASS_IN
,
PHASE_BUFFERSIZE
);
print_client
(
"NdrGetBuffer(
\n
"
);
indent
++
;
...
...
@@ -218,7 +218,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
fprintf
(
client
,
"
\n
"
);
/* marshal arguments */
write_remoting_arguments
(
client
,
indent
,
func
,
PASS_IN
,
PHASE_MARSHAL
);
write_remoting_arguments
(
client
,
indent
,
func
,
""
,
PASS_IN
,
PHASE_MARSHAL
);
/* send/receive message */
/* print_client("NdrNsSendReceive(\n"); */
...
...
@@ -248,7 +248,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
/* unmarshall arguments */
fprintf
(
client
,
"
\n
"
);
write_remoting_arguments
(
client
,
indent
,
func
,
PASS_OUT
,
PHASE_UNMARSHAL
);
write_remoting_arguments
(
client
,
indent
,
func
,
""
,
PASS_OUT
,
PHASE_UNMARSHAL
);
/* unmarshal return value */
if
(
!
is_void
(
get_func_return_type
(
func
)))
...
...
@@ -257,7 +257,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
print_client
(
"MIDL_memset(&%s, 0, sizeof(%s));
\n
"
,
"_RetVal"
,
"_RetVal"
);
else
if
(
is_ptr
(
get_func_return_type
(
func
))
||
is_array
(
get_func_return_type
(
func
)))
print_client
(
"%s = 0;
\n
"
,
"_RetVal"
);
write_remoting_arguments
(
client
,
indent
,
func
,
PASS_RETURN
,
PHASE_UNMARSHAL
);
write_remoting_arguments
(
client
,
indent
,
func
,
""
,
PASS_RETURN
,
PHASE_UNMARSHAL
);
}
/* update proc_offset */
...
...
tools/widl/expr.c
View file @
bf011b0f
...
...
@@ -576,7 +576,7 @@ const type_t *expr_resolve_type(const struct expr_loc *expr_loc, const type_t *c
void
write_expr
(
FILE
*
h
,
const
expr_t
*
e
,
int
brackets
,
int
toplevel
,
const
char
*
toplevel_prefix
,
const
type_t
*
cont_type
)
const
type_t
*
cont_type
,
const
char
*
local_var_prefix
)
{
switch
(
e
->
type
)
{
...
...
@@ -602,9 +602,13 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
{
int
found_in_cont_type
;
find_identifier
(
e
->
u
.
sval
,
cont_type
,
&
found_in_cont_type
);
if
(
found_in_cont_type
)
fprintf
(
h
,
"%s"
,
toplevel_prefix
);
if
(
found_in_cont_type
)
{
fprintf
(
h
,
"%s%s"
,
toplevel_prefix
,
e
->
u
.
sval
);
break
;
}
}
fprintf
(
h
,
"%s
"
,
e
->
u
.
sval
);
fprintf
(
h
,
"%s
%s"
,
local_var_prefix
,
e
->
u
.
sval
);
break
;
case
EXPR_STRLIT
:
fprintf
(
h
,
"
\"
%s
\"
"
,
e
->
u
.
sval
);
...
...
@@ -614,33 +618,33 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
break
;
case
EXPR_LOGNOT
:
fprintf
(
h
,
"!"
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
break
;
case
EXPR_NOT
:
fprintf
(
h
,
"~"
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
break
;
case
EXPR_POS
:
fprintf
(
h
,
"+"
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
break
;
case
EXPR_NEG
:
fprintf
(
h
,
"-"
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
break
;
case
EXPR_ADDRESSOF
:
fprintf
(
h
,
"&"
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
break
;
case
EXPR_PPTR
:
fprintf
(
h
,
"*"
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
break
;
case
EXPR_CAST
:
fprintf
(
h
,
"("
);
write_type_decl
(
h
,
e
->
u
.
tref
,
NULL
);
fprintf
(
h
,
")"
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
break
;
case
EXPR_SIZEOF
:
fprintf
(
h
,
"sizeof("
);
...
...
@@ -666,7 +670,7 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
case
EXPR_GTREQL
:
case
EXPR_LESSEQL
:
if
(
brackets
)
fprintf
(
h
,
"("
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
switch
(
e
->
type
)
{
case
EXPR_SHL
:
fprintf
(
h
,
" << "
);
break
;
...
...
@@ -689,38 +693,38 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
case
EXPR_LESSEQL
:
fprintf
(
h
,
" <= "
);
break
;
default:
break
;
}
write_expr
(
h
,
e
->
u
.
ext
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
u
.
ext
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
if
(
brackets
)
fprintf
(
h
,
")"
);
break
;
case
EXPR_MEMBER
:
if
(
brackets
)
fprintf
(
h
,
"("
);
if
(
e
->
ref
->
type
==
EXPR_PPTR
)
{
write_expr
(
h
,
e
->
ref
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
fprintf
(
h
,
"->"
);
}
else
{
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
fprintf
(
h
,
"."
);
}
write_expr
(
h
,
e
->
u
.
ext
,
1
,
0
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
u
.
ext
,
1
,
0
,
toplevel_prefix
,
cont_type
,
""
);
if
(
brackets
)
fprintf
(
h
,
")"
);
break
;
case
EXPR_COND
:
if
(
brackets
)
fprintf
(
h
,
"("
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
fprintf
(
h
,
" ? "
);
write_expr
(
h
,
e
->
u
.
ext
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
u
.
ext
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
fprintf
(
h
,
" : "
);
write_expr
(
h
,
e
->
ext2
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ext2
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
if
(
brackets
)
fprintf
(
h
,
")"
);
break
;
case
EXPR_ARRAY
:
if
(
brackets
)
fprintf
(
h
,
"("
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
fprintf
(
h
,
"["
);
write_expr
(
h
,
e
->
u
.
ext
,
1
,
1
,
toplevel_prefix
,
cont_type
);
write_expr
(
h
,
e
->
u
.
ext
,
1
,
1
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
fprintf
(
h
,
"]"
);
if
(
brackets
)
fprintf
(
h
,
")"
);
break
;
...
...
tools/widl/expr.h
View file @
bf011b0f
...
...
@@ -37,4 +37,5 @@ extern expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, exp
extern
const
type_t
*
expr_resolve_type
(
const
struct
expr_loc
*
expr_loc
,
const
type_t
*
cont_type
,
const
expr_t
*
expr
);
extern
int
compare_expr
(
const
expr_t
*
a
,
const
expr_t
*
b
);
extern
void
write_expr
(
FILE
*
h
,
const
expr_t
*
e
,
int
brackets
,
int
toplevel
,
const
char
*
toplevel_prefix
,
const
type_t
*
cont_type
);
extern
void
write_expr
(
FILE
*
h
,
const
expr_t
*
e
,
int
brackets
,
int
toplevel
,
const
char
*
toplevel_prefix
,
const
type_t
*
cont_type
,
const
char
*
local_var_prefix
);
tools/widl/header.c
View file @
bf011b0f
...
...
@@ -194,7 +194,7 @@ static void write_enums(FILE *h, var_list_t *enums)
fprintf
(
h
,
"%s"
,
get_name
(
v
));
if
(
v
->
eval
)
{
fprintf
(
h
,
" = "
);
write_expr
(
h
,
v
->
eval
,
0
,
1
,
NULL
,
NULL
);
write_expr
(
h
,
v
->
eval
,
0
,
1
,
NULL
,
NULL
,
""
);
}
}
if
(
list_next
(
enums
,
&
v
->
entry
))
fprintf
(
h
,
",
\n
"
);
...
...
@@ -499,7 +499,7 @@ void write_declaration(const var_t *v, int is_in_interface)
if
(
is_const_decl
(
v
)
&&
v
->
eval
)
{
fprintf
(
header
,
"#define %s ("
,
v
->
name
);
write_expr
(
header
,
v
->
eval
,
0
,
1
,
NULL
,
NULL
);
write_expr
(
header
,
v
->
eval
,
0
,
1
,
NULL
,
NULL
,
""
);
fprintf
(
header
,
")
\n\n
"
);
}
else
if
(
v
->
type
->
type
!=
RPC_FC_FUNCTION
||
!
is_in_interface
)
...
...
tools/widl/proxy.c
View file @
bf011b0f
...
...
@@ -213,7 +213,7 @@ static void proxy_check_pointers( const var_list_t *args )
}
}
static
void
free_variable
(
const
var_t
*
arg
)
static
void
free_variable
(
const
var_t
*
arg
,
const
char
*
local_var_prefix
)
{
unsigned
int
type_offset
=
arg
->
type
->
typestring_offset
;
expr_t
*
iid
;
...
...
@@ -223,7 +223,7 @@ static void free_variable( const var_t *arg )
if
(
size
)
{
print_proxy
(
"__frame->_StubMsg.MaxCount = "
);
write_expr
(
proxy
,
size
,
0
,
1
,
NULL
,
NULL
);
write_expr
(
proxy
,
size
,
0
,
1
,
NULL
,
NULL
,
local_var_prefix
);
fprintf
(
proxy
,
";
\n\n
"
);
print_proxy
(
"NdrClearOutParameters( &__frame->_StubMsg, "
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%u], "
,
type_offset
);
...
...
@@ -251,7 +251,7 @@ static void free_variable( const var_t *arg )
if
(
iid
)
{
print_proxy
(
"__frame->_StubMsg.MaxCount = (unsigned long) "
);
write_expr
(
proxy
,
iid
,
1
,
1
,
NULL
,
NULL
);
write_expr
(
proxy
,
iid
,
1
,
1
,
NULL
,
NULL
,
local_var_prefix
);
print_proxy
(
";
\n\n
"
);
}
print_proxy
(
"NdrClearOutParameters( &__frame->_StubMsg, "
);
...
...
@@ -264,7 +264,7 @@ static void free_variable( const var_t *arg )
}
}
static
void
proxy_free_variables
(
var_list_t
*
args
)
static
void
proxy_free_variables
(
var_list_t
*
args
,
const
char
*
local_var_prefix
)
{
const
var_t
*
arg
;
...
...
@@ -272,7 +272,7 @@ static void proxy_free_variables( var_list_t *args )
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
free_variable
(
arg
);
free_variable
(
arg
,
local_var_prefix
);
fprintf
(
proxy
,
"
\n
"
);
}
}
...
...
@@ -337,11 +337,11 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
print_proxy
(
"{
\n
"
);
indent
++
;
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_IN
,
PHASE_BUFFERSIZE
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
""
,
PASS_IN
,
PHASE_BUFFERSIZE
);
print_proxy
(
"NdrProxyGetBuffer(This, &__frame->_StubMsg);
\n
"
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_IN
,
PHASE_MARSHAL
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
""
,
PASS_IN
,
PHASE_MARSHAL
);
print_proxy
(
"NdrProxySendReceive(This, &__frame->_StubMsg);
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
...
...
@@ -354,7 +354,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
indent
--
;
fprintf
(
proxy
,
"
\n
"
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_OUT
,
PHASE_UNMARSHAL
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
""
,
PASS_OUT
,
PHASE_UNMARSHAL
);
if
(
has_ret
)
{
...
...
@@ -362,7 +362,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
print_proxy
(
"MIDL_memset(&%s, 0, sizeof(%s));
\n
"
,
"_RetVal"
,
"_RetVal"
);
else
if
(
is_ptr
(
get_func_return_type
(
cur
))
||
is_array
(
get_func_return_type
(
cur
)))
print_proxy
(
"%s = 0;
\n
"
,
"_RetVal"
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_RETURN
,
PHASE_UNMARSHAL
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
""
,
PASS_RETURN
,
PHASE_UNMARSHAL
);
}
indent
--
;
...
...
@@ -380,7 +380,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
print_proxy
(
"{
\n
"
);
if
(
has_ret
)
{
indent
++
;
proxy_free_variables
(
cur
->
args
);
proxy_free_variables
(
cur
->
args
,
""
);
print_proxy
(
"_RetVal = NdrProxyErrorHandler(RpcExceptionCode());
\n
"
);
indent
--
;
}
...
...
@@ -424,7 +424,7 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
fprintf
(
proxy
,
"
\n
"
);
print_proxy
(
"RpcExceptionInit( 0, __stub_finally );
\n
"
);
write_parameters_init
(
proxy
,
indent
,
cur
);
write_parameters_init
(
proxy
,
indent
,
cur
,
""
);
print_proxy
(
"RpcTryFinally
\n
"
);
print_proxy
(
"{
\n
"
);
...
...
@@ -437,10 +437,10 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
indent
--
;
fprintf
(
proxy
,
"
\n
"
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_IN
,
PHASE_UNMARSHAL
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
""
,
PASS_IN
,
PHASE_UNMARSHAL
);
fprintf
(
proxy
,
"
\n
"
);
assign_stub_out_args
(
proxy
,
indent
,
cur
);
assign_stub_out_args
(
proxy
,
indent
,
cur
,
""
);
print_proxy
(
"*_pdwStubPhase = STUB_CALL_SERVER;
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
...
...
@@ -460,26 +460,26 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
print_proxy
(
"*_pdwStubPhase = STUB_MARSHAL;
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_OUT
,
PHASE_BUFFERSIZE
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
""
,
PASS_OUT
,
PHASE_BUFFERSIZE
);
if
(
!
is_void
(
get_func_return_type
(
cur
)))
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_RETURN
,
PHASE_BUFFERSIZE
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
""
,
PASS_RETURN
,
PHASE_BUFFERSIZE
);
print_proxy
(
"NdrStubGetBuffer(This, _pRpcChannelBuffer, &__frame->_StubMsg);
\n
"
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_OUT
,
PHASE_MARSHAL
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
""
,
PASS_OUT
,
PHASE_MARSHAL
);
fprintf
(
proxy
,
"
\n
"
);
/* marshall the return value */
if
(
!
is_void
(
get_func_return_type
(
cur
)))
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_RETURN
,
PHASE_MARSHAL
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
""
,
PASS_RETURN
,
PHASE_MARSHAL
);
indent
--
;
print_proxy
(
"}
\n
"
);
print_proxy
(
"RpcFinally
\n
"
);
print_proxy
(
"{
\n
"
);
write_remoting_arguments
(
proxy
,
indent
+
1
,
cur
,
PASS_OUT
,
PHASE_FREE
);
write_remoting_arguments
(
proxy
,
indent
+
1
,
cur
,
""
,
PASS_OUT
,
PHASE_FREE
);
if
(
has_full_pointer
)
write_full_pointer_free
(
proxy
,
indent
,
cur
);
...
...
tools/widl/server.c
View file @
bf011b0f
...
...
@@ -87,7 +87,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
fprintf
(
server
,
"
\n
"
);
print_server
(
"RpcExceptionInit( __server_filter, __server_finally );
\n
"
);
write_parameters_init
(
server
,
indent
,
func
);
write_parameters_init
(
server
,
indent
,
func
,
""
);
if
(
explicit_handle_var
)
{
...
...
@@ -117,7 +117,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
fprintf
(
server
,
"
\n
"
);
/* unmarshall arguments */
write_remoting_arguments
(
server
,
indent
,
func
,
PASS_IN
,
PHASE_UNMARSHAL
);
write_remoting_arguments
(
server
,
indent
,
func
,
""
,
PASS_IN
,
PHASE_UNMARSHAL
);
}
print_server
(
"if (__frame->_StubMsg.Buffer > __frame->_StubMsg.BufferEnd)
\n
"
);
...
...
@@ -138,7 +138,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
fprintf
(
server
,
"
\n
"
);
/* Assign 'out' arguments */
assign_stub_out_args
(
server
,
indent
,
func
);
assign_stub_out_args
(
server
,
indent
,
func
,
""
);
/* Call the real server function */
if
(
!
is_void
(
get_func_return_type
(
func
)))
...
...
@@ -184,10 +184,10 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
if
(
has_out_arg_or_return
(
func
))
{
write_remoting_arguments
(
server
,
indent
,
func
,
PASS_OUT
,
PHASE_BUFFERSIZE
);
write_remoting_arguments
(
server
,
indent
,
func
,
""
,
PASS_OUT
,
PHASE_BUFFERSIZE
);
if
(
!
is_void
(
get_func_return_type
(
func
)))
write_remoting_arguments
(
server
,
indent
,
func
,
PASS_RETURN
,
PHASE_BUFFERSIZE
);
write_remoting_arguments
(
server
,
indent
,
func
,
""
,
PASS_RETURN
,
PHASE_BUFFERSIZE
);
print_server
(
"_pRpcMessage->BufferLength = __frame->_StubMsg.BufferLength;
\n
"
);
fprintf
(
server
,
"
\n
"
);
...
...
@@ -202,11 +202,11 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
}
/* marshall arguments */
write_remoting_arguments
(
server
,
indent
,
func
,
PASS_OUT
,
PHASE_MARSHAL
);
write_remoting_arguments
(
server
,
indent
,
func
,
""
,
PASS_OUT
,
PHASE_MARSHAL
);
/* marshall the return value */
if
(
!
is_void
(
get_func_return_type
(
func
)))
write_remoting_arguments
(
server
,
indent
,
func
,
PASS_RETURN
,
PHASE_MARSHAL
);
write_remoting_arguments
(
server
,
indent
,
func
,
""
,
PASS_RETURN
,
PHASE_MARSHAL
);
indent
--
;
print_server
(
"}
\n
"
);
...
...
@@ -214,7 +214,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
print_server
(
"{
\n
"
);
indent
++
;
write_remoting_arguments
(
server
,
indent
,
func
,
PASS_OUT
,
PHASE_FREE
);
write_remoting_arguments
(
server
,
indent
,
func
,
""
,
PASS_OUT
,
PHASE_FREE
);
if
(
has_full_pointer
)
write_full_pointer_free
(
server
,
indent
,
func
);
...
...
tools/widl/typegen.c
View file @
bf011b0f
...
...
@@ -341,26 +341,27 @@ void print(FILE *file, int indent, const char *format, va_list va)
}
static
void
write_var_init
(
FILE
*
file
,
int
indent
,
const
type_t
*
t
,
const
char
*
n
)
static
void
write_var_init
(
FILE
*
file
,
int
indent
,
const
type_t
*
t
,
const
char
*
n
,
const
char
*
local_var_prefix
)
{
if
(
decl_indirect
(
t
))
print_file
(
file
,
indent
,
"MIDL_memset(&%s, 0, sizeof(%s));
\n
"
,
n
,
n
);
print_file
(
file
,
indent
,
"MIDL_memset(&%s%s, 0, sizeof(%s%s));
\n
"
,
local_var_prefix
,
n
,
local_var_prefix
,
n
);
else
if
(
is_ptr
(
t
)
||
is_array
(
t
))
print_file
(
file
,
indent
,
"%s
= 0;
\n
"
,
n
);
print_file
(
file
,
indent
,
"%s
%s = 0;
\n
"
,
local_var_prefix
,
n
);
}
void
write_parameters_init
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
)
void
write_parameters_init
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
const
char
*
local_var_prefix
)
{
const
var_t
*
var
;
if
(
!
is_void
(
get_func_return_type
(
func
)))
write_var_init
(
file
,
indent
,
get_func_return_type
(
func
),
"_RetVal"
);
write_var_init
(
file
,
indent
,
get_func_return_type
(
func
),
"_RetVal"
,
local_var_prefix
);
if
(
!
func
->
args
)
return
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
write_var_init
(
file
,
indent
,
var
->
type
,
var
->
name
);
write_var_init
(
file
,
indent
,
var
->
type
,
var
->
name
,
local_var_prefix
);
fprintf
(
file
,
"
\n
"
);
}
...
...
@@ -2631,7 +2632,7 @@ static unsigned int get_function_buffer_size( const func_t *func, enum pass pass
}
static
void
print_phase_function
(
FILE
*
file
,
int
indent
,
const
char
*
type
,
enum
remoting_phase
phase
,
const
char
*
local_var_prefix
,
enum
remoting_phase
phase
,
const
var_t
*
var
,
unsigned
int
type_offset
)
{
const
char
*
function
;
...
...
@@ -2657,9 +2658,10 @@ static void print_phase_function(FILE *file, int indent, const char *type,
print_file
(
file
,
indent
,
"Ndr%s%s(
\n
"
,
type
,
function
);
indent
++
;
print_file
(
file
,
indent
,
"&__frame->_StubMsg,
\n
"
);
print_file
(
file
,
indent
,
"%s%s%s%s,
\n
"
,
print_file
(
file
,
indent
,
"%s%s%s%s
%s
,
\n
"
,
(
phase
==
PHASE_UNMARSHAL
)
?
"(unsigned char **)"
:
"(unsigned char *)"
,
(
phase
==
PHASE_UNMARSHAL
||
decl_indirect
(
var
->
type
))
?
"&"
:
""
,
local_var_prefix
,
(
phase
==
PHASE_UNMARSHAL
&&
decl_indirect
(
var
->
type
))
?
"_p_"
:
""
,
var
->
name
);
print_file
(
file
,
indent
,
"(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]%s
\n
"
,
...
...
@@ -2669,8 +2671,8 @@ static void print_phase_function(FILE *file, int indent, const char *type,
indent
--
;
}
void
print_phase_basetype
(
FILE
*
file
,
int
indent
,
enum
remoting_phase
phase
,
enum
pass
pass
,
const
var_t
*
var
,
void
print_phase_basetype
(
FILE
*
file
,
int
indent
,
const
char
*
local_var_prefix
,
enum
remoting_phase
phase
,
enum
pass
pass
,
const
var_t
*
var
,
const
char
*
varname
)
{
type_t
*
type
=
var
->
type
;
...
...
@@ -2740,7 +2742,7 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase,
fprintf
(
file
,
" *)__frame->_StubMsg.Buffer = *"
);
else
fprintf
(
file
,
" *)__frame->_StubMsg.Buffer = "
);
fprintf
(
file
,
"%s
"
,
varname
);
fprintf
(
file
,
"%s
%s"
,
local_var_prefix
,
varname
);
fprintf
(
file
,
";
\n
"
);
}
else
if
(
phase
==
PHASE_UNMARSHAL
)
...
...
@@ -2755,7 +2757,7 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase,
print_file
(
file
,
indent
,
""
);
else
print_file
(
file
,
indent
,
"*"
);
fprintf
(
file
,
"%s
"
,
varname
);
fprintf
(
file
,
"%s
%s"
,
local_var_prefix
,
varname
);
if
(
pass
==
PASS_IN
&&
is_ptr
(
type
))
fprintf
(
file
,
" = ("
);
else
...
...
@@ -2794,9 +2796,8 @@ expr_t *get_size_is_expr(const type_t *t, const char *name)
return
x
;
}
static
void
write_parameter_conf_or_var_exprs
(
FILE
*
file
,
int
indent
,
enum
remoting_phase
phase
,
const
var_t
*
var
)
static
void
write_parameter_conf_or_var_exprs
(
FILE
*
file
,
int
indent
,
const
char
*
local_var_prefix
,
enum
remoting_phase
phase
,
const
var_t
*
var
)
{
const
type_t
*
type
=
var
->
type
;
/* get fundamental type for the argument */
...
...
@@ -2813,14 +2814,14 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent,
if
(
type
->
size_is
)
{
print_file
(
file
,
indent
,
"__frame->_StubMsg.MaxCount = (unsigned long)"
);
write_expr
(
file
,
type
->
size_is
,
1
,
1
,
NULL
,
NULL
);
write_expr
(
file
,
type
->
size_is
,
1
,
1
,
NULL
,
NULL
,
local_var_prefix
);
fprintf
(
file
,
";
\n\n
"
);
}
if
(
type
->
length_is
)
{
print_file
(
file
,
indent
,
"__frame->_StubMsg.Offset = (unsigned long)0;
\n
"
);
/* FIXME */
print_file
(
file
,
indent
,
"__frame->_StubMsg.ActualCount = (unsigned long)"
);
write_expr
(
file
,
type
->
length_is
,
1
,
1
,
NULL
,
NULL
);
write_expr
(
file
,
type
->
length_is
,
1
,
1
,
NULL
,
NULL
,
local_var_prefix
);
fprintf
(
file
,
";
\n\n
"
);
}
}
...
...
@@ -2831,7 +2832,7 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent,
if
(
is_conformance_needed_for_phase
(
phase
))
{
print_file
(
file
,
indent
,
"__frame->_StubMsg.MaxCount = (unsigned long)"
);
write_expr
(
file
,
get_attrp
(
var
->
attrs
,
ATTR_SWITCHIS
),
1
,
1
,
NULL
,
NULL
);
write_expr
(
file
,
get_attrp
(
var
->
attrs
,
ATTR_SWITCHIS
),
1
,
1
,
NULL
,
NULL
,
local_var_prefix
);
fprintf
(
file
,
";
\n\n
"
);
}
break
;
...
...
@@ -2843,7 +2844,7 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent,
if
(
is_conformance_needed_for_phase
(
phase
)
&&
(
iid
=
get_attrp
(
var
->
attrs
,
ATTR_IIDIS
)))
{
print_file
(
file
,
indent
,
"__frame->_StubMsg.MaxCount = (unsigned long) "
);
write_expr
(
file
,
iid
,
1
,
1
,
NULL
,
NULL
);
write_expr
(
file
,
iid
,
1
,
1
,
NULL
,
NULL
,
local_var_prefix
);
fprintf
(
file
,
";
\n\n
"
);
}
break
;
...
...
@@ -2855,9 +2856,8 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent,
}
}
static
void
write_remoting_arg
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
enum
pass
pass
,
enum
remoting_phase
phase
,
const
var_t
*
var
)
static
void
write_remoting_arg
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
const
char
*
local_var_prefix
,
enum
pass
pass
,
enum
remoting_phase
phase
,
const
var_t
*
var
)
{
int
in_attr
,
out_attr
,
pointer_type
;
const
type_t
*
type
=
var
->
type
;
...
...
@@ -2886,7 +2886,7 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
break
;
}
write_parameter_conf_or_var_exprs
(
file
,
indent
,
phase
,
var
);
write_parameter_conf_or_var_exprs
(
file
,
indent
,
local_var_prefix
,
phase
,
var
);
rtype
=
type
->
type
;
if
(
is_context_handle
(
type
))
...
...
@@ -2901,14 +2901,14 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
int
is_ch_ptr
=
is_aliaschain_attr
(
type
,
ATTR_CONTEXTHANDLE
)
?
FALSE
:
TRUE
;
print_file
(
file
,
indent
,
"NdrClientContextMarshall(
\n
"
);
print_file
(
file
,
indent
+
1
,
"&__frame->_StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"(NDR_CCONTEXT)%s%s
,
\n
"
,
is_ch_ptr
?
"*"
:
""
,
var
->
name
);
print_file
(
file
,
indent
+
1
,
"(NDR_CCONTEXT)%s%s
%s,
\n
"
,
is_ch_ptr
?
"*"
:
""
,
local_var_prefix
,
var
->
name
);
print_file
(
file
,
indent
+
1
,
"%s);
\n
"
,
in_attr
&&
out_attr
?
"1"
:
"0"
);
}
else
{
print_file
(
file
,
indent
,
"NdrServerContextNewMarshall(
\n
"
);
print_file
(
file
,
indent
+
1
,
"&__frame->_StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"(NDR_SCONTEXT)%s
,
\n
"
,
var
->
name
);
print_file
(
file
,
indent
+
1
,
"(NDR_SCONTEXT)%s
%s,
\n
"
,
local_var_prefix
,
var
->
name
);
print_file
(
file
,
indent
+
1
,
"(NDR_RUNDOWN)%s_rundown,
\n
"
,
get_context_handle_type_name
(
var
->
type
));
print_file
(
file
,
indent
+
1
,
"(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
start_offset
);
}
...
...
@@ -2918,15 +2918,15 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
if
(
pass
==
PASS_OUT
)
{
if
(
!
in_attr
)
print_file
(
file
,
indent
,
"*%s
= 0;
\n
"
,
var
->
name
);
print_file
(
file
,
indent
,
"*%s
%s = 0;
\n
"
,
local_var_prefix
,
var
->
name
);
print_file
(
file
,
indent
,
"NdrClientContextUnmarshall(
\n
"
);
print_file
(
file
,
indent
+
1
,
"&__frame->_StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"(NDR_CCONTEXT *)%s
,
\n
"
,
var
->
name
);
print_file
(
file
,
indent
+
1
,
"(NDR_CCONTEXT *)%s
%s,
\n
"
,
local_var_prefix
,
var
->
name
);
print_file
(
file
,
indent
+
1
,
"_Handle);
\n
"
);
}
else
{
print_file
(
file
,
indent
,
"%s
= NdrServerContextNewUnmarshall(
\n
"
,
var
->
name
);
print_file
(
file
,
indent
,
"%s
%s = NdrServerContextNewUnmarshall(
\n
"
,
local_var_prefix
,
var
->
name
);
print_file
(
file
,
indent
+
1
,
"&__frame->_StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
start_offset
);
}
...
...
@@ -2934,20 +2934,21 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
}
else
if
(
is_user_type
(
var
->
type
))
{
print_phase_function
(
file
,
indent
,
"UserMarshal"
,
phase
,
var
,
start_offset
);
print_phase_function
(
file
,
indent
,
"UserMarshal"
,
local_var_prefix
,
phase
,
var
,
start_offset
);
}
else
if
(
is_string_type
(
var
->
attrs
,
var
->
type
))
{
if
(
is_array
(
type
)
&&
!
is_conformant_array
(
type
))
print_phase_function
(
file
,
indent
,
"NonConformantString"
,
phase
,
var
,
start_offset
);
print_phase_function
(
file
,
indent
,
"NonConformantString"
,
local_var_prefix
,
phase
,
var
,
start_offset
);
else
{
if
(
phase
==
PHASE_FREE
||
pass
==
PASS_RETURN
||
pointer_type
==
RPC_FC_UP
)
print_phase_function
(
file
,
indent
,
"Pointer"
,
phase
,
var
,
print_phase_function
(
file
,
indent
,
"Pointer"
,
local_var_prefix
,
phase
,
var
,
start_offset
-
(
type
->
size_is
?
4
:
2
));
else
print_phase_function
(
file
,
indent
,
"ConformantString"
,
phase
,
var
,
start_offset
);
print_phase_function
(
file
,
indent
,
"ConformantString"
,
local_var_prefix
,
phase
,
var
,
start_offset
);
}
}
else
if
(
is_array
(
type
))
...
...
@@ -2978,7 +2979,7 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
}
if
(
pointer_type
!=
RPC_FC_RP
)
array_type
=
"Pointer"
;
print_phase_function
(
file
,
indent
,
array_type
,
phase
,
var
,
start_offset
);
print_phase_function
(
file
,
indent
,
array_type
,
local_var_prefix
,
phase
,
var
,
start_offset
);
if
(
phase
==
PHASE_FREE
&&
pointer_type
==
RPC_FC_RP
)
{
/* these are all unmarshalled by allocating memory */
...
...
@@ -2987,16 +2988,16 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
((
type
->
type
==
RPC_FC_SMVARRAY
||
type
->
type
==
RPC_FC_LGVARRAY
)
&&
in_attr
)
||
(
type
->
type
==
RPC_FC_CARRAY
&&
!
in_attr
))
{
print_file
(
file
,
indent
,
"if (%s
)
\n
"
,
var
->
name
);
print_file
(
file
,
indent
,
"if (%s
%s)
\n
"
,
local_var_prefix
,
var
->
name
);
indent
++
;
print_file
(
file
,
indent
,
"__frame->_StubMsg.pfnFree(%s
);
\n
"
,
var
->
name
);
print_file
(
file
,
indent
,
"__frame->_StubMsg.pfnFree(%s
%s);
\n
"
,
local_var_prefix
,
var
->
name
);
}
}
}
else
if
(
!
is_ptr
(
var
->
type
)
&&
is_base_type
(
rtype
))
{
if
(
phase
!=
PHASE_FREE
)
print_phase_basetype
(
file
,
indent
,
phase
,
pass
,
var
,
var
->
name
);
print_phase_basetype
(
file
,
indent
,
local_var_prefix
,
phase
,
pass
,
var
,
var
->
name
);
}
else
if
(
!
is_ptr
(
var
->
type
))
{
...
...
@@ -3004,27 +3005,27 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
{
case
RPC_FC_STRUCT
:
case
RPC_FC_PSTRUCT
:
print_phase_function
(
file
,
indent
,
"SimpleStruct"
,
phase
,
var
,
start_offset
);
print_phase_function
(
file
,
indent
,
"SimpleStruct"
,
local_var_prefix
,
phase
,
var
,
start_offset
);
break
;
case
RPC_FC_CSTRUCT
:
case
RPC_FC_CPSTRUCT
:
print_phase_function
(
file
,
indent
,
"ConformantStruct"
,
phase
,
var
,
start_offset
);
print_phase_function
(
file
,
indent
,
"ConformantStruct"
,
local_var_prefix
,
phase
,
var
,
start_offset
);
break
;
case
RPC_FC_CVSTRUCT
:
print_phase_function
(
file
,
indent
,
"ConformantVaryingStruct"
,
phase
,
var
,
start_offset
);
print_phase_function
(
file
,
indent
,
"ConformantVaryingStruct"
,
local_var_prefix
,
phase
,
var
,
start_offset
);
break
;
case
RPC_FC_BOGUS_STRUCT
:
print_phase_function
(
file
,
indent
,
"ComplexStruct"
,
phase
,
var
,
start_offset
);
print_phase_function
(
file
,
indent
,
"ComplexStruct"
,
local_var_prefix
,
phase
,
var
,
start_offset
);
break
;
case
RPC_FC_RP
:
if
(
is_base_type
(
var
->
type
->
ref
->
type
))
{
print_phase_basetype
(
file
,
indent
,
phase
,
pass
,
var
,
var
->
name
);
print_phase_basetype
(
file
,
indent
,
local_var_prefix
,
phase
,
pass
,
var
,
var
->
name
);
}
else
if
(
var
->
type
->
ref
->
type
==
RPC_FC_STRUCT
)
{
if
(
phase
!=
PHASE_BUFFERSIZE
&&
phase
!=
PHASE_FREE
)
print_phase_function
(
file
,
indent
,
"SimpleStruct"
,
phase
,
var
,
start_offset
+
4
);
print_phase_function
(
file
,
indent
,
local_var_prefix
,
"SimpleStruct"
,
phase
,
var
,
start_offset
+
4
);
}
else
{
...
...
@@ -3032,10 +3033,10 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
if
((
iid
=
get_attrp
(
var
->
attrs
,
ATTR_IIDIS
)))
{
print_file
(
file
,
indent
,
"__frame->_StubMsg.MaxCount = (unsigned long) "
);
write_expr
(
file
,
iid
,
1
,
1
,
NULL
,
NULL
);
write_expr
(
file
,
iid
,
1
,
1
,
NULL
,
NULL
,
local_var_prefix
);
fprintf
(
file
,
";
\n\n
"
);
}
print_phase_function
(
file
,
indent
,
"Pointer"
,
phase
,
var
,
start_offset
);
print_phase_function
(
file
,
indent
,
"Pointer"
,
local_var_prefix
,
phase
,
var
,
start_offset
);
}
break
;
default:
...
...
@@ -3047,25 +3048,25 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
if
(
last_ptr
(
var
->
type
)
&&
(
pointer_type
==
RPC_FC_RP
)
&&
is_base_type
(
rtype
))
{
if
(
phase
!=
PHASE_FREE
)
print_phase_basetype
(
file
,
indent
,
phase
,
pass
,
var
,
var
->
name
);
print_phase_basetype
(
file
,
indent
,
local_var_prefix
,
phase
,
pass
,
var
,
var
->
name
);
}
else
if
(
last_ptr
(
var
->
type
)
&&
(
pointer_type
==
RPC_FC_RP
)
&&
(
rtype
==
RPC_FC_STRUCT
))
{
if
(
phase
!=
PHASE_BUFFERSIZE
&&
phase
!=
PHASE_FREE
)
print_phase_function
(
file
,
indent
,
"SimpleStruct"
,
phase
,
var
,
start_offset
+
4
);
print_phase_function
(
file
,
indent
,
"SimpleStruct"
,
local_var_prefix
,
phase
,
var
,
start_offset
+
4
);
}
else
{
if
(
var
->
type
->
ref
->
type
==
RPC_FC_IP
)
print_phase_function
(
file
,
indent
,
"InterfacePointer"
,
phase
,
var
,
start_offset
);
print_phase_function
(
file
,
indent
,
"InterfacePointer"
,
local_var_prefix
,
phase
,
var
,
start_offset
);
else
print_phase_function
(
file
,
indent
,
"Pointer"
,
phase
,
var
,
start_offset
);
print_phase_function
(
file
,
indent
,
"Pointer"
,
local_var_prefix
,
phase
,
var
,
start_offset
);
}
}
fprintf
(
file
,
"
\n
"
);
}
void
write_remoting_arguments
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
void
write_remoting_arguments
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
const
char
*
local_var_prefix
,
enum
pass
pass
,
enum
remoting_phase
phase
)
{
if
(
phase
==
PHASE_BUFFERSIZE
&&
pass
!=
PASS_RETURN
)
...
...
@@ -3080,7 +3081,7 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
var
=
*
func
->
def
;
var
.
type
=
get_func_return_type
(
func
);
var
.
name
=
xstrdup
(
"_RetVal"
);
write_remoting_arg
(
file
,
indent
,
func
,
pass
,
phase
,
&
var
);
write_remoting_arg
(
file
,
indent
,
func
,
local_var_prefix
,
pass
,
phase
,
&
var
);
free
(
var
.
name
);
}
else
...
...
@@ -3089,7 +3090,7 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
if
(
!
func
->
args
)
return
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
write_remoting_arg
(
file
,
indent
,
func
,
pass
,
phase
,
var
);
write_remoting_arg
(
file
,
indent
,
func
,
local_var_prefix
,
pass
,
phase
,
var
);
}
}
...
...
@@ -3196,9 +3197,9 @@ void declare_stub_args( FILE *file, int indent, const func_t *func )
write_type_decl_left
(
file
,
var
->
type
);
fprintf
(
file
,
" "
);
if
(
var
->
type
->
declarray
)
{
fprintf
(
file
,
"(*%s)"
,
get_name
(
var
)
);
fprintf
(
file
,
"(*%s)"
,
var
->
name
);
}
else
fprintf
(
file
,
"%s"
,
get_name
(
var
)
);
fprintf
(
file
,
"%s"
,
var
->
name
);
write_type_right
(
file
,
var
->
type
,
FALSE
);
fprintf
(
file
,
";
\n
"
);
...
...
@@ -3210,7 +3211,7 @@ void declare_stub_args( FILE *file, int indent, const func_t *func )
}
void
assign_stub_out_args
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
)
void
assign_stub_out_args
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
const
char
*
local_var_prefix
)
{
int
in_attr
,
out_attr
;
int
i
=
0
,
sep
=
0
;
...
...
@@ -3229,7 +3230,7 @@ void assign_stub_out_args( FILE *file, int indent, const func_t *func )
if
(
!
in_attr
)
{
print_file
(
file
,
indent
,
"%s
"
,
get_name
(
var
)
);
print_file
(
file
,
indent
,
"%s
%s"
,
local_var_prefix
,
var
->
name
);
if
(
is_context_handle
(
var
->
type
))
{
...
...
@@ -3246,7 +3247,7 @@ void assign_stub_out_args( FILE *file, int indent, const func_t *func )
fprintf
(
file
,
" = NdrAllocate(&__frame->_StubMsg, "
);
for
(
;
type
->
size_is
;
type
=
type
->
ref
)
{
write_expr
(
file
,
type
->
size_is
,
TRUE
,
TRUE
,
NULL
,
NULL
);
write_expr
(
file
,
type
->
size_is
,
TRUE
,
TRUE
,
NULL
,
NULL
,
local_var_prefix
);
fprintf
(
file
,
" * "
);
}
size
=
type_memsize
(
type
,
&
align
);
...
...
@@ -3254,9 +3255,9 @@ void assign_stub_out_args( FILE *file, int indent, const func_t *func )
}
else
if
(
!
is_string
)
{
fprintf
(
file
,
" = &
_W%u;
\n
"
,
i
);
fprintf
(
file
,
" = &
%s_W%u;
\n
"
,
local_var_prefix
,
i
);
if
(
is_ptr
(
var
->
type
)
&&
!
last_ptr
(
var
->
type
))
print_file
(
file
,
indent
,
"
_W%u = 0;
\n
"
,
i
);
print_file
(
file
,
indent
,
"
%s_W%u = 0;
\n
"
,
local_var_prefix
,
i
);
i
++
;
}
...
...
@@ -3288,7 +3289,7 @@ int write_expr_eval_routines(FILE *file, const char *iface)
name
,
var_name
,
name
,
eval
->
baseoff
);
print_file
(
file
,
1
,
"pStubMsg->Offset = 0;
\n
"
);
/* FIXME */
print_file
(
file
,
1
,
"pStubMsg->MaxCount = (unsigned long)"
);
write_expr
(
file
,
eval
->
expr
,
1
,
1
,
var_name_expr
,
eval
->
structure
);
write_expr
(
file
,
eval
->
expr
,
1
,
1
,
var_name_expr
,
eval
->
structure
,
""
);
fprintf
(
file
,
";
\n
"
);
print_file
(
file
,
0
,
"}
\n\n
"
);
callback_offset
++
;
...
...
tools/widl/typegen.h
View file @
bf011b0f
...
...
@@ -41,13 +41,15 @@ typedef int (*type_pred_t)(const type_t *);
void
write_formatstringsdecl
(
FILE
*
f
,
int
indent
,
const
statement_list_t
*
stmts
,
type_pred_t
pred
);
void
write_procformatstring
(
FILE
*
file
,
const
statement_list_t
*
stmts
,
type_pred_t
pred
);
void
write_typeformatstring
(
FILE
*
file
,
const
statement_list_t
*
stmts
,
type_pred_t
pred
);
void
print_phase_basetype
(
FILE
*
file
,
int
indent
,
enum
remoting_phase
phase
,
enum
pass
pass
,
const
var_t
*
var
,
const
char
*
varname
);
void
write_remoting_arguments
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
enum
pass
pass
,
enum
remoting_phase
phase
);
void
print_phase_basetype
(
FILE
*
file
,
int
indent
,
const
char
*
local_var_prefix
,
enum
remoting_phase
phase
,
enum
pass
pass
,
const
var_t
*
var
,
const
char
*
varname
);
void
write_remoting_arguments
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
const
char
*
local_var_prefix
,
enum
pass
pass
,
enum
remoting_phase
phase
);
size_t
get_size_procformatstring_type
(
const
char
*
name
,
const
type_t
*
type
,
const
attr_list_t
*
attrs
);
size_t
get_size_procformatstring_func
(
const
func_t
*
func
);
size_t
get_size_procformatstring
(
const
statement_list_t
*
stmts
,
type_pred_t
pred
);
size_t
get_size_typeformatstring
(
const
statement_list_t
*
stmts
,
type_pred_t
pred
);
void
assign_stub_out_args
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
);
void
assign_stub_out_args
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
const
char
*
local_var_prefix
);
void
declare_stub_args
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
);
int
write_expr_eval_routines
(
FILE
*
file
,
const
char
*
iface
);
void
write_expr_eval_routine_list
(
FILE
*
file
,
const
char
*
iface
);
...
...
@@ -56,7 +58,7 @@ void write_endpoints( FILE *f, const char *prefix, const str_list_t *list );
void
write_exceptions
(
FILE
*
file
);
size_t
type_memsize
(
const
type_t
*
t
,
unsigned
int
*
align
);
int
decl_indirect
(
const
type_t
*
t
);
void
write_parameters_init
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
);
void
write_parameters_init
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
const
char
*
local_var_prefix
);
void
print
(
FILE
*
file
,
int
indent
,
const
char
*
format
,
va_list
ap
);
int
get_padding
(
const
var_list_t
*
fields
);
int
is_user_type
(
const
type_t
*
t
);
...
...
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