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
d33a553d
Commit
d33a553d
authored
Feb 02, 2005
by
Huw Davies
Committed by
Alexandre Julliard
Feb 02, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for typedefs.
parent
69bdc10a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
2 deletions
+51
-2
parser.y
tools/widl/parser.y
+3
-1
typelib.c
tools/widl/typelib.c
+17
-0
typelib.h
tools/widl/typelib.h
+1
-0
widltypes.h
tools/widl/widltypes.h
+1
-0
write_msft.c
tools/widl/write_msft.c
+29
-1
No files found.
tools/widl/parser.y
View file @
d33a553d
...
...
@@ -732,12 +732,14 @@ type: tVOID { $$ = make_tref(NULL, make_type(0, NULL)); }
| tUNION aIDENTIFIER { $$ = make_tref(NULL, find_type2($2, tsUNION)); }
;
typedef: tTYPEDEF m_attributes type pident_list { typeref_t *tref = uniq_tref($3);
typedef: tTYPEDEF m_attributes type pident_list { typeref_t *tref = uniq_tref($3);
$4->tname = tref->name;
tref->name = NULL;
$$ = type_ref(tref);
$$->attrs = $2;
if (!parse_only && do_header) write_typedef($$, $4);
if (in_typelib && $$->attrs)
add_typedef($$, $4);
reg_types($$, $4, 0);
}
;
...
...
tools/widl/typelib.c
View file @
d33a553d
...
...
@@ -148,6 +148,8 @@ unsigned short get_type_vt(type_t *t)
case
RPC_FC_PSTRUCT
:
return
VT_USERDEFINED
;
case
0
:
if
(
t
->
attrs
)
return
VT_USERDEFINED
;
return
0
;
default:
error
(
"get_type_vt: unknown-type: %d
\n
"
,
t
->
type
);
...
...
@@ -264,3 +266,18 @@ void add_enum(type_t *enumeration)
LINK
(
entry
,
typelib
->
entry
);
typelib
->
entry
=
entry
;
}
void
add_typedef
(
type_t
*
tdef
,
var_t
*
name
)
{
typelib_entry_t
*
entry
;
if
(
!
typelib
)
return
;
entry
=
xmalloc
(
sizeof
(
*
entry
));
entry
->
kind
=
TKIND_ALIAS
;
entry
->
u
.
tdef
=
xmalloc
(
sizeof
(
*
entry
->
u
.
tdef
));
memcpy
(
entry
->
u
.
tdef
,
name
,
sizeof
(
*
name
));
entry
->
u
.
tdef
->
type
=
tdef
;
entry
->
u
.
tdef
->
name
=
xstrdup
(
name
->
name
);
LINK
(
entry
,
typelib
->
entry
);
typelib
->
entry
=
entry
;
}
tools/widl/typelib.h
View file @
d33a553d
...
...
@@ -29,6 +29,7 @@ extern void add_coclass(class_t *cls);
extern
void
add_module
(
type_t
*
module
);
extern
void
add_struct
(
type_t
*
structure
);
extern
void
add_enum
(
type_t
*
enumeration
);
extern
void
add_typedef
(
type_t
*
tdef
,
var_t
*
name
);
/* Copied from wtypes.h. Not included directly because that would create a
* circular dependency (after all, wtypes.h is generated by widl...) */
...
...
tools/widl/widltypes.h
View file @
d33a553d
...
...
@@ -242,6 +242,7 @@ struct _typelib_entry_t {
type_t
*
module
;
type_t
*
structure
;
type_t
*
enumeration
;
var_t
*
tdef
;
}
u
;
DECL_LINK
(
typelib_entry_t
)
};
...
...
tools/widl/write_msft.c
View file @
d33a553d
...
...
@@ -884,6 +884,8 @@ static int encode_type(
case
RPC_FC_IP
:
add_interface_typeinfo
(
typelib
,
type
);
break
;
case
0
:
error
(
"encode_type: VT_USERDEFINED - can't yet add typedef's on the fly
\n
"
);
default:
error
(
"encode_type: VT_USERDEFINED - unhandled type %d
\n
"
,
type
->
type
);
}
...
...
@@ -934,7 +936,7 @@ static int encode_type(
static
void
dump_type
(
type_t
*
t
)
{
chat
(
"dump_type: %p name %s type %d ref %p rname %s
\n
"
,
t
,
t
->
name
,
t
->
type
,
t
->
ref
,
t
->
rname
);
chat
(
"dump_type: %p name %s type %d ref %p rname %s
attrs %p
\n
"
,
t
,
t
->
name
,
t
->
type
,
t
->
ref
,
t
->
rname
,
t
->
attrs
);
if
(
t
->
ref
)
dump_type
(
t
->
ref
);
}
...
...
@@ -1616,6 +1618,9 @@ static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_
case
ATTR_ODL
:
break
;
case
ATTR_PUBLIC
:
break
;
case
ATTR_RESTRICTED
:
typeinfo
->
flags
|=
0x200
;
/* TYPEFLAG_FRESTRICTED */
break
;
...
...
@@ -1685,6 +1690,7 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
var_t
*
var
;
msft_typeinfo_t
*
msft_typeinfo
;
dispinterface
->
typelib_idx
=
typelib
->
typelib_header
.
nrtypeinfos
;
msft_typeinfo
=
create_msft_typeinfo
(
typelib
,
TKIND_DISPATCH
,
dispinterface
->
name
,
dispinterface
->
attrs
,
typelib
->
typelib_header
.
nrtypeinfos
);
...
...
@@ -1813,6 +1819,24 @@ static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration)
}
}
static
void
add_typedef_typeinfo
(
msft_typelib_t
*
typelib
,
var_t
*
tdef
)
{
msft_typeinfo_t
*
msft_typeinfo
;
int
alignment
;
attr_t
*
attrs
;
tdef
->
type
->
typelib_idx
=
typelib
->
typelib_header
.
nrtypeinfos
;
msft_typeinfo
=
create_msft_typeinfo
(
typelib
,
TKIND_ALIAS
,
tdef
->
name
,
tdef
->
type
->
attrs
,
typelib
->
typelib_header
.
nrtypeinfos
);
attrs
=
tdef
->
type
->
attrs
;
tdef
->
type
->
attrs
=
NULL
;
encode_var
(
typelib
,
tdef
,
&
msft_typeinfo
->
typeinfo
->
datatype1
,
&
msft_typeinfo
->
typeinfo
->
size
,
&
alignment
,
&
msft_typeinfo
->
typeinfo
->
datatype2
);
tdef
->
type
->
attrs
=
attrs
;
msft_typeinfo
->
typeinfo
->
typekind
|=
(
alignment
<<
11
|
alignment
<<
6
);
}
static
void
add_entry
(
msft_typelib_t
*
typelib
,
typelib_entry_t
*
entry
)
{
switch
(
entry
->
kind
)
{
...
...
@@ -1828,6 +1852,10 @@ static void add_entry(msft_typelib_t *typelib, typelib_entry_t *entry)
add_enum_typeinfo
(
typelib
,
entry
->
u
.
enumeration
);
break
;
case
TKIND_ALIAS
:
add_typedef_typeinfo
(
typelib
,
entry
->
u
.
tdef
);
break
;
default:
error
(
"add_entry: unhandled type %d
\n
"
,
entry
->
kind
);
break
;
...
...
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