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
32a2477e
Commit
32a2477e
authored
Oct 02, 2007
by
Dan Hipschman
Committed by
Alexandre Julliard
Oct 03, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Add a declonly argument to write_type_left.
parent
4c8c425f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
42 deletions
+63
-42
client.c
tools/widl/client.c
+2
-2
header.c
tools/widl/header.c
+43
-24
header.h
tools/widl/header.h
+4
-2
parser.y
tools/widl/parser.y
+3
-3
proxy.c
tools/widl/proxy.c
+2
-2
server.c
tools/widl/server.c
+1
-1
typegen.c
tools/widl/typegen.c
+8
-8
No files found.
tools/widl/client.c
View file @
32a2477e
...
...
@@ -109,7 +109,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
}
}
write_type_left
(
client
,
def
->
type
);
write_type_
decl_
left
(
client
,
def
->
type
);
if
(
needs_space_after
(
def
->
type
))
fprintf
(
client
,
" "
);
write_prefix_name
(
client
,
prefix_client
,
def
);
...
...
@@ -130,7 +130,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
if
(
!
is_void
(
def
->
type
))
{
print_client
(
""
);
write_type_left
(
client
,
def
->
type
);
write_type_
decl_
left
(
client
,
def
->
type
);
fprintf
(
client
,
" _RetVal;
\n
"
);
}
...
...
tools/widl/header.c
View file @
32a2477e
...
...
@@ -156,7 +156,7 @@ static void write_field(FILE *h, var_t *v)
}
}
indent
(
h
,
0
);
write_type
(
h
,
v
->
type
,
TRUE
,
"%s"
,
name
);
write_type
_def_or_decl
(
h
,
v
->
type
,
TRUE
,
"%s"
,
name
);
fprintf
(
h
,
";
\n
"
);
}
}
...
...
@@ -193,19 +193,19 @@ int needs_space_after(type_t *t)
||
(
!
is_ptr
(
t
)
&&
(
!
is_conformant_array
(
t
)
||
t
->
declarray
)));
}
void
write_type_left
(
FILE
*
h
,
type_t
*
t
)
void
write_type_left
(
FILE
*
h
,
type_t
*
t
,
int
declonly
)
{
if
(
t
->
is_const
)
fprintf
(
h
,
"const "
);
if
(
t
->
kind
==
TKIND_ALIAS
)
fprintf
(
h
,
"%s"
,
t
->
name
);
else
if
(
t
->
declarray
)
write_type_left
(
h
,
t
->
ref
);
else
if
(
t
->
declarray
)
write_type_left
(
h
,
t
->
ref
,
declonly
);
else
{
if
(
t
->
sign
>
0
)
fprintf
(
h
,
"signed "
);
else
if
(
t
->
sign
<
0
)
fprintf
(
h
,
"unsigned "
);
switch
(
t
->
type
)
{
case
RPC_FC_ENUM16
:
case
RPC_FC_ENUM32
:
if
(
t
->
defined
&&
!
t
->
written
&&
!
t
->
ignore
)
{
if
(
!
declonly
&&
t
->
defined
&&
!
t
->
written
&&
!
t
->
ignore
)
{
if
(
t
->
name
)
fprintf
(
h
,
"enum %s {
\n
"
,
t
->
name
);
else
fprintf
(
h
,
"enum {
\n
"
);
t
->
written
=
TRUE
;
...
...
@@ -223,7 +223,7 @@ void write_type_left(FILE *h, type_t *t)
case
RPC_FC_PSTRUCT
:
case
RPC_FC_BOGUS_STRUCT
:
case
RPC_FC_ENCAPSULATED_UNION
:
if
(
t
->
defined
&&
!
t
->
written
&&
!
t
->
ignore
)
{
if
(
!
declonly
&&
t
->
defined
&&
!
t
->
written
&&
!
t
->
ignore
)
{
if
(
t
->
name
)
fprintf
(
h
,
"struct %s {
\n
"
,
t
->
name
);
else
fprintf
(
h
,
"struct {
\n
"
);
t
->
written
=
TRUE
;
...
...
@@ -235,7 +235,7 @@ void write_type_left(FILE *h, type_t *t)
else
fprintf
(
h
,
"struct %s"
,
t
->
name
);
break
;
case
RPC_FC_NON_ENCAPSULATED_UNION
:
if
(
t
->
defined
&&
!
t
->
written
&&
!
t
->
ignore
)
{
if
(
!
declonly
&&
t
->
defined
&&
!
t
->
written
&&
!
t
->
ignore
)
{
if
(
t
->
name
)
fprintf
(
h
,
"union %s {
\n
"
,
t
->
name
);
else
fprintf
(
h
,
"union {
\n
"
);
t
->
written
=
TRUE
;
...
...
@@ -253,7 +253,7 @@ void write_type_left(FILE *h, type_t *t)
case
RPC_FC_CARRAY
:
case
RPC_FC_CVARRAY
:
case
RPC_FC_BOGUS_ARRAY
:
write_type_left
(
h
,
t
->
ref
);
write_type_left
(
h
,
t
->
ref
,
declonly
);
fprintf
(
h
,
"%s*"
,
needs_space_after
(
t
->
ref
)
?
" "
:
""
);
break
;
default:
...
...
@@ -274,20 +274,39 @@ void write_type_right(FILE *h, type_t *t, int is_field)
}
}
void
write_type
(
FILE
*
h
,
type_t
*
t
,
int
is_field
,
const
char
*
fmt
,
...)
void
write_type_v
(
FILE
*
h
,
type_t
*
t
,
int
is_field
,
int
declonly
,
const
char
*
fmt
,
va_list
args
)
{
write_type_left
(
h
,
t
);
write_type_left
(
h
,
t
,
declonly
);
if
(
fmt
)
{
va_list
args
;
va_start
(
args
,
fmt
);
if
(
needs_space_after
(
t
))
fprintf
(
h
,
" "
);
vfprintf
(
h
,
fmt
,
args
);
va_end
(
args
);
}
write_type_right
(
h
,
t
,
is_field
);
}
void
write_type_def_or_decl
(
FILE
*
f
,
type_t
*
t
,
int
field
,
const
char
*
fmt
,
...)
{
va_list
args
;
va_start
(
args
,
fmt
);
write_type_v
(
f
,
t
,
field
,
FALSE
,
fmt
,
args
);
va_end
(
args
);
}
void
write_type_decl
(
FILE
*
f
,
type_t
*
t
,
const
char
*
fmt
,
...)
{
va_list
args
;
va_start
(
args
,
fmt
);
write_type_v
(
f
,
t
,
FALSE
,
TRUE
,
fmt
,
args
);
va_end
(
args
);
}
void
write_type_decl_left
(
FILE
*
f
,
type_t
*
t
)
{
write_type_left
(
f
,
t
,
TRUE
);
}
static
int
user_type_registered
(
const
char
*
name
)
{
user_type_t
*
ut
;
...
...
@@ -373,7 +392,7 @@ void write_context_handle_rundowns(void)
void
write_typedef
(
type_t
*
type
)
{
fprintf
(
header
,
"typedef "
);
write_type
(
header
,
type
->
orig
,
FALSE
,
"%s"
,
type
->
name
);
write_type
_def_or_decl
(
header
,
type
->
orig
,
FALSE
,
"%s"
,
type
->
name
);
fprintf
(
header
,
";
\n
"
);
}
...
...
@@ -414,13 +433,13 @@ void write_expr(FILE *h, const expr_t *e, int brackets)
break
;
case
EXPR_CAST
:
fprintf
(
h
,
"("
);
write_type
(
h
,
e
->
u
.
tref
,
FALSE
,
NULL
);
write_type
_decl
(
h
,
e
->
u
.
tref
,
NULL
);
fprintf
(
h
,
")"
);
write_expr
(
h
,
e
->
ref
,
1
);
break
;
case
EXPR_SIZEOF
:
fprintf
(
h
,
"sizeof("
);
write_type
(
h
,
e
->
u
.
tref
,
FALSE
,
NULL
);
write_type
_decl
(
h
,
e
->
u
.
tref
,
NULL
);
fprintf
(
h
,
")"
);
break
;
case
EXPR_SHL
:
...
...
@@ -469,7 +488,7 @@ void write_constdef(const var_t *v)
void
write_externdef
(
const
var_t
*
v
)
{
fprintf
(
header
,
"extern const "
);
write_type
(
header
,
v
->
type
,
FALSE
,
"%s"
,
v
->
name
);
write_type
_def_or_decl
(
header
,
v
->
type
,
FALSE
,
"%s"
,
v
->
name
);
fprintf
(
header
,
";
\n\n
"
);
}
...
...
@@ -595,7 +614,7 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
}
if
(
arg
->
args
)
{
write_type_left
(
h
,
arg
->
type
);
write_type_
decl_
left
(
h
,
arg
->
type
);
fprintf
(
h
,
" (STDMETHODCALLTYPE *"
);
write_name
(
h
,
arg
);
fprintf
(
h
,
")("
);
...
...
@@ -603,7 +622,7 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
fprintf
(
h
,
")"
);
}
else
write_type
(
h
,
arg
->
type
,
FALSE
,
"%s"
,
arg
->
name
);
write_type
_decl
(
h
,
arg
->
type
,
"%s"
,
arg
->
name
);
count
++
;
}
if
(
do_indent
)
indentation
--
;
...
...
@@ -621,7 +640,7 @@ static void write_cpp_method_def(const type_t *iface)
if
(
!
is_callas
(
def
->
attrs
))
{
indent
(
header
,
0
);
fprintf
(
header
,
"virtual "
);
write_type_left
(
header
,
def
->
type
);
write_type_
decl_
left
(
header
,
def
->
type
);
fprintf
(
header
,
" STDMETHODCALLTYPE "
);
write_name
(
header
,
def
);
fprintf
(
header
,
"(
\n
"
);
...
...
@@ -646,7 +665,7 @@ static void do_write_c_method_def(const type_t *iface, const char *name)
const
var_t
*
def
=
cur
->
def
;
if
(
!
is_callas
(
def
->
attrs
))
{
indent
(
header
,
0
);
write_type_left
(
header
,
def
->
type
);
write_type_
decl_
left
(
header
,
def
->
type
);
fprintf
(
header
,
" (STDMETHODCALLTYPE *"
);
write_name
(
header
,
def
);
fprintf
(
header
,
")(
\n
"
);
...
...
@@ -679,7 +698,7 @@ static void write_method_proto(const type_t *iface)
if
(
!
is_local
(
def
->
attrs
))
{
/* proxy prototype */
write_type_left
(
header
,
def
->
type
);
write_type_
decl_
left
(
header
,
def
->
type
);
fprintf
(
header
,
" CALLBACK %s_"
,
iface
->
name
);
write_name
(
header
,
def
);
fprintf
(
header
,
"_Proxy(
\n
"
);
...
...
@@ -701,14 +720,14 @@ static void write_method_proto(const type_t *iface)
if
(
&
m
->
entry
!=
iface
->
funcs
)
{
const
var_t
*
mdef
=
m
->
def
;
/* proxy prototype - use local prototype */
write_type_left
(
header
,
mdef
->
type
);
write_type_
decl_
left
(
header
,
mdef
->
type
);
fprintf
(
header
,
" CALLBACK %s_"
,
iface
->
name
);
write_name
(
header
,
mdef
);
fprintf
(
header
,
"_Proxy(
\n
"
);
write_args
(
header
,
m
->
args
,
iface
->
name
,
1
,
TRUE
);
fprintf
(
header
,
");
\n
"
);
/* stub prototype - use remotable prototype */
write_type_left
(
header
,
def
->
type
);
write_type_
decl_
left
(
header
,
def
->
type
);
fprintf
(
header
,
" __RPC_STUB %s_"
,
iface
->
name
);
write_name
(
header
,
mdef
);
fprintf
(
header
,
"_Stub(
\n
"
);
...
...
@@ -727,7 +746,7 @@ static void write_function_proto(const type_t *iface, const func_t *fun, const c
var_t
*
def
=
fun
->
def
;
/* FIXME: do we need to handle call_as? */
write_type_left
(
header
,
def
->
type
);
write_type_
decl_
left
(
header
,
def
->
type
);
fprintf
(
header
,
" "
);
write_prefix_name
(
header
,
prefix
,
def
);
fprintf
(
header
,
"(
\n
"
);
...
...
tools/widl/header.h
View file @
32a2477e
...
...
@@ -32,9 +32,11 @@ extern int is_conformant_array(const type_t *t);
extern
void
write_name
(
FILE
*
h
,
const
var_t
*
v
);
extern
void
write_prefix_name
(
FILE
*
h
,
const
char
*
prefix
,
const
var_t
*
v
);
extern
const
char
*
get_name
(
const
var_t
*
v
);
extern
void
write_type_left
(
FILE
*
h
,
type_t
*
t
);
extern
void
write_type_left
(
FILE
*
h
,
type_t
*
t
,
int
declonly
);
extern
void
write_type_right
(
FILE
*
h
,
type_t
*
t
,
int
is_field
);
extern
void
write_type
(
FILE
*
h
,
type_t
*
t
,
int
is_field
,
const
char
*
fmt
,
...);
extern
void
write_type_def_or_decl
(
FILE
*
h
,
type_t
*
t
,
int
is_field
,
const
char
*
fmt
,
...);
extern
void
write_type_decl
(
FILE
*
f
,
type_t
*
t
,
const
char
*
fmt
,
...);
extern
void
write_type_decl_left
(
FILE
*
f
,
type_t
*
t
);
extern
int
needs_space_after
(
type_t
*
t
);
extern
int
is_object
(
const
attr_list_t
*
list
);
extern
int
is_local
(
const
attr_list_t
*
list
);
...
...
tools/widl/parser.y
View file @
32a2477e
...
...
@@ -325,20 +325,20 @@ statement: ';' {}
| constdef ';' { if (!parse_only && do_header) { write_constdef($1); } }
| cppquote {}
| enumdef ';' { if (!parse_only && do_header) {
write_type(header, $1, FALSE, NULL);
write_type
_def_or_decl
(header, $1, FALSE, NULL);
fprintf(header, ";\n\n");
}
}
| externdef ';' { if (!parse_only && do_header) { write_externdef($1); } }
| import {}
| structdef ';' { if (!parse_only && do_header) {
write_type(header, $1, FALSE, NULL);
write_type
_def_or_decl
(header, $1, FALSE, NULL);
fprintf(header, ";\n\n");
}
}
| typedef ';' {}
| uniondef ';' { if (!parse_only && do_header) {
write_type(header, $1, FALSE, NULL);
write_type
_def_or_decl
(header, $1, FALSE, NULL);
fprintf(header, ";\n\n");
}
}
...
...
tools/widl/proxy.c
View file @
32a2477e
...
...
@@ -255,7 +255,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
int
has_ret
=
!
is_void
(
def
->
type
);
indent
=
0
;
write_type_left
(
proxy
,
def
->
type
);
write_type_
decl_
left
(
proxy
,
def
->
type
);
print_proxy
(
" STDMETHODCALLTYPE %s_"
,
iface
->
name
);
write_name
(
proxy
,
def
);
print_proxy
(
"_Proxy(
\n
"
);
...
...
@@ -266,7 +266,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
/* local variables */
if
(
has_ret
)
{
print_proxy
(
""
);
write_type_left
(
proxy
,
def
->
type
);
write_type_
decl_
left
(
proxy
,
def
->
type
);
print_proxy
(
" _RetVal;
\n
"
);
}
print_proxy
(
"RPC_MESSAGE _RpcMessage;
\n
"
);
...
...
tools/widl/server.c
View file @
32a2477e
...
...
@@ -187,7 +187,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
if
(
is_context_handle
(
var
->
type
))
{
print_server
(
"("
);
write_type_left
(
server
,
var
->
type
);
write_type_
decl_
left
(
server
,
var
->
type
);
fprintf
(
server
,
")%sNDRSContextValue(%s)"
,
is_ptr
(
var
->
type
)
?
""
:
"*"
,
var
->
name
);
}
else
...
...
tools/widl/typegen.c
View file @
32a2477e
...
...
@@ -2548,7 +2548,7 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase,
if
(
phase
==
PHASE_MARSHAL
)
{
print_file
(
file
,
indent
,
"*("
);
write_type
(
file
,
is_ptr
(
type
)
?
type
->
ref
:
type
,
FALSE
,
NULL
);
write_type
_decl
(
file
,
is_ptr
(
type
)
?
type
->
ref
:
type
,
NULL
);
if
(
is_ptr
(
type
))
fprintf
(
file
,
" *)_StubMsg.Buffer = *"
);
else
...
...
@@ -2567,12 +2567,12 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase,
fprintf
(
file
,
" = ("
);
else
fprintf
(
file
,
" = *("
);
write_type
(
file
,
is_ptr
(
type
)
?
type
->
ref
:
type
,
FALSE
,
NULL
);
write_type
_decl
(
file
,
is_ptr
(
type
)
?
type
->
ref
:
type
,
NULL
);
fprintf
(
file
,
" *)_StubMsg.Buffer;
\n
"
);
}
print_file
(
file
,
indent
,
"_StubMsg.Buffer += sizeof("
);
write_type
(
file
,
var
->
type
,
FALSE
,
NULL
);
write_type
_decl
(
file
,
var
->
type
,
NULL
);
fprintf
(
file
,
");
\n
"
);
}
...
...
@@ -2930,13 +2930,13 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
break
;
case
EXPR_CAST
:
fprintf
(
h
,
"("
);
write_type
(
h
,
e
->
u
.
tref
,
FALSE
,
NULL
);
write_type
_decl
(
h
,
e
->
u
.
tref
,
NULL
);
fprintf
(
h
,
")"
);
write_struct_expr
(
h
,
e
->
ref
,
1
,
fields
,
structvar
);
break
;
case
EXPR_SIZEOF
:
fprintf
(
h
,
"sizeof("
);
write_type
(
h
,
e
->
u
.
tref
,
FALSE
,
NULL
);
write_type
_decl
(
h
,
e
->
u
.
tref
,
NULL
);
fprintf
(
h
,
")"
);
break
;
case
EXPR_SHL
:
...
...
@@ -2987,7 +2987,7 @@ void declare_stub_args( FILE *file, int indent, const func_t *func )
if
(
!
is_void
(
def
->
type
))
{
print_file
(
file
,
indent
,
""
);
write_type_left
(
file
,
def
->
type
);
write_type_
decl_
left
(
file
,
def
->
type
);
fprintf
(
file
,
" _RetVal;
\n
"
);
}
...
...
@@ -3010,12 +3010,12 @@ void declare_stub_args( FILE *file, int indent, const func_t *func )
if
(
!
in_attr
&&
!
var
->
type
->
size_is
&&
!
is_string
)
{
print_file
(
file
,
indent
,
""
);
write_type
(
file
,
var
->
type
->
ref
,
FALSE
,
"_W%u"
,
i
++
);
write_type
_decl
(
file
,
var
->
type
->
ref
,
"_W%u"
,
i
++
);
fprintf
(
file
,
";
\n
"
);
}
print_file
(
file
,
indent
,
""
);
write_type_left
(
file
,
var
->
type
);
write_type_
decl_
left
(
file
,
var
->
type
);
fprintf
(
file
,
" "
);
if
(
var
->
type
->
declarray
)
{
fprintf
(
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