Rebase against f72ef20e88fba67254caf0124ab8713e3d15fa2a.

This commit is contained in:
Alistair Leslie-Hughes 2021-01-29 10:38:52 +11:00
parent bd135b1477
commit 5c5a8f3b2c
24 changed files with 408 additions and 1052 deletions

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "24b9203d3544001dd51894f1c1edd99819367198"
echo "f72ef20e88fba67254caf0124ab8713e3d15fa2a"
}
# Show version information
@ -4478,29 +4478,33 @@ fi
# | * [#49998] widl - Support WinRT idls
# |
# | Modified files:
# | * include/windows.foundation.idl, include/windows.media.speechsynthesis.idl, tools/widl/expr.c, tools/widl/hash.c,
# | tools/widl/hash.h, tools/widl/header.c, tools/widl/parser.l, tools/widl/parser.y, tools/widl/typegen.c,
# | tools/widl/typelib.c, tools/widl/typetree.c, tools/widl/typetree.h, tools/widl/utils.c, tools/widl/utils.h,
# | tools/widl/widltypes.h
# | * include/windows.foundation.idl, include/windows.media.speechsynthesis.idl, include/winnt.h, tools/widl/expr.c,
# | tools/widl/hash.c, tools/widl/hash.h, tools/widl/header.c, tools/widl/parser.l, tools/widl/parser.y,
# | tools/widl/typegen.c, tools/widl/typelib.c, tools/widl/typetree.c, tools/widl/typetree.h, tools/widl/utils.c,
# | tools/widl/utils.h, tools/widl/widltypes.h
# |
if test "$enable_widl_winrt_support" -eq 1; then
patch_apply widl-winrt-support/0005-widl-Support-WinRT-runtimeclass-type.patch
patch_apply widl-winrt-support/0006-widl-Support-WinRT-eventadd-eventremove-attributes.patch
patch_apply widl-winrt-support/0007-widl-Support-WinRT-flags-attribute-parsing.patch
patch_apply widl-winrt-support/0008-widl-Support-using-qualified-names-for-interfaces.patch
patch_apply widl-winrt-support/0009-widl-Support-WinRT-static-attribute-parsing.patch
patch_apply widl-winrt-support/0010-widl-Support-WinRT-requires-keyword.patch
patch_apply widl-winrt-support/0011-widl-Support-WinRT-activatable-attribute.patch
patch_apply widl-winrt-support/0012-widl-Support-WinRT-parameterized-type-parsing.patch
patch_apply widl-winrt-support/0013-widl-Introduce-new-strappend-helper.patch
patch_apply widl-winrt-support/0014-widl-Support-partially-specialized-parameterized-typ.patch
patch_apply widl-winrt-support/0015-widl-Support-WinRT-parameterized-interface-type.patch
patch_apply widl-winrt-support/0016-widl-Support-WinRT-delegate-type.patch
patch_apply widl-winrt-support/0017-widl-Support-WinRT-parameterized-delegate-type.patch
patch_apply widl-winrt-support/0018-widl-Compute-signatures-for-parameterized-types.patch
patch_apply widl-winrt-support/0019-widl-Compute-uuids-for-parameterized-types.patch
patch_apply widl-winrt-support/0020-widl-Generate-helper-macros-for-WinRT-implementation.patch
patch_apply widl-winrt-support/0021-include-Add-IVectorView-HSTRING-declaration-to-windo.patch
patch_apply widl-winrt-support/0001-include-Define-DECLSPEC_SELECTANY-on-MinGW.patch
patch_apply widl-winrt-support/0002-widl-Generate-WinRT-runtimeclass-name-constants.patch
patch_apply widl-winrt-support/0003-widl-Support-WinRT-eventadd-eventremove-attributes.patch
patch_apply widl-winrt-support/0004-widl-Support-WinRT-flags-attribute-parsing.patch
patch_apply widl-winrt-support/0005-widl-Support-using-qualified-names-for-interfaces.patch
patch_apply widl-winrt-support/0006-widl-Support-WinRT-static-attribute-parsing.patch
patch_apply widl-winrt-support/0007-widl-Support-WinRT-requires-keyword.patch
patch_apply widl-winrt-support/0008-widl-Support-WinRT-activatable-attribute.patch
patch_apply widl-winrt-support/0009-widl-Support-WinRT-parameterized-type-parsing.patch
patch_apply widl-winrt-support/0010-widl-Introduce-new-strappend-helper.patch
patch_apply widl-winrt-support/0011-widl-Support-partially-specialized-parameterized-typ.patch
patch_apply widl-winrt-support/0012-widl-Support-WinRT-parameterized-interface-type.patch
patch_apply widl-winrt-support/0013-widl-Support-WinRT-delegate-type.patch
patch_apply widl-winrt-support/0014-widl-Support-WinRT-parameterized-delegate-type.patch
patch_apply widl-winrt-support/0015-widl-Compute-signatures-for-parameterized-types.patch
patch_apply widl-winrt-support/0016-widl-Compute-uuids-for-parameterized-types.patch
patch_apply widl-winrt-support/0017-widl-Generate-helper-macros-for-WinRT-implementation.patch
patch_apply widl-winrt-support/0018-include-Add-IVectorView-HSTRING-declaration-to-windo.patch
patch_apply widl-winrt-support/0019-widl-Never-use-the-namespace-ABI-prefix-for-global-t.patch
patch_apply widl-winrt-support/0020-widl-Precompute-qualified-type-names-and-use-them-fo.patch
patch_apply widl-winrt-support/0021-widl-Define-the-C-type-name-as-an-alias-for-the-C-qu.patch
fi
# Patchset windows.media.speech.dll

View File

@ -0,0 +1,25 @@
From 9c00130e319055e1b8fb336338e656f8ca5d64b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 19 Jan 2021 13:47:45 +0100
Subject: [PATCH] include: Define DECLSPEC_SELECTANY on MinGW.
---
include/winnt.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/winnt.h b/include/winnt.h
index 5b3efe61385..bb045fa2745 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -110,6 +110,8 @@ extern "C" {
#ifndef DECLSPEC_SELECTANY
#if defined(_MSC_VER) && (_MSC_VER >= 1100)
#define DECLSPEC_SELECTANY __declspec(selectany)
+#elif defined(__MINGW32__)
+#define DECLSPEC_SELECTANY __attribute__((selectany))
#else
#define DECLSPEC_SELECTANY
#endif
--
2.29.2

View File

@ -0,0 +1,35 @@
From 41ffc864a47b18e138fe92e6f5be78d9cc1e7936 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 19 Jan 2021 13:51:25 +0100
Subject: [PATCH] widl: Generate WinRT runtimeclass name constants.
---
tools/widl/header.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index ad205df0d05..153437971cc 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -1698,6 +1698,7 @@ static void write_runtimeclass(FILE *header, type_t *runtimeclass)
{
expr_t *contract = get_attrp(runtimeclass->attrs, ATTR_CONTRACT);
char *name, *c_name;
+ size_t i, len;
name = format_namespace(runtimeclass->namespace, "", ".", runtimeclass->name, NULL);
c_name = format_namespace(runtimeclass->namespace, "", "_", runtimeclass->name, NULL);
fprintf(header, "/*\n");
@@ -1706,6 +1707,10 @@ static void write_runtimeclass(FILE *header, type_t *runtimeclass)
if (contract) write_apicontract_guard_start(header, contract);
fprintf(header, "#ifndef RUNTIMECLASS_%s_DEFINED\n", c_name);
fprintf(header, "#define RUNTIMECLASS_%s_DEFINED\n", c_name);
+ /* FIXME: MIDL generates extern const here but GCC warns if extern is initialized */
+ fprintf(header, "/*extern*/ const DECLSPEC_SELECTANY WCHAR RuntimeClass_%s[] = {", c_name);
+ for (i = 0, len = strlen(name); i < len; ++i) fprintf(header, "'%c',", name[i]);
+ fprintf(header, "0};\n");
fprintf(header, "#endif /* RUNTIMECLASS_%s_DEFINED */\n", c_name);
free(c_name);
free(name);
--
2.29.2

View File

@ -1,4 +1,4 @@
From 0b5447c4b3f89a00c295acdd124f532550079b4c Mon Sep 17 00:00:00 2001
From 6ecf89d3afe33a136e41c0106adeb0b27fe74c7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 1 Oct 2020 20:10:02 +0200
Subject: [PATCH] widl: Support WinRT eventadd/eventremove attributes.
@ -11,10 +11,10 @@ Subject: [PATCH] widl: Support WinRT eventadd/eventremove attributes.
4 files changed, 15 insertions(+)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index 93bcb4f5214..ae392fe7de4 100644
index 153437971cc..4db244fef5d 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -187,6 +187,10 @@ const char *get_name(const var_t *v)
@@ -185,6 +185,10 @@ const char *get_name(const var_t *v)
{
static char *buffer;
free( buffer );
@ -26,7 +26,7 @@ index 93bcb4f5214..ae392fe7de4 100644
return buffer = strmake( "get_%s", v->name );
if (is_attr( v->attrs, ATTR_PROPPUT ))
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 80a6bc38afb..4932e0adbe2 100644
index 6bbfed5e80b..a0b9714dfa0 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -359,6 +359,8 @@ static const struct keyword attr_keywords[] =
@ -39,7 +39,7 @@ index 80a6bc38afb..4932e0adbe2 100644
{"explicit_handle", tEXPLICITHANDLE, 0},
{"fault_status", tFAULTSTATUS, 0},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 93714ebf712..b19fb16efd0 100644
index d12caa06b63..537b4f332f3 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -197,6 +197,7 @@ static typelib_t *current_typelib;
@ -78,7 +78,7 @@ index 93714ebf712..b19fb16efd0 100644
if (is_attr(func->attrs, ATTR_PROPPUT) != is_attr(func_iter->attrs, ATTR_PROPPUT)) continue;
if (is_attr(func->attrs, ATTR_PROPPUTREF) != is_attr(func_iter->attrs, ATTR_PROPPUTREF)) continue;
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 77313b30c0f..75510ee50b1 100644
index 46a44dac039..51d325ce930 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -103,6 +103,8 @@ enum attr_type

View File

@ -1,4 +1,4 @@
From 025a89076222bff7f5abb7c1c8992c93eaf92be6 Mon Sep 17 00:00:00 2001
From 837aa860559609889bd9dbf189960a3dca021ce5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 12 Oct 2020 18:02:59 +0200
Subject: [PATCH] widl: Support WinRT flags attribute parsing.
@ -10,7 +10,7 @@ Subject: [PATCH] widl: Support WinRT flags attribute parsing.
3 files changed, 5 insertions(+)
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 4932e0adbe2..51142ded6e6 100644
index a0b9714dfa0..7e20d30e7f0 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -364,6 +364,7 @@ static const struct keyword attr_keywords[] =
@ -22,7 +22,7 @@ index 4932e0adbe2..51142ded6e6 100644
{"free", tFREE, 0},
{"handle", tHANDLE, 0},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index b19fb16efd0..110b570f4e4 100644
index 537b4f332f3..480552e3723 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -202,6 +202,7 @@ static typelib_t *current_typelib;
@ -50,7 +50,7 @@ index b19fb16efd0..110b570f4e4 100644
/* ATTR_HANDLE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "handle" },
/* ATTR_HELPCONTEXT */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, "helpcontext" },
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 75510ee50b1..a3283761256 100644
index 51d325ce930..0fba33d6a09 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -108,6 +108,7 @@ enum attr_type

View File

@ -1,791 +0,0 @@
From 62715392ea059ed59519abacb47ab84e1fc5ab64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 20 Nov 2020 11:06:18 +0100
Subject: [PATCH] widl: Support WinRT runtimeclass type.
MIDL doesn't generate anything special in the header files for these
types. They can however be used instead of interfaces as function
arguments or type parameters, but pointer to their default interface
type is instead used in the generated code.
---
include/windows.media.speechsynthesis.idl | 25 ++
tools/widl/expr.c | 1 +
tools/widl/header.c | 100 +++++++-
tools/widl/parser.l | 1 +
tools/widl/parser.y | 269 +++++++++++++---------
tools/widl/typegen.c | 4 +
tools/widl/typelib.c | 1 +
tools/widl/typetree.c | 17 ++
tools/widl/typetree.h | 24 ++
tools/widl/widltypes.h | 10 +-
10 files changed, 337 insertions(+), 115 deletions(-)
diff --git a/include/windows.media.speechsynthesis.idl b/include/windows.media.speechsynthesis.idl
index 7a1de5fcba6..90bc9f279c6 100644
--- a/include/windows.media.speechsynthesis.idl
+++ b/include/windows.media.speechsynthesis.idl
@@ -29,6 +29,8 @@ namespace Windows {
typedef enum VoiceGender VoiceGender;
interface IInstalledVoicesStatic;
interface IVoiceInformation;
+ runtimeclass VoiceInformation;
+ runtimeclass SpeechSynthesizer;
}
}
}
@@ -42,6 +44,29 @@ namespace Windows {
Male = 0,
Female = 1
};
+
+ [
+ contract(Windows.Foundation.UniversalApiContract, 1.0),
+ exclusiveto(Windows.Media.SpeechSynthesis.VoiceInformation),
+ uuid(b127d6a4-1291-4604-aa9c-83134083352c)
+ ]
+ interface IVoiceInformation : IInspectable
+ {
+ [propget] HRESULT DisplayName([out] [retval] HSTRING* value);
+ [propget] HRESULT Id([out] [retval] HSTRING* value);
+ [propget] HRESULT Language([out] [retval] HSTRING* value);
+ [propget] HRESULT Description([out] [retval] HSTRING* value);
+ [propget] HRESULT Gender([out] [retval] VoiceGender* value);
+ }
+
+ [
+ contract(Windows.Foundation.UniversalApiContract, 1.0),
+ marshaling_behavior(agile)
+ ]
+ runtimeclass VoiceInformation
+ {
+ [default] interface IVoiceInformation;
+ }
}
}
}
diff --git a/tools/widl/expr.c b/tools/widl/expr.c
index be8311cfb7f..13bd5a889aa 100644
--- a/tools/widl/expr.c
+++ b/tools/widl/expr.c
@@ -463,6 +463,7 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type,
case TYPE_ARRAY:
case TYPE_BITFIELD:
case TYPE_APICONTRACT:
+ case TYPE_RUNTIMECLASS:
/* nothing to do */
break;
case TYPE_ALIAS:
diff --git a/tools/widl/header.c b/tools/widl/header.c
index d5e35aac92f..cd31d145caa 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -463,6 +463,9 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i
case TYPE_COCLASS:
fprintf(h, "%s", name);
break;
+ case TYPE_RUNTIMECLASS:
+ fprintf(h, "%s", type_get_name(type_runtimeclass_get_default_iface(t), name_type));
+ break;
case TYPE_VOID:
fprintf(h, "void");
break;
@@ -545,6 +548,7 @@ void write_type_right(FILE *h, type_t *t, int is_field)
case TYPE_MODULE:
case TYPE_COCLASS:
case TYPE_INTERFACE:
+ case TYPE_RUNTIMECLASS:
break;
case TYPE_APICONTRACT:
/* not supposed to be here */
@@ -1031,7 +1035,8 @@ static int is_aggregate_return(const var_t *func)
{
enum type_type type = type_get_type(type_function_get_rettype(func->declspec.type));
return type == TYPE_STRUCT || type == TYPE_UNION ||
- type == TYPE_COCLASS || type == TYPE_INTERFACE;
+ type == TYPE_COCLASS || type == TYPE_INTERFACE ||
+ type == TYPE_RUNTIMECLASS;
}
static char *get_vtbl_entry_name(const type_t *iface, const var_t *func)
@@ -1480,6 +1485,56 @@ static char *format_apicontract_macro(const type_t *type)
return name;
}
+static void write_winrt_type_comments(FILE *header, const type_t *type)
+{
+ expr_t *contract = get_attrp(type->attrs, ATTR_CONTRACT);
+ type_t *exclusiveto = get_attrp(type->attrs, ATTR_EXCLUSIVETO);
+ fprintf(header, " *\n");
+ if (contract)
+ {
+ const type_t *type = contract->u.tref.type;
+ char *name = format_namespace(type->namespace, "", ".", type->name, NULL);
+ int ver = contract->ref->u.lval;
+ fprintf(header, " * Introduced to %s in version %d.%d\n *\n", name, (ver >> 16) & 0xffff, ver & 0xffff);
+ free(name);
+ }
+ if (exclusiveto)
+ {
+ char *name = format_namespace(exclusiveto->namespace, "", ".", exclusiveto->name, NULL);
+ fprintf(header, " * Interface is a part of the implementation of type %s\n *\n", name);
+ free(name);
+ }
+ if (type_get_type(type) == TYPE_RUNTIMECLASS)
+ {
+ ifref_list_t *ifaces = type_runtimeclass_get_ifaces(type);
+ ifref_t *entry;
+ fprintf(header, " * Class implements the following interfaces:\n");
+ LIST_FOR_EACH_ENTRY(entry, ifaces, ifref_t, entry)
+ {
+ char *name = format_namespace(entry->iface->namespace, "", ".", entry->iface->name, NULL);
+ fprintf(header, " * %s", name);
+ if (is_attr(entry->attrs, ATTR_DEFAULT)) fprintf(header, " ** Default Interface **");
+ fprintf(header, "\n");
+ free(name);
+ }
+ fprintf(header, " *\n");
+ }
+ switch (get_attrv(type->attrs, ATTR_THREADING))
+ {
+ case THREADING_SINGLE: fprintf(header, " * Class Threading Model: Single Threaded Apartment\n *\n"); break;
+ case THREADING_BOTH: fprintf(header, " * Class Threading Model: Both Single and Multi Threaded Apartment\n *\n"); break;
+ case THREADING_MTA: fprintf(header, " * Class Threading Model: Multi Threaded Apartment\n *\n"); break;
+ default: break;
+ }
+ switch (get_attrv(type->attrs, ATTR_MARSHALING_BEHAVIOR))
+ {
+ case MARSHALING_AGILE: fprintf(header, " * Class Marshaling Behavior: Agile - Class is agile\n *\n"); break;
+ case MARSHALING_STANDARD: fprintf(header, " * Class Marshaling Behavior: Standard - Class marshals using the standard marshaler\n *\n"); break;
+ case MARSHALING_NONE: fprintf(header, " * Class Marshaling Behavior: None - Class cannot be marshaled\n *\n"); break;
+ default: break;
+ }
+}
+
static void write_apicontract_guard_start(FILE *header, const expr_t *expr)
{
const type_t *type;
@@ -1689,6 +1744,45 @@ static void write_apicontract(FILE *header, type_t *apicontract)
free(name);
}
+static void write_runtimeclass(FILE *header, type_t *runtimeclass)
+{
+ expr_t *contract = get_attrp(runtimeclass->attrs, ATTR_CONTRACT);
+ size_t i, len;
+ char *name, *c_name;
+ name = format_namespace(runtimeclass->namespace, "", ".", runtimeclass->name, NULL);
+ c_name = format_namespace(runtimeclass->namespace, "", "_", runtimeclass->name, NULL);
+ fprintf(header, "/*\n");
+ fprintf(header, " * Class %s\n", name);
+ write_winrt_type_comments(header, runtimeclass);
+ fprintf(header, " */\n");
+ if (contract) write_apicontract_guard_start(header, contract);
+ fprintf(header, "#ifndef RUNTIMECLASS_%s_DEFINED\n", c_name);
+ fprintf(header, "#define RUNTIMECLASS_%s_DEFINED\n", c_name);
+ /* MIDL generates extern const here */
+ fprintf(header, "static const DECLSPEC_SELECTANY WCHAR RuntimeClass_%s[] = {", c_name);
+ for (i = 0, len = strlen(name); i < len; ++i) fprintf(header, "'%c',", name[i]);
+ fprintf(header, "0};\n");
+ fprintf(header, "#endif /* RUNTIMECLASS_%s_DEFINED */\n", c_name);
+ free(c_name);
+ free(name);
+ if (contract) write_apicontract_guard_end(header, contract);
+ fprintf(header, "\n");
+}
+
+static void write_runtimeclass_forward(FILE *header, type_t *runtimeclass)
+{
+ fprintf(header, "#ifndef __%s_FWD_DEFINED__\n", runtimeclass->c_name);
+ fprintf(header, "#define __%s_FWD_DEFINED__\n", runtimeclass->c_name);
+ fprintf(header, "#ifdef __cplusplus\n");
+ write_namespace_start(header, runtimeclass->namespace);
+ write_line(header, 0, "class %s;", runtimeclass->name);
+ write_namespace_end(header, runtimeclass->namespace);
+ fprintf(header, "#else\n");
+ fprintf(header, "typedef struct %s %s;\n", runtimeclass->c_name, runtimeclass->c_name);
+ fprintf(header, "#endif /* defined __cplusplus */\n");
+ fprintf(header, "#endif /* defined __%s_FWD_DEFINED__ */\n\n", runtimeclass->c_name);
+}
+
static void write_import(FILE *header, const char *fname)
{
char *hname, *p;
@@ -1753,6 +1847,8 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts)
}
else if (type_get_type(stmt->u.type) == TYPE_COCLASS)
write_coclass_forward(header, stmt->u.type);
+ else if (type_get_type(stmt->u.type) == TYPE_RUNTIMECLASS)
+ write_runtimeclass_forward(header, stmt->u.type);
break;
case STMT_TYPEREF:
case STMT_IMPORTLIB:
@@ -1809,6 +1905,8 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
write_coclass(header, stmt->u.type);
else if (type_get_type(stmt->u.type) == TYPE_APICONTRACT)
write_apicontract(header, stmt->u.type);
+ else if (type_get_type(stmt->u.type) == TYPE_RUNTIMECLASS)
+ write_runtimeclass(header, stmt->u.type);
else
{
write_type_definition(header, stmt->u.type, stmt->declonly);
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 7a811d537d1..6bbfed5e80b 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -298,6 +298,7 @@ static const struct keyword keywords[] = {
{"pascal", tPASCAL, 0},
{"properties", tPROPERTIES, 0},
{"register", tREGISTER, 0},
+ {"runtimeclass", tRUNTIMECLASS, 1},
{"short", tSHORT, 0},
{"signed", tSIGNED, 0},
{"sizeof", tSIZEOF, 0},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 351bbd12107..d12caa06b63 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -100,6 +100,7 @@ static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
+static attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs);
const char *get_attr_display_name(enum attr_type type);
static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func);
@@ -247,6 +248,7 @@ static typelib_t *current_typelib;
%token tREQUESTEDIT
%token tRESTRICTED
%token tRETVAL
+%token tRUNTIMECLASS
%token tSAFEARRAY
%token tSHORT
%token tSIGNED tSINGLENODE
@@ -292,8 +294,8 @@ static typelib_t *current_typelib;
%type <type> base_type int_std
%type <type> enumdef structdef uniondef typedecl
%type <type> type qualified_seq qualified_type
-%type <ifref> coclass_int
-%type <ifref_list> coclass_ints
+%type <ifref> class_interface
+%type <ifref_list> class_interfaces
%type <var> arg ne_union_field union_field s_field case enum enum_member declaration
%type <var> funcdef
%type <var_list> m_args arg_list args dispint_meths
@@ -304,6 +306,7 @@ static typelib_t *current_typelib;
%type <declarator> m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator
%type <declarator_list> declarator_list struct_declarator_list
%type <type> coclass coclasshdr coclassdef
+%type <type> runtimeclass runtimeclass_hdr runtimeclass_def
%type <type> apicontract
%type <num> contract_ver
%type <num> pointer_type threading_type marshaling_behavior version
@@ -364,6 +367,9 @@ gbl_statements: { $$ = NULL; }
}
| gbl_statements apicontract ';' { $$ = append_statement($1, make_statement_type_decl($2));
reg_type($2, $2->name, current_namespace, 0); }
+ | gbl_statements runtimeclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
+ | gbl_statements runtimeclass_def { $$ = append_statement($1, make_statement_type_decl($2));
+ reg_type($2, $2->name, current_namespace, 0); }
| gbl_statements moduledef { $$ = append_statement($1, make_statement_module($2)); }
| gbl_statements librarydef { $$ = append_statement($1, make_statement_library($2)); }
| gbl_statements statement { $$ = append_statement($1, $2); }
@@ -380,6 +386,9 @@ imp_statements: { $$ = NULL; }
}
| imp_statements apicontract ';' { $$ = append_statement($1, make_statement_type_decl($2));
reg_type($2, $2->name, current_namespace, 0); }
+ | imp_statements runtimeclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
+ | imp_statements runtimeclass_def { $$ = append_statement($1, make_statement_type_decl($2));
+ reg_type($2, $2->name, current_namespace, 0); }
| imp_statements moduledef { $$ = append_statement($1, make_statement_module($2)); }
| imp_statements statement { $$ = append_statement($1, $2); }
| imp_statements importlib { $$ = append_statement($1, make_statement_importlib($2)); }
@@ -562,7 +571,9 @@ attribute: { $$ = NULL; }
| tENCODE { $$ = make_attr(ATTR_ENCODE); }
| tENDPOINT '(' str_list ')' { $$ = make_attrp(ATTR_ENDPOINT, $3); }
| tENTRY '(' expr_const ')' { $$ = make_attrp(ATTR_ENTRY, $3); }
- | tEXCLUSIVETO '(' decl_spec ')' { $$ = make_attrp(ATTR_EXCLUSIVETO, $3->type); }
+ | tEXCLUSIVETO '(' decl_spec ')' { if ($3->type->type_type != TYPE_RUNTIMECLASS)
+ error_loc("type %s is not a runtimeclass\n", $3->type->name);
+ $$ = make_attrp(ATTR_EXCLUSIVETO, $3->type); }
| tEXPLICITHANDLE { $$ = make_attr(ATTR_EXPLICIT_HANDLE); }
| tFAULTSTATUS { $$ = make_attr(ATTR_FAULTSTATUS); }
| tFORCEALLOCATE { $$ = make_attr(ATTR_FORCEALLOCATE); }
@@ -897,10 +908,29 @@ coclasshdr: attributes coclass { $$ = $2;
}
;
-coclassdef: coclasshdr '{' coclass_ints '}' semicolon_opt
+coclassdef: coclasshdr '{' class_interfaces '}' semicolon_opt
{ $$ = type_coclass_define($1, $3); }
;
+runtimeclass:
+ tRUNTIMECLASS aIDENTIFIER { $$ = type_new_runtimeclass($2, current_namespace); }
+ | tRUNTIMECLASS aKNOWNTYPE { $$ = find_type($2, NULL, 0);
+ if (type_get_type_detect_alias($$) != TYPE_RUNTIMECLASS)
+ error_loc("%s was not declared a runtimeclass at %s:%d\n", $2,
+ $$->loc_info.input_name, $$->loc_info.line_number);
+ }
+ ;
+
+runtimeclass_hdr: attributes runtimeclass { $$ = $2;
+ check_def($$);
+ $$->attrs = check_runtimeclass_attrs($2->name, $1);
+ }
+ ;
+
+runtimeclass_def: runtimeclass_hdr '{' class_interfaces '}' semicolon_opt
+ { $$ = type_runtimeclass_define($1, $3); }
+ ;
+
apicontract: attributes tAPICONTRACT aIDENTIFIER '{' '}'
{ $$ = get_type(TYPE_APICONTRACT, $3, current_namespace, 0);
check_def($$);
@@ -912,11 +942,11 @@ namespacedef: tNAMESPACE aIDENTIFIER { $$ = $2; }
| tNAMESPACE aNAMESPACE { $$ = $2; }
;
-coclass_ints: { $$ = NULL; }
- | coclass_ints coclass_int { $$ = append_ifref( $1, $2 ); }
+class_interfaces: { $$ = NULL; }
+ | class_interfaces class_interface { $$ = append_ifref( $1, $2 ); }
;
-coclass_int:
+class_interface:
m_attributes interfacedec { $$ = make_ifref($2); $$->attrs = $1; }
;
@@ -2185,117 +2215,118 @@ struct allowed_attr
unsigned int on_module : 1;
unsigned int on_coclass : 1;
unsigned int on_apicontract : 1;
+ unsigned int on_runtimeclass : 1;
const char *display_name;
};
struct allowed_attr allowed_attr[] =
{
- /* attr { D ACF M I Fn ARG T En Enm St Un Fi L DI M C AC <display name> } */
- /* ATTR_AGGREGATABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "aggregatable" },
- /* ATTR_ALLOCATE */ { 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "allocate" },
- /* ATTR_ANNOTATION */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "annotation" },
- /* ATTR_APPOBJECT */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "appobject" },
- /* ATTR_ASYNC */ { 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "async" },
- /* ATTR_ASYNCUUID */ { 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, "async_uuid" },
- /* ATTR_AUTO_HANDLE */ { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "auto_handle" },
- /* ATTR_BINDABLE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "bindable" },
- /* ATTR_BROADCAST */ { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "broadcast" },
- /* ATTR_CALLAS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "call_as" },
- /* ATTR_CALLCONV */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL },
- /* ATTR_CASE */ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "case" },
- /* ATTR_CODE */ { 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "code" },
- /* ATTR_COMMSTATUS */ { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "comm_status" },
- /* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" },
- /* ATTR_CONTRACT */ { 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, "contract" },
- /* ATTR_CONTRACTVERSION */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "contractversion" },
- /* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, "control" },
- /* ATTR_CUSTOM */ { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, "custom" },
- /* ATTR_DECODE */ { 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "decode" },
- /* ATTR_DEFAULT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, "default" },
- /* ATTR_DEFAULTBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultbind" },
- /* ATTR_DEFAULTCOLLELEM */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultcollelem" },
- /* ATTR_DEFAULTVALUE */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultvalue" },
- /* ATTR_DEFAULTVTABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "defaultvtable" },
- /* ATTR_DISABLECONSISTENCYCHECK */{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "disable_consistency_check" },
- /* ATTR_DISPINTERFACE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL },
- /* ATTR_DISPLAYBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "displaybind" },
- /* ATTR_DLLNAME */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "dllname" },
- /* ATTR_DUAL */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "dual" },
- /* ATTR_ENABLEALLOCATE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "enable_allocate" },
- /* ATTR_ENCODE */ { 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "encode" },
- /* ATTR_ENDPOINT */ { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "endpoint" },
- /* ATTR_ENTRY */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "entry" },
- /* ATTR_EXCLUSIVETO */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "exclusive_to" },
- /* ATTR_EXPLICIT_HANDLE */ { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "explicit_handle" },
- /* ATTR_FAULTSTATUS */ { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "fault_status" },
- /* ATTR_FORCEALLOCATE */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "force_allocate" },
- /* ATTR_HANDLE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "handle" },
- /* ATTR_HELPCONTEXT */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, "helpcontext" },
- /* ATTR_HELPFILE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "helpfile" },
- /* ATTR_HELPSTRING */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, "helpstring" },
- /* ATTR_HELPSTRINGCONTEXT */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, "helpstringcontext" },
- /* ATTR_HELPSTRINGDLL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "helpstringdll" },
- /* ATTR_HIDDEN */ { 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, "hidden" },
- /* ATTR_ID */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, "id" },
- /* ATTR_IDEMPOTENT */ { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "idempotent" },
- /* ATTR_IGNORE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "ignore" },
- /* ATTR_IIDIS */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "iid_is" },
- /* ATTR_IMMEDIATEBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "immediatebind" },
- /* ATTR_IMPLICIT_HANDLE */ { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "implicit_handle" },
- /* ATTR_IN */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "in" },
- /* ATTR_INPUTSYNC */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "inputsync" },
- /* ATTR_LENGTHIS */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "length_is" },
- /* ATTR_LIBLCID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "lcid" },
- /* ATTR_LICENSED */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "licensed" },
- /* ATTR_LOCAL */ { 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "local" },
- /* ATTR_MARSHALING_BEHAVIOR */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "marshaling_behavior" },
- /* ATTR_MAYBE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "maybe" },
- /* ATTR_MESSAGE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "message" },
- /* ATTR_NOCODE */ { 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nocode" },
- /* ATTR_NONBROWSABLE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nonbrowsable" },
- /* ATTR_NONCREATABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "noncreatable" },
- /* ATTR_NONEXTENSIBLE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nonextensible" },
- /* ATTR_NOTIFY */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "notify" },
- /* ATTR_NOTIFYFLAG */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "notify_flag" },
- /* ATTR_OBJECT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "object" },
- /* ATTR_ODL */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "odl" },
- /* ATTR_OLEAUTOMATION */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "oleautomation" },
- /* ATTR_OPTIMIZE */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "optimize" },
- /* ATTR_OPTIONAL */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "optional" },
- /* ATTR_OUT */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "out" },
- /* ATTR_PARAMLCID */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "lcid" },
- /* ATTR_PARTIALIGNORE */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "partial_ignore" },
- /* ATTR_POINTERDEFAULT */ { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "pointer_default" },
- /* ATTR_POINTERTYPE */ { 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "ref, unique or ptr" },
- /* ATTR_PROGID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "progid" },
- /* ATTR_PROPGET */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propget" },
- /* ATTR_PROPPUT */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propput" },
- /* ATTR_PROPPUTREF */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propputref" },
- /* ATTR_PROXY */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "proxy" },
- /* ATTR_PUBLIC */ { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "public" },
- /* ATTR_RANGE */ { 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, "range" },
- /* ATTR_READONLY */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "readonly" },
- /* ATTR_REPRESENTAS */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "represent_as" },
- /* ATTR_REQUESTEDIT */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "requestedit" },
- /* ATTR_RESTRICTED */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, "restricted" },
- /* ATTR_RETVAL */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "retval" },
- /* ATTR_SIZEIS */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "size_is" },
- /* ATTR_SOURCE */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "source" },
- /* ATTR_STRICTCONTEXTHANDLE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "strict_context_handle" },
- /* ATTR_STRING */ { 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "string" },
- /* ATTR_SWITCHIS */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "switch_is" },
- /* ATTR_SWITCHTYPE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "switch_type" },
- /* ATTR_THREADING */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "threading" },
- /* ATTR_TRANSMITAS */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "transmit_as" },
- /* ATTR_UIDEFAULT */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "uidefault" },
- /* ATTR_USESGETLASTERROR */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "usesgetlasterror" },
- /* ATTR_USERMARSHAL */ { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "user_marshal" },
- /* ATTR_UUID */ { 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, "uuid" },
- /* ATTR_V1ENUM */ { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "v1_enum" },
- /* ATTR_VARARG */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "vararg" },
- /* ATTR_VERSION */ { 1, 0, 0, 1, 0, 0, 1, 1, 0, 2, 0, 0, 1, 0, 0, 1, 0, "version" },
- /* ATTR_VIPROGID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "vi_progid" },
- /* ATTR_WIREMARSHAL */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "wire_marshal" },
+ /* attr { D ACF M I Fn ARG T En Enm St Un Fi L DI M C AC R <display name> } */
+ /* ATTR_AGGREGATABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "aggregatable" },
+ /* ATTR_ALLOCATE */ { 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "allocate" },
+ /* ATTR_ANNOTATION */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "annotation" },
+ /* ATTR_APPOBJECT */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "appobject" },
+ /* ATTR_ASYNC */ { 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "async" },
+ /* ATTR_ASYNCUUID */ { 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, "async_uuid" },
+ /* ATTR_AUTO_HANDLE */ { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "auto_handle" },
+ /* ATTR_BINDABLE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "bindable" },
+ /* ATTR_BROADCAST */ { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "broadcast" },
+ /* ATTR_CALLAS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "call_as" },
+ /* ATTR_CALLCONV */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL },
+ /* ATTR_CASE */ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "case" },
+ /* ATTR_CODE */ { 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "code" },
+ /* ATTR_COMMSTATUS */ { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "comm_status" },
+ /* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" },
+ /* ATTR_CONTRACT */ { 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, "contract" },
+ /* ATTR_CONTRACTVERSION */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "contractversion" },
+ /* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, "control" },
+ /* ATTR_CUSTOM */ { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, "custom" },
+ /* ATTR_DECODE */ { 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "decode" },
+ /* ATTR_DEFAULT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, "default" },
+ /* ATTR_DEFAULTBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultbind" },
+ /* ATTR_DEFAULTCOLLELEM */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultcollelem" },
+ /* ATTR_DEFAULTVALUE */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultvalue" },
+ /* ATTR_DEFAULTVTABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "defaultvtable" },
+ /* ATTR_DISABLECONSISTENCYCHECK */{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "disable_consistency_check" },
+ /* ATTR_DISPINTERFACE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL },
+ /* ATTR_DISPLAYBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "displaybind" },
+ /* ATTR_DLLNAME */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "dllname" },
+ /* ATTR_DUAL */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "dual" },
+ /* ATTR_ENABLEALLOCATE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "enable_allocate" },
+ /* ATTR_ENCODE */ { 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "encode" },
+ /* ATTR_ENDPOINT */ { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "endpoint" },
+ /* ATTR_ENTRY */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "entry" },
+ /* ATTR_EXCLUSIVETO */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "exclusive_to" },
+ /* ATTR_EXPLICIT_HANDLE */ { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "explicit_handle" },
+ /* ATTR_FAULTSTATUS */ { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "fault_status" },
+ /* ATTR_FORCEALLOCATE */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "force_allocate" },
+ /* ATTR_HANDLE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "handle" },
+ /* ATTR_HELPCONTEXT */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, "helpcontext" },
+ /* ATTR_HELPFILE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "helpfile" },
+ /* ATTR_HELPSTRING */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, "helpstring" },
+ /* ATTR_HELPSTRINGCONTEXT */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, "helpstringcontext" },
+ /* ATTR_HELPSTRINGDLL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "helpstringdll" },
+ /* ATTR_HIDDEN */ { 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, "hidden" },
+ /* ATTR_ID */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, "id" },
+ /* ATTR_IDEMPOTENT */ { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "idempotent" },
+ /* ATTR_IGNORE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "ignore" },
+ /* ATTR_IIDIS */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "iid_is" },
+ /* ATTR_IMMEDIATEBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "immediatebind" },
+ /* ATTR_IMPLICIT_HANDLE */ { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "implicit_handle" },
+ /* ATTR_IN */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "in" },
+ /* ATTR_INPUTSYNC */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "inputsync" },
+ /* ATTR_LENGTHIS */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "length_is" },
+ /* ATTR_LIBLCID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "lcid" },
+ /* ATTR_LICENSED */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "licensed" },
+ /* ATTR_LOCAL */ { 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "local" },
+ /* ATTR_MARSHALING_BEHAVIOR */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "marshaling_behavior" },
+ /* ATTR_MAYBE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "maybe" },
+ /* ATTR_MESSAGE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "message" },
+ /* ATTR_NOCODE */ { 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nocode" },
+ /* ATTR_NONBROWSABLE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nonbrowsable" },
+ /* ATTR_NONCREATABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "noncreatable" },
+ /* ATTR_NONEXTENSIBLE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nonextensible" },
+ /* ATTR_NOTIFY */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "notify" },
+ /* ATTR_NOTIFYFLAG */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "notify_flag" },
+ /* ATTR_OBJECT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "object" },
+ /* ATTR_ODL */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "odl" },
+ /* ATTR_OLEAUTOMATION */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "oleautomation" },
+ /* ATTR_OPTIMIZE */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "optimize" },
+ /* ATTR_OPTIONAL */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "optional" },
+ /* ATTR_OUT */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "out" },
+ /* ATTR_PARAMLCID */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "lcid" },
+ /* ATTR_PARTIALIGNORE */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "partial_ignore" },
+ /* ATTR_POINTERDEFAULT */ { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "pointer_default" },
+ /* ATTR_POINTERTYPE */ { 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "ref, unique or ptr" },
+ /* ATTR_PROGID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "progid" },
+ /* ATTR_PROPGET */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propget" },
+ /* ATTR_PROPPUT */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propput" },
+ /* ATTR_PROPPUTREF */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propputref" },
+ /* ATTR_PROXY */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "proxy" },
+ /* ATTR_PUBLIC */ { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "public" },
+ /* ATTR_RANGE */ { 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "range" },
+ /* ATTR_READONLY */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "readonly" },
+ /* ATTR_REPRESENTAS */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "represent_as" },
+ /* ATTR_REQUESTEDIT */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "requestedit" },
+ /* ATTR_RESTRICTED */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, "restricted" },
+ /* ATTR_RETVAL */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "retval" },
+ /* ATTR_SIZEIS */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "size_is" },
+ /* ATTR_SOURCE */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "source" },
+ /* ATTR_STRICTCONTEXTHANDLE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "strict_context_handle" },
+ /* ATTR_STRING */ { 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "string" },
+ /* ATTR_SWITCHIS */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "switch_is" },
+ /* ATTR_SWITCHTYPE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "switch_type" },
+ /* ATTR_THREADING */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, "threading" },
+ /* ATTR_TRANSMITAS */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "transmit_as" },
+ /* ATTR_UIDEFAULT */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "uidefault" },
+ /* ATTR_USESGETLASTERROR */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "usesgetlasterror" },
+ /* ATTR_USERMARSHAL */ { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "user_marshal" },
+ /* ATTR_UUID */ { 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, "uuid" },
+ /* ATTR_V1ENUM */ { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "v1_enum" },
+ /* ATTR_VARARG */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "vararg" },
+ /* ATTR_VERSION */ { 1, 0, 0, 1, 0, 0, 1, 1, 0, 2, 0, 0, 1, 0, 0, 1, 0, 1, "version" },
+ /* ATTR_VIPROGID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "vi_progid" },
+ /* ATTR_WIREMARSHAL */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "wire_marshal" },
};
static attr_list_t *append_attr(attr_list_t *list, attr_t *attr)
@@ -2510,6 +2541,17 @@ static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs)
return attrs;
}
+static attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs)
+{
+ const attr_t *attr;
+ if (!attrs) return attrs;
+ LIST_FOR_EACH_ENTRY(attr, attrs, const attr_t, entry)
+ if (!allowed_attr[attr->type].on_runtimeclass)
+ error_loc("inapplicable attribute %s for runtimeclass %s\n",
+ allowed_attr[attr->type].display_name, name);
+ return attrs;
+}
+
static attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs)
{
const attr_t *attr;
@@ -2559,6 +2601,7 @@ static int is_allowed_conf_type(const type_t *type)
case TYPE_FUNCTION:
case TYPE_INTERFACE:
case TYPE_BITFIELD:
+ case TYPE_RUNTIMECLASS:
return FALSE;
case TYPE_APICONTRACT:
/* not supposed to be here */
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 5d0f24be06f..2e9be0748c1 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -353,6 +353,7 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
return TGT_ENUM;
case TYPE_POINTER:
if (type_get_type(type_pointer_get_ref_type(type)) == TYPE_INTERFACE ||
+ type_get_type(type_pointer_get_ref_type(type)) == TYPE_RUNTIMECLASS ||
(type_get_type(type_pointer_get_ref_type(type)) == TYPE_VOID && is_attr(attrs, ATTR_IIDIS)))
return TGT_IFACE_POINTER;
else if (is_aliaschain_attr(type_pointer_get_ref_type(type), ATTR_CONTEXTHANDLE))
@@ -373,6 +374,7 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
case TYPE_VOID:
case TYPE_ALIAS:
case TYPE_BITFIELD:
+ case TYPE_RUNTIMECLASS:
break;
case TYPE_APICONTRACT:
/* not supposed to be here */
@@ -1971,6 +1973,7 @@ unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align)
case TYPE_FUNCTION:
case TYPE_BITFIELD:
case TYPE_APICONTRACT:
+ case TYPE_RUNTIMECLASS:
/* these types should not be encountered here due to language
* restrictions (interface, void, coclass, module), logical
* restrictions (alias - due to type_get_type call above) or
@@ -2073,6 +2076,7 @@ static unsigned int type_buffer_alignment(const type_t *t)
case TYPE_FUNCTION:
case TYPE_BITFIELD:
case TYPE_APICONTRACT:
+ case TYPE_RUNTIMECLASS:
/* these types should not be encountered here due to language
* restrictions (interface, void, coclass, module), logical
* restrictions (alias - due to type_get_type call above) or
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index faf76440f93..ace6424e3a0 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -218,6 +218,7 @@ unsigned short get_type_vt(type_t *t)
case TYPE_MODULE:
case TYPE_UNION:
case TYPE_ENCAPSULATED_UNION:
+ case TYPE_RUNTIMECLASS:
return VT_USERDEFINED;
case TYPE_VOID:
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index df883576915..107a2d36a2f 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -215,6 +215,16 @@ type_t *type_new_coclass(char *name)
return type;
}
+type_t *type_new_runtimeclass(char *name, struct namespace *namespace)
+{
+ type_t *type = get_type(TYPE_RUNTIMECLASS, name, NULL, 0);
+ if (type->type_type != TYPE_RUNTIMECLASS || type->defined)
+ error_loc("%s: redefinition error; original definition was at %s:%d\n",
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
+ type->name = name;
+ type->namespace = namespace;
+ return type;
+}
type_t *type_new_array(const char *name, const decl_spec_t *element, int declptr,
unsigned int dim, expr_t *size_is, expr_t *length_is)
@@ -509,6 +519,13 @@ type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces)
return coclass;
}
+type_t *type_runtimeclass_define(type_t *runtimeclass, ifref_list_t *ifaces)
+{
+ runtimeclass->details.runtimeclass.ifaces = ifaces;
+ runtimeclass->defined = TRUE;
+ return runtimeclass;
+}
+
int type_is_equal(const type_t *type1, const type_t *type2)
{
if (type_get_type_detect_alias(type1) != type_get_type_detect_alias(type2))
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 7abec41a8fd..951084cf875 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -44,11 +44,13 @@ type_t *type_new_struct(char *name, struct namespace *namespace, int defined, va
type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields);
type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases);
type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
+type_t *type_new_runtimeclass(char *name, struct namespace *namespace);
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts);
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
void type_module_define(type_t *module, statement_list_t *stmts);
type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces);
+type_t *type_runtimeclass_define(type_t *runtimeclass, ifref_list_t *ifaces);
int type_is_equal(const type_t *type1, const type_t *type2);
const char *type_get_name(const type_t *type, enum name_type name_type);
char *gen_name(void);
@@ -222,6 +224,7 @@ static inline int type_is_complete(const type_t *type)
case TYPE_POINTER:
case TYPE_ARRAY:
case TYPE_BITFIELD:
+ case TYPE_RUNTIMECLASS:
return TRUE;
case TYPE_APICONTRACT:
assert(0);
@@ -322,6 +325,27 @@ static inline ifref_list_t *type_coclass_get_ifaces(const type_t *type)
return type->details.coclass.ifaces;
}
+static inline ifref_list_t *type_runtimeclass_get_ifaces(const type_t *type)
+{
+ type = type_get_real_type(type);
+ assert(type_get_type(type) == TYPE_RUNTIMECLASS);
+ return type->details.runtimeclass.ifaces;
+}
+
+static inline type_t *type_runtimeclass_get_default_iface(const type_t *type)
+{
+ ifref_list_t *ifaces = type_runtimeclass_get_ifaces(type);
+ ifref_t *entry;
+ attr_t *attr;
+
+ LIST_FOR_EACH_ENTRY(entry, ifaces, ifref_t, entry)
+ LIST_FOR_EACH_ENTRY(attr, entry->attrs, attr_t, entry)
+ if (attr->type == ATTR_DEFAULT) return entry->iface;
+
+ assert(0);
+ return NULL;
+}
+
static inline const decl_spec_t *type_pointer_get_ref(const type_t *type)
{
type = type_get_real_type(type);
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index fbaabfbc8c3..77313b30c0f 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -270,7 +270,8 @@ enum threading_type
THREADING_NEUTRAL,
THREADING_SINGLE,
THREADING_FREE,
- THREADING_BOTH
+ THREADING_BOTH,
+ THREADING_MTA,
};
enum marshaling_type
@@ -425,6 +426,11 @@ struct alias_details
struct _decl_spec_t aliasee;
};
+struct runtimeclass_details
+{
+ ifref_list_t *ifaces;
+};
+
#define HASHMAX 64
struct namespace {
@@ -452,6 +458,7 @@ enum type_type
TYPE_ARRAY,
TYPE_BITFIELD,
TYPE_APICONTRACT,
+ TYPE_RUNTIMECLASS,
};
struct _type_t {
@@ -472,6 +479,7 @@ struct _type_t {
struct pointer_details pointer;
struct bitfield_details bitfield;
struct alias_details alias;
+ struct runtimeclass_details runtimeclass;
} details;
const char *c_name;
unsigned int typestring_offset;
--
2.29.2

View File

@ -1,4 +1,4 @@
From 82858b36352aac56942221757ed5ecf9bc40e42b Mon Sep 17 00:00:00 2001
From 2719c1018570b5fed5058541f54a3334044de160 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 25 Sep 2020 17:13:47 +0200
Subject: [PATCH] widl: Support using qualified names for interfaces.
@ -11,10 +11,10 @@ the lookup namespace if it's active.
2 files changed, 38 insertions(+), 22 deletions(-)
diff --git a/include/windows.media.speechsynthesis.idl b/include/windows.media.speechsynthesis.idl
index 90bc9f279c6..89fe616b9b3 100644
index 71c51b74c0c..502261f79c6 100644
--- a/include/windows.media.speechsynthesis.idl
+++ b/include/windows.media.speechsynthesis.idl
@@ -65,7 +65,7 @@ namespace Windows {
@@ -64,7 +64,7 @@ namespace Windows {
]
runtimeclass VoiceInformation
{
@ -24,7 +24,7 @@ index 90bc9f279c6..89fe616b9b3 100644
}
}
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 110b570f4e4..6f1a7a68e9c 100644
index 480552e3723..1e3e254ec8c 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -75,6 +75,8 @@ static void append_chain_callconv(type_t *chain, char *callconv);

View File

@ -1,72 +1,16 @@
From d8ed7fe746a0ae8506683ea7aeadfb33ac6e0fa3 Mon Sep 17 00:00:00 2001
From 0a3ad97a115851c604c6291de3fc71ef7c418cba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 14:30:32 +0200
Subject: [PATCH] widl: Support WinRT static attribute parsing.
---
tools/widl/header.c | 30 ++++++++++++++++++++++++++++++
tools/widl/parser.l | 1 +
tools/widl/parser.y | 8 ++++++++
tools/widl/widltypes.h | 1 +
4 files changed, 40 insertions(+)
tools/widl/parser.l | 1 +
tools/widl/parser.y | 8 ++++++++
tools/widl/widltypes.h | 1 +
3 files changed, 10 insertions(+)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index ae392fe7de4..cb8231f213d 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -109,6 +109,17 @@ int is_attr(const attr_list_t *list, enum attr_type t)
return 0;
}
+static void get_attr_statics(const attr_list_t *attrs, expr_list_t *list)
+{
+ const attr_t *attr;
+ if (!attrs) return;
+ LIST_FOR_EACH_ENTRY( attr, attrs, const attr_t, entry )
+ {
+ if (attr->type != ATTR_STATIC) continue;
+ list_add_tail(list, &((expr_t *)attr->u.pval)->entry);
+ }
+}
+
void *get_attrp(const attr_list_t *list, enum attr_type t)
{
const attr_t *attr;
@@ -1495,6 +1506,8 @@ static void write_winrt_type_comments(FILE *header, const type_t *type)
{
expr_t *contract = get_attrp(type->attrs, ATTR_CONTRACT);
type_t *exclusiveto = get_attrp(type->attrs, ATTR_EXCLUSIVETO);
+ expr_list_t statics = LIST_INIT(statics);
+ get_attr_statics(type->attrs, &statics);
fprintf(header, " *\n");
if (contract)
{
@@ -1510,6 +1523,23 @@ static void write_winrt_type_comments(FILE *header, const type_t *type)
fprintf(header, " * Interface is a part of the implementation of type %s\n *\n", name);
free(name);
}
+ if (!list_empty(&statics))
+ {
+ expr_t *expr;
+ fprintf(header, " * RuntimeClass contains static methods.\n");
+ LIST_FOR_EACH_ENTRY(expr, &statics, expr_t, entry)
+ {
+ const type_t *iface = expr->u.tref.type, *apicontract = expr->ref->u.tref.type;
+ int version_req = expr->ref->ref->u.lval;
+ char *iface_name = format_namespace(iface->namespace, "", ".", iface->name, NULL);
+ char *name = format_namespace(apicontract->namespace, "", ".", apicontract->name, NULL);
+ fprintf(header, " * Static Methods exist on the %s interface starting with version %d.%d of the %s API contract\n",
+ iface_name, (version_req >> 16) & 0xffff, version_req & 0xffff, name);
+ free(iface_name);
+ free(name);
+ }
+ fprintf(header, " *\n");
+ }
if (type_get_type(type) == TYPE_RUNTIMECLASS)
{
ifref_list_t *ifaces = type_runtimeclass_get_ifaces(type);
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 51142ded6e6..2695e8cf622 100644
index 7e20d30e7f0..dd7cdae5338 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -426,6 +426,7 @@ static const struct keyword attr_keywords[] =
@ -78,7 +22,7 @@ index 51142ded6e6..2695e8cf622 100644
{"string", tSTRING, 0},
{"switch_is", tSWITCHIS, 0},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 6f1a7a68e9c..908e7b6d4da 100644
index 1e3e254ec8c..01cdbffe4c7 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -285,6 +285,7 @@ static typelib_t *current_typelib;
@ -118,7 +62,7 @@ index 6f1a7a68e9c..908e7b6d4da 100644
/* ATTR_STRING */ { 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "string" },
/* ATTR_SWITCHIS */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "switch_is" },
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index a3283761256..0e001f20cfb 100644
index 0fba33d6a09..8e9ba3e4460 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -162,6 +162,7 @@ enum attr_type

View File

@ -1,50 +1,18 @@
From 191aa18a3ce42474ef07e81132247b9f388bbc82 Mon Sep 17 00:00:00 2001
From ca531da15e6fb32e182d83e98857e6945163e083 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 00:31:57 +0200
Subject: [PATCH] widl: Support WinRT requires keyword.
---
tools/widl/header.c | 13 +++++++++++
tools/widl/parser.l | 1 +
tools/widl/parser.y | 49 ++++++++++++++++++++++++++++++++----------
tools/widl/typetree.c | 5 ++++-
tools/widl/typetree.h | 9 +++++++-
tools/widl/widltypes.h | 1 +
6 files changed, 65 insertions(+), 13 deletions(-)
5 files changed, 52 insertions(+), 13 deletions(-)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index cb8231f213d..78f17b0eee2 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -1506,6 +1506,7 @@ static void write_winrt_type_comments(FILE *header, const type_t *type)
{
expr_t *contract = get_attrp(type->attrs, ATTR_CONTRACT);
type_t *exclusiveto = get_attrp(type->attrs, ATTR_EXCLUSIVETO);
+ type_list_t *requires = type->type_type == TYPE_INTERFACE ? type_iface_get_requires(type) : NULL;
expr_list_t statics = LIST_INIT(statics);
get_attr_statics(type->attrs, &statics);
fprintf(header, " *\n");
@@ -1523,6 +1524,18 @@ static void write_winrt_type_comments(FILE *header, const type_t *type)
fprintf(header, " * Interface is a part of the implementation of type %s\n *\n", name);
free(name);
}
+ if (requires)
+ {
+ type_list_t *req;
+ fprintf(header, " * Any object which implements this interface must also implement the following interfaces:\n");
+ for (req = requires; req; req = req->next)
+ {
+ char *name = format_namespace(req->type->namespace, "", ".", req->type->name, NULL);
+ fprintf(header, " * %s\n", name);
+ free(name);
+ }
+ fprintf(header, " *\n");
+ }
if (!list_empty(&statics))
{
expr_t *expr;
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 2695e8cf622..5b332abf455 100644
index dd7cdae5338..0a5ef3c1b89 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -298,6 +298,7 @@ static const struct keyword keywords[] = {
@ -56,7 +24,7 @@ index 2695e8cf622..5b332abf455 100644
{"short", tSHORT, 0},
{"signed", tSIGNED, 0},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 908e7b6d4da..bf89ba771ac 100644
index 01cdbffe4c7..b774b01cdd7 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -38,12 +38,6 @@
@ -164,7 +132,7 @@ index 908e7b6d4da..bf89ba771ac 100644
static attr_list_t *move_attr(attr_list_t *dst, attr_list_t *src, enum attr_type type)
{
attr_t *attr;
@@ -3058,7 +3085,7 @@ static void check_async_uuid(type_t *iface)
@@ -3060,7 +3087,7 @@ static void check_async_uuid(type_t *iface)
stmts = append_statement(stmts, make_statement_declaration(finish_func));
}
@ -174,7 +142,7 @@ index 908e7b6d4da..bf89ba771ac 100644
}
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 107a2d36a2f..90c34302ca1 100644
index a18ffe1f4a5..fa21766b253 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -463,7 +463,7 @@ static unsigned int compute_method_indexes(type_t *iface)
@ -211,7 +179,7 @@ index 107a2d36a2f..90c34302ca1 100644
compute_method_indexes(dispiface);
}
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 951084cf875..8c555b91656 100644
index dc44c3f5fa7..a4ba4333bae 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -45,7 +45,7 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t
@ -223,7 +191,7 @@ index 951084cf875..8c555b91656 100644
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
void type_module_define(type_t *module, statement_list_t *stmts);
@@ -169,6 +169,13 @@ static inline type_t *type_iface_get_inherit(const type_t *type)
@@ -170,6 +170,13 @@ static inline type_t *type_iface_get_inherit(const type_t *type)
return type->details.iface->inherit;
}
@ -238,10 +206,10 @@ index 951084cf875..8c555b91656 100644
{
type = type_get_real_type(type);
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 0e001f20cfb..1848e891643 100644
index 8e9ba3e4460..7db2deb1839 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -386,6 +386,7 @@ struct iface_details
@@ -385,6 +385,7 @@ struct iface_details
struct _type_t *inherit;
struct _type_t *disp_inherit;
struct _type_t *async_iface;

View File

@ -1,46 +1,16 @@
From 05b4b34e57597d00a0d80d2247356ee5ba05db95 Mon Sep 17 00:00:00 2001
From 58ae5534e33ac94eaac4885bb0d9aa31abc5496d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 11:35:29 +0200
Subject: [PATCH] widl: Support WinRT activatable attribute.
---
tools/widl/header.c | 11 +++++++++++
tools/widl/parser.l | 1 +
tools/widl/parser.y | 3 +++
tools/widl/widltypes.h | 1 +
4 files changed, 16 insertions(+)
tools/widl/parser.l | 1 +
tools/widl/parser.y | 3 +++
tools/widl/widltypes.h | 1 +
3 files changed, 5 insertions(+)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index 78f17b0eee2..dd4ba935af7 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -1505,6 +1505,7 @@ static char *format_apicontract_macro(const type_t *type)
static void write_winrt_type_comments(FILE *header, const type_t *type)
{
expr_t *contract = get_attrp(type->attrs, ATTR_CONTRACT);
+ expr_t *activatable = get_attrp(type->attrs, ATTR_ACTIVATABLE);
type_t *exclusiveto = get_attrp(type->attrs, ATTR_EXCLUSIVETO);
type_list_t *requires = type->type_type == TYPE_INTERFACE ? type_iface_get_requires(type) : NULL;
expr_list_t statics = LIST_INIT(statics);
@@ -1518,6 +1519,16 @@ static void write_winrt_type_comments(FILE *header, const type_t *type)
fprintf(header, " * Introduced to %s in version %d.%d\n *\n", name, (ver >> 16) & 0xffff, ver & 0xffff);
free(name);
}
+ if (activatable)
+ {
+ const type_t *apicontract = activatable->u.tref.type;
+ int version_req = activatable->ref->u.lval;
+ char *name = format_namespace(apicontract->namespace, "", ".", apicontract->name, NULL);
+ fprintf(header, " * RuntimeClass can be activated.\n");
+ fprintf(header, " * Type can be activated via RoActivateInstance starting with version %d.%d of the %s API contract\n *\n",
+ (version_req >> 16) & 0xffff, version_req & 0xffff, name);
+ free(name);
+ }
if (exclusiveto)
{
char *name = format_namespace(exclusiveto->namespace, "", ".", exclusiveto->name, NULL);
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 5b332abf455..0b6b51b847e 100644
index 0a5ef3c1b89..e09722d7023 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -321,6 +321,7 @@ static const struct keyword keywords[] = {
@ -52,7 +22,7 @@ index 5b332abf455..0b6b51b847e 100644
{"agile", tAGILE, 1},
{"all_nodes", tALLNODES, 0},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index bf89ba771ac..4a464d28120 100644
index b774b01cdd7..e5a39872524 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -173,6 +173,7 @@ static typelib_t *current_typelib;
@ -80,7 +50,7 @@ index bf89ba771ac..4a464d28120 100644
/* ATTR_ALLOCATE */ { 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "allocate" },
/* ATTR_ANNOTATION */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "annotation" },
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 1848e891643..345d1a90d01 100644
index 7db2deb1839..a3000a7417b 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -69,6 +69,7 @@ typedef struct list warning_list_t;

View File

@ -1,4 +1,4 @@
From 9c28d7140282cb09d7cc37f6b16d88789b49285f Mon Sep 17 00:00:00 2001
From e0a0dba826b36993a81ae1df1186e53bfbe8e61c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 16:31:16 +0200
Subject: [PATCH] widl: Support WinRT parameterized type parsing.
@ -79,10 +79,10 @@ index 13bd5a889aa..c83e9aa5ec0 100644
break;
case TYPE_ALIAS:
diff --git a/tools/widl/header.c b/tools/widl/header.c
index dd4ba935af7..4de34a59d22 100644
index 4db244fef5d..344b6891747 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -501,6 +501,8 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i
@@ -488,6 +488,8 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i
break;
}
case TYPE_APICONTRACT:
@ -91,7 +91,7 @@ index dd4ba935af7..4de34a59d22 100644
/* shouldn't be here */
assert(0);
break;
@@ -568,6 +570,8 @@ void write_type_right(FILE *h, type_t *t, int is_field)
@@ -555,6 +557,8 @@ void write_type_right(FILE *h, type_t *t, int is_field)
case TYPE_RUNTIMECLASS:
break;
case TYPE_APICONTRACT:
@ -100,7 +100,7 @@ index dd4ba935af7..4de34a59d22 100644
/* not supposed to be here */
assert(0);
break;
@@ -1969,10 +1973,8 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
@@ -1860,10 +1864,8 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
write_apicontract(header, stmt->u.type);
else if (type_get_type(stmt->u.type) == TYPE_RUNTIMECLASS)
write_runtimeclass(header, stmt->u.type);
@ -113,7 +113,7 @@ index dd4ba935af7..4de34a59d22 100644
case STMT_TYPEREF:
/* FIXME: shouldn't write out forward declarations for undefined
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 4a464d28120..48135d4372e 100644
index e5a39872524..9083df8cf27 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -81,6 +81,8 @@ static var_t *reg_const(var_t *var);
@ -288,7 +288,7 @@ index ace6424e3a0..6f6c5f3ccc8 100644
assert(0);
break;
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 90c34302ca1..b9bc4a1f075 100644
index fa21766b253..f451f8f3a1a 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -463,6 +463,36 @@ static unsigned int compute_method_indexes(type_t *iface)
@ -329,7 +329,7 @@ index 90c34302ca1..b9bc4a1f075 100644
{
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 8c555b91656..b04a67f6b47 100644
index a4ba4333bae..79c5a01ce3a 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -45,6 +45,8 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t
@ -341,7 +341,7 @@ index 8c555b91656..b04a67f6b47 100644
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
@@ -234,6 +236,8 @@ static inline int type_is_complete(const type_t *type)
@@ -235,6 +237,8 @@ static inline int type_is_complete(const type_t *type)
case TYPE_RUNTIMECLASS:
return TRUE;
case TYPE_APICONTRACT:
@ -351,10 +351,10 @@ index 8c555b91656..b04a67f6b47 100644
break;
}
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 345d1a90d01..8dd6958ba35 100644
index a3000a7417b..2c0ac4003ce 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -437,6 +437,12 @@ struct runtimeclass_details
@@ -436,6 +436,12 @@ struct runtimeclass_details
ifref_list_t *ifaces;
};
@ -367,7 +367,7 @@ index 345d1a90d01..8dd6958ba35 100644
#define HASHMAX 64
struct namespace {
@@ -465,6 +471,8 @@ enum type_type
@@ -464,6 +470,8 @@ enum type_type
TYPE_BITFIELD,
TYPE_APICONTRACT,
TYPE_RUNTIMECLASS,
@ -376,7 +376,7 @@ index 345d1a90d01..8dd6958ba35 100644
};
struct _type_t {
@@ -486,6 +494,7 @@ struct _type_t {
@@ -485,6 +493,7 @@ struct _type_t {
struct bitfield_details bitfield;
struct alias_details alias;
struct runtimeclass_details runtimeclass;

View File

@ -1,4 +1,4 @@
From cbc4c4a9c0c7c1fc5c99fe665494e58008d67fc7 Mon Sep 17 00:00:00 2001
From 99bc0225cdc921dc87d3906de145533690ad7816 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 1 Dec 2020 14:41:01 +0100
Subject: [PATCH] widl: Introduce new strappend helper.
@ -11,7 +11,7 @@ And use it for format_namespace to grow buffer as needed.
3 files changed, 53 insertions(+), 31 deletions(-)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index b9bc4a1f075..3cf324cc7f6 100644
index f451f8f3a1a..95c04c245b8 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -89,41 +89,25 @@ const char *type_get_name(const type_t *type, enum name_type name_type)

View File

@ -1,4 +1,4 @@
From 5d655b453867b46faf2fda420d08cad412b50729 Mon Sep 17 00:00:00 2001
From 680c7575c78c63e8bc8e971d8f1385175bf5f106 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 12 Oct 2020 23:23:18 +0200
Subject: [PATCH] widl: Support partially specialized parameterized type.
@ -39,7 +39,7 @@ index ab7c4753c3b..5f7a49c38e4 100644
contract(Windows.Foundation.FoundationContract, 1.0),
uuid(bbe1fa4c-b0e3-4583-baef-1f1b2e483e56)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 48135d4372e..14c9c5d007e 100644
index 9083df8cf27..61bbe2a50ee 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -302,6 +302,8 @@ static typelib_t *current_typelib;
@ -96,7 +96,7 @@ index 48135d4372e..14c9c5d007e 100644
| base_type { $$ = $1; }
| enumdef { $$ = $1; }
| tENUM aIDENTIFIER { $$ = type_new_enum($2, current_namespace, FALSE, NULL); }
@@ -3367,3 +3386,19 @@ static void check_def(const type_t *t)
@@ -3369,3 +3388,19 @@ static void check_def(const type_t *t)
error_loc("%s: redefinition error; original definition was at %s:%d\n",
t->name, t->loc_info.input_name, t->loc_info.line_number);
}
@ -117,7 +117,7 @@ index 48135d4372e..14c9c5d007e 100644
+ return type;
+}
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 3cf324cc7f6..e2d0a573c0d 100644
index 95c04c245b8..d2c472fcca0 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -100,13 +100,40 @@ static size_t append_namespace(char **buf, size_t *len, size_t pos, struct names
@ -180,7 +180,7 @@ index 3cf324cc7f6..e2d0a573c0d 100644
{
type_t *iface = make_type(TYPE_INTERFACE);
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index b04a67f6b47..472fdf2d5fc 100644
index 79c5a01ce3a..c46a2629467 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -45,6 +45,8 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t
@ -193,10 +193,10 @@ index b04a67f6b47..472fdf2d5fc 100644
void type_parameterized_interface_define(type_t *type, type_list_t *params, type_t *inherit, statement_list_t *stmts);
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 8dd6958ba35..ff71a1859ae 100644
index 2c0ac4003ce..be82342e31a 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -651,6 +651,7 @@ void init_loc_info(loc_info_t *);
@@ -650,6 +650,7 @@ void init_loc_info(loc_info_t *);
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix,
const char *abi_prefix);

View File

@ -1,4 +1,4 @@
From 798ecb14bb4856d1bee11f97ab98158d81b9b504 Mon Sep 17 00:00:00 2001
From 5ef017f5ca2e3676b9558f328b192033875d5ba1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 1 Dec 2020 17:34:23 +0100
Subject: [PATCH] widl: Support WinRT parameterized interface type.
@ -8,19 +8,25 @@ blocks, in the same way MIDL does, generating a new interface to the
header from the parameterized type template, replacing its parameters
with the given types.
---
include/windows.media.speechsynthesis.idl | 23 +++
include/windows.media.speechsynthesis.idl | 24 +++
tools/widl/header.c | 7 +-
tools/widl/parser.l | 1 +
tools/widl/parser.y | 63 +++++-
tools/widl/typetree.c | 238 ++++++++++++++++++++++
tools/widl/typetree.h | 2 +
6 files changed, 329 insertions(+), 5 deletions(-)
6 files changed, 330 insertions(+), 5 deletions(-)
diff --git a/include/windows.media.speechsynthesis.idl b/include/windows.media.speechsynthesis.idl
index 89fe616b9b3..40c45c82051 100644
index 502261f79c6..7e9af77316a 100644
--- a/include/windows.media.speechsynthesis.idl
+++ b/include/windows.media.speechsynthesis.idl
@@ -35,6 +35,18 @@ namespace Windows {
@@ -29,11 +29,24 @@ namespace Windows {
typedef enum VoiceGender VoiceGender;
interface IInstalledVoicesStatic;
interface IVoiceInformation;
+ runtimeclass SpeechSynthesizer;
runtimeclass VoiceInformation;
}
}
}
@ -39,7 +45,7 @@ index 89fe616b9b3..40c45c82051 100644
namespace Windows {
namespace Media {
namespace SpeechSynthesis {
@@ -59,6 +71,17 @@ namespace Windows {
@@ -58,6 +71,17 @@ namespace Windows {
[propget] HRESULT Gender([out] [retval] VoiceGender* value);
}
@ -58,10 +64,10 @@ index 89fe616b9b3..40c45c82051 100644
contract(Windows.Foundation.UniversalApiContract, 1.0),
marshaling_behavior(agile)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index 4de34a59d22..d607df5d1c9 100644
index 344b6891747..e81c31aabb2 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -1492,7 +1492,8 @@ static void write_forward(FILE *header, type_t *iface)
@@ -1479,7 +1479,8 @@ static void write_forward(FILE *header, type_t *iface)
fprintf(header, "typedef interface %s %s;\n", iface->c_name, iface->c_name);
fprintf(header, "#ifdef __cplusplus\n");
write_namespace_start(header, iface->namespace);
@ -71,7 +77,7 @@ index 4de34a59d22..d607df5d1c9 100644
write_namespace_end(header, iface->namespace);
fprintf(header, "#endif /* __cplusplus */\n");
fprintf(header, "#endif\n\n" );
@@ -1655,11 +1656,13 @@ static void write_com_interface_end(FILE *header, type_t *iface)
@@ -1548,11 +1549,13 @@ static void write_com_interface_end(FILE *header, type_t *iface)
write_namespace_start(header, iface->namespace);
}
if (uuid) {
@ -87,7 +93,7 @@ index 4de34a59d22..d607df5d1c9 100644
if (type_iface_get_inherit(iface))
{
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 0b6b51b847e..44deb9fee5c 100644
index e09722d7023..228e988530f 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -276,6 +276,7 @@ static const struct keyword keywords[] = {
@ -99,7 +105,7 @@ index 0b6b51b847e..44deb9fee5c 100644
{"dispinterface", tDISPINTERFACE, 0},
{"double", tDOUBLE, 0},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 14c9c5d007e..4d0390fd606 100644
index 61bbe2a50ee..60268f1b7d4 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -84,6 +84,7 @@ static void push_lookup_namespace(const char *name);
@ -192,7 +198,7 @@ index 14c9c5d007e..4d0390fd606 100644
;
int_statements: { $$ = NULL; }
@@ -3164,6 +3189,27 @@ static void check_async_uuid(type_t *iface)
@@ -3166,6 +3191,27 @@ static void check_async_uuid(type_t *iface)
iface->details.iface->async_iface = async_iface->details.iface->async_iface = async_iface;
}
@ -220,7 +226,7 @@ index 14c9c5d007e..4d0390fd606 100644
static void check_statements(const statement_list_t *stmts, int is_inside_library)
{
const statement_t *stmt;
@@ -3345,6 +3391,15 @@ static statement_t *make_statement_typedef(declarator_list_t *decls, int declonl
@@ -3347,6 +3393,15 @@ static statement_t *make_statement_typedef(declarator_list_t *decls, int declonl
return stmt;
}
@ -236,7 +242,7 @@ index 14c9c5d007e..4d0390fd606 100644
static statement_list_t *append_statements(statement_list_t *l1, statement_list_t *l2)
{
if (!l2) return l1;
@@ -3396,8 +3451,10 @@ type_t *find_parameterized_type(type_t *type, type_list_t *params, int t)
@@ -3398,8 +3453,10 @@ type_t *find_parameterized_type(type_t *type, type_list_t *params, int t)
assert(type->type_type == TYPE_PARAMETERIZED_TYPE);
type = type_parameterized_type_specialize_partial(type, params);
}
@ -250,7 +256,7 @@ index 14c9c5d007e..4d0390fd606 100644
free(name);
return type;
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index e2d0a573c0d..a9a1ab390e8 100644
index d2c472fcca0..a7c04a509e5 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -137,6 +137,41 @@ char *format_parameterized_type_name(type_t *type, type_list_t *params)
@ -513,7 +519,7 @@ index e2d0a573c0d..a9a1ab390e8 100644
{
type_t *iface = make_type(TYPE_INTERFACE);
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 472fdf2d5fc..e1a52d21d09 100644
index c46a2629467..1e726d3a264 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -46,6 +46,8 @@ type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *unio

View File

@ -1,4 +1,4 @@
From 2226e8730b2a9a5170c34260448a16a2080ddf91 Mon Sep 17 00:00:00 2001
From 4f91c256296729cd02b8ed85b5caf28ac7ff1e64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 24 Sep 2020 00:00:54 +0200
Subject: [PATCH] widl: Support WinRT delegate type.
@ -28,10 +28,10 @@ index c83e9aa5ec0..88d59290d6b 100644
break;
case TYPE_ALIAS:
diff --git a/tools/widl/header.c b/tools/widl/header.c
index d607df5d1c9..37e96a8dcbe 100644
index e81c31aabb2..e3a2aec08fe 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -483,6 +483,9 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i
@@ -470,6 +470,9 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i
case TYPE_RUNTIMECLASS:
fprintf(h, "%s", type_get_name(type_runtimeclass_get_default_iface(t), name_type));
break;
@ -41,7 +41,7 @@ index d607df5d1c9..37e96a8dcbe 100644
case TYPE_VOID:
fprintf(h, "void");
break;
@@ -568,6 +571,7 @@ void write_type_right(FILE *h, type_t *t, int is_field)
@@ -555,6 +558,7 @@ void write_type_right(FILE *h, type_t *t, int is_field)
case TYPE_COCLASS:
case TYPE_INTERFACE:
case TYPE_RUNTIMECLASS:
@ -49,7 +49,7 @@ index d607df5d1c9..37e96a8dcbe 100644
break;
case TYPE_APICONTRACT:
case TYPE_PARAMETERIZED_TYPE:
@@ -987,7 +991,7 @@ int has_out_arg_or_return(const var_t *func)
@@ -974,7 +978,7 @@ int has_out_arg_or_return(const var_t *func)
int is_object(const type_t *iface)
{
const attr_t *attr;
@ -58,7 +58,7 @@ index d607df5d1c9..37e96a8dcbe 100644
return 1;
if (iface->attrs) LIST_FOR_EACH_ENTRY( attr, iface->attrs, const attr_t, entry )
if (attr->type == ATTR_OBJECT || attr->type == ATTR_ODL) return 1;
@@ -1904,9 +1908,10 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts)
@@ -1795,9 +1799,10 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts)
switch (stmt->type)
{
case STMT_TYPE:
@ -70,7 +70,7 @@ index d607df5d1c9..37e96a8dcbe 100644
if (is_object(iface) || is_attr(iface->attrs, ATTR_DISPINTERFACE))
{
write_forward(header, iface);
@@ -1946,10 +1951,11 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
@@ -1837,10 +1842,11 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
switch (stmt->type)
{
case STMT_TYPE:
@ -86,7 +86,7 @@ index d607df5d1c9..37e96a8dcbe 100644
if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type))
{
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 44deb9fee5c..6c1b0473ab4 100644
index 228e988530f..c3d4b4ebd8e 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -278,6 +278,7 @@ static const struct keyword keywords[] = {
@ -98,7 +98,7 @@ index 44deb9fee5c..6c1b0473ab4 100644
{"double", tDOUBLE, 0},
{"enum", tENUM, 0},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 4d0390fd606..569669dcfac 100644
index 60268f1b7d4..3670da04715 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -120,6 +120,7 @@ static statement_t *make_statement_module(type_t *type);
@ -167,7 +167,7 @@ index 4d0390fd606..569669dcfac 100644
return FALSE;
case TYPE_APICONTRACT:
case TYPE_PARAMETERIZED_TYPE:
@@ -3400,6 +3417,14 @@ static statement_t *make_statement_parameterized_type(type_t *type, type_list_t
@@ -3402,6 +3419,14 @@ static statement_t *make_statement_parameterized_type(type_t *type, type_list_t
return stmt;
}
@ -231,7 +231,7 @@ index 6f6c5f3ccc8..8b2a2401367 100644
case TYPE_VOID:
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index a9a1ab390e8..89ebc0b5999 100644
index a7c04a509e5..8c3ed223144 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -509,6 +509,14 @@ static unsigned int compute_method_indexes(type_t *iface)
@ -286,7 +286,7 @@ index a9a1ab390e8..89ebc0b5999 100644
{
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index e1a52d21d09..de3db4e7c7e 100644
index 1e726d3a264..3b5db8f50f6 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -52,6 +52,7 @@ type_t *find_parameterized_type(type_t *type, type_list_t *params, int t);
@ -297,7 +297,7 @@ index e1a52d21d09..de3db4e7c7e 100644
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
void type_module_define(type_t *module, statement_list_t *stmts);
@@ -238,6 +239,7 @@ static inline int type_is_complete(const type_t *type)
@@ -239,6 +240,7 @@ static inline int type_is_complete(const type_t *type)
case TYPE_ARRAY:
case TYPE_BITFIELD:
case TYPE_RUNTIMECLASS:
@ -320,10 +320,10 @@ index e1a52d21d09..de3db4e7c7e 100644
{
type = type_get_real_type(type);
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index ff71a1859ae..6feabafbefd 100644
index be82342e31a..d55922b72e9 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -443,6 +443,11 @@ struct parameterized_details
@@ -442,6 +442,11 @@ struct parameterized_details
type_list_t *params;
};
@ -335,7 +335,7 @@ index ff71a1859ae..6feabafbefd 100644
#define HASHMAX 64
struct namespace {
@@ -473,6 +478,7 @@ enum type_type
@@ -472,6 +477,7 @@ enum type_type
TYPE_RUNTIMECLASS,
TYPE_PARAMETERIZED_TYPE,
TYPE_PARAMETER,
@ -343,7 +343,7 @@ index ff71a1859ae..6feabafbefd 100644
};
struct _type_t {
@@ -495,6 +501,7 @@ struct _type_t {
@@ -494,6 +500,7 @@ struct _type_t {
struct alias_details alias;
struct runtimeclass_details runtimeclass;
struct parameterized_details parameterized;

View File

@ -1,4 +1,4 @@
From 9784639ef93dc7e775d4b42d851179eee728f5d9 Mon Sep 17 00:00:00 2001
From fb6ba3b61a5b4c1c0fc8ccb061d29680f247d17c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 1 Dec 2020 17:43:01 +0100
Subject: [PATCH] widl: Support WinRT parameterized delegate type.
@ -28,7 +28,7 @@ index 5f7a49c38e4..9583fa5bcc8 100644
{
[
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 569669dcfac..6811f80a088 100644
index 3670da04715..12be073c01a 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1084,6 +1084,17 @@ delegatedef:
@ -50,7 +50,7 @@ index 569669dcfac..6811f80a088 100644
required_types:
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 89ebc0b5999..e9eb2a4e75e 100644
index 8c3ed223144..6a30891f656 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -142,16 +142,16 @@ static char const *parameterized_type_shorthands[][2] = {
@ -169,7 +169,7 @@ index 89ebc0b5999..e9eb2a4e75e 100644
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods)
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index de3db4e7c7e..939bc5b412e 100644
index 3b5db8f50f6..e354259ab18 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -53,6 +53,7 @@ void type_parameterized_interface_declare(type_t *type, type_list_t *params);

View File

@ -1,4 +1,4 @@
From 76f48d39dd43be3a66117b7cd49e70dea962d52b Mon Sep 17 00:00:00 2001
From 466bf2736d778fdc23bdcb338c00fac0aa80c1b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 1 Dec 2020 17:44:43 +0100
Subject: [PATCH] widl: Compute signatures for parameterized types.
@ -10,7 +10,7 @@ Subject: [PATCH] widl: Compute signatures for parameterized types.
3 files changed, 163 insertions(+)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index e9eb2a4e75e..c0a7b584b0c 100644
index 6a30891f656..74ee92ed094 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -49,6 +49,7 @@ type_t *make_type(enum type_type type)
@ -204,10 +204,10 @@ index e9eb2a4e75e..c0a7b584b0c 100644
}
compute_method_indexes(iface);
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 939bc5b412e..b4257fe615f 100644
index e354259ab18..4d705a060f3 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -80,6 +80,16 @@ static inline enum type_type type_get_type(const type_t *type)
@@ -81,6 +81,16 @@ static inline enum type_type type_get_type(const type_t *type)
return type_get_type_detect_alias(type_get_real_type(type));
}
@ -225,10 +225,10 @@ index 939bc5b412e..b4257fe615f 100644
{
type = type_get_real_type(type);
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 6feabafbefd..c784ae4ce52 100644
index d55922b72e9..a1fce0ef87d 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -504,6 +504,7 @@ struct _type_t {
@@ -503,6 +503,7 @@ struct _type_t {
struct delegate_details delegate;
} details;
const char *c_name;
@ -236,7 +236,7 @@ index 6feabafbefd..c784ae4ce52 100644
unsigned int typestring_offset;
unsigned int ptrdesc; /* used for complex structs */
int typelib_idx;
@@ -659,6 +660,7 @@ void init_loc_info(loc_info_t *);
@@ -658,6 +659,7 @@ void init_loc_info(loc_info_t *);
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix,
const char *abi_prefix);
char *format_parameterized_type_name(type_t *type, type_list_t *params);

View File

@ -1,4 +1,4 @@
From df420c2d870d9ec0bccd91cedde12be6506620d7 Mon Sep 17 00:00:00 2001
From 9d5f825326a9e00db5eacbc0beeafbcb4bea85ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 28 Sep 2020 17:00:41 +0200
Subject: [PATCH] widl: Compute uuids for parameterized types.
@ -222,7 +222,7 @@ index 3c2fd2914bf..208b193ac87 100644
+
#endif
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index c0a7b584b0c..176b34d1846 100644
index 74ee92ed094..4002b9d62ae 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -29,6 +29,7 @@
@ -300,10 +300,10 @@ index c0a7b584b0c..176b34d1846 100644
return iface;
}
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index b4257fe615f..46a223d50e3 100644
index 4d705a060f3..eefd79f139d 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -84,7 +84,7 @@ static inline const GUID *type_get_uuid(const type_t *type)
@@ -85,7 +85,7 @@ static inline const GUID *type_get_uuid(const type_t *type)
{
static const GUID empty;
attr_t *attr;

View File

@ -1,4 +1,4 @@
From 46d985e5575c2f1868d6c50d2e00400205f11b92 Mon Sep 17 00:00:00 2001
From f41e0e81316bade72909f7abd6eb9943c44fff72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Wed, 26 Aug 2020 22:46:02 +0200
Subject: [PATCH] widl: Generate helper macros for WinRT implementation.
@ -22,10 +22,10 @@ interface methods with the simple non-prefixed names instead.
3 files changed, 90 insertions(+), 2 deletions(-)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index 37e96a8dcbe..3c4a9df9a83 100644
index e3a2aec08fe..5130d82a774 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -50,6 +50,8 @@ static void write_winrt_type_comments(FILE *header, const type_t *type);
@@ -48,6 +48,8 @@ static void write_type_v(FILE *f, const decl_spec_t *t, int is_field, int declon
static void write_apicontract_guard_start(FILE *header, const expr_t *expr);
static void write_apicontract_guard_end(FILE *header, const expr_t *expr);
@ -34,7 +34,7 @@ index 37e96a8dcbe..3c4a9df9a83 100644
static void indent(FILE *h, int delta)
{
int c;
@@ -616,10 +618,11 @@ static void write_type_definition(FILE *f, type_t *t, int declonly)
@@ -603,10 +605,11 @@ static void write_type_definition(FILE *f, type_t *t, int declonly)
t->written = save_written;
write_namespace_end(f, t->namespace);
fprintf(f, "extern \"C\" {\n");
@ -48,7 +48,7 @@ index 37e96a8dcbe..3c4a9df9a83 100644
}
if (contract) write_apicontract_guard_end(f, contract);
}
@@ -1643,6 +1646,70 @@ static void write_com_interface_start(FILE *header, const type_t *iface)
@@ -1536,6 +1539,70 @@ static void write_com_interface_start(FILE *header, const type_t *iface)
fprintf(header,"#define __%s_%sINTERFACE_DEFINED__\n\n", iface->c_name, dispinterface ? "DISP" : "");
}
@ -119,7 +119,7 @@ index 37e96a8dcbe..3c4a9df9a83 100644
static void write_com_interface_end(FILE *header, type_t *iface)
{
int dispinterface = is_attr(iface->attrs, ATTR_DISPINTERFACE);
@@ -1715,6 +1782,7 @@ static void write_com_interface_end(FILE *header, type_t *iface)
@@ -1608,6 +1675,7 @@ static void write_com_interface_end(FILE *header, type_t *iface)
fprintf(header, "#else\n");
write_inline_wrappers(header, type, type, iface->c_name);
fprintf(header, "#endif\n");
@ -128,7 +128,7 @@ index 37e96a8dcbe..3c4a9df9a83 100644
fprintf(header, "\n");
fprintf(header, "#endif\n");
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 176b34d1846..439b1b54b8a 100644
index 4002b9d62ae..cd2ce3c9348 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -51,6 +51,7 @@ type_t *make_type(enum type_type type)
@ -177,10 +177,10 @@ index 176b34d1846..439b1b54b8a 100644
return new_type;
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index c784ae4ce52..a5618646366 100644
index a1fce0ef87d..21598a9213d 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -505,6 +505,7 @@ struct _type_t {
@@ -504,6 +504,7 @@ struct _type_t {
} details;
const char *c_name;
const char *signature;

View File

@ -1,4 +1,4 @@
From 0f430cec7cce71db0ac00321de5e4f8f52e7adc5 Mon Sep 17 00:00:00 2001
From 61216c5e78aaa94ada1580b5b95a9171b78cbb5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 25 Sep 2020 17:05:17 +0200
Subject: [PATCH] include: Add IVectorView<HSTRING> declaration to

View File

@ -0,0 +1,29 @@
From e2d3c65428092ad029f1182ecd5768f54f3e105a Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 7 Jan 2021 13:07:33 +0100
Subject: [PATCH] widl: Never use the namespace ABI prefix for global types.
Otherwise we end up with types like ABI::IInspectable.
---
tools/widl/typetree.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index cd2ce3c9348..a6fc2b79857 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -106,9 +106,10 @@ static size_t append_namespace(char **buf, size_t *len, size_t pos, struct names
static size_t append_namespaces(char **buf, size_t *len, size_t pos, struct namespace *namespace, const char *prefix,
const char *separator, const char *suffix, const char *abi_prefix)
{
+ int nested = namespace && !is_global_namespace(namespace);
size_t n = 0;
n += strappend(buf, len, pos + n, "%s", prefix);
- n += append_namespace(buf, len, pos + n, namespace, separator, abi_prefix);
+ if (nested) n += append_namespace(buf, len, pos + n, namespace, separator, abi_prefix);
n += strappend(buf, len, pos + n, "%s", suffix);
return n;
}
--
2.29.2

View File

@ -0,0 +1,140 @@
From 800d1ba0a89f1344bd13ef1a078764c8eba28296 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 7 Jan 2021 14:28:21 +0100
Subject: [PATCH] widl: Precompute qualified type names, and use them for C++
interfaces.
This is what MIDL does and avoid mismatching and even fixes some compiling issues.
---
tools/widl/header.c | 8 +++-----
tools/widl/parser.y | 6 ++++++
tools/widl/typetree.c | 16 ++++++++++++++++
tools/widl/typetree.h | 1 +
tools/widl/widltypes.h | 1 +
5 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index 5130d82a774..60f0cd96fce 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -137,15 +137,13 @@ static void write_guid(FILE *f, const char *guid_prefix, const char *name, const
static void write_uuid_decl(FILE *f, type_t *type, const UUID *uuid)
{
- char *name = format_namespace(type->namespace, "", "::", type->name, use_abi_namespace ? "ABI" : NULL);
fprintf(f, "#ifdef __CRT_UUID_DECL\n");
fprintf(f, "__CRT_UUID_DECL(%s, 0x%08x, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x,"
"0x%02x,0x%02x,0x%02x,0x%02x,0x%02x)\n",
- name, uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1],
+ type->qualified_name, uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1],
uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6],
uuid->Data4[7]);
fprintf(f, "#endif\n");
- free(name);
}
static const char *uuid_string(const UUID *uuid)
@@ -467,13 +465,13 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i
case TYPE_INTERFACE:
case TYPE_MODULE:
case TYPE_COCLASS:
- fprintf(h, "%s", name);
+ fprintf(h, "%s", type_get_qualified_name(t, name_type));
break;
case TYPE_RUNTIMECLASS:
fprintf(h, "%s", type_get_name(type_runtimeclass_get_default_iface(t), name_type));
break;
case TYPE_DELEGATE:
- fprintf(h, "%s", type_get_name(type_delegate_get_iface(t), name_type));
+ fprintf(h, "%s", type_get_qualified_name(type_delegate_get_iface(t), name_type));
break;
case TYPE_VOID:
fprintf(h, "void");
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 12be073c01a..35b6ca74cf2 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -2158,9 +2158,15 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
nt = xmalloc(sizeof(struct rtype));
nt->name = name;
if (is_global_namespace(namespace))
+ {
type->c_name = name;
+ type->qualified_name = name;
+ }
else
+ {
type->c_name = format_namespace(namespace, "__x_", "_C", name, use_abi_namespace ? "ABI" : NULL);
+ type->qualified_name = format_namespace(namespace, "", "::", name, use_abi_namespace ? "ABI" : NULL);
+ }
nt->type = type;
nt->t = t;
nt->next = namespace->type_hash[hash];
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index a6fc2b79857..b4dac8b5f70 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -52,6 +52,7 @@ type_t *make_type(enum type_type type)
t->c_name = NULL;
t->signature = NULL;
t->short_name = NULL;
+ t->qualified_name = NULL;
memset(&t->details, 0, sizeof(t->details));
t->typestring_offset = 0;
t->ptrdesc = 0;
@@ -92,6 +93,20 @@ const char *type_get_name(const type_t *type, enum name_type name_type)
return NULL;
}
+const char *type_get_qualified_name(const type_t *type, enum name_type name_type)
+{
+ assert(!!type->c_name == !!type->qualified_name);
+ switch(name_type) {
+ case NAME_DEFAULT:
+ return type->qualified_name;
+ case NAME_C:
+ return type->c_name;
+ }
+
+ assert(0);
+ return NULL;
+}
+
static size_t append_namespace(char **buf, size_t *len, size_t pos, struct namespace *namespace, const char *separator, const char *abi_prefix)
{
int nested = namespace && !is_global_namespace(namespace);
@@ -684,6 +699,7 @@ static void compute_delegate_iface_names(type_t *delegate, type_t *type, type_li
iface->name = strmake("I%s", delegate->name);
if (type) iface->c_name = format_parameterized_type_c_name(type, params, "I");
else iface->c_name = format_namespace(delegate->namespace, "__x_", "_C", iface->name, use_abi_namespace ? "ABI" : NULL);
+ iface->qualified_name = format_namespace(delegate->namespace, "", "::", iface->name, use_abi_namespace ? "ABI" : NULL);
}
static void compute_interface_signature_uuid(type_t *iface)
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index eefd79f139d..b48c794c125 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -61,6 +61,7 @@ type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces);
type_t *type_runtimeclass_define(type_t *runtimeclass, ifref_list_t *ifaces);
int type_is_equal(const type_t *type1, const type_t *type2);
const char *type_get_name(const type_t *type, enum name_type name_type);
+const char *type_get_qualified_name(const type_t *type, enum name_type name_type);
char *gen_name(void);
extern int is_attr(const attr_list_t *list, enum attr_type t);
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 21598a9213d..6aeeac228b6 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -505,6 +505,7 @@ struct _type_t {
const char *c_name;
const char *signature;
const char *short_name;
+ const char *qualified_name;
unsigned int typestring_offset;
unsigned int ptrdesc; /* used for complex structs */
int typelib_idx;
--
2.29.2

View File

@ -0,0 +1,26 @@
From dc7e23bd6fc0a32c640957dfe8bab603ef800871 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 7 Jan 2021 14:14:22 +0100
Subject: [PATCH] widl: Define the C type name as an alias for the C++
qualified name.
---
tools/widl/header.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index 60f0cd96fce..e635f6360f7 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -1483,6 +1483,8 @@ static void write_forward(FILE *header, type_t *iface)
fprintf(header, "#define __%s_FWD_DEFINED__\n", iface->c_name);
fprintf(header, "typedef interface %s %s;\n", iface->c_name, iface->c_name);
fprintf(header, "#ifdef __cplusplus\n");
+ if (iface->namespace && !is_global_namespace(iface->namespace))
+ fprintf(header, "#define %s %s\n", iface->c_name, iface->qualified_name);
write_namespace_start(header, iface->namespace);
if (strchr(iface->name, '<')) write_line(header, 0, "template<> struct %s;", iface->name);
else write_line(header, 0, "interface %s;", iface->name);
--
2.29.2

View File

@ -1 +1 @@
24b9203d3544001dd51894f1c1edd99819367198
f72ef20e88fba67254caf0124ab8713e3d15fa2a