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
85ed9ca3
Commit
85ed9ca3
authored
Jan 24, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Move support for stub arguments to typegen.c to make it usable for proxies too.
parent
7d659398
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
103 deletions
+106
-103
server.c
tools/widl/server.c
+2
-103
typegen.c
tools/widl/typegen.c
+102
-0
typegen.h
tools/widl/typegen.h
+2
-0
No files found.
tools/widl/server.c
View file @
85ed9ca3
...
...
@@ -76,99 +76,6 @@ static void write_parameters_init(const func_t *func)
}
static
void
declare_args
(
const
func_t
*
func
)
{
int
in_attr
,
out_attr
;
int
i
=
0
;
const
var_t
*
var
;
if
(
!
func
->
args
)
return
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
{
const
expr_t
*
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
int
has_size
=
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
);
int
is_string
=
is_attr
(
var
->
attrs
,
ATTR_STRING
);
in_attr
=
is_attr
(
var
->
attrs
,
ATTR_IN
);
out_attr
=
is_attr
(
var
->
attrs
,
ATTR_OUT
);
if
(
!
out_attr
&&
!
in_attr
)
in_attr
=
1
;
if
(
!
in_attr
&&
!
has_size
&&
!
is_string
)
{
int
indirection
;
print_server
(
""
);
write_type
(
server
,
var
->
type
,
NULL
,
var
->
tname
);
for
(
indirection
=
0
;
indirection
<
var
->
ptr_level
-
1
;
indirection
++
)
fprintf
(
server
,
"*"
);
fprintf
(
server
,
" _W%u;
\n
"
,
i
++
);
}
print_server
(
""
);
write_type
(
server
,
var
->
type
,
var
,
var
->
tname
);
fprintf
(
server
,
" "
);
write_name
(
server
,
var
);
write_array
(
server
,
var
->
array
,
0
);
fprintf
(
server
,
";
\n
"
);
}
}
static
void
assign_out_args
(
const
func_t
*
func
)
{
int
in_attr
,
out_attr
;
int
i
=
0
,
sep
=
0
;
const
var_t
*
var
;
const
expr_t
*
size_is
;
int
has_size
;
if
(
!
func
->
args
)
return
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
{
int
is_string
=
is_attr
(
var
->
attrs
,
ATTR_STRING
);
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
has_size
=
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
);
in_attr
=
is_attr
(
var
->
attrs
,
ATTR_IN
);
out_attr
=
is_attr
(
var
->
attrs
,
ATTR_OUT
);
if
(
!
out_attr
&&
!
in_attr
)
in_attr
=
1
;
if
(
!
in_attr
)
{
print_server
(
""
);
write_name
(
server
,
var
);
if
(
has_size
)
{
unsigned
int
size
;
type_t
*
type
=
var
->
type
;
fprintf
(
server
,
" = NdrAllocate(&_StubMsg, "
);
write_expr
(
server
,
size_is
,
1
);
size
=
get_type_memsize
(
type
);
fprintf
(
server
,
" * %u);
\n
"
,
size
);
}
else
if
(
!
is_string
)
{
fprintf
(
server
,
" = &_W%u;
\n
"
,
i
);
if
(
var
->
ptr_level
>
1
)
print_server
(
"_W%u = 0;
\n
"
,
i
);
i
++
;
}
sep
=
1
;
}
}
if
(
sep
)
fprintf
(
server
,
"
\n
"
);
}
static
void
write_function_stubs
(
type_t
*
iface
,
unsigned
int
*
proc_offset
,
unsigned
int
*
type_offset
)
{
char
*
implicit_handle
=
get_attrp
(
iface
->
attrs
,
ATTR_IMPLICIT_HANDLE
);
...
...
@@ -215,16 +122,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
fprintf
(
server
,
"{
\n
"
);
indent
++
;
/* declare return value '_RetVal' */
if
(
!
is_void
(
def
->
type
,
NULL
))
{
print_server
(
""
);
write_type
(
server
,
def
->
type
,
def
,
def
->
tname
);
fprintf
(
server
,
" _RetVal;
\n
"
);
}
/* Declare arguments */
declare_
args
(
func
);
declare_
stub_args
(
server
,
indent
,
func
);
print_server
(
"MIDL_STUB_MESSAGE _StubMsg;
\n
"
);
print_server
(
"RPC_STATUS _Status;
\n
"
);
...
...
@@ -291,7 +190,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
fprintf
(
server
,
"
\n
"
);
/* Assign 'out' arguments */
assign_
out_args
(
func
);
assign_
stub_out_args
(
server
,
indent
,
func
);
/* Call the real server function */
if
(
!
is_void
(
def
->
type
,
NULL
))
...
...
tools/widl/typegen.c
View file @
85ed9ca3
...
...
@@ -2099,6 +2099,108 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
}
}
void
declare_stub_args
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
)
{
int
in_attr
,
out_attr
;
int
i
=
0
;
const
var_t
*
def
=
func
->
def
;
const
var_t
*
var
;
/* declare return value '_RetVal' */
if
(
!
is_void
(
def
->
type
,
NULL
))
{
print_file
(
file
,
indent
,
""
);
write_type
(
file
,
def
->
type
,
def
,
def
->
tname
);
fprintf
(
file
,
" _RetVal;
\n
"
);
}
if
(
!
func
->
args
)
return
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
{
const
expr_t
*
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
int
has_size
=
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
);
int
is_string
=
is_attr
(
var
->
attrs
,
ATTR_STRING
);
in_attr
=
is_attr
(
var
->
attrs
,
ATTR_IN
);
out_attr
=
is_attr
(
var
->
attrs
,
ATTR_OUT
);
if
(
!
out_attr
&&
!
in_attr
)
in_attr
=
1
;
if
(
!
in_attr
&&
!
has_size
&&
!
is_string
)
{
int
indirection
;
print_file
(
file
,
indent
,
""
);
write_type
(
file
,
var
->
type
,
NULL
,
var
->
tname
);
for
(
indirection
=
0
;
indirection
<
var
->
ptr_level
-
1
;
indirection
++
)
fprintf
(
file
,
"*"
);
fprintf
(
file
,
" _W%u;
\n
"
,
i
++
);
}
print_file
(
file
,
indent
,
""
);
write_type
(
file
,
var
->
type
,
var
,
var
->
tname
);
fprintf
(
file
,
" "
);
write_name
(
file
,
var
);
write_array
(
file
,
var
->
array
,
0
);
fprintf
(
file
,
";
\n
"
);
}
}
void
assign_stub_out_args
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
)
{
int
in_attr
,
out_attr
;
int
i
=
0
,
sep
=
0
;
const
var_t
*
var
;
const
expr_t
*
size_is
;
int
has_size
;
if
(
!
func
->
args
)
return
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
{
int
is_string
=
is_attr
(
var
->
attrs
,
ATTR_STRING
);
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
has_size
=
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
);
in_attr
=
is_attr
(
var
->
attrs
,
ATTR_IN
);
out_attr
=
is_attr
(
var
->
attrs
,
ATTR_OUT
);
if
(
!
out_attr
&&
!
in_attr
)
in_attr
=
1
;
if
(
!
in_attr
)
{
print_file
(
file
,
indent
,
""
);
write_name
(
file
,
var
);
if
(
has_size
)
{
unsigned
int
size
;
type_t
*
type
=
var
->
type
;
fprintf
(
file
,
" = NdrAllocate(&_StubMsg, "
);
write_expr
(
file
,
size_is
,
1
);
size
=
get_type_memsize
(
type
);
fprintf
(
file
,
" * %u);
\n
"
,
size
);
}
else
if
(
!
is_string
)
{
fprintf
(
file
,
" = &_W%u;
\n
"
,
i
);
if
(
var
->
ptr_level
>
1
)
print_file
(
file
,
indent
,
"_W%u = 0;
\n
"
,
i
);
i
++
;
}
sep
=
1
;
}
}
if
(
sep
)
fprintf
(
file
,
"
\n
"
);
}
int
write_expr_eval_routines
(
FILE
*
file
,
const
char
*
iface
)
{
int
result
=
0
;
...
...
tools/widl/typegen.h
View file @
85ed9ca3
...
...
@@ -46,5 +46,7 @@ size_t get_size_procformatstring_var(const var_t *var);
size_t
get_size_typeformatstring_var
(
const
var_t
*
var
);
size_t
get_size_procformatstring
(
const
ifref_list_t
*
ifaces
,
int
for_objects
);
size_t
get_size_typeformatstring
(
const
ifref_list_t
*
ifaces
,
int
for_objects
);
void
assign_stub_out_args
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
);
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
);
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