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
aa2bd521
Commit
aa2bd521
authored
Aug 15, 2019
by
Richard Pospesel
Committed by
Alexandre Julliard
Aug 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Pass a decl_spec_t to write_type_v().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d0e10aa3
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
37 deletions
+50
-37
client.c
tools/widl/client.c
+2
-2
expr.c
tools/widl/expr.c
+2
-2
header.c
tools/widl/header.c
+13
-13
header.h
tools/widl/header.h
+1
-1
proxy.c
tools/widl/proxy.c
+1
-1
server.c
tools/widl/server.c
+1
-1
typegen.c
tools/widl/typegen.c
+19
-17
typetree.h
tools/widl/typetree.h
+11
-0
No files found.
tools/widl/client.c
View file @
aa2bd521
...
...
@@ -136,7 +136,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
if
(
has_ret
)
{
print_client
(
"%s"
,
""
);
write_type_decl
(
client
,
retval
->
declspec
.
type
,
retval
->
name
);
write_type_decl
(
client
,
&
retval
->
declspec
,
retval
->
name
);
fprintf
(
client
,
";
\n
"
);
}
print_client
(
"RPC_MESSAGE _RpcMessage;
\n
"
);
...
...
@@ -488,7 +488,7 @@ static void write_implicithandledecl(type_t *iface)
if
(
implicit_handle
)
{
write_type_decl
(
client
,
implicit_handle
->
declspec
.
type
,
implicit_handle
->
name
);
write_type_decl
(
client
,
&
implicit_handle
->
declspec
,
implicit_handle
->
name
);
fprintf
(
client
,
";
\n\n
"
);
}
}
...
...
tools/widl/expr.c
View file @
aa2bd521
...
...
@@ -759,13 +759,13 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
break
;
case
EXPR_CAST
:
fprintf
(
h
,
"("
);
write_type_decl
(
h
,
e
->
u
.
tref
.
type
,
NULL
);
write_type_decl
(
h
,
&
e
->
u
.
tref
,
NULL
);
fprintf
(
h
,
")"
);
write_expr
(
h
,
e
->
ref
,
1
,
toplevel
,
toplevel_prefix
,
cont_type
,
local_var_prefix
);
break
;
case
EXPR_SIZEOF
:
fprintf
(
h
,
"sizeof("
);
write_type_decl
(
h
,
e
->
u
.
tref
.
type
,
NULL
);
write_type_decl
(
h
,
&
e
->
u
.
tref
,
NULL
);
fprintf
(
h
,
")"
);
break
;
case
EXPR_SHL
:
...
...
tools/widl/header.c
View file @
aa2bd521
...
...
@@ -43,7 +43,7 @@ user_type_list_t user_type_list = LIST_INIT(user_type_list);
context_handle_list_t
context_handle_list
=
LIST_INIT
(
context_handle_list
);
generic_handle_list_t
generic_handle_list
=
LIST_INIT
(
generic_handle_list
);
static
void
write_type_def_or_decl
(
FILE
*
f
,
type
_t
*
t
,
int
field
,
const
char
*
name
);
static
void
write_type_def_or_decl
(
FILE
*
f
,
const
decl_spec
_t
*
t
,
int
field
,
const
char
*
name
);
static
void
indent
(
FILE
*
h
,
int
delta
)
{
...
...
@@ -252,7 +252,7 @@ static void write_fields(FILE *h, var_list_t *fields)
default:
;
}
write_type_def_or_decl
(
h
,
v
->
declspec
.
type
,
TRUE
,
name
);
write_type_def_or_decl
(
h
,
&
v
->
declspec
,
TRUE
,
name
);
fprintf
(
h
,
";
\n
"
);
}
}
...
...
@@ -485,9 +485,9 @@ void write_type_right(FILE *h, type_t *t, int is_field)
}
}
static
void
write_type_v
(
FILE
*
h
,
type_t
*
t
,
int
is_field
,
int
declonly
,
const
char
*
name
)
static
void
write_type_v
(
FILE
*
h
,
const
decl_spec_t
*
ds
,
int
is_field
,
int
declonly
,
const
char
*
name
)
{
type_t
*
pt
=
NULL
;
type_t
*
t
=
ds
->
type
,
*
pt
=
NULL
;
int
ptr_level
=
0
;
if
(
!
h
)
return
;
...
...
@@ -529,7 +529,7 @@ static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const c
}
}
static
void
write_type_def_or_decl
(
FILE
*
f
,
type
_t
*
t
,
int
field
,
const
char
*
name
)
static
void
write_type_def_or_decl
(
FILE
*
f
,
const
decl_spec
_t
*
t
,
int
field
,
const
char
*
name
)
{
write_type_v
(
f
,
t
,
field
,
FALSE
,
name
);
}
...
...
@@ -558,7 +558,7 @@ static void write_type_definition(FILE *f, type_t *t)
}
}
void
write_type_decl
(
FILE
*
f
,
type
_t
*
t
,
const
char
*
name
)
void
write_type_decl
(
FILE
*
f
,
const
decl_spec
_t
*
t
,
const
char
*
name
)
{
write_type_v
(
f
,
t
,
FALSE
,
TRUE
,
name
);
}
...
...
@@ -789,7 +789,7 @@ static void write_generic_handle_routines(FILE *header)
static
void
write_typedef
(
FILE
*
header
,
type_t
*
type
)
{
fprintf
(
header
,
"typedef "
);
write_type_def_or_decl
(
header
,
type_alias_get_aliasee
_type
(
type
),
FALSE
,
type
->
name
);
write_type_def_or_decl
(
header
,
type_alias_get_aliasee
(
type
),
FALSE
,
type
->
name
);
fprintf
(
header
,
";
\n
"
);
}
...
...
@@ -833,7 +833,7 @@ static void write_declaration(FILE *header, const var_t *v)
fprintf
(
header
,
"extern "
);
break
;
}
write_type_def_or_decl
(
header
,
v
->
declspec
.
type
,
FALSE
,
v
->
name
);
write_type_def_or_decl
(
header
,
&
v
->
declspec
,
FALSE
,
v
->
name
);
fprintf
(
header
,
";
\n\n
"
);
}
}
...
...
@@ -1073,7 +1073,7 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
}
else
fprintf
(
h
,
","
);
}
write_type_decl
(
h
,
arg
->
declspec
.
type
,
arg
->
name
);
write_type_decl
(
h
,
&
arg
->
declspec
,
arg
->
name
);
if
(
method
==
2
)
{
const
expr_t
*
expr
=
get_attrp
(
arg
->
attrs
,
ATTR_DEFAULTVALUE
);
if
(
expr
)
{
...
...
@@ -1337,12 +1337,12 @@ static void write_locals(FILE *fp, const type_t *iface, int body)
write_args
(
fp
,
type_function_get_args
(
m
->
declspec
.
type
),
iface
->
name
,
1
,
TRUE
);
fprintf
(
fp
,
")"
);
if
(
body
)
{
type_t
*
rt
=
type_function_get_rettype
(
m
->
declspec
.
type
);
const
decl_spec_t
*
rt
=
type_function_get_ret
(
m
->
declspec
.
type
);
fprintf
(
fp
,
"
\n
{
\n
"
);
fprintf
(
fp
,
" %s
\n
"
,
comment
);
if
(
rt
->
name
&&
strcmp
(
rt
->
name
,
"HRESULT"
)
==
0
)
if
(
rt
->
type
->
name
&&
strcmp
(
rt
->
type
->
name
,
"HRESULT"
)
==
0
)
fprintf
(
fp
,
" return E_NOTIMPL;
\n
"
);
else
if
(
type_get_type
(
rt
)
!=
TYPE_VOID
)
{
else
if
(
type_get_type
(
rt
->
type
)
!=
TYPE_VOID
)
{
fprintf
(
fp
,
" "
);
write_type_decl
(
fp
,
rt
,
"rv"
);
fprintf
(
fp
,
";
\n
"
);
...
...
@@ -1536,7 +1536,7 @@ static void write_rpc_interface_start(FILE *header, const type_t *iface)
if
(
var
)
{
fprintf
(
header
,
"extern "
);
write_type_decl
(
header
,
var
->
declspec
.
type
,
var
->
name
);
write_type_decl
(
header
,
&
var
->
declspec
,
var
->
name
);
fprintf
(
header
,
";
\n
"
);
}
if
(
old_names
)
...
...
tools/widl/header.h
View file @
aa2bd521
...
...
@@ -31,7 +31,7 @@ extern unsigned int get_attrv(const attr_list_t *list, enum attr_type t);
extern
const
char
*
get_name
(
const
var_t
*
v
);
extern
void
write_type_left
(
FILE
*
h
,
type_t
*
t
,
enum
name_type
name_type
,
int
declonly
);
extern
void
write_type_right
(
FILE
*
h
,
type_t
*
t
,
int
is_field
);
extern
void
write_type_decl
(
FILE
*
f
,
type
_t
*
t
,
const
char
*
name
);
extern
void
write_type_decl
(
FILE
*
f
,
const
decl_spec
_t
*
t
,
const
char
*
name
);
extern
void
write_type_decl_left
(
FILE
*
f
,
type_t
*
t
);
extern
unsigned
int
get_context_handle_offset
(
const
type_t
*
type
);
extern
unsigned
int
get_generic_handle_offset
(
const
type_t
*
type
);
...
...
tools/widl/proxy.c
View file @
aa2bd521
...
...
@@ -229,7 +229,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
/* local variables */
if
(
has_ret
)
{
print_proxy
(
"%s"
,
""
);
write_type_decl
(
proxy
,
retval
->
declspec
.
type
,
retval
->
name
);
write_type_decl
(
proxy
,
&
retval
->
declspec
,
retval
->
name
);
fprintf
(
proxy
,
";
\n
"
);
}
print_proxy
(
"RPC_MESSAGE _RpcMessage;
\n
"
);
...
...
tools/widl/server.c
View file @
aa2bd521
...
...
@@ -159,7 +159,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
{
print_server
(
"__frame->_RetVal = NDRSContextUnmarshall((char*)0, _pRpcMessage->DataRepresentation);
\n
"
);
print_server
(
"*(("
);
write_type_decl
(
server
,
ret_type
,
NULL
);
write_type_decl
(
server
,
type_function_get_ret
(
func
->
declspec
.
type
)
,
NULL
);
fprintf
(
server
,
"*)NDRSContextValue(__frame->_RetVal)) = "
);
}
else
...
...
tools/widl/typegen.c
View file @
aa2bd521
...
...
@@ -2217,8 +2217,9 @@ static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs,
static
void
print_start_tfs_comment
(
FILE
*
file
,
type_t
*
t
,
unsigned
int
tfsoff
)
{
const
decl_spec_t
ds
=
{.
type
=
t
};
print_file
(
file
,
0
,
"/* %u ("
,
tfsoff
);
write_type_decl
(
file
,
t
,
NULL
);
write_type_decl
(
file
,
&
ds
,
NULL
);
print_file
(
file
,
0
,
") */
\n
"
);
}
...
...
@@ -4006,8 +4007,9 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
}
else
{
const
type_t
*
ref
=
is_ptr
(
type
)
?
type_pointer_get_ref_type
(
type
)
:
type
;
switch
(
get_basic_fc
(
ref
))
const
decl_spec_t
*
ref
=
is_ptr
(
type
)
?
type_pointer_get_ref
(
type
)
:
&
var
->
declspec
;
switch
(
get_basic_fc
(
ref
->
type
))
{
case
FC_BYTE
:
case
FC_CHAR
:
...
...
@@ -4044,7 +4046,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
default:
error
(
"print_phase_basetype: Unsupported type: %s (0x%02x, ptr_level: 0)
\n
"
,
var
->
name
,
get_basic_fc
(
ref
));
var
->
name
,
get_basic_fc
(
ref
->
type
));
}
if
(
phase
==
PHASE_MARSHAL
&&
alignment
>
1
)
...
...
@@ -4055,7 +4057,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
if
(
phase
==
PHASE_MARSHAL
)
{
print_file
(
file
,
indent
,
"*("
);
write_type_decl
(
file
,
is_ptr
(
type
)
?
type_pointer_get_ref_type
(
type
)
:
type
,
NULL
);
write_type_decl
(
file
,
ref
,
NULL
);
if
(
is_ptr
(
type
))
fprintf
(
file
,
" *)__frame->_StubMsg.Buffer = *"
);
else
...
...
@@ -4066,7 +4068,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
else
if
(
phase
==
PHASE_UNMARSHAL
)
{
print_file
(
file
,
indent
,
"if (__frame->_StubMsg.Buffer + sizeof("
);
write_type_decl
(
file
,
is_ptr
(
type
)
?
type_pointer_get_ref_type
(
type
)
:
type
,
NULL
);
write_type_decl
(
file
,
ref
,
NULL
);
fprintf
(
file
,
") > __frame->_StubMsg.BufferEnd)
\n
"
);
print_file
(
file
,
indent
,
"{
\n
"
);
print_file
(
file
,
indent
+
1
,
"RpcRaiseException(RPC_X_BAD_STUB_DATA);
\n
"
);
...
...
@@ -4078,12 +4080,12 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
fprintf
(
file
,
" = ("
);
else
fprintf
(
file
,
" = *("
);
write_type_decl
(
file
,
is_ptr
(
type
)
?
type_pointer_get_ref_type
(
type
)
:
type
,
NULL
);
write_type_decl
(
file
,
ref
,
NULL
);
fprintf
(
file
,
" *)__frame->_StubMsg.Buffer;
\n
"
);
}
print_file
(
file
,
indent
,
"__frame->_StubMsg.Buffer += sizeof("
);
write_type_decl
(
file
,
is_ptr
(
type
)
?
type_pointer_get_ref_type
(
type
)
:
type
,
NULL
);
write_type_decl
(
file
,
ref
,
NULL
);
fprintf
(
file
,
");
\n
"
);
}
}
...
...
@@ -4388,9 +4390,9 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
range_max
=
LIST_ENTRY
(
list_next
(
range_list
,
list_head
(
range_list
)),
const
expr_t
,
entry
);
print_file
(
file
,
indent
,
"if ((%s%s < ("
,
local_var_prefix
,
var
->
name
);
write_type_decl
(
file
,
var
->
declspec
.
type
,
NULL
);
write_type_decl
(
file
,
&
var
->
declspec
,
NULL
);
fprintf
(
file
,
")0x%x) || (%s%s > ("
,
range_min
->
cval
,
local_var_prefix
,
var
->
name
);
write_type_decl
(
file
,
var
->
declspec
.
type
,
NULL
);
write_type_decl
(
file
,
&
var
->
declspec
,
NULL
);
fprintf
(
file
,
")0x%x))
\n
"
,
range_max
->
cval
);
print_file
(
file
,
indent
,
"{
\n
"
);
print_file
(
file
,
indent
+
1
,
"RpcRaiseException(RPC_S_INVALID_BOUND);
\n
"
);
...
...
@@ -4605,7 +4607,7 @@ void declare_stub_args( FILE *file, int indent, const var_t *func )
{
int
in_attr
,
out_attr
;
int
i
=
0
;
const
var_t
*
var
=
type_function_get_retval
(
func
->
declspec
.
type
);
var_t
*
var
=
type_function_get_retval
(
func
->
declspec
.
type
);
/* declare return value */
if
(
!
is_void
(
var
->
declspec
.
type
))
...
...
@@ -4615,7 +4617,7 @@ void declare_stub_args( FILE *file, int indent, const var_t *func )
else
{
print_file
(
file
,
indent
,
"%s"
,
""
);
write_type_decl
(
file
,
var
->
declspec
.
type
,
var
->
name
);
write_type_decl
(
file
,
&
var
->
declspec
,
var
->
name
);
fprintf
(
file
,
";
\n
"
);
}
}
...
...
@@ -4623,7 +4625,7 @@ void declare_stub_args( FILE *file, int indent, const var_t *func )
if
(
!
type_function_get_args
(
func
->
declspec
.
type
))
return
;
LIST_FOR_EACH_ENTRY
(
var
,
type_function_get_args
(
func
->
declspec
.
type
),
const
var_t
,
entry
)
LIST_FOR_EACH_ENTRY
(
var
,
type_function_get_args
(
func
->
declspec
.
type
),
var_t
,
entry
)
{
in_attr
=
is_attr
(
var
->
attrs
,
ATTR_IN
);
out_attr
=
is_attr
(
var
->
attrs
,
ATTR_OUT
);
...
...
@@ -4636,14 +4638,14 @@ void declare_stub_args( FILE *file, int indent, const var_t *func )
{
if
(
!
in_attr
&&
!
is_conformant_array
(
var
->
declspec
.
type
))
{
type
_t
*
type_to_print
;
const
decl_spec
_t
*
type_to_print
;
char
name
[
16
];
print_file
(
file
,
indent
,
"%s"
,
""
);
if
(
type_get_type
(
var
->
declspec
.
type
)
==
TYPE_ARRAY
&&
!
type_array_is_decl_as_ptr
(
var
->
declspec
.
type
))
type_to_print
=
var
->
declspec
.
type
;
type_to_print
=
&
var
->
declspec
;
else
type_to_print
=
type_pointer_get_ref
_type
(
var
->
declspec
.
type
);
type_to_print
=
type_pointer_get_ref
(
var
->
declspec
.
type
);
sprintf
(
name
,
"_W%u"
,
i
++
);
write_type_decl
(
file
,
type_to_print
,
name
);
fprintf
(
file
,
";
\n
"
);
...
...
@@ -4820,7 +4822,7 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
if
(
add_retval
&&
!
is_void
(
retval
->
declspec
.
type
))
{
print_file
(
file
,
2
,
"%s"
,
""
);
write_type_decl
(
file
,
retval
->
declspec
.
type
,
retval
->
name
);
write_type_decl
(
file
,
&
retval
->
declspec
,
retval
->
name
);
if
(
is_array
(
retval
->
declspec
.
type
)
||
is_ptr
(
retval
->
declspec
.
type
)
||
type_memsize
(
retval
->
declspec
.
type
)
==
pointer_size
)
fprintf
(
file
,
";
\n
"
);
...
...
tools/widl/typetree.h
View file @
aa2bd521
...
...
@@ -105,6 +105,11 @@ static inline var_t *type_function_get_retval(const type_t *type)
return
type
->
details
.
function
->
retval
;
}
static
inline
const
decl_spec_t
*
type_function_get_ret
(
const
type_t
*
type
)
{
return
&
type_function_get_retval
(
type
)
->
declspec
;
}
static
inline
type_t
*
type_function_get_rettype
(
const
type_t
*
type
)
{
return
type_function_get_retval
(
type
)
->
declspec
.
type
;
...
...
@@ -302,6 +307,12 @@ static inline int type_is_alias(const type_t *type)
return
type
->
type_type
==
TYPE_ALIAS
;
}
static
inline
const
decl_spec_t
*
type_alias_get_aliasee
(
const
type_t
*
type
)
{
assert
(
type_is_alias
(
type
));
return
&
type
->
details
.
alias
.
aliasee
;
}
static
inline
type_t
*
type_alias_get_aliasee_type
(
const
type_t
*
type
)
{
assert
(
type_is_alias
(
type
));
...
...
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