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
867b0f82
Commit
867b0f82
authored
Jul 31, 2015
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 31, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Use proper macro name for forward declarations of interfaces inside a namespace.
parent
ddc493a8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
2 deletions
+49
-2
header.c
tools/widl/header.c
+2
-2
parser.y
tools/widl/parser.y
+7
-0
typetree.c
tools/widl/typetree.c
+31
-0
widltypes.h
tools/widl/widltypes.h
+9
-0
No files found.
tools/widl/header.c
View file @
867b0f82
...
@@ -1219,8 +1219,8 @@ static void write_function_proto(FILE *header, const type_t *iface, const var_t
...
@@ -1219,8 +1219,8 @@ static void write_function_proto(FILE *header, const type_t *iface, const var_t
static
void
write_forward
(
FILE
*
header
,
type_t
*
iface
)
static
void
write_forward
(
FILE
*
header
,
type_t
*
iface
)
{
{
fprintf
(
header
,
"#ifndef __%s_FWD_DEFINED__
\n
"
,
iface
->
name
);
fprintf
(
header
,
"#ifndef __%s_FWD_DEFINED__
\n
"
,
iface
->
c_
name
);
fprintf
(
header
,
"#define __%s_FWD_DEFINED__
\n
"
,
iface
->
name
);
fprintf
(
header
,
"#define __%s_FWD_DEFINED__
\n
"
,
iface
->
c_
name
);
fprintf
(
header
,
"typedef interface %s %s;
\n
"
,
iface
->
name
,
iface
->
name
);
fprintf
(
header
,
"typedef interface %s %s;
\n
"
,
iface
->
name
,
iface
->
name
);
fprintf
(
header
,
"#endif
\n\n
"
);
fprintf
(
header
,
"#endif
\n\n
"
);
}
}
...
...
tools/widl/parser.y
View file @
867b0f82
...
@@ -1971,6 +1971,8 @@ int is_type(const char *name)
...
@@ -1971,6 +1971,8 @@ int is_type(const char *name)
type_t *get_type(enum type_type type, char *name, struct namespace *namespace, int t)
type_t *get_type(enum type_type type, char *name, struct namespace *namespace, int t)
{
{
type_t *tp;
type_t *tp;
if (!namespace)
namespace = &global_namespace;
if (name) {
if (name) {
tp = find_type(name, namespace, t);
tp = find_type(name, namespace, t);
if (tp) {
if (tp) {
...
@@ -1980,6 +1982,11 @@ type_t *get_type(enum type_type type, char *name, struct namespace *namespace, i
...
@@ -1980,6 +1982,11 @@ type_t *get_type(enum type_type type, char *name, struct namespace *namespace, i
}
}
tp = make_type(type);
tp = make_type(type);
tp->name = name;
tp->name = name;
tp->namespace = namespace;
if (is_global_namespace(namespace))
tp->c_name = name;
else
tp->c_name = format_namespace(namespace, "__x_", "_C", name);
if (!name) return tp;
if (!name) return tp;
return reg_type(tp, name, namespace, t);
return reg_type(tp, name, namespace, t);
}
}
...
...
tools/widl/typetree.c
View file @
867b0f82
...
@@ -45,8 +45,10 @@ type_t *make_type(enum type_type type)
...
@@ -45,8 +45,10 @@ type_t *make_type(enum type_type type)
{
{
type_t
*
t
=
alloc_type
();
type_t
*
t
=
alloc_type
();
t
->
name
=
NULL
;
t
->
name
=
NULL
;
t
->
namespace
=
NULL
;
t
->
type_type
=
type
;
t
->
type_type
=
type
;
t
->
attrs
=
NULL
;
t
->
attrs
=
NULL
;
t
->
c_name
=
NULL
;
t
->
orig
=
NULL
;
t
->
orig
=
NULL
;
memset
(
&
t
->
details
,
0
,
sizeof
(
t
->
details
));
memset
(
&
t
->
details
,
0
,
sizeof
(
t
->
details
));
t
->
typestring_offset
=
0
;
t
->
typestring_offset
=
0
;
...
@@ -76,6 +78,35 @@ static const var_t *find_arg(const var_list_t *args, const char *name)
...
@@ -76,6 +78,35 @@ static const var_t *find_arg(const var_list_t *args, const char *name)
return
NULL
;
return
NULL
;
}
}
static
char
*
append_namespace
(
char
*
ptr
,
struct
namespace
*
namespace
,
const
char
*
separator
)
{
if
(
is_global_namespace
(
namespace
))
return
ptr
;
ptr
=
append_namespace
(
ptr
,
namespace
->
parent
,
separator
);
strcpy
(
ptr
,
namespace
->
name
);
strcat
(
ptr
,
separator
);
return
ptr
+
strlen
(
ptr
);
}
char
*
format_namespace
(
struct
namespace
*
namespace
,
const
char
*
prefix
,
const
char
*
separator
,
const
char
*
suffix
)
{
unsigned
len
=
strlen
(
prefix
)
+
strlen
(
suffix
);
unsigned
sep_len
=
strlen
(
separator
);
struct
namespace
*
iter
;
char
*
ret
,
*
ptr
;
for
(
iter
=
namespace
;
!
is_global_namespace
(
iter
);
iter
=
iter
->
parent
)
len
+=
strlen
(
iter
->
name
)
+
sep_len
;
ret
=
xmalloc
(
len
+
1
);
strcpy
(
ret
,
prefix
);
ptr
=
append_namespace
(
ret
+
strlen
(
ret
),
namespace
,
separator
);
strcpy
(
ptr
,
suffix
);
return
ret
;
}
type_t
*
type_new_function
(
var_list_t
*
args
)
type_t
*
type_new_function
(
var_list_t
*
args
)
{
{
var_t
*
arg
;
var_t
*
arg
;
...
...
tools/widl/widltypes.h
View file @
867b0f82
...
@@ -412,6 +412,7 @@ enum type_type
...
@@ -412,6 +412,7 @@ enum type_type
struct
_type_t
{
struct
_type_t
{
const
char
*
name
;
const
char
*
name
;
struct
namespace
*
namespace
;
enum
type_type
type_type
;
enum
type_type
type_type
;
attr_list_t
*
attrs
;
attr_list_t
*
attrs
;
union
union
...
@@ -427,6 +428,7 @@ struct _type_t {
...
@@ -427,6 +428,7 @@ struct _type_t {
struct
pointer_details
pointer
;
struct
pointer_details
pointer
;
struct
bitfield_details
bitfield
;
struct
bitfield_details
bitfield
;
}
details
;
}
details
;
const
char
*
c_name
;
type_t
*
orig
;
/* dup'd types */
type_t
*
orig
;
/* dup'd types */
unsigned
int
typestring_offset
;
unsigned
int
typestring_offset
;
unsigned
int
ptrdesc
;
/* used for complex structs */
unsigned
int
ptrdesc
;
/* used for complex structs */
...
@@ -570,6 +572,8 @@ var_list_t *append_var(var_list_t *list, var_t *var);
...
@@ -570,6 +572,8 @@ var_list_t *append_var(var_list_t *list, var_t *var);
void
init_loc_info
(
loc_info_t
*
);
void
init_loc_info
(
loc_info_t
*
);
char
*
format_namespace
(
struct
namespace
*
namespace
,
const
char
*
prefix
,
const
char
*
separator
,
const
char
*
suffix
);
static
inline
var_list_t
*
type_get_function_args
(
const
type_t
*
func_type
)
static
inline
var_list_t
*
type_get_function_args
(
const
type_t
*
func_type
)
{
{
return
func_type
->
details
.
function
->
args
;
return
func_type
->
details
.
function
->
args
;
...
@@ -599,4 +603,9 @@ static inline int statements_has_func(const statement_list_t *stmts)
...
@@ -599,4 +603,9 @@ static inline int statements_has_func(const statement_list_t *stmts)
return
has_func
;
return
has_func
;
}
}
static
inline
int
is_global_namespace
(
const
struct
namespace
*
namespace
)
{
return
!
namespace
->
name
;
}
#endif
#endif
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