diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 0afed93d..bb67ec45 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "4807a8f588c67e2296474399368a96c0046120fd" + echo "92fb63d7754ba56b2604d253b600284c52ab82c6" } # Show version information @@ -259,6 +259,11 @@ patch_enable_all () enable_uxtheme_CloseThemeClass="$1" enable_version_VerQueryValue="$1" enable_widl_SLTG_Typelib_Support="$1" + enable_widl_winrt_support="$1" + enable_windows_gaming_input_dll="$1" + enable_windows_globalization_dll="$1" + enable_windows_media_speech_dll="$1" + enable_windows_networking_connectivity_dll="$1" enable_windowscodecs_GIF_Encoder="$1" enable_windowscodecs_TIFF_Support="$1" enable_wine_inf_Directory_ContextMenuHandlers="$1" @@ -853,6 +858,21 @@ patch_enable () widl-SLTG_Typelib_Support) enable_widl_SLTG_Typelib_Support="$2" ;; + widl-winrt-support) + enable_widl_winrt_support="$2" + ;; + windows.gaming.input-dll) + enable_windows_gaming_input_dll="$2" + ;; + windows.globalization-dll) + enable_windows_globalization_dll="$2" + ;; + windows.media.speech.dll) + enable_windows_media_speech_dll="$2" + ;; + windows.networking.connectivity.dll) + enable_windows_networking_connectivity_dll="$2" + ;; windowscodecs-GIF_Encoder) enable_windowscodecs_GIF_Encoder="$2" ;; @@ -1403,6 +1423,34 @@ if test "$enable_wineboot_ProxySettings" -eq 1; then enable_wineboot_drivers_etc_Stubs=1 fi +if test "$enable_windows_networking_connectivity_dll" -eq 1; then + if test "$enable_windows_globalization_dll" -gt 1; then + abort "Patchset windows.globalization-dll disabled, but windows.networking.connectivity.dll depends on that." + fi + enable_windows_globalization_dll=1 +fi + +if test "$enable_windows_globalization_dll" -eq 1; then + if test "$enable_windows_gaming_input_dll" -gt 1; then + abort "Patchset windows.gaming.input-dll disabled, but windows.globalization-dll depends on that." + fi + enable_windows_gaming_input_dll=1 +fi + +if test "$enable_windows_gaming_input_dll" -eq 1; then + if test "$enable_windows_media_speech_dll" -gt 1; then + abort "Patchset windows.media.speech.dll disabled, but windows.gaming.input-dll depends on that." + fi + enable_windows_media_speech_dll=1 +fi + +if test "$enable_windows_media_speech_dll" -eq 1; then + if test "$enable_widl_winrt_support" -gt 1; then + abort "Patchset widl-winrt-support disabled, but windows.media.speech.dll depends on that." + fi + enable_widl_winrt_support=1 +fi + if test "$enable_user32_window_activation" -eq 1; then if test "$enable_user32_recursive_activation" -gt 1; then abort "Patchset user32-recursive-activation disabled, but user32-window-activation depends on that." @@ -4179,6 +4227,130 @@ if test "$enable_version_VerQueryValue" -eq 1; then patch_apply version-VerQueryValue/0001-version-Test-for-VerQueryValueA-try-2.patch fi +# Patchset widl-winrt-support +# | +# | This patchset fixes the following Wine bugs: +# | * [#49998] widl - Support WinRT idls +# | +# | Modified files: +# | * include/Makefile.in, include/windows.foundation.idl, include/windows.media.speechsynthesis.idl, +# | include/windowscontracts.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/widltypes.h +# | +if test "$enable_widl_winrt_support" -eq 1; then + patch_apply widl-winrt-support/0001-widl-Introduce-format_namespace_buffer-helper.patch + patch_apply widl-winrt-support/0002-widl-Support-WinRT-contractversion-attribute-parsing.patch + patch_apply widl-winrt-support/0003-widl-Support-WinRT-apicontract-type.patch + patch_apply widl-winrt-support/0004-widl-Support-WinRT-contract-attribute.patch + patch_apply widl-winrt-support/0005-include-Add-windows.media.speechsynthesis.idl-draft.patch + patch_apply widl-winrt-support/0006-widl-Support-WinRT-marshaling_behavior-attribute-par.patch + patch_apply widl-winrt-support/0007-widl-Support-WinRT-mta-threading-attribute-parsing.patch + patch_apply widl-winrt-support/0008-widl-Support-WinRT-exclusiveto-attribute-parsing.patch + patch_apply widl-winrt-support/0009-widl-Support-WinRT-runtimeclass-type.patch + patch_apply widl-winrt-support/0010-widl-Support-WinRT-eventadd-eventremove-attributes.patch + patch_apply widl-winrt-support/0011-widl-Support-WinRT-flags-attribute-parsing.patch + patch_apply widl-winrt-support/0012-widl-Support-using-qualified-names-for-interfaces.patch + patch_apply widl-winrt-support/0013-widl-Support-WinRT-static-attribute-parsing.patch + patch_apply widl-winrt-support/0014-widl-Support-WinRT-requires-keyword.patch + patch_apply widl-winrt-support/0015-widl-Support-WinRT-activatable-attribute.patch + patch_apply widl-winrt-support/0016-widl-Support-WinRT-parameterized-type-parsing.patch + patch_apply widl-winrt-support/0017-widl-Support-partially-specialized-parameterized-typ.patch + patch_apply widl-winrt-support/0018-widl-Support-WinRT-parameterized-interface-type.patch + patch_apply widl-winrt-support/0019-widl-Support-WinRT-delegate-type.patch + patch_apply widl-winrt-support/0020-widl-Support-WinRT-parameterized-delegate-type.patch + patch_apply widl-winrt-support/0021-widl-Compute-signatures-for-parameterized-types.patch + patch_apply widl-winrt-support/0022-widl-Compute-uuids-for-parameterized-types.patch + patch_apply widl-winrt-support/0023-widl-Generate-helper-macros-for-WinRT-implementation.patch + patch_apply widl-winrt-support/0024-include-Add-IVectorView-HSTRING-declaration-to-windo.patch +fi + +# Patchset windows.media.speech.dll +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * widl-winrt-support +# | +# | This patchset fixes the following Wine bugs: +# | * [#49740] windows.media.speech: New DLL +# | +# | Modified files: +# | * configure.ac, dlls/windows.media.speech.dll/Makefile.in, dlls/windows.media.speech.dll/windows.media.speech.spec, +# | dlls/windows.media.speech.dll/windows.media.speech_main.c, loader/wine.inf.in +# | +if test "$enable_windows_media_speech_dll" -eq 1; then + patch_apply windows.media.speech.dll/0001-windows.media.speech-Add-stub-dll.patch + patch_apply windows.media.speech.dll/0002-windows.media.speech-Implement-IInstalledVoicesStati.patch + patch_apply windows.media.speech.dll/0003-windows.media.speech-Implement-IInstalledVoicesStati.patch + patch_apply windows.media.speech.dll/0004-windows.media.speech-Fake-empty-IInstalledVoicesStat.patch +fi + +# Patchset windows.gaming.input-dll +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * widl-winrt-support, windows.media.speech.dll +# | +# | This patchset fixes the following Wine bugs: +# | * [#49756] windows.gaming.input: New DLL +# | +# | Modified files: +# | * configure.ac, dlls/windows.gaming.input.dll/Makefile.in, dlls/windows.gaming.input.dll/windows.gaming.input.spec, +# | dlls/windows.gaming.input.dll/windows.gaming.input_main.c, include/Makefile.in, include/asyncinfo.idl, +# | include/windows.foundation.idl, include/windows.gaming.input.forcefeedback.idl, include/windows.gaming.input.idl, +# | include/windows.system.idl, loader/wine.inf.in +# | +if test "$enable_windows_gaming_input_dll" -eq 1; then + patch_apply windows.gaming.input-dll/0001-windows.gaming.input-Add-stub-dll.patch + patch_apply windows.gaming.input-dll/0002-windows.gaming.input-Implement-IGamepadStatics-stubs.patch + patch_apply windows.gaming.input-dll/0003-windows.gaming.input-Implement-IGamepadStatics-Gamep.patch + patch_apply windows.gaming.input-dll/0004-windows.gaming.input-Fake-empty-IGamepadStatics-Game.patch + patch_apply windows.gaming.input-dll/0005-windows.gaming.input-Fake-IEventHandler_Gamepad-supp.patch + patch_apply windows.gaming.input-dll/0006-windows.gaming.input-Implement-IRawGameControllerSta.patch + patch_apply windows.gaming.input-dll/0007-windows.gaming.input-Implement-IRawGameControllerSta.patch + patch_apply windows.gaming.input-dll/0008-windows.gaming.input-Fake-empty-IRawGameControllerSt.patch + patch_apply windows.gaming.input-dll/0009-windows.gaming.input-Fake-IEventHandler_RawGameContr.patch +fi + +# Patchset windows.globalization-dll +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * widl-winrt-support, windows.media.speech.dll, windows.gaming.input-dll +# | +# | This patchset fixes the following Wine bugs: +# | * [#49740] windows.globalization: New DLL +# | * [#49998] windows.globalization: New DLL +# | +# | Modified files: +# | * configure.ac, dlls/windows.globalization.dll/Makefile.in, dlls/windows.globalization.dll/windows.globalization.spec, +# | dlls/windows.globalization.dll/windows.globalization_main.c, include/Makefile.in, include/windows.globalization.idl, +# | include/windows.system.userprofile.idl, loader/wine.inf.in +# | +if test "$enable_windows_globalization_dll" -eq 1; then + patch_apply windows.globalization-dll/0001-windows.globalization-Add-stub-dll.patch + patch_apply windows.globalization-dll/0002-windows.globalization-Implement-IGlobalizationPrefer.patch + patch_apply windows.globalization-dll/0003-windows.globalization-Implement-IGlobalizationPrefer.patch + patch_apply windows.globalization-dll/0004-windows.globalization-Implement-IGlobalizationPrefer.patch + patch_apply windows.globalization-dll/0005-windows.globalization-Fake-empty-IGlobalizationPrefe.patch +fi + +# Patchset windows.networking.connectivity.dll +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * widl-winrt-support, windows.media.speech.dll, windows.gaming.input-dll, windows.globalization-dll +# | +# | This patchset fixes the following Wine bugs: +# | * [#46534] windows.networking.connectivity: New DLL +# | +# | Modified files: +# | * configure.ac, dlls/windows.networking.connectivity.dll/Makefile.in, +# | dlls/windows.networking.connectivity.dll/windows.networking.connectivity.spec, +# | dlls/windows.networking.connectivity.dll/windows.networking.connectivity_main.c, loader/wine.inf.in +# | +if test "$enable_windows_networking_connectivity_dll" -eq 1; then + patch_apply windows.networking.connectivity.dll/0001-windows.networking.connectivity-Add-stub-dll.patch + patch_apply windows.networking.connectivity.dll/0002-windows.networking.connectivity-Implement-IActivatio.patch + patch_apply windows.networking.connectivity.dll/0003-windows.networking.connectivity-Implement-INetworkIn.patch +fi + # Patchset windowscodecs-GIF_Encoder # | # | Modified files: diff --git a/patches/widl-winrt-support/0003-widl-Introduce-format_namespace_buffer-helper.patch b/patches/widl-winrt-support/0001-widl-Introduce-format_namespace_buffer-helper.patch similarity index 82% rename from patches/widl-winrt-support/0003-widl-Introduce-format_namespace_buffer-helper.patch rename to patches/widl-winrt-support/0001-widl-Introduce-format_namespace_buffer-helper.patch index aa410c0e..96b30573 100644 --- a/patches/widl-winrt-support/0003-widl-Introduce-format_namespace_buffer-helper.patch +++ b/patches/widl-winrt-support/0001-widl-Introduce-format_namespace_buffer-helper.patch @@ -1,7 +1,7 @@ -From ee1ce628835376e5054972ef3c39996a2b015309 Mon Sep 17 00:00:00 2001 +From ba7d12c53e656fcc0dd638a7758d60a332d3bb7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 23 Sep 2020 14:14:01 +0200 -Subject: [PATCH 03/28] widl: Introduce format_namespace_buffer helper. +Subject: [PATCH] widl: Introduce format_namespace_buffer helper. To compute format_namespace length and write to an existing buffer. @@ -9,12 +9,12 @@ Also add explicit abi_prefix parameter. --- tools/widl/header.c | 2 +- tools/widl/parser.y | 2 +- - tools/widl/typetree.c | 54 +++++++++++++++++++----------------------- + tools/widl/typetree.c | 58 +++++++++++++++++++++--------------------- tools/widl/widltypes.h | 3 ++- - 4 files changed, 29 insertions(+), 32 deletions(-) + 4 files changed, 33 insertions(+), 32 deletions(-) diff --git a/tools/widl/header.c b/tools/widl/header.c -index 743d86f0ee9..d67fea4cc95 100644 +index 015bbe2ece7..a892243fb54 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -132,7 +132,7 @@ static void write_guid(FILE *f, const char *guid_prefix, const char *name, const @@ -27,10 +27,10 @@ index 743d86f0ee9..d67fea4cc95 100644 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", diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index 5bc0d82703e..306e5194467 100644 +index 160e4029a6e..1bbb2e78f7e 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -1905,7 +1905,7 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in +@@ -1922,7 +1922,7 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in if (is_global_namespace(namespace)) type->c_name = name; else @@ -40,15 +40,23 @@ index 5bc0d82703e..306e5194467 100644 nt->t = t; nt->next = namespace->type_hash[hash]; diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c -index e9afc6fdd28..ebba2c4c6bb 100644 +index c0547b36a96..d211fa8d277 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c -@@ -89,41 +89,37 @@ const char *type_get_name(const type_t *type, enum name_type name_type) +@@ -89,41 +89,41 @@ const char *type_get_name(const type_t *type, enum name_type name_type) return NULL; } -static char *append_namespace(char *ptr, struct namespace *namespace, const char *separator) --{ ++#define append_buf(f, ...) \ ++ do { \ ++ int r = f(buf + ret, max(ret, len) - ret, ## __VA_ARGS__); \ ++ assert(r >= 0); \ ++ ret += r; \ ++ } while(0) ++ ++static int append_namespace(char *buf, size_t len, struct namespace *namespace, const char *separator, const char *abi_prefix) + { - if(is_global_namespace(namespace)) { - if(!use_abi_namespace) - return ptr; @@ -56,15 +64,11 @@ index e9afc6fdd28..ebba2c4c6bb 100644 - strcat(ptr, separator); - return ptr + strlen(ptr); - } -+#define append_buf(f, ...) \ -+ do { int r = f(buf + ret, max(ret, len) - ret, __VA_ARGS__); assert(r >= 0); ret += r; } while(0) - +- - ptr = append_namespace(ptr, namespace->parent, separator); - strcpy(ptr, namespace->name); - strcat(ptr, separator); - return ptr + strlen(ptr); -+static int append_namespace(char *buf, size_t len, struct namespace *namespace, const char *separator, const char *abi_prefix) -+{ + const char *name = namespace && !is_global_namespace(namespace) ? namespace->name : abi_prefix; + int ret = 0; + if (!name) return 0; @@ -111,10 +115,10 @@ index e9afc6fdd28..ebba2c4c6bb 100644 type_t *type_new_function(var_list_t *args) diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h -index 085a0ff55f5..630f42860f1 100644 +index b02b80e122c..7a43e517698 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -605,7 +605,8 @@ var_list_t *append_var(var_list_t *list, var_t *var); +@@ -613,7 +613,8 @@ var_list_t *append_var(var_list_t *list, var_t *var); void init_loc_info(loc_info_t *); @@ -125,5 +129,5 @@ index 085a0ff55f5..630f42860f1 100644 static inline enum type_type type_get_type_detect_alias(const type_t *type) { -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0002-widl-Support-WinRT-contractversion-attribute-parsing.patch b/patches/widl-winrt-support/0002-widl-Support-WinRT-contractversion-attribute-parsing.patch new file mode 100644 index 00000000..271fe812 --- /dev/null +++ b/patches/widl-winrt-support/0002-widl-Support-WinRT-contractversion-attribute-parsing.patch @@ -0,0 +1,89 @@ +From 724457cf02d0e14878bcb2354732656637141f8b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?R=C3=A9mi=20Bernon?= +Date: Tue, 13 Oct 2020 14:04:28 +0200 +Subject: [PATCH] widl: Support WinRT contractversion attribute parsing. + +--- + tools/widl/parser.l | 1 + + tools/widl/parser.y | 12 +++++++++++- + tools/widl/widltypes.h | 1 + + 3 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/tools/widl/parser.l b/tools/widl/parser.l +index d7d96702322..a4e1d0d2c47 100644 +--- a/tools/widl/parser.l ++++ b/tools/widl/parser.l +@@ -338,6 +338,7 @@ static const struct keyword attr_keywords[] = + {"context_handle", tCONTEXTHANDLE, 0}, + {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE, 0}, + {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE, 0}, ++ {"contractversion", tCONTRACTVERSION, 1}, + {"control", tCONTROL, 0}, + {"custom", tCUSTOM, 0}, + {"decode", tDECODE, 0}, +diff --git a/tools/widl/parser.y b/tools/widl/parser.y +index 1bbb2e78f7e..3c4c8041a1c 100644 +--- a/tools/widl/parser.y ++++ b/tools/widl/parser.y +@@ -177,7 +177,9 @@ static typelib_t *current_typelib; + %token tAUTOHANDLE tBINDABLE tBOOLEAN tBROADCAST tBYTE tBYTECOUNT + %token tCALLAS tCALLBACK tCASE tCDECL tCHAR tCOCLASS tCODE tCOMMSTATUS + %token tCONST tCONTEXTHANDLE tCONTEXTHANDLENOSERIALIZE +-%token tCONTEXTHANDLESERIALIZE tCONTROL tCPPQUOTE ++%token tCONTEXTHANDLESERIALIZE ++%token tCONTRACTVERSION ++%token tCONTROL tCPPQUOTE + %token tCUSTOM + %token tDECODE tDEFAULT tDEFAULTBIND + %token tDEFAULTCOLLELEM +@@ -290,6 +292,7 @@ static typelib_t *current_typelib; + %type m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator + %type declarator_list struct_declarator_list + %type coclass coclasshdr coclassdef ++%type contract_ver + %type pointer_type threading_type version + %type libraryhdr callconv cppquote importlib import t_ident + %type uuid_string +@@ -492,6 +495,11 @@ str_list: aSTRING { $$ = append_str( NULL, $1 ); } + | str_list ',' aSTRING { $$ = append_str( $1, $3 ); } + ; + ++contract_ver: ++ aNUM { $$ = MAKEVERSION(0, $1); } ++ | aNUM '.' aNUM { $$ = MAKEVERSION($3, $1); } ++ ; ++ + attribute: { $$ = NULL; } + | tAGGREGATABLE { $$ = make_attr(ATTR_AGGREGATABLE); } + | tANNOTATION '(' aSTRING ')' { $$ = make_attrp(ATTR_ANNOTATION, $3); } +@@ -507,6 +515,7 @@ attribute: { $$ = NULL; } + | tCONTEXTHANDLE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); } + | tCONTEXTHANDLENOSERIALIZE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ } + | tCONTEXTHANDLESERIALIZE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ } ++ | tCONTRACTVERSION '(' contract_ver ')' { $$ = make_attrv(ATTR_CONTRACTVERSION, $3); } + | tCONTROL { $$ = make_attr(ATTR_CONTROL); } + | tCUSTOM '(' uuid_string ',' expr_const ')' { $$ = make_custom_attr($3, $5); } + | tDECODE { $$ = make_attr(ATTR_DECODE); } +@@ -2155,6 +2164,7 @@ struct allowed_attr allowed_attr[] = + /* ATTR_CODE */ { 0, 1, 0, 1, 1, 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, "comm_status" }, + /* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" }, ++ /* ATTR_CONTRACTVERSION */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "contractversion" }, + /* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, "control" }, + /* ATTR_CUSTOM */ { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, "custom" }, + /* ATTR_DECODE */ { 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "decode" }, +diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h +index 7a43e517698..78401cf8278 100644 +--- a/tools/widl/widltypes.h ++++ b/tools/widl/widltypes.h +@@ -84,6 +84,7 @@ enum attr_type + ATTR_CODE, + ATTR_COMMSTATUS, + ATTR_CONTEXTHANDLE, ++ ATTR_CONTRACTVERSION, + ATTR_CONTROL, + ATTR_CUSTOM, + ATTR_DECODE, +-- +2.29.2 + diff --git a/patches/widl-winrt-support/0003-widl-Support-WinRT-apicontract-type.patch b/patches/widl-winrt-support/0003-widl-Support-WinRT-apicontract-type.patch new file mode 100644 index 00000000..3586008c --- /dev/null +++ b/patches/widl-winrt-support/0003-widl-Support-WinRT-apicontract-type.patch @@ -0,0 +1,558 @@ +From 10cbcc558ccda4af0f1151786b95f1fae0438d66 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?R=C3=A9mi=20Bernon?= +Date: Fri, 20 Nov 2020 11:05:32 +0100 +Subject: [PATCH] widl: Support WinRT apicontract type. + +--- + include/Makefile.in | 1 + + include/windows.foundation.idl | 1 + + include/windowscontracts.idl | 33 +++++ + tools/widl/expr.c | 1 + + tools/widl/header.c | 27 ++++ + tools/widl/parser.l | 1 + + tools/widl/parser.y | 239 +++++++++++++++++++-------------- + tools/widl/typegen.c | 6 + + tools/widl/typelib.c | 3 +- + tools/widl/typetree.h | 3 + + tools/widl/widltypes.h | 1 + + 11 files changed, 211 insertions(+), 105 deletions(-) + create mode 100644 include/windowscontracts.idl + +diff --git a/include/Makefile.in b/include/Makefile.in +index 3df4da64233..a84e44998cc 100644 +--- a/include/Makefile.in ++++ b/include/Makefile.in +@@ -744,6 +744,7 @@ SOURCES = \ + windns.h \ + windows.foundation.idl \ + windows.h \ ++ windowscontracts.idl \ + windowsx.h \ + wine/debug.h \ + wine/exception.h \ +diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl +index 2c16fa2da22..2a38e9f671b 100644 +--- a/include/windows.foundation.idl ++++ b/include/windows.foundation.idl +@@ -22,6 +22,7 @@ + + import "inspectable.idl"; + /* import "asyncinfo.idl"; */ ++import "windowscontracts.idl"; + /* import "eventtoken.idl"; */ + /* import "ivectorchangedeventargs.idl"; */ + +diff --git a/include/windowscontracts.idl b/include/windowscontracts.idl +new file mode 100644 +index 00000000000..6bcf80ac954 +--- /dev/null ++++ b/include/windowscontracts.idl +@@ -0,0 +1,33 @@ ++/* ++ * Copyright 2020 RĂ©mi Bernon for CodeWeavers ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++ */ ++ ++#ifdef __WIDL__ ++#pragma winrt ns_prefix ++#endif ++ ++namespace Windows { ++ namespace Foundation { ++ [contractversion(4)] ++ apicontract FoundationContract ++ {}; ++ ++ [contractversion(10)] ++ apicontract UniversalApiContract ++ {}; ++ } ++} +diff --git a/tools/widl/expr.c b/tools/widl/expr.c +index d1ee599a39e..be8311cfb7f 100644 +--- a/tools/widl/expr.c ++++ b/tools/widl/expr.c +@@ -462,6 +462,7 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type, + case TYPE_POINTER: + case TYPE_ARRAY: + case TYPE_BITFIELD: ++ case TYPE_APICONTRACT: + /* nothing to do */ + break; + case TYPE_ALIAS: +diff --git a/tools/widl/header.c b/tools/widl/header.c +index a892243fb54..657ce50c679 100644 +--- a/tools/widl/header.c ++++ b/tools/widl/header.c +@@ -471,6 +471,10 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i + else write_type_left(h, ds, name_type, declonly, write_callconv); + break; + } ++ case TYPE_APICONTRACT: ++ /* shouldn't be here */ ++ assert(0); ++ break; + } + } + } +@@ -533,6 +537,10 @@ void write_type_right(FILE *h, type_t *t, int is_field) + case TYPE_COCLASS: + case TYPE_INTERFACE: + break; ++ case TYPE_APICONTRACT: ++ /* not supposed to be here */ ++ assert(0); ++ break; + } + } + +@@ -1452,6 +1460,14 @@ static void write_forward(FILE *header, type_t *iface) + fprintf(header, "#endif\n\n" ); + } + ++static char *format_apicontract_macro(const type_t *type) ++{ ++ char *name = format_namespace(type->namespace, "", "_", type->name, NULL); ++ int i; ++ for (i = strlen(name); i > 0; --i) name[i - 1] = toupper(name[i - 1]); ++ return name; ++} ++ + static void write_com_interface_start(FILE *header, const type_t *iface) + { + int dispinterface = is_attr(iface->attrs, ATTR_DISPINTERFACE); +@@ -1616,6 +1632,15 @@ static void write_coclass_forward(FILE *header, type_t *cocl) + fprintf(header, "#endif /* defined __%s_FWD_DEFINED__ */\n\n", cocl->name ); + } + ++static void write_apicontract(FILE *header, type_t *apicontract) ++{ ++ char *name = format_apicontract_macro(apicontract); ++ fprintf(header, "#if !defined(%s_VERSION)\n", name); ++ fprintf(header, "#define %s_VERSION %#x\n", name, get_attrv(apicontract->attrs, ATTR_CONTRACTVERSION)); ++ fprintf(header, "#endif // defined(%s_VERSION)\n\n", name); ++ free(name); ++} ++ + static void write_import(FILE *header, const char *fname) + { + char *hname, *p; +@@ -1734,6 +1759,8 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons + } + else if (type_get_type(stmt->u.type) == TYPE_COCLASS) + write_coclass(header, stmt->u.type); ++ else if (type_get_type(stmt->u.type) == TYPE_APICONTRACT) ++ write_apicontract(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 a4e1d0d2c47..6a9bb65a483 100644 +--- a/tools/widl/parser.l ++++ b/tools/widl/parser.l +@@ -267,6 +267,7 @@ static const struct keyword keywords[] = { + {"_fastcall", tFASTCALL, 0}, + {"_pascal", tPASCAL, 0}, + {"_stdcall", tSTDCALL, 0}, ++ {"apicontract", tAPICONTRACT, 1}, + {"boolean", tBOOLEAN, 0}, + {"byte", tBYTE, 0}, + {"case", tCASE, 0}, +diff --git a/tools/widl/parser.y b/tools/widl/parser.y +index 3c4c8041a1c..5b4bd518a0b 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_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); + static void check_def(const type_t *t); +@@ -173,7 +174,9 @@ static typelib_t *current_typelib; + %token GREATEREQUAL LESSEQUAL + %token LOGICALOR LOGICALAND + %token ELLIPSIS +-%token tAGGREGATABLE tALLNODES tALLOCATE tANNOTATION tAPPOBJECT tASYNC tASYNCUUID ++%token tAGGREGATABLE tALLNODES tALLOCATE tANNOTATION ++%token tAPICONTRACT ++%token tAPPOBJECT tASYNC tASYNCUUID + %token tAUTOHANDLE tBINDABLE tBOOLEAN tBROADCAST tBYTE tBYTECOUNT + %token tCALLAS tCALLBACK tCASE tCDECL tCHAR tCOCLASS tCODE tCOMMSTATUS + %token tCONST tCONTEXTHANDLE tCONTEXTHANDLENOSERIALIZE +@@ -292,6 +295,7 @@ static typelib_t *current_typelib; + %type m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator + %type declarator_list struct_declarator_list + %type coclass coclasshdr coclassdef ++%type apicontract + %type contract_ver + %type pointer_type threading_type version + %type libraryhdr callconv cppquote importlib import t_ident +@@ -349,6 +353,8 @@ gbl_statements: { $$ = NULL; } + | gbl_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2)); + reg_type($2, $2->name, current_namespace, 0); + } ++ | gbl_statements apicontract ';' { $$ = 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); } +@@ -363,6 +369,8 @@ imp_statements: { $$ = NULL; } + | imp_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2)); + reg_type($2, $2->name, current_namespace, 0); + } ++ | imp_statements apicontract ';' { $$ = 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)); } +@@ -868,6 +876,13 @@ coclassdef: coclasshdr '{' coclass_ints '}' semicolon_opt + { $$ = type_coclass_define($1, $3); } + ; + ++apicontract: attributes tAPICONTRACT aIDENTIFIER '{' '}' ++ { $$ = get_type(TYPE_APICONTRACT, $3, current_namespace, 0); ++ check_def($$); ++ $$->attrs = check_apicontract_attrs($$->name, $1); ++ } ++ ; ++ + namespacedef: tNAMESPACE aIDENTIFIER { $$ = $2; } + | tNAMESPACE aNAMESPACE { $$ = $2; } + ; +@@ -2143,114 +2158,115 @@ struct allowed_attr + unsigned int on_dispinterface : 1; + unsigned int on_module : 1; + unsigned int on_coclass : 1; ++ unsigned int on_apicontract : 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 } */ +- /* ATTR_AGGREGATABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "aggregatable" }, +- /* ATTR_ALLOCATE */ { 0, 1, 0, 0, 0, 0, 1, 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, "annotation" }, +- /* ATTR_APPOBJECT */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "appobject" }, +- /* ATTR_ASYNC */ { 0, 1, 0, 0, 1, 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, "async_uuid" }, +- /* ATTR_AUTO_HANDLE */ { 1, 1, 0, 1, 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, "bindable" }, +- /* ATTR_BROADCAST */ { 1, 0, 0, 0, 1, 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, "call_as" }, +- /* ATTR_CALLCONV */ { 0, 0, 0, 0, 1, 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, "case" }, +- /* ATTR_CODE */ { 0, 1, 0, 1, 1, 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, "comm_status" }, +- /* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" }, +- /* ATTR_CONTRACTVERSION */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "contractversion" }, +- /* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, "control" }, +- /* ATTR_CUSTOM */ { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, "custom" }, +- /* ATTR_DECODE */ { 0, 0, 0, 1, 1, 0, 1, 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, "default" }, +- /* ATTR_DEFAULTBIND */ { 0, 0, 0, 0, 1, 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, "defaultcollelem" }, +- /* ATTR_DEFAULTVALUE */ { 0, 0, 0, 0, 0, 1, 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, "defaultvtable" }, +- /* ATTR_DISABLECONSISTENCYCHECK */{ 0, 0, 0, 0, 0, 1, 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, NULL }, +- /* ATTR_DISPLAYBIND */ { 0, 0, 0, 0, 1, 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, "dllname" }, +- /* ATTR_DUAL */ { 0, 0, 0, 1, 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, "enable_allocate" }, +- /* ATTR_ENCODE */ { 0, 0, 0, 1, 1, 0, 1, 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, "endpoint" }, +- /* ATTR_ENTRY */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "entry" }, +- /* ATTR_EXPLICIT_HANDLE */ { 1, 1, 0, 1, 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, "fault_status" }, +- /* ATTR_FORCEALLOCATE */ { 0, 0, 0, 0, 0, 1, 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, "handle" }, +- /* ATTR_HELPCONTEXT */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, "helpcontext" }, +- /* ATTR_HELPFILE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "helpfile" }, +- /* ATTR_HELPSTRING */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, "helpstring" }, +- /* ATTR_HELPSTRINGCONTEXT */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, "helpstringcontext" }, +- /* ATTR_HELPSTRINGDLL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "helpstringdll" }, +- /* ATTR_HIDDEN */ { 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, "hidden" }, +- /* ATTR_ID */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, "id" }, +- /* ATTR_IDEMPOTENT */ { 1, 0, 0, 0, 1, 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, "ignore" }, +- /* ATTR_IIDIS */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "iid_is" }, +- /* ATTR_IMMEDIATEBIND */ { 0, 0, 0, 0, 1, 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, "implicit_handle" }, +- /* ATTR_IN */ { 0, 0, 0, 0, 0, 1, 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, "inputsync" }, +- /* ATTR_LENGTHIS */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "length_is" }, +- /* ATTR_LIBLCID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "lcid" }, +- /* ATTR_LICENSED */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "licensed" }, +- /* ATTR_LOCAL */ { 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "local" }, +- /* ATTR_MAYBE */ { 0, 0, 0, 0, 1, 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, "message" }, +- /* ATTR_NOCODE */ { 0, 1, 0, 1, 1, 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, "nonbrowsable" }, +- /* ATTR_NONCREATABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "noncreatable" }, +- /* ATTR_NONEXTENSIBLE */ { 0, 0, 0, 1, 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, "notify" }, +- /* ATTR_NOTIFYFLAG */ { 0, 0, 0, 0, 1, 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, "object" }, +- /* ATTR_ODL */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "odl" }, +- /* ATTR_OLEAUTOMATION */ { 0, 0, 0, 1, 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, "optimize" }, +- /* ATTR_OPTIONAL */ { 0, 0, 0, 0, 0, 1, 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, "out" }, +- /* ATTR_PARAMLCID */ { 0, 0, 0, 0, 0, 1, 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, "partial_ignore" }, +- /* ATTR_POINTERDEFAULT */ { 1, 0, 0, 1, 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, "ref, unique or ptr" }, +- /* ATTR_PROGID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "progid" }, +- /* ATTR_PROPGET */ { 0, 0, 0, 0, 1, 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, "propput" }, +- /* ATTR_PROPPUTREF */ { 0, 0, 0, 0, 1, 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, "proxy" }, +- /* ATTR_PUBLIC */ { 0, 0, 0, 0, 0, 0, 1, 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, "range" }, +- /* ATTR_READONLY */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "readonly" }, +- /* ATTR_REPRESENTAS */ { 1, 0, 0, 0, 0, 0, 1, 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, "requestedit" }, +- /* ATTR_RESTRICTED */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, "restricted" }, +- /* ATTR_RETVAL */ { 0, 0, 0, 0, 0, 1, 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, "size_is" }, +- /* ATTR_SOURCE */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "source" }, +- /* ATTR_STRICTCONTEXTHANDLE */ { 0, 0, 0, 1, 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, "string" }, +- /* ATTR_SWITCHIS */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "switch_is" }, +- /* ATTR_SWITCHTYPE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, "switch_type" }, +- /* ATTR_THREADING */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "threading" }, +- /* ATTR_TRANSMITAS */ { 1, 0, 0, 0, 0, 0, 1, 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, "uidefault" }, +- /* ATTR_USESGETLASTERROR */ { 0, 0, 0, 0, 1, 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, "user_marshal" }, +- /* ATTR_UUID */ { 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, "uuid" }, +- /* ATTR_V1ENUM */ { 0, 0, 0, 0, 0, 0, 1, 1, 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, "vararg" }, +- /* ATTR_VERSION */ { 1, 0, 0, 1, 0, 0, 1, 1, 0, 2, 0, 0, 1, 0, 0, 1, "version" }, +- /* ATTR_VIPROGID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "vi_progid" }, +- /* ATTR_WIREMARSHAL */ { 1, 0, 0, 0, 0, 0, 1, 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 } */ ++ /* 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_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_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_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" }, + }; + + static attr_list_t *append_attr(attr_list_t *list, attr_t *attr) +@@ -2465,6 +2481,17 @@ static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs) + return attrs; + } + ++static attr_list_t *check_apicontract_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_apicontract) ++ error_loc("inapplicable attribute %s for apicontract %s\n", ++ allowed_attr[attr->type].display_name, name); ++ return attrs; ++} ++ + static int is_allowed_conf_type(const type_t *type) + { + switch (type_get_type(type)) +@@ -2504,6 +2531,10 @@ static int is_allowed_conf_type(const type_t *type) + case TYPE_INTERFACE: + case TYPE_BITFIELD: + return FALSE; ++ case TYPE_APICONTRACT: ++ /* not supposed to be here */ ++ assert(0); ++ break; + } + return FALSE; + } +diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c +index 4874dfd6c24..5d0f24be06f 100644 +--- a/tools/widl/typegen.c ++++ b/tools/widl/typegen.c +@@ -374,6 +374,10 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att + case TYPE_ALIAS: + case TYPE_BITFIELD: + break; ++ case TYPE_APICONTRACT: ++ /* not supposed to be here */ ++ assert(0); ++ break; + } + return TGT_INVALID; + } +@@ -1966,6 +1970,7 @@ unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align) + case TYPE_MODULE: + case TYPE_FUNCTION: + case TYPE_BITFIELD: ++ case TYPE_APICONTRACT: + /* 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 +@@ -2067,6 +2072,7 @@ static unsigned int type_buffer_alignment(const type_t *t) + case TYPE_MODULE: + case TYPE_FUNCTION: + case TYPE_BITFIELD: ++ case TYPE_APICONTRACT: + /* 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 cf027558d0a..faf76440f93 100644 +--- a/tools/widl/typelib.c ++++ b/tools/widl/typelib.c +@@ -224,7 +224,8 @@ unsigned short get_type_vt(type_t *t) + return VT_VOID; + + case TYPE_ALIAS: +- /* aliases should be filtered out by the type_get_type call above */ ++ case TYPE_APICONTRACT: ++ /* not supposed to be here */ + assert(0); + break; + +diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h +index e288c574002..7abec41a8fd 100644 +--- a/tools/widl/typetree.h ++++ b/tools/widl/typetree.h +@@ -223,6 +223,9 @@ static inline int type_is_complete(const type_t *type) + case TYPE_ARRAY: + case TYPE_BITFIELD: + return TRUE; ++ case TYPE_APICONTRACT: ++ assert(0); ++ break; + } + return FALSE; + } +diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h +index 78401cf8278..878650d9c27 100644 +--- a/tools/widl/widltypes.h ++++ b/tools/widl/widltypes.h +@@ -440,6 +440,7 @@ enum type_type + TYPE_POINTER, + TYPE_ARRAY, + TYPE_BITFIELD, ++ TYPE_APICONTRACT, + }; + + struct _type_t { +-- +2.29.2 + diff --git a/patches/widl-winrt-support/0008-widl-Support-WinRT-contract-attribute.patch b/patches/widl-winrt-support/0004-widl-Support-WinRT-contract-attribute.patch similarity index 78% rename from patches/widl-winrt-support/0008-widl-Support-WinRT-contract-attribute.patch rename to patches/widl-winrt-support/0004-widl-Support-WinRT-contract-attribute.patch index dde0db38..57105e51 100644 --- a/patches/widl-winrt-support/0008-widl-Support-WinRT-contract-attribute.patch +++ b/patches/widl-winrt-support/0004-widl-Support-WinRT-contract-attribute.patch @@ -1,22 +1,21 @@ -From 8a97a7f01dcf01f089dd65dc7739718db8bea07c Mon Sep 17 00:00:00 2001 +From 1b6d9ab9462963fd6465840a726fadf2ad612bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 23 Sep 2020 19:23:45 +0200 Subject: [PATCH] widl: Support WinRT contract attribute. --- - include/windows.foundation.idl | 14 ++--- - include/windows.media.speechsynthesis.idl | 13 ++++ - tools/widl/header.c | 72 ++++++++++++++++++++++- - tools/widl/parser.l | 1 + - tools/widl/parser.y | 9 +++ - tools/widl/widltypes.h | 1 + - 6 files changed, 100 insertions(+), 10 deletions(-) + include/windows.foundation.idl | 14 +++---- + tools/widl/header.c | 72 ++++++++++++++++++++++++++++++++-- + tools/widl/parser.l | 1 + + tools/widl/parser.y | 10 +++++ + tools/widl/widltypes.h | 1 + + 5 files changed, 88 insertions(+), 10 deletions(-) diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl -index 2c16fa2da22..c08334ed660 100644 +index 2a38e9f671b..5e17062f399 100644 --- a/include/windows.foundation.idl +++ b/include/windows.foundation.idl -@@ -27,7 +27,7 @@ import "inspectable.idl"; +@@ -28,7 +28,7 @@ import "windowscontracts.idl"; namespace Windows { namespace Foundation { @@ -25,7 +24,7 @@ index 2c16fa2da22..c08334ed660 100644 enum PropertyType { Empty = 0, UInt8 = 1, -@@ -72,19 +72,19 @@ namespace Windows { +@@ -73,19 +73,19 @@ namespace Windows { OtherTypeArray = 1044 }; @@ -48,7 +47,7 @@ index 2c16fa2da22..c08334ed660 100644 struct Rect { FLOAT X; FLOAT Y; -@@ -92,18 +92,18 @@ namespace Windows { +@@ -93,18 +93,18 @@ namespace Windows { FLOAT Height; }; @@ -70,29 +69,8 @@ index 2c16fa2da22..c08334ed660 100644 uuid(96369f54-8eb6-48f0-abce-c1b211e627c3) ] interface IStringable : IInspectable -diff --git a/include/windows.media.speechsynthesis.idl b/include/windows.media.speechsynthesis.idl -index d3dedfe0709..7a1de5fcba6 100644 ---- a/include/windows.media.speechsynthesis.idl -+++ b/include/windows.media.speechsynthesis.idl -@@ -32,3 +32,16 @@ namespace Windows { - } - } - } -+ -+namespace Windows { -+ namespace Media { -+ namespace SpeechSynthesis { -+ [contract(Windows.Foundation.UniversalApiContract, 1.0)] -+ enum VoiceGender -+ { -+ Male = 0, -+ Female = 1 -+ }; -+ } -+ } -+} diff --git a/tools/widl/header.c b/tools/widl/header.c -index a892243fb54..e1c48ae35ea 100644 +index 657ce50c679..223ab5c5ca9 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -45,6 +45,11 @@ generic_handle_list_t generic_handle_list = LIST_INIT(generic_handle_list); @@ -145,7 +123,7 @@ index a892243fb54..e1c48ae35ea 100644 } int needs_space_after(type_t *t) -@@ -555,7 +566,9 @@ static void write_type_definition(FILE *f, type_t *t, int declonly) +@@ -563,7 +574,9 @@ static void write_type_definition(FILE *f, type_t *t, int declonly) int in_namespace = t->namespace && !is_global_namespace(t->namespace); int save_written = t->written; decl_spec_t ds = {.type = t}; @@ -155,7 +133,7 @@ index a892243fb54..e1c48ae35ea 100644 if(in_namespace) { fprintf(f, "#ifdef __cplusplus\n"); fprintf(f, "} /* extern \"C\" */\n"); -@@ -573,6 +586,7 @@ static void write_type_definition(FILE *f, type_t *t, int declonly) +@@ -581,6 +594,7 @@ static void write_type_definition(FILE *f, type_t *t, int declonly) fprintf(f, ";\n"); fprintf(f, "#endif\n\n"); } @@ -163,8 +141,8 @@ index a892243fb54..e1c48ae35ea 100644 } void write_type_decl(FILE *f, const decl_spec_t *t, const char *name) -@@ -1452,12 +1466,55 @@ static void write_forward(FILE *header, type_t *iface) - fprintf(header, "#endif\n\n" ); +@@ -1468,12 +1482,55 @@ static char *format_apicontract_macro(const type_t *type) + return name; } +static void write_winrt_type_comments(FILE *header, const type_t *type) @@ -219,7 +197,7 @@ index a892243fb54..e1c48ae35ea 100644 fprintf(header,"#ifndef __%s_%sINTERFACE_DEFINED__\n", iface->c_name, dispinterface ? "DISP" : ""); fprintf(header,"#define __%s_%sINTERFACE_DEFINED__\n\n", iface->c_name, dispinterface ? "DISP" : ""); } -@@ -1466,6 +1523,7 @@ static void write_com_interface_end(FILE *header, type_t *iface) +@@ -1482,6 +1539,7 @@ static void write_com_interface_end(FILE *header, type_t *iface) { int dispinterface = is_attr(iface->attrs, ATTR_DISPINTERFACE); const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); @@ -227,7 +205,7 @@ index a892243fb54..e1c48ae35ea 100644 type_t *type; if (uuid) -@@ -1543,17 +1601,22 @@ static void write_com_interface_end(FILE *header, type_t *iface) +@@ -1559,17 +1617,22 @@ static void write_com_interface_end(FILE *header, type_t *iface) write_locals(header, iface, FALSE); fprintf(header, "\n"); } @@ -251,7 +229,7 @@ index a892243fb54..e1c48ae35ea 100644 fprintf(header,"#ifndef __%s_INTERFACE_DEFINED__\n", iface->name); fprintf(header,"#define __%s_INTERFACE_DEFINED__\n\n", iface->name); if (var) -@@ -1578,7 +1641,10 @@ static void write_rpc_interface_start(FILE *header, const type_t *iface) +@@ -1594,7 +1657,10 @@ static void write_rpc_interface_start(FILE *header, const type_t *iface) static void write_rpc_interface_end(FILE *header, const type_t *iface) { @@ -264,22 +242,30 @@ index a892243fb54..e1c48ae35ea 100644 static void write_coclass(FILE *header, type_t *cocl) diff --git a/tools/widl/parser.l b/tools/widl/parser.l -index b715342ad59..c689b1cd400 100644 +index 6a9bb65a483..9dce03577c6 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l -@@ -338,6 +338,7 @@ static const struct keyword attr_keywords[] = +@@ -339,6 +339,7 @@ static const struct keyword attr_keywords[] = {"context_handle", tCONTEXTHANDLE, 0}, {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE, 0}, {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE, 0}, + {"contract", tCONTRACT, 1}, + {"contractversion", tCONTRACTVERSION, 1}, {"control", tCONTROL, 0}, - {"decode", tDECODE, 0}, - {"defaultbind", tDEFAULTBIND, 0}, + {"custom", tCUSTOM, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index bb29f976629..b6c24741f21 100644 +index 5b4bd518a0b..1d413ca74f4 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -264,6 +264,7 @@ static typelib_t *current_typelib; +@@ -181,6 +181,7 @@ static typelib_t *current_typelib; + %token tCALLAS tCALLBACK tCASE tCDECL tCHAR tCOCLASS tCODE tCOMMSTATUS + %token tCONST tCONTEXTHANDLE tCONTEXTHANDLENOSERIALIZE + %token tCONTEXTHANDLESERIALIZE ++%token tCONTRACT + %token tCONTRACTVERSION + %token tCONTROL tCPPQUOTE + %token tCUSTOM +@@ -271,6 +272,7 @@ static typelib_t *current_typelib; %type str_list %type m_expr expr expr_const expr_int_const array m_bitfield %type m_exprs /* exprs expr_list */ expr_list_int_const @@ -287,8 +273,8 @@ index bb29f976629..b6c24741f21 100644 %type interfacehdr %type storage_cls_spec %type type_qualifier m_type_qual_list -@@ -490,6 +491,12 @@ str_list: aSTRING { $$ = append_str( NULL, $1 ); } - | str_list ',' aSTRING { $$ = append_str( $1, $3 ); } +@@ -508,6 +510,12 @@ contract_ver: + | aNUM '.' aNUM { $$ = MAKEVERSION($3, $1); } ; +contract_req: decl_spec ',' contract_ver { if ($1->type->type_type != TYPE_APICONTRACT) @@ -300,34 +286,34 @@ index bb29f976629..b6c24741f21 100644 attribute: { $$ = NULL; } | tAGGREGATABLE { $$ = make_attr(ATTR_AGGREGATABLE); } | tANNOTATION '(' aSTRING ')' { $$ = make_attrp(ATTR_ANNOTATION, $3); } -@@ -505,6 +512,7 @@ attribute: { $$ = NULL; } +@@ -523,6 +531,7 @@ attribute: { $$ = NULL; } | tCONTEXTHANDLE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); } | tCONTEXTHANDLENOSERIALIZE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ } | tCONTEXTHANDLESERIALIZE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ } + | tCONTRACT '(' contract_req ')' { $$ = make_attrp(ATTR_CONTRACT, $3); } + | tCONTRACTVERSION '(' contract_ver ')' { $$ = make_attrv(ATTR_CONTRACTVERSION, $3); } | tCONTROL { $$ = make_attr(ATTR_CONTROL); } - | tDECODE { $$ = make_attr(ATTR_DECODE); } - | tDEFAULT { $$ = make_attr(ATTR_DEFAULT); } -@@ -2141,6 +2149,7 @@ struct allowed_attr allowed_attr[] = - /* ATTR_CODE */ { 0, 1, 0, 1, 1, 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, "comm_status" }, - /* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" }, -+ /* ATTR_CONTRACT */ { 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, "contract" }, - /* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, "control" }, - /* ATTR_DECODE */ { 0, 0, 0, 1, 1, 0, 1, 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, "default" }, + | tCUSTOM '(' uuid_string ',' expr_const ')' { $$ = make_custom_attr($3, $5); } +@@ -2180,6 +2189,7 @@ struct allowed_attr allowed_attr[] = + /* 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" }, diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h -index 62d3c1faa00..5e93dc1275f 100644 +index 878650d9c27..d5862426ad4 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -83,6 +83,7 @@ enum attr_type +@@ -84,6 +84,7 @@ enum attr_type ATTR_CODE, ATTR_COMMSTATUS, ATTR_CONTEXTHANDLE, + ATTR_CONTRACT, + ATTR_CONTRACTVERSION, ATTR_CONTROL, - ATTR_DECODE, - ATTR_DEFAULT, + ATTR_CUSTOM, -- 2.29.2 diff --git a/patches/widl-winrt-support/0001-include-Add-windows.media.speechsynthesis.idl-draft.patch b/patches/widl-winrt-support/0005-include-Add-windows.media.speechsynthesis.idl-draft.patch similarity index 72% rename from patches/widl-winrt-support/0001-include-Add-windows.media.speechsynthesis.idl-draft.patch rename to patches/widl-winrt-support/0005-include-Add-windows.media.speechsynthesis.idl-draft.patch index 8d276a95..0271373c 100644 --- a/patches/widl-winrt-support/0001-include-Add-windows.media.speechsynthesis.idl-draft.patch +++ b/patches/widl-winrt-support/0005-include-Add-windows.media.speechsynthesis.idl-draft.patch @@ -1,35 +1,32 @@ -From 5dc312c4a09e51410c217919511b84323923607e Mon Sep 17 00:00:00 2001 +From 01f45ef12247bf784f27b3edb78b5ce0969c50a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 23 Sep 2020 19:23:45 +0200 -Subject: [PATCH 01/28] include: Add windows.media.speechsynthesis.idl draft. +Subject: [PATCH] include: Add windows.media.speechsynthesis.idl draft. -This IDL is used by windows.media.speech.dll, which is itself required -by Flight Simulator. It will here be used as an illustration and test -case for WIDL WinRT features. --- include/Makefile.in | 1 + - include/windows.media.speechsynthesis.idl | 34 +++++++++++++++++++++++ - 2 files changed, 35 insertions(+) + include/windows.media.speechsynthesis.idl | 47 +++++++++++++++++++++++ + 2 files changed, 48 insertions(+) create mode 100644 include/windows.media.speechsynthesis.idl diff --git a/include/Makefile.in b/include/Makefile.in -index 23306689cab..d59b0be715d 100644 +index a84e44998cc..1028ebcb3e4 100644 --- a/include/Makefile.in +++ b/include/Makefile.in -@@ -735,6 +735,7 @@ SOURCES = \ +@@ -743,6 +743,7 @@ SOURCES = \ windef.h \ windns.h \ windows.foundation.idl \ + windows.media.speechsynthesis.idl \ windows.h \ + windowscontracts.idl \ windowsx.h \ - wine/debug.h \ diff --git a/include/windows.media.speechsynthesis.idl b/include/windows.media.speechsynthesis.idl new file mode 100644 -index 00000000000..d3dedfe0709 +index 00000000000..7a1de5fcba6 --- /dev/null +++ b/include/windows.media.speechsynthesis.idl -@@ -0,0 +1,34 @@ +@@ -0,0 +1,47 @@ +/* + * Copyright 2020 RĂ©mi Bernon for CodeWeavers + * @@ -64,6 +61,19 @@ index 00000000000..d3dedfe0709 + } + } +} ++ ++namespace Windows { ++ namespace Media { ++ namespace SpeechSynthesis { ++ [contract(Windows.Foundation.UniversalApiContract, 1.0)] ++ enum VoiceGender ++ { ++ Male = 0, ++ Female = 1 ++ }; ++ } ++ } ++} -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0009-widl-Support-WinRT-marshaling_behavior-attribute-par.patch b/patches/widl-winrt-support/0006-widl-Support-WinRT-marshaling_behavior-attribute-par.patch similarity index 72% rename from patches/widl-winrt-support/0009-widl-Support-WinRT-marshaling_behavior-attribute-par.patch rename to patches/widl-winrt-support/0006-widl-Support-WinRT-marshaling_behavior-attribute-par.patch index 6ebfaa4f..7a123687 100644 --- a/patches/widl-winrt-support/0009-widl-Support-WinRT-marshaling_behavior-attribute-par.patch +++ b/patches/widl-winrt-support/0006-widl-Support-WinRT-marshaling_behavior-attribute-par.patch @@ -1,4 +1,4 @@ -From 8ae37dd05502ae83af4f0284181eabae88aad9ee Mon Sep 17 00:00:00 2001 +From 96f79d868d6311262a9d30fe96b25cc120216531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 12 Oct 2020 20:34:28 +0200 Subject: [PATCH] widl: Support WinRT marshaling_behavior attribute parsing. @@ -6,15 +6,15 @@ Subject: [PATCH] widl: Support WinRT marshaling_behavior attribute parsing. --- tools/widl/header.c | 7 +++++++ tools/widl/parser.l | 4 ++++ - tools/widl/parser.y | 19 +++++++++++++++++-- + tools/widl/parser.y | 18 ++++++++++++++++-- tools/widl/widltypes.h | 9 +++++++++ - 4 files changed, 37 insertions(+), 2 deletions(-) + 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/tools/widl/header.c b/tools/widl/header.c -index e1c48ae35ea..9185477964e 100644 +index 223ab5c5ca9..21f8528c31d 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c -@@ -1478,6 +1478,13 @@ static void write_winrt_type_comments(FILE *header, const type_t *type) +@@ -1494,6 +1494,13 @@ 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); } @@ -29,10 +29,10 @@ index e1c48ae35ea..9185477964e 100644 static void write_apicontract_guard_start(FILE *header, const expr_t *expr) diff --git a/tools/widl/parser.l b/tools/widl/parser.l -index c689b1cd400..92f7c7844f3 100644 +index 9dce03577c6..01c6f800a08 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l -@@ -319,6 +319,7 @@ static const struct keyword keywords[] = { +@@ -320,6 +320,7 @@ static const struct keyword keywords[] = { static const struct keyword attr_keywords[] = { {"aggregatable", tAGGREGATABLE, 0}, @@ -40,7 +40,7 @@ index c689b1cd400..92f7c7844f3 100644 {"all_nodes", tALLNODES, 0}, {"allocate", tALLOCATE, 0}, {"annotation", tANNOTATION, 0}, -@@ -378,12 +379,14 @@ static const struct keyword attr_keywords[] = +@@ -381,12 +382,14 @@ static const struct keyword attr_keywords[] = {"length_is", tLENGTHIS, 0}, {"licensed", tLICENSED, 0}, {"local", tLOCAL, 0}, @@ -55,7 +55,7 @@ index c689b1cd400..92f7c7844f3 100644 {"nonextensible", tNONEXTENSIBLE, 0}, {"notify", tNOTIFY, 0}, {"notify_flag", tNOTIFYFLAG, 0}, -@@ -413,6 +416,7 @@ static const struct keyword attr_keywords[] = +@@ -416,6 +419,7 @@ static const struct keyword attr_keywords[] = {"single_node", tSINGLENODE, 0}, {"size_is", tSIZEIS, 0}, {"source", tSOURCE, 0}, @@ -64,22 +64,21 @@ index c689b1cd400..92f7c7844f3 100644 {"string", tSTRING, 0}, {"switch_is", tSWITCHIS, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index b6c24741f21..f3f71e9838a 100644 +index 1d413ca74f4..a8160df900a 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -172,7 +172,10 @@ static typelib_t *current_typelib; +@@ -174,7 +174,9 @@ static typelib_t *current_typelib; %token GREATEREQUAL LESSEQUAL %token LOGICALOR LOGICALAND %token ELLIPSIS --%token tAGGREGATABLE tALLNODES tALLOCATE tANNOTATION tAPPOBJECT tASYNC tASYNCUUID -+%token tAGGREGATABLE tALLNODES tAPPOBJECT tASYNC tASYNCUUID -+%token tAGGREGATABLE tALLNODES +-%token tAGGREGATABLE tALLNODES tALLOCATE tANNOTATION ++%token tAGGREGATABLE +%token tAGILE -+%token tALLOCATE tANNOTATION ++%token tALLNODES tALLOCATE tANNOTATION + %token tAPICONTRACT + %token tAPPOBJECT tASYNC tASYNCUUID %token tAUTOHANDLE tBINDABLE tBOOLEAN tBROADCAST tBYTE tBYTECOUNT - %token tCALLAS tCALLBACK tCASE tCDECL tCHAR tCOCLASS tCODE tCOMMSTATUS - %token tCONST tCONTEXTHANDLE tCONTEXTHANDLENOSERIALIZE -@@ -208,12 +211,14 @@ static typelib_t *current_typelib; +@@ -216,12 +218,14 @@ static typelib_t *current_typelib; %token tLENGTHIS tLIBRARY %token tLICENSED tLOCAL %token tLONG @@ -94,7 +93,7 @@ index b6c24741f21..f3f71e9838a 100644 %token tNONEXTENSIBLE %token tNOTIFY tNOTIFYFLAG %token tNULL -@@ -239,6 +244,7 @@ static typelib_t *current_typelib; +@@ -247,6 +251,7 @@ static typelib_t *current_typelib; %token tSIZEIS tSIZEOF %token tSMALL %token tSOURCE @@ -102,16 +101,16 @@ index b6c24741f21..f3f71e9838a 100644 %token tSTATIC %token tSTDCALL %token tSTRICTCONTEXTHANDLE -@@ -289,7 +295,7 @@ static typelib_t *current_typelib; - %type m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator - %type declarator_list struct_declarator_list +@@ -299,7 +304,7 @@ static typelib_t *current_typelib; %type coclass coclasshdr coclassdef + %type apicontract + %type contract_ver -%type pointer_type threading_type version +%type pointer_type threading_type marshaling_behavior version %type libraryhdr callconv cppquote importlib import t_ident %type uuid_string %type import_start -@@ -491,6 +497,12 @@ str_list: aSTRING { $$ = append_str( NULL, $1 ); } +@@ -505,6 +510,12 @@ str_list: aSTRING { $$ = append_str( NULL, $1 ); } | str_list ',' aSTRING { $$ = append_str( $1, $3 ); } ; @@ -121,10 +120,10 @@ index b6c24741f21..f3f71e9838a 100644 + | tSTANDARD { $$ = MARSHALING_STANDARD; } + ; + - contract_req: decl_spec ',' contract_ver { if ($1->type->type_type != TYPE_APICONTRACT) - error_loc("type %s is not an apicontract\n", $1->type->name); - $$ = make_exprl(EXPR_NUM, $3); -@@ -551,6 +563,8 @@ attribute: { $$ = NULL; } + contract_ver: + aNUM { $$ = MAKEVERSION(0, $1); } + | aNUM '.' aNUM { $$ = MAKEVERSION($3, $1); } +@@ -572,6 +583,8 @@ attribute: { $$ = NULL; } | tLCID { $$ = make_attr(ATTR_PARAMLCID); } | tLICENSED { $$ = make_attr(ATTR_LICENSED); } | tLOCAL { $$ = make_attr(ATTR_LOCAL); } @@ -133,19 +132,19 @@ index b6c24741f21..f3f71e9838a 100644 | tMAYBE { $$ = make_attr(ATTR_MAYBE); } | tMESSAGE { $$ = make_attr(ATTR_MESSAGE); } | tNOCODE { $$ = make_attr(ATTR_NOCODE); } -@@ -2188,6 +2202,7 @@ struct allowed_attr allowed_attr[] = - /* ATTR_LIBLCID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "lcid" }, - /* ATTR_LICENSED */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "licensed" }, - /* ATTR_LOCAL */ { 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "local" }, -+ /* ATTR_MARSHALING_BEHAVIOR */ { 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, "maybe" }, - /* ATTR_MESSAGE */ { 0, 0, 0, 0, 1, 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, "nocode" }, +@@ -2230,6 +2243,7 @@ struct allowed_attr allowed_attr[] = + /* 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" }, diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h -index 5e93dc1275f..c32b029e4a8 100644 +index d5862426ad4..6c130d4701e 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -122,6 +122,7 @@ enum attr_type +@@ -125,6 +125,7 @@ enum attr_type ATTR_LIBLCID, ATTR_LICENSED, ATTR_LOCAL, @@ -153,7 +152,7 @@ index 5e93dc1275f..c32b029e4a8 100644 ATTR_MAYBE, ATTR_MESSAGE, ATTR_NOCODE, -@@ -268,6 +269,14 @@ enum threading_type +@@ -271,6 +272,14 @@ enum threading_type THREADING_BOTH }; diff --git a/patches/widl-winrt-support/0010-widl-Support-WinRT-mta-threading-attribute-parsing.patch b/patches/widl-winrt-support/0007-widl-Support-WinRT-mta-threading-attribute-parsing.patch similarity index 83% rename from patches/widl-winrt-support/0010-widl-Support-WinRT-mta-threading-attribute-parsing.patch rename to patches/widl-winrt-support/0007-widl-Support-WinRT-mta-threading-attribute-parsing.patch index 1bc3bf16..bae73a29 100644 --- a/patches/widl-winrt-support/0010-widl-Support-WinRT-mta-threading-attribute-parsing.patch +++ b/patches/widl-winrt-support/0007-widl-Support-WinRT-mta-threading-attribute-parsing.patch @@ -1,7 +1,7 @@ -From d2013864b6a28fabca3678172ab95b95ab2bb9af Mon Sep 17 00:00:00 2001 +From b7c63f88f9c751933f2734eda85da6bb90c2b4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 13 Oct 2020 11:35:49 +0200 -Subject: [PATCH 10/28] widl: Support WinRT mta threading attribute parsing. +Subject: [PATCH] widl: Support WinRT mta threading attribute parsing. --- tools/widl/header.c | 7 +++++++ @@ -11,7 +11,7 @@ Subject: [PATCH 10/28] widl: Support WinRT mta threading attribute parsing. 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/widl/header.c b/tools/widl/header.c -index 6d5987bd4c1..843aba214a4 100644 +index 21f8528c31d..3fa938192d3 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -1494,6 +1494,13 @@ static void write_winrt_type_comments(FILE *header, const type_t *type) @@ -29,10 +29,10 @@ index 6d5987bd4c1..843aba214a4 100644 { case MARSHALING_AGILE: fprintf(header, " * Class Marshaling Behavior: Agile - Class is agile\n *\n"); break; diff --git a/tools/widl/parser.l b/tools/widl/parser.l -index 39a19a3c1de..c99feffb5d6 100644 +index 01c6f800a08..067966a85d4 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l -@@ -382,6 +382,7 @@ static const struct keyword attr_keywords[] = +@@ -385,6 +385,7 @@ static const struct keyword attr_keywords[] = {"marshaling_behavior", tMARSHALINGBEHAVIOR, 1}, {"maybe", tMAYBE, 0}, {"message", tMESSAGE, 0}, @@ -41,10 +41,10 @@ index 39a19a3c1de..c99feffb5d6 100644 {"nocode", tNOCODE, 0}, {"nonbrowsable", tNONBROWSABLE, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index ebaa0fc514b..a4ad03ef037 100644 +index a8160df900a..caaa2f49d0c 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -220,6 +220,7 @@ static typelib_t *current_typelib; +@@ -222,6 +222,7 @@ static typelib_t *current_typelib; %token tMAYBE tMESSAGE %token tMETHODS %token tMODULE @@ -52,7 +52,7 @@ index ebaa0fc514b..a4ad03ef037 100644 %token tNAMESPACE %token tNOCODE tNONBROWSABLE %token tNONCREATABLE -@@ -1150,6 +1151,7 @@ threading_type: +@@ -1154,6 +1155,7 @@ threading_type: | tSINGLE { $$ = THREADING_SINGLE; } | tFREE { $$ = THREADING_FREE; } | tBOTH { $$ = THREADING_BOTH; } @@ -61,10 +61,10 @@ index ebaa0fc514b..a4ad03ef037 100644 pointer_type: diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h -index 62a018ab5a5..26634fa7f7d 100644 +index 6c130d4701e..8a3bd00e340 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -266,7 +266,8 @@ enum threading_type +@@ -269,7 +269,8 @@ enum threading_type THREADING_NEUTRAL, THREADING_SINGLE, THREADING_FREE, @@ -75,5 +75,5 @@ index 62a018ab5a5..26634fa7f7d 100644 enum marshaling_type -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0011-widl-Support-WinRT-exclusiveto-attribute-parsing.patch b/patches/widl-winrt-support/0008-widl-Support-WinRT-exclusiveto-attribute-parsing.patch similarity index 77% rename from patches/widl-winrt-support/0011-widl-Support-WinRT-exclusiveto-attribute-parsing.patch rename to patches/widl-winrt-support/0008-widl-Support-WinRT-exclusiveto-attribute-parsing.patch index b95dd70b..e7ea76c1 100644 --- a/patches/widl-winrt-support/0011-widl-Support-WinRT-exclusiveto-attribute-parsing.patch +++ b/patches/widl-winrt-support/0008-widl-Support-WinRT-exclusiveto-attribute-parsing.patch @@ -1,4 +1,4 @@ -From 2a66f0891e81685b0eaf7dc9bcdd1cb60eb166af Mon Sep 17 00:00:00 2001 +From b50209766aa6b602ebee9b7c17f274d30e238ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 13 Oct 2020 00:11:08 +0200 Subject: [PATCH] widl: Support WinRT exclusiveto attribute parsing. @@ -11,10 +11,10 @@ Subject: [PATCH] widl: Support WinRT exclusiveto attribute parsing. 4 files changed, 12 insertions(+) diff --git a/tools/widl/header.c b/tools/widl/header.c -index d7efbe72a35..e18585615f2 100644 +index 3fa938192d3..1d910364994 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c -@@ -1469,6 +1469,7 @@ static void write_forward(FILE *header, type_t *iface) +@@ -1485,6 +1485,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); @@ -22,7 +22,7 @@ index d7efbe72a35..e18585615f2 100644 fprintf(header, " *\n"); if (contract) { -@@ -1478,6 +1479,12 @@ static void write_winrt_type_comments(FILE *header, const type_t *type) +@@ -1494,6 +1495,12 @@ 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); } @@ -36,10 +36,10 @@ index d7efbe72a35..e18585615f2 100644 { case THREADING_SINGLE: fprintf(header, " * Class Threading Model: Single Threaded Apartment\n *\n"); break; diff --git a/tools/widl/parser.l b/tools/widl/parser.l -index 403886221a6..01ce16fa8c1 100644 +index 067966a85d4..de25b7d12c4 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l -@@ -355,6 +355,7 @@ static const struct keyword attr_keywords[] = +@@ -358,6 +358,7 @@ static const struct keyword attr_keywords[] = {"encode", tENCODE, 0}, {"endpoint", tENDPOINT, 0}, {"entry", tENTRY, 0}, @@ -48,10 +48,10 @@ index 403886221a6..01ce16fa8c1 100644 {"fault_status", tFAULTSTATUS, 0}, {"force_allocate", tFORCEALLOCATE, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index 7cef2abda80..986ecd4b29b 100644 +index caaa2f49d0c..57f1e3f5301 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -189,6 +189,7 @@ static typelib_t *current_typelib; +@@ -196,6 +196,7 @@ static typelib_t *current_typelib; %token tDLLNAME tDONTFREE tDOUBLE tDUAL %token tENABLEALLOCATE tENCODE tENDPOINT %token tENTRY tENUM tERRORSTATUST @@ -59,7 +59,7 @@ index 7cef2abda80..986ecd4b29b 100644 %token tEXPLICITHANDLE tEXTERN %token tFALSE %token tFASTCALL tFAULTSTATUS -@@ -541,6 +542,7 @@ attribute: { $$ = NULL; } +@@ -561,6 +562,7 @@ attribute: { $$ = NULL; } | tENCODE { $$ = make_attr(ATTR_ENCODE); } | tENDPOINT '(' str_list ')' { $$ = make_attrp(ATTR_ENDPOINT, $3); } | tENTRY '(' expr_const ')' { $$ = make_attrp(ATTR_ENTRY, $3); } @@ -67,19 +67,19 @@ index 7cef2abda80..986ecd4b29b 100644 | tEXPLICITHANDLE { $$ = make_attr(ATTR_EXPLICIT_HANDLE); } | tFAULTSTATUS { $$ = make_attr(ATTR_FAULTSTATUS); } | tFORCEALLOCATE { $$ = make_attr(ATTR_FORCEALLOCATE); } -@@ -2182,6 +2184,7 @@ struct allowed_attr allowed_attr[] = - /* ATTR_ENCODE */ { 0, 0, 0, 1, 1, 0, 1, 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, "endpoint" }, - /* ATTR_ENTRY */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "entry" }, -+ /* ATTR_EXCLUSIVETO */ { 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, "explicit_handle" }, - /* ATTR_FAULTSTATUS */ { 0, 0, 0, 0, 1, 1, 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, "force_allocate" }, +@@ -2223,6 +2225,7 @@ struct allowed_attr allowed_attr[] = + /* 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" }, diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h -index 90a73af2bf5..6292ddc96db 100644 +index 8a3bd00e340..7ad0cbea66f 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -100,6 +100,7 @@ enum attr_type +@@ -103,6 +103,7 @@ enum attr_type ATTR_ENCODE, ATTR_ENDPOINT, ATTR_ENTRY, diff --git a/patches/widl-winrt-support/0009-widl-Support-WinRT-runtimeclass-type.patch b/patches/widl-winrt-support/0009-widl-Support-WinRT-runtimeclass-type.patch new file mode 100644 index 00000000..f7c2009d --- /dev/null +++ b/patches/widl-winrt-support/0009-widl-Support-WinRT-runtimeclass-type.patch @@ -0,0 +1,746 @@ +From 84586a64342dd0da353d56579fd58927feca226d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?R=C3=A9mi=20Bernon?= +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 | 65 +++++- + 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 | 7 + + 10 files changed, 300 insertions(+), 114 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 1d910364994..93bcb4f5214 100644 +--- a/tools/widl/header.c ++++ b/tools/widl/header.c +@@ -465,6 +465,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; +@@ -547,6 +550,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 */ +@@ -1033,7 +1037,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) +@@ -1501,6 +1506,21 @@ 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 (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; +@@ -1728,6 +1748,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; +@@ -1792,6 +1851,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: +@@ -1848,6 +1909,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 de25b7d12c4..80a6bc38afb 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 57f1e3f5301..93714ebf712 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 base_type int_std + %type enumdef structdef uniondef typedecl + %type type qualified_seq qualified_type +-%type coclass_int +-%type coclass_ints ++%type class_interface ++%type class_interfaces + %type arg ne_union_field union_field s_field case enum enum_member declaration + %type funcdef + %type m_args arg_list args dispint_meths +@@ -304,6 +306,7 @@ static typelib_t *current_typelib; + %type m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator + %type declarator_list struct_declarator_list + %type coclass coclasshdr coclassdef ++%type runtimeclass runtimeclass_hdr runtimeclass_def + %type apicontract + %type contract_ver + %type 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 } */ +- /* 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 } */ ++ /* 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 d211fa8d277..9bddba90681 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 7ad0cbea66f..77313b30c0f 100644 +--- a/tools/widl/widltypes.h ++++ b/tools/widl/widltypes.h +@@ -426,6 +426,11 @@ struct alias_details + struct _decl_spec_t aliasee; + }; + ++struct runtimeclass_details ++{ ++ ifref_list_t *ifaces; ++}; ++ + #define HASHMAX 64 + + struct namespace { +@@ -453,6 +458,7 @@ enum type_type + TYPE_ARRAY, + TYPE_BITFIELD, + TYPE_APICONTRACT, ++ TYPE_RUNTIMECLASS, + }; + + struct _type_t { +@@ -473,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 + diff --git a/patches/widl-winrt-support/0013-widl-Support-WinRT-eventadd-eventremove-attributes.patch b/patches/widl-winrt-support/0010-widl-Support-WinRT-eventadd-eventremove-attributes.patch similarity index 70% rename from patches/widl-winrt-support/0013-widl-Support-WinRT-eventadd-eventremove-attributes.patch rename to patches/widl-winrt-support/0010-widl-Support-WinRT-eventadd-eventremove-attributes.patch index 888cee41..17761de3 100644 --- a/patches/widl-winrt-support/0013-widl-Support-WinRT-eventadd-eventremove-attributes.patch +++ b/patches/widl-winrt-support/0010-widl-Support-WinRT-eventadd-eventremove-attributes.patch @@ -1,4 +1,4 @@ -From 2c2b50a97a60d7da4c1737f06fbd56d686aebcb8 Mon Sep 17 00:00:00 2001 +From 8e4ce83c6e6b23b81c0ec70699fd1884b004dc73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 1 Oct 2020 20:10:02 +0200 Subject: [PATCH] widl: Support WinRT eventadd/eventremove attributes. @@ -11,7 +11,7 @@ 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 065a82ea384..812becad63b 100644 +index 93bcb4f5214..ae392fe7de4 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -187,6 +187,10 @@ const char *get_name(const var_t *v) @@ -26,10 +26,10 @@ index 065a82ea384..812becad63b 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 4fcba3f2301..74e55f0d6ab 100644 +index 80a6bc38afb..4932e0adbe2 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l -@@ -358,6 +358,8 @@ static const struct keyword attr_keywords[] = +@@ -359,6 +359,8 @@ static const struct keyword attr_keywords[] = {"encode", tENCODE, 0}, {"endpoint", tENDPOINT, 0}, {"entry", tENTRY, 0}, @@ -39,10 +39,10 @@ index 4fcba3f2301..74e55f0d6ab 100644 {"explicit_handle", tEXPLICITHANDLE, 0}, {"fault_status", tFAULTSTATUS, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index 72b9d79cba1..fe35bde38e7 100644 +index 93714ebf712..b19fb16efd0 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -195,6 +195,7 @@ static typelib_t *current_typelib; +@@ -197,6 +197,7 @@ static typelib_t *current_typelib; %token tDLLNAME tDONTFREE tDOUBLE tDUAL %token tENABLEALLOCATE tENCODE tENDPOINT %token tENTRY tENUM tERRORSTATUST @@ -50,7 +50,7 @@ index 72b9d79cba1..fe35bde38e7 100644 %token tEXCLUSIVETO %token tEXPLICITHANDLE tEXTERN %token tFALSE -@@ -568,6 +569,8 @@ attribute: { $$ = NULL; } +@@ -571,6 +572,8 @@ attribute: { $$ = NULL; } | tENCODE { $$ = make_attr(ATTR_ENCODE); } | tENDPOINT '(' str_list ')' { $$ = make_attrp(ATTR_ENDPOINT, $3); } | tENTRY '(' expr_const ')' { $$ = make_attrp(ATTR_ENTRY, $3); } @@ -59,16 +59,16 @@ index 72b9d79cba1..fe35bde38e7 100644 | 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); } -@@ -2260,6 +2263,8 @@ struct allowed_attr allowed_attr[] = - /* ATTR_ENCODE */ { 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "encode" }, - /* ATTR_ENDPOINT */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "endpoint" }, - /* ATTR_ENTRY */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "entry" }, -+ /* ATTR_EVENTADD */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "eventadd" }, -+ /* ATTR_EVENTREMOVE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "eventremove" }, - /* ATTR_EXCLUSIVETO */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "exclusive_to" }, - /* ATTR_EXPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "explicit_handle" }, - /* ATTR_FAULTSTATUS */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "fault_status" }, -@@ -2909,6 +2914,8 @@ static void check_functions(const type_t *iface, int is_inside_library) +@@ -2256,6 +2259,8 @@ struct allowed_attr allowed_attr[] = + /* 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_EVENTADD */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "eventadd" }, ++ /* ATTR_EVENTREMOVE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "eventremove" }, + /* 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" }, +@@ -2929,6 +2934,8 @@ static void check_functions(const type_t *iface, int is_inside_library) { if (func == func_iter) break; if (strcmp(func->name, func_iter->name)) continue; @@ -78,10 +78,10 @@ index 72b9d79cba1..fe35bde38e7 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 3d8be66f4b8..b46fed49cd6 100644 +index 77313b30c0f..75510ee50b1 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -101,6 +101,8 @@ enum attr_type +@@ -103,6 +103,8 @@ enum attr_type ATTR_ENCODE, ATTR_ENDPOINT, ATTR_ENTRY, @@ -91,5 +91,5 @@ index 3d8be66f4b8..b46fed49cd6 100644 ATTR_EXPLICIT_HANDLE, ATTR_FAULTSTATUS, -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0014-widl-Support-WinRT-flags-attribute-parsing.patch b/patches/widl-winrt-support/0011-widl-Support-WinRT-flags-attribute-parsing.patch similarity index 58% rename from patches/widl-winrt-support/0014-widl-Support-WinRT-flags-attribute-parsing.patch rename to patches/widl-winrt-support/0011-widl-Support-WinRT-flags-attribute-parsing.patch index 37548b4b..ca022b06 100644 --- a/patches/widl-winrt-support/0014-widl-Support-WinRT-flags-attribute-parsing.patch +++ b/patches/widl-winrt-support/0011-widl-Support-WinRT-flags-attribute-parsing.patch @@ -1,7 +1,7 @@ -From c64bd2a13a6ec07122d08bc81d4933b38eec5edf Mon Sep 17 00:00:00 2001 +From 3fbc18351dcd54b48c1441e428a90efd8c68ffd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 12 Oct 2020 18:02:59 +0200 -Subject: [PATCH 14/28] widl: Support WinRT flags attribute parsing. +Subject: [PATCH] widl: Support WinRT flags attribute parsing. --- tools/widl/parser.l | 1 + @@ -10,10 +10,10 @@ Subject: [PATCH 14/28] widl: Support WinRT flags attribute parsing. 3 files changed, 5 insertions(+) diff --git a/tools/widl/parser.l b/tools/widl/parser.l -index 02a6b47e225..f5a57db4797 100644 +index 4932e0adbe2..51142ded6e6 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l -@@ -361,6 +361,7 @@ static const struct keyword attr_keywords[] = +@@ -364,6 +364,7 @@ static const struct keyword attr_keywords[] = {"exclusiveto", tEXCLUSIVETO, 1}, {"explicit_handle", tEXPLICITHANDLE, 0}, {"fault_status", tFAULTSTATUS, 0}, @@ -22,10 +22,10 @@ index 02a6b47e225..f5a57db4797 100644 {"free", tFREE, 0}, {"handle", tHANDLE, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index b1b3201042f..131226ba7be 100644 +index b19fb16efd0..110b570f4e4 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -200,6 +200,7 @@ static typelib_t *current_typelib; +@@ -202,6 +202,7 @@ static typelib_t *current_typelib; %token tEXPLICITHANDLE tEXTERN %token tFALSE %token tFASTCALL tFAULTSTATUS @@ -33,7 +33,7 @@ index b1b3201042f..131226ba7be 100644 %token tFLOAT tFORCEALLOCATE %token tHANDLE %token tHANDLET -@@ -575,6 +576,7 @@ attribute: { $$ = NULL; } +@@ -579,6 +580,7 @@ attribute: { $$ = NULL; } $$ = make_attrp(ATTR_EXCLUSIVETO, $3->type); } | tEXPLICITHANDLE { $$ = make_attr(ATTR_EXPLICIT_HANDLE); } | tFAULTSTATUS { $$ = make_attr(ATTR_FAULTSTATUS); } @@ -41,19 +41,19 @@ index b1b3201042f..131226ba7be 100644 | tFORCEALLOCATE { $$ = make_attr(ATTR_FORCEALLOCATE); } | tHANDLE { $$ = make_attr(ATTR_HANDLE); } | tHELPCONTEXT '(' expr_int_const ')' { $$ = make_attrp(ATTR_HELPCONTEXT, $3); } -@@ -2243,6 +2245,7 @@ struct allowed_attr allowed_attr[] = - /* ATTR_EXCLUSIVETO */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "exclusive_to" }, - /* ATTR_EXPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "explicit_handle" }, - /* ATTR_FAULTSTATUS */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "fault_status" }, -+ /* ATTR_FLAGS */ { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "flags" }, - /* ATTR_FORCEALLOCATE */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "handle" }, - /* ATTR_HELPCONTEXT */ { 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, "helpcontext" }, +@@ -2264,6 +2266,7 @@ struct allowed_attr allowed_attr[] = + /* 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_FLAGS */ { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "flags" }, + /* 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" }, diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h -index da70a8f97d5..0bf7b644fff 100644 +index 75510ee50b1..a3283761256 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -105,6 +105,7 @@ enum attr_type +@@ -108,6 +108,7 @@ enum attr_type ATTR_EXCLUSIVETO, ATTR_EXPLICIT_HANDLE, ATTR_FAULTSTATUS, @@ -62,5 +62,5 @@ index da70a8f97d5..0bf7b644fff 100644 ATTR_HANDLE, ATTR_HELPCONTEXT, -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0012-widl-Support-WinRT-runtimeclass-type.patch b/patches/widl-winrt-support/0012-widl-Support-WinRT-runtimeclass-type.patch deleted file mode 100644 index e0b6cb58..00000000 --- a/patches/widl-winrt-support/0012-widl-Support-WinRT-runtimeclass-type.patch +++ /dev/null @@ -1,744 +0,0 @@ -From 46d4c130ac65bff2c20e9ac9f295bc84ad98578b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Tue, 13 Oct 2020 15:57:04 +0200 -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 | 65 +++++- - tools/widl/parser.l | 1 + - tools/widl/parser.y | 267 +++++++++++++--------- - tools/widl/typegen.c | 4 + - tools/widl/typelib.c | 1 + - tools/widl/typetree.c | 17 ++ - tools/widl/typetree.h | 24 ++ - tools/widl/widltypes.h | 7 + - 10 files changed, 299 insertions(+), 113 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 8aed9be3f57..065a82ea384 100644 ---- a/tools/widl/header.c -+++ b/tools/widl/header.c -@@ -465,6 +465,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; -@@ -547,6 +550,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 */ -@@ -1033,7 +1037,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) -@@ -1501,6 +1506,21 @@ 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 (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; -@@ -1728,6 +1748,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; -@@ -1792,6 +1851,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: -@@ -1848,6 +1909,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 999cd1054c2..4fcba3f2301 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 57e844209f4..72b9d79cba1 100644 ---- a/tools/widl/parser.y -+++ b/tools/widl/parser.y -@@ -99,6 +99,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); -@@ -245,6 +246,7 @@ static typelib_t *current_typelib; - %token tREQUESTEDIT - %token tRESTRICTED - %token tRETVAL -+%token tRUNTIMECLASS - %token tSAFEARRAY - %token tSHORT - %token tSIGNED tSINGLENODE -@@ -290,8 +292,8 @@ static typelib_t *current_typelib; - %type base_type int_std - %type enumdef structdef uniondef typedecl - %type type qualified_seq qualified_type --%type coclass_int --%type coclass_ints -+%type class_interface -+%type class_interfaces - %type arg ne_union_field union_field s_field case enum enum_member declaration - %type funcdef - %type m_args arg_list args dispint_meths -@@ -302,6 +304,7 @@ static typelib_t *current_typelib; - %type m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator - %type declarator_list struct_declarator_list - %type coclass coclasshdr coclassdef -+%type runtimeclass runtimeclass_hdr runtimeclass_def - %type apicontract - %type contract_ver - %type pointer_type threading_type marshaling_behavior version -@@ -362,6 +365,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); } -@@ -378,6 +384,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)); } -@@ -559,7 +568,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); } -@@ -894,10 +905,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($$); -@@ -909,11 +939,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; } - ; - -@@ -2190,116 +2220,117 @@ 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 I Fn ARG T En Enm St Un Fi L DI M C AC } */ -- /* ATTR_AGGREGATABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "aggregatable" }, -- /* ATTR_ALLOCATE */ { 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "allocate" }, -- /* ATTR_ANNOTATION */ { 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, 1, 0, "appobject" }, -- /* ATTR_ASYNC */ { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "async" }, -- /* ATTR_ASYNCUUID */ { 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, "async_uuid" }, -- /* ATTR_AUTO_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "auto_handle" }, -- /* ATTR_BINDABLE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "bindable" }, -- /* ATTR_BROADCAST */ { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "broadcast" }, -- /* ATTR_CALLAS */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "call_as" }, -- /* ATTR_CALLCONV */ { 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, 1, 0, 0, 0, 0, 0, "case" }, -- /* ATTR_CODE */ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "code" }, -- /* ATTR_COMMSTATUS */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" }, -- /* ATTR_CONTRACT */ { 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, 1, "contractversion" }, -- /* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, "control" }, -- /* ATTR_DECODE */ { 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "decode" }, -- /* ATTR_DEFAULT */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, "default" }, -- /* ATTR_DEFAULTBIND */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultbind" }, -- /* ATTR_DEFAULTCOLLELEM */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultcollelem" }, -- /* ATTR_DEFAULTVALUE */ { 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, 1, 0, "defaultvtable" }, -- /* ATTR_DISABLECONSISTENCYCHECK */{ 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, NULL }, -- /* ATTR_DISPLAYBIND */ { 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, 1, 0, 0, "dllname" }, -- /* ATTR_DUAL */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "dual" }, -- /* ATTR_ENABLEALLOCATE */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "enable_allocate" }, -- /* ATTR_ENCODE */ { 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "encode" }, -- /* ATTR_ENDPOINT */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "endpoint" }, -- /* ATTR_ENTRY */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "entry" }, -- /* ATTR_EXCLUSIVETO */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "exclusive_to" }, -- /* ATTR_EXPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "explicit_handle" }, -- /* ATTR_FAULTSTATUS */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "fault_status" }, -- /* ATTR_FORCEALLOCATE */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "handle" }, -- /* ATTR_HELPCONTEXT */ { 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, 1, 0, 0, 0, 0, "helpfile" }, -- /* ATTR_HELPSTRING */ { 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, "helpstring" }, -- /* ATTR_HELPSTRINGCONTEXT */ { 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, 1, 0, 0, 0, 0, "helpstringdll" }, -- /* ATTR_HIDDEN */ { 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, "hidden" }, -- /* ATTR_ID */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, "id" }, -- /* ATTR_IDEMPOTENT */ { 1, 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, 1, 0, 0, 0, 0, 0, "ignore" }, -- /* ATTR_IIDIS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "iid_is" }, -- /* ATTR_IMMEDIATEBIND */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "immediatebind" }, -- /* ATTR_IMPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "implicit_handle" }, -- /* ATTR_IN */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "in" }, -- /* ATTR_INPUTSYNC */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "inputsync" }, -- /* ATTR_LENGTHIS */ { 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, 1, 0, 0, 0, 0, "lcid" }, -- /* ATTR_LICENSED */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "licensed" }, -- /* ATTR_LOCAL */ { 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "local" }, -- /* ATTR_MARSHALING_BEHAVIOR */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "marshaling_behavior" }, -- /* ATTR_MAYBE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "maybe" }, -- /* ATTR_MESSAGE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "message" }, -- /* ATTR_NOCODE */ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nocode" }, -- /* ATTR_NONBROWSABLE */ { 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, 1, 0, "noncreatable" }, -- /* ATTR_NONEXTENSIBLE */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nonextensible" }, -- /* ATTR_NOTIFY */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "notify" }, -- /* ATTR_NOTIFYFLAG */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "notify_flag" }, -- /* ATTR_OBJECT */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "object" }, -- /* ATTR_ODL */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "odl" }, -- /* ATTR_OLEAUTOMATION */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "oleautomation" }, -- /* ATTR_OPTIMIZE */ { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "optimize" }, -- /* ATTR_OPTIONAL */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "optional" }, -- /* ATTR_OUT */ { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "out" }, -- /* ATTR_PARAMLCID */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "lcid" }, -- /* ATTR_PARTIALIGNORE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "partial_ignore" }, -- /* ATTR_POINTERDEFAULT */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "pointer_default" }, -- /* ATTR_POINTERTYPE */ { 1, 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, 1, 0, "progid" }, -- /* ATTR_PROPGET */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propget" }, -- /* ATTR_PROPPUT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propput" }, -- /* ATTR_PROPPUTREF */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propputref" }, -- /* ATTR_PROXY */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "proxy" }, -- /* ATTR_PUBLIC */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "public" }, -- /* ATTR_RANGE */ { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, "range" }, -- /* ATTR_READONLY */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "readonly" }, -- /* ATTR_REPRESENTAS */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "represent_as" }, -- /* ATTR_REQUESTEDIT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "requestedit" }, -- /* ATTR_RESTRICTED */ { 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, "restricted" }, -- /* ATTR_RETVAL */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "retval" }, -- /* ATTR_SIZEIS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "size_is" }, -- /* ATTR_SOURCE */ { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "source" }, -- /* ATTR_STRICTCONTEXTHANDLE */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "strict_context_handle" }, -- /* ATTR_STRING */ { 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "string" }, -- /* ATTR_SWITCHIS */ { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "switch_is" }, -- /* ATTR_SWITCHTYPE */ { 1, 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, 1, 0, "threading" }, -- /* ATTR_TRANSMITAS */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "transmit_as" }, -- /* ATTR_UIDEFAULT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "uidefault" }, -- /* ATTR_USESGETLASTERROR */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "usesgetlasterror" }, -- /* ATTR_USERMARSHAL */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "user_marshal" }, -- /* ATTR_UUID */ { 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, "uuid" }, -- /* ATTR_V1ENUM */ { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "v1_enum" }, -- /* ATTR_VARARG */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "vararg" }, -- /* ATTR_VERSION */ { 1, 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, 1, 0, "vi_progid" }, -- /* ATTR_WIREMARSHAL */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "wire_marshal" }, -+ /* attr { D ACF I Fn ARG T En Enm St Un Fi L DI M C AC R } */ -+ /* ATTR_AGGREGATABLE */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "allocate" }, -+ /* ATTR_ANNOTATION */ { 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, 1, 0, 0, "appobject" }, -+ /* ATTR_ASYNC */ { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "async" }, -+ /* ATTR_ASYNCUUID */ { 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, "async_uuid" }, -+ /* ATTR_AUTO_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "auto_handle" }, -+ /* ATTR_BINDABLE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "bindable" }, -+ /* ATTR_BROADCAST */ { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "broadcast" }, -+ /* ATTR_CALLAS */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "call_as" }, -+ /* ATTR_CALLCONV */ { 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, 1, 0, 0, 0, 0, 0, 0, "case" }, -+ /* ATTR_CODE */ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "code" }, -+ /* ATTR_COMMSTATUS */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" }, -+ /* ATTR_CONTRACT */ { 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, 1, 0, "contractversion" }, -+ /* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, "control" }, -+ /* ATTR_DECODE */ { 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "decode" }, -+ /* ATTR_DEFAULT */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, "default" }, -+ /* ATTR_DEFAULTBIND */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultbind" }, -+ /* ATTR_DEFAULTCOLLELEM */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultcollelem" }, -+ /* ATTR_DEFAULTVALUE */ { 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, 1, 0, 0, "defaultvtable" }, -+ /* ATTR_DISABLECONSISTENCYCHECK */{ 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, NULL }, -+ /* ATTR_DISPLAYBIND */ { 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, 1, 0, 0, 0, "dllname" }, -+ /* ATTR_DUAL */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "dual" }, -+ /* ATTR_ENABLEALLOCATE */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "enable_allocate" }, -+ /* ATTR_ENCODE */ { 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "encode" }, -+ /* ATTR_ENDPOINT */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "endpoint" }, -+ /* ATTR_ENTRY */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "entry" }, -+ /* ATTR_EXCLUSIVETO */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "exclusive_to" }, -+ /* ATTR_EXPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "explicit_handle" }, -+ /* ATTR_FAULTSTATUS */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "force_allocate" }, -+ /* ATTR_HANDLE */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "handle" }, -+ /* ATTR_HELPCONTEXT */ { 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, 1, 0, 0, 0, 0, 0, "helpfile" }, -+ /* ATTR_HELPSTRING */ { 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, "helpstring" }, -+ /* ATTR_HELPSTRINGCONTEXT */ { 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, 1, 0, 0, 0, 0, 0, "helpstringdll" }, -+ /* ATTR_HIDDEN */ { 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, "hidden" }, -+ /* ATTR_ID */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, "id" }, -+ /* ATTR_IDEMPOTENT */ { 1, 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, 1, 0, 0, 0, 0, 0, 0, "ignore" }, -+ /* ATTR_IIDIS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "iid_is" }, -+ /* ATTR_IMMEDIATEBIND */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "immediatebind" }, -+ /* ATTR_IMPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "implicit_handle" }, -+ /* ATTR_IN */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "in" }, -+ /* ATTR_INPUTSYNC */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "inputsync" }, -+ /* ATTR_LENGTHIS */ { 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, 1, 0, 0, 0, 0, 0, "lcid" }, -+ /* ATTR_LICENSED */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "licensed" }, -+ /* ATTR_LOCAL */ { 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "local" }, -+ /* ATTR_MARSHALING_BEHAVIOR */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "marshaling_behavior" }, -+ /* ATTR_MAYBE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "maybe" }, -+ /* ATTR_MESSAGE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "message" }, -+ /* ATTR_NOCODE */ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nocode" }, -+ /* ATTR_NONBROWSABLE */ { 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, 1, 0, 0, "noncreatable" }, -+ /* ATTR_NONEXTENSIBLE */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nonextensible" }, -+ /* ATTR_NOTIFY */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "notify" }, -+ /* ATTR_NOTIFYFLAG */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "notify_flag" }, -+ /* ATTR_OBJECT */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "object" }, -+ /* ATTR_ODL */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "odl" }, -+ /* ATTR_OLEAUTOMATION */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "oleautomation" }, -+ /* ATTR_OPTIMIZE */ { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "optimize" }, -+ /* ATTR_OPTIONAL */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "optional" }, -+ /* ATTR_OUT */ { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "out" }, -+ /* ATTR_PARAMLCID */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "lcid" }, -+ /* ATTR_PARTIALIGNORE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "partial_ignore" }, -+ /* ATTR_POINTERDEFAULT */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "pointer_default" }, -+ /* ATTR_POINTERTYPE */ { 1, 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, 1, 0, 0, "progid" }, -+ /* ATTR_PROPGET */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propget" }, -+ /* ATTR_PROPPUT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propput" }, -+ /* ATTR_PROPPUTREF */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propputref" }, -+ /* ATTR_PROXY */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "public" }, -+ /* ATTR_RANGE */ { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "range" }, -+ /* ATTR_READONLY */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "represent_as" }, -+ /* ATTR_REQUESTEDIT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "requestedit" }, -+ /* ATTR_RESTRICTED */ { 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, "restricted" }, -+ /* ATTR_RETVAL */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "retval" }, -+ /* ATTR_SIZEIS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "size_is" }, -+ /* ATTR_SOURCE */ { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "source" }, -+ /* ATTR_STRICTCONTEXTHANDLE */ { 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, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "string" }, -+ /* ATTR_SWITCHIS */ { 1, 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, 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, 1, 0, 1, "threading" }, -+ /* ATTR_TRANSMITAS */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "transmit_as" }, -+ /* ATTR_UIDEFAULT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "uidefault" }, -+ /* ATTR_USESGETLASTERROR */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "user_marshal" }, -+ /* ATTR_UUID */ { 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, "uuid" }, -+ /* ATTR_V1ENUM */ { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "v1_enum" }, -+ /* ATTR_VARARG */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "vararg" }, -+ /* ATTR_VERSION */ { 1, 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, 1, 0, 0, "vi_progid" }, -+ /* ATTR_WIREMARSHAL */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "wire_marshal" }, - }; - - const char *get_attr_display_name(enum attr_type type) -@@ -2490,6 +2521,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; -@@ -2539,6 +2581,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 d8dcd5d80b0..d075619448d 100644 ---- a/tools/widl/typetree.c -+++ b/tools/widl/typetree.c -@@ -211,6 +211,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) -@@ -505,6 +515,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 5e5ca55a2cb..3d8be66f4b8 100644 ---- a/tools/widl/widltypes.h -+++ b/tools/widl/widltypes.h -@@ -419,6 +419,11 @@ struct alias_details - struct _decl_spec_t aliasee; - }; - -+struct runtimeclass_details -+{ -+ ifref_list_t *ifaces; -+}; -+ - #define HASHMAX 64 - - struct namespace { -@@ -446,6 +451,7 @@ enum type_type - TYPE_ARRAY, - TYPE_BITFIELD, - TYPE_APICONTRACT, -+ TYPE_RUNTIMECLASS, - }; - - struct _type_t { -@@ -466,6 +472,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.28.0 - diff --git a/patches/widl-winrt-support/0015-widl-Support-using-qualified-names-for-interfaces.patch b/patches/widl-winrt-support/0012-widl-Support-using-qualified-names-for-interfaces.patch similarity index 88% rename from patches/widl-winrt-support/0015-widl-Support-using-qualified-names-for-interfaces.patch rename to patches/widl-winrt-support/0012-widl-Support-using-qualified-names-for-interfaces.patch index 61f44b4f..e9358835 100644 --- a/patches/widl-winrt-support/0015-widl-Support-using-qualified-names-for-interfaces.patch +++ b/patches/widl-winrt-support/0012-widl-Support-using-qualified-names-for-interfaces.patch @@ -1,7 +1,7 @@ -From 65fefdad1ecb8bc45a89bee1393acf2cfcbb63b8 Mon Sep 17 00:00:00 2001 +From 9250fdc20535cf4126a953fc4eb6a95b40279efa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 25 Sep 2020 17:13:47 +0200 -Subject: [PATCH 15/28] widl: Support using qualified names for interfaces. +Subject: [PATCH] widl: Support using qualified names for interfaces. And make qualified name lookup more robust, only looking for types in the lookup namespace if it's active. @@ -24,10 +24,10 @@ index 90bc9f279c6..89fe616b9b3 100644 } } diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index 131226ba7be..8e79ce3660f 100644 +index 110b570f4e4..6f1a7a68e9c 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -74,6 +74,8 @@ static void append_chain_callconv(type_t *chain, char *callconv); +@@ -75,6 +75,8 @@ static void append_chain_callconv(type_t *chain, char *callconv); static warning_list_t *append_warning(warning_list_t *, int); static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs); @@ -36,7 +36,7 @@ index 131226ba7be..8e79ce3660f 100644 static type_t *find_type_or_error(const char *name, int t); static type_t *find_type_or_error2(char *name, int t); -@@ -81,7 +83,6 @@ static var_t *reg_const(var_t *var); +@@ -82,7 +84,6 @@ static var_t *reg_const(var_t *var); static void push_namespace(const char *name); static void pop_namespace(const char *name); @@ -44,7 +44,7 @@ index 131226ba7be..8e79ce3660f 100644 static void push_lookup_namespace(const char *name); static void check_arg_attrs(const var_t *arg); -@@ -293,7 +294,7 @@ static typelib_t *current_typelib; +@@ -295,7 +296,7 @@ static typelib_t *current_typelib; %type namespacedef %type base_type int_std %type enumdef structdef uniondef typedecl @@ -53,7 +53,7 @@ index 131226ba7be..8e79ce3660f 100644 %type class_interface %type class_interfaces %type arg ne_union_field union_field s_field case enum enum_member declaration -@@ -884,15 +885,15 @@ int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); } +@@ -888,15 +889,15 @@ int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); } | tINT3264 { $$ = type_new_int(TYPE_BASIC_INT3264, 0); } ; @@ -76,7 +76,7 @@ index 131226ba7be..8e79ce3660f 100644 coclass: tCOCLASS aIDENTIFIER { $$ = type_new_coclass($2); } | tCOCLASS aKNOWNTYPE { $$ = find_type($2, NULL, 0); -@@ -990,6 +991,8 @@ inherit: { $$ = NULL; } +@@ -994,6 +995,8 @@ inherit: { $$ = NULL; } interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } | tINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } @@ -85,7 +85,7 @@ index 131226ba7be..8e79ce3660f 100644 ; interfacehdr: attributes interface { $$ = $2; -@@ -1953,12 +1956,6 @@ static void pop_namespace(const char *name) +@@ -1970,12 +1973,6 @@ static void pop_namespace(const char *name) current_namespace = current_namespace->parent; } @@ -98,7 +98,7 @@ index 131226ba7be..8e79ce3660f 100644 static void push_lookup_namespace(const char *name) { struct namespace *namespace; -@@ -2076,11 +2073,29 @@ type_t *find_type(const char *name, struct namespace *namespace, int t) +@@ -2093,11 +2090,29 @@ type_t *find_type(const char *name, struct namespace *namespace, int t) return NULL; } @@ -130,7 +130,7 @@ index 131226ba7be..8e79ce3660f 100644 { error_loc("type '%s' not found\n", name); return NULL; -@@ -2097,15 +2112,16 @@ static type_t *find_type_or_error2(char *name, int t) +@@ -2114,15 +2129,16 @@ static type_t *find_type_or_error2(char *name, int t) int is_type(const char *name) { @@ -152,5 +152,5 @@ index 131226ba7be..8e79ce3660f 100644 type_t *get_type(enum type_type type, char *name, struct namespace *namespace, int t) -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0017-widl-Support-WinRT-static-attribute-parsing.patch b/patches/widl-winrt-support/0013-widl-Support-WinRT-static-attribute-parsing.patch similarity index 89% rename from patches/widl-winrt-support/0017-widl-Support-WinRT-static-attribute-parsing.patch rename to patches/widl-winrt-support/0013-widl-Support-WinRT-static-attribute-parsing.patch index 2d0e0f0e..308c1fab 100644 --- a/patches/widl-winrt-support/0017-widl-Support-WinRT-static-attribute-parsing.patch +++ b/patches/widl-winrt-support/0013-widl-Support-WinRT-static-attribute-parsing.patch @@ -1,7 +1,7 @@ -From ca0364f1bd90bb35821c6ffb620e502f2b4afb7a Mon Sep 17 00:00:00 2001 +From 383521b26b11d59b9a45fd6b1d1fcb7744028595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 13 Oct 2020 14:30:32 +0200 -Subject: [PATCH 17/28] widl: Support WinRT static attribute parsing. +Subject: [PATCH] widl: Support WinRT static attribute parsing. --- tools/widl/header.c | 30 ++++++++++++++++++++++++++++++ @@ -11,7 +11,7 @@ Subject: [PATCH 17/28] widl: Support WinRT static attribute parsing. 4 files changed, 40 insertions(+) diff --git a/tools/widl/header.c b/tools/widl/header.c -index 812becad63b..3bc6b452177 100644 +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) @@ -66,10 +66,10 @@ index 812becad63b..3bc6b452177 100644 { ifref_list_t *ifaces = type_runtimeclass_get_ifaces(type); diff --git a/tools/widl/parser.l b/tools/widl/parser.l -index f5a57db4797..90791543db2 100644 +index 51142ded6e6..2695e8cf622 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l -@@ -422,6 +422,7 @@ static const struct keyword attr_keywords[] = +@@ -426,6 +426,7 @@ static const struct keyword attr_keywords[] = {"size_is", tSIZEIS, 0}, {"source", tSOURCE, 0}, {"standard", tSTANDARD, 1}, @@ -78,10 +78,10 @@ index f5a57db4797..90791543db2 100644 {"string", tSTRING, 0}, {"switch_is", tSWITCHIS, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index 1727b5bb396..e6e67826a8f 100644 +index 6f1a7a68e9c..908e7b6d4da 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -283,6 +283,7 @@ static typelib_t *current_typelib; +@@ -285,6 +285,7 @@ static typelib_t *current_typelib; %type m_expr expr expr_const expr_int_const array m_bitfield %type m_exprs /* exprs expr_list */ expr_list_int_const %type contract_req @@ -89,7 +89,7 @@ index 1727b5bb396..e6e67826a8f 100644 %type interfacehdr %type storage_cls_spec %type type_qualifier m_type_qual_list -@@ -538,6 +539,11 @@ contract_req: decl_spec ',' contract_ver { if ($1->type->type_type != TYPE_APICO +@@ -541,6 +542,11 @@ contract_req: decl_spec ',' contract_ver { if ($1->type->type_type != TYPE_APICO $$ = make_exprt(EXPR_GTREQL, declare_var(NULL, $1, make_declarator(NULL), 0), $$); } @@ -101,7 +101,7 @@ index 1727b5bb396..e6e67826a8f 100644 attribute: { $$ = NULL; } | tAGGREGATABLE { $$ = make_attr(ATTR_AGGREGATABLE); } | tANNOTATION '(' aSTRING ')' { $$ = make_attrp(ATTR_ANNOTATION, $3); } -@@ -634,6 +640,7 @@ attribute: { $$ = NULL; } +@@ -638,6 +644,7 @@ attribute: { $$ = NULL; } | tRETVAL { $$ = make_attr(ATTR_RETVAL); } | tSIZEIS '(' m_exprs ')' { $$ = make_attrp(ATTR_SIZEIS, $3); } | tSOURCE { $$ = make_attr(ATTR_SOURCE); } @@ -109,7 +109,7 @@ index 1727b5bb396..e6e67826a8f 100644 | tSTRICTCONTEXTHANDLE { $$ = make_attr(ATTR_STRICTCONTEXTHANDLE); } | tSTRING { $$ = make_attr(ATTR_STRING); } | tSWITCHIS '(' expr ')' { $$ = make_attrp(ATTR_SWITCHIS, $3); } -@@ -2296,6 +2303,7 @@ struct allowed_attr allowed_attr[] = +@@ -2336,6 +2343,7 @@ struct allowed_attr allowed_attr[] = /* 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" }, @@ -118,10 +118,10 @@ index 1727b5bb396..e6e67826a8f 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 0bf7b644fff..aa3e6e75898 100644 +index a3283761256..0e001f20cfb 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -159,6 +159,7 @@ enum attr_type +@@ -162,6 +162,7 @@ enum attr_type ATTR_RETVAL, ATTR_SIZEIS, ATTR_SOURCE, @@ -130,5 +130,5 @@ index 0bf7b644fff..aa3e6e75898 100644 ATTR_STRING, ATTR_SWITCHIS, -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0018-widl-Support-WinRT-requires-keyword.patch b/patches/widl-winrt-support/0014-widl-Support-WinRT-requires-keyword.patch similarity index 89% rename from patches/widl-winrt-support/0018-widl-Support-WinRT-requires-keyword.patch rename to patches/widl-winrt-support/0014-widl-Support-WinRT-requires-keyword.patch index 0b6f4b01..11f9e7b5 100644 --- a/patches/widl-winrt-support/0018-widl-Support-WinRT-requires-keyword.patch +++ b/patches/widl-winrt-support/0014-widl-Support-WinRT-requires-keyword.patch @@ -1,7 +1,7 @@ -From 0d3503123e3f0cb458ada24b052e1d39f1c4dddb Mon Sep 17 00:00:00 2001 +From 1cdacef37ec25c6069b6cd6d1d8c9d1754b771fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 13 Oct 2020 00:31:57 +0200 -Subject: [PATCH 18/28] widl: Support WinRT requires keyword. +Subject: [PATCH] widl: Support WinRT requires keyword. --- tools/widl/header.c | 13 +++++++++++ @@ -13,7 +13,7 @@ Subject: [PATCH 18/28] widl: Support WinRT requires keyword. 6 files changed, 65 insertions(+), 13 deletions(-) diff --git a/tools/widl/header.c b/tools/widl/header.c -index 3bc6b452177..5dfc5e2ff8c 100644 +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) @@ -44,7 +44,7 @@ index 3bc6b452177..5dfc5e2ff8c 100644 { expr_t *expr; diff --git a/tools/widl/parser.l b/tools/widl/parser.l -index 90791543db2..2b41bea1bc9 100644 +index 2695e8cf622..5b332abf455 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l @@ -298,6 +298,7 @@ static const struct keyword keywords[] = { @@ -56,7 +56,7 @@ index 90791543db2..2b41bea1bc9 100644 {"short", tSHORT, 0}, {"signed", tSIGNED, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index e6e67826a8f..1da667e0ced 100644 +index 908e7b6d4da..bf89ba771ac 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -38,12 +38,6 @@ @@ -81,7 +81,7 @@ index e6e67826a8f..1da667e0ced 100644 static attr_list_t *append_attr(attr_list_t *list, attr_t *attr); static attr_list_t *append_attr_list(attr_list_t *new_list, attr_list_t *old_list); static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right, -@@ -140,6 +136,7 @@ static typelib_t *current_typelib; +@@ -141,6 +137,7 @@ static typelib_t *current_typelib; expr_t *expr; expr_list_t *expr_list; type_t *type; @@ -89,7 +89,7 @@ index e6e67826a8f..1da667e0ced 100644 var_t *var; var_list_t *var_list; declarator_t *declarator; -@@ -247,6 +244,7 @@ static typelib_t *current_typelib; +@@ -249,6 +246,7 @@ static typelib_t *current_typelib; %token tREADONLY tREF %token tREGISTER tREPRESENTAS %token tREQUESTEDIT @@ -97,7 +97,7 @@ index e6e67826a8f..1da667e0ced 100644 %token tRESTRICTED %token tRETVAL %token tRUNTIMECLASS -@@ -296,6 +294,7 @@ static typelib_t *current_typelib; +@@ -298,6 +296,7 @@ static typelib_t *current_typelib; %type base_type int_std %type enumdef structdef uniondef typedecl %type type qualified_type @@ -105,7 +105,7 @@ index e6e67826a8f..1da667e0ced 100644 %type class_interface %type class_interfaces %type arg ne_union_field union_field s_field case enum enum_member declaration -@@ -1009,19 +1008,27 @@ interfacehdr: attributes interface { $$ = $2; +@@ -1013,19 +1012,27 @@ interfacehdr: attributes interface { $$ = $2; } ; @@ -137,7 +137,7 @@ index e6e67826a8f..1da667e0ced 100644 } | dispinterfacedef semicolon_opt { $$ = $1; } ; -@@ -1317,6 +1324,26 @@ static str_list_t *append_str(str_list_t *list, char *str) +@@ -1344,6 +1351,26 @@ static str_list_t *append_str(str_list_t *list, char *str) return list; } @@ -164,7 +164,7 @@ index e6e67826a8f..1da667e0ced 100644 static attr_list_t *move_attr(attr_list_t *dst, attr_list_t *src, enum attr_type type) { attr_t *attr; -@@ -3015,7 +3042,7 @@ static void check_async_uuid(type_t *iface) +@@ -3058,7 +3085,7 @@ static void check_async_uuid(type_t *iface) stmts = append_statement(stmts, make_statement_declaration(finish_func)); } @@ -174,10 +174,10 @@ index e6e67826a8f..1da667e0ced 100644 } diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c -index d075619448d..3d26fd23b26 100644 +index 9bddba90681..85e745bee37 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c -@@ -459,7 +459,7 @@ static unsigned int compute_method_indexes(type_t *iface) +@@ -463,7 +463,7 @@ static unsigned int compute_method_indexes(type_t *iface) return idx; } @@ -186,7 +186,7 @@ index d075619448d..3d26fd23b26 100644 { iface->details.iface = xmalloc(sizeof(*iface->details.iface)); iface->details.iface->disp_props = NULL; -@@ -468,6 +468,7 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm +@@ -472,6 +472,7 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm iface->details.iface->inherit = inherit; iface->details.iface->disp_inherit = NULL; iface->details.iface->async_iface = NULL; @@ -194,7 +194,7 @@ index d075619448d..3d26fd23b26 100644 iface->defined = TRUE; compute_method_indexes(iface); } -@@ -482,6 +483,7 @@ void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *met +@@ -486,6 +487,7 @@ void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *met if (!iface->details.iface->inherit) error_loc("IDispatch is undefined\n"); iface->details.iface->disp_inherit = NULL; iface->details.iface->async_iface = NULL; @@ -202,7 +202,7 @@ index d075619448d..3d26fd23b26 100644 iface->defined = TRUE; compute_method_indexes(iface); } -@@ -496,6 +498,7 @@ void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface) +@@ -500,6 +502,7 @@ void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface) if (!dispiface->details.iface->inherit) error_loc("IDispatch is undefined\n"); dispiface->details.iface->disp_inherit = iface; dispiface->details.iface->async_iface = NULL; @@ -238,10 +238,10 @@ index 951084cf875..8c555b91656 100644 { type = type_get_real_type(type); diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h -index aa3e6e75898..be71886260b 100644 +index 0e001f20cfb..1848e891643 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -378,6 +378,7 @@ struct iface_details +@@ -386,6 +386,7 @@ struct iface_details struct _type_t *inherit; struct _type_t *disp_inherit; struct _type_t *async_iface; @@ -250,5 +250,5 @@ index aa3e6e75898..be71886260b 100644 struct module_details -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0019-widl-Support-WinRT-activatable-attribute.patch b/patches/widl-winrt-support/0015-widl-Support-WinRT-activatable-attribute.patch similarity index 88% rename from patches/widl-winrt-support/0019-widl-Support-WinRT-activatable-attribute.patch rename to patches/widl-winrt-support/0015-widl-Support-WinRT-activatable-attribute.patch index 3039a86e..7e97c1a8 100644 --- a/patches/widl-winrt-support/0019-widl-Support-WinRT-activatable-attribute.patch +++ b/patches/widl-winrt-support/0015-widl-Support-WinRT-activatable-attribute.patch @@ -1,4 +1,4 @@ -From 0e9827b742b8592c539efe970e34977383ef14ba Mon Sep 17 00:00:00 2001 +From 1b9a28bd1800db506745628cc718f4a84d185fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 13 Oct 2020 11:35:29 +0200 Subject: [PATCH] widl: Support WinRT activatable attribute. @@ -11,7 +11,7 @@ Subject: [PATCH] widl: Support WinRT activatable attribute. 4 files changed, 16 insertions(+) diff --git a/tools/widl/header.c b/tools/widl/header.c -index 5dfc5e2ff8c..5c87a997349 100644 +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) @@ -40,7 +40,7 @@ index 5dfc5e2ff8c..5c87a997349 100644 { char *name = format_namespace(exclusiveto->namespace, "", ".", exclusiveto->name, NULL); diff --git a/tools/widl/parser.l b/tools/widl/parser.l -index ad4506017b2..34d24794ee0 100644 +index 5b332abf455..0b6b51b847e 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l @@ -321,6 +321,7 @@ static const struct keyword keywords[] = { @@ -52,18 +52,18 @@ index ad4506017b2..34d24794ee0 100644 {"agile", tAGILE, 1}, {"all_nodes", tALLNODES, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index 28fd8ca924a..7cc4be0bd4f 100644 +index bf89ba771ac..4a464d28120 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -172,6 +172,7 @@ static typelib_t *current_typelib; +@@ -173,6 +173,7 @@ static typelib_t *current_typelib; %token GREATEREQUAL LESSEQUAL %token LOGICALOR LOGICALAND %token ELLIPSIS +%token tACTIVATABLE - %token tAGGREGATABLE tALLNODES + %token tAGGREGATABLE %token tAGILE - %token tALLOCATE tANNOTATION -@@ -545,6 +546,7 @@ static_attr: decl_spec ',' contract_req { if ($1->type->type_type != TYPE_INTER + %token tALLNODES tALLOCATE tANNOTATION +@@ -547,6 +548,7 @@ static_attr: decl_spec ',' contract_req { if ($1->type->type_type != TYPE_INTER } attribute: { $$ = NULL; } @@ -71,7 +71,7 @@ index 28fd8ca924a..7cc4be0bd4f 100644 | tAGGREGATABLE { $$ = make_attr(ATTR_AGGREGATABLE); } | tANNOTATION '(' aSTRING ')' { $$ = make_attrp(ATTR_ANNOTATION, $3); } | tAPPOBJECT { $$ = make_attr(ATTR_APPOBJECT); } -@@ -2263,6 +2265,7 @@ struct allowed_attr +@@ -2277,6 +2279,7 @@ struct allowed_attr struct allowed_attr allowed_attr[] = { /* attr { D ACF M I Fn ARG T En Enm St Un Fi L DI M C AC R } */ @@ -80,10 +80,10 @@ index 28fd8ca924a..7cc4be0bd4f 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 894edfc0a1d..a8d41485d32 100644 +index 1848e891643..345d1a90d01 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -68,6 +68,7 @@ typedef struct list warning_list_t; +@@ -69,6 +69,7 @@ typedef struct list warning_list_t; enum attr_type { @@ -92,5 +92,5 @@ index 894edfc0a1d..a8d41485d32 100644 ATTR_ALLOCATE, ATTR_ANNOTATION, -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0020-widl-Support-WinRT-parameterized-type-parsing.patch b/patches/widl-winrt-support/0016-widl-Support-WinRT-parameterized-type-parsing.patch similarity index 90% rename from patches/widl-winrt-support/0020-widl-Support-WinRT-parameterized-type-parsing.patch rename to patches/widl-winrt-support/0016-widl-Support-WinRT-parameterized-type-parsing.patch index 9b1f3f70..764e8010 100644 --- a/patches/widl-winrt-support/0020-widl-Support-WinRT-parameterized-type-parsing.patch +++ b/patches/widl-winrt-support/0016-widl-Support-WinRT-parameterized-type-parsing.patch @@ -1,7 +1,7 @@ -From 46f497692aa6da875d56764538eefaadb9a8ec38 Mon Sep 17 00:00:00 2001 +From 0f685576a7a76025edeae6c06f380c32c3e0541b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 13 Oct 2020 16:31:16 +0200 -Subject: [PATCH 20/28] widl: Support WinRT parameterized type parsing. +Subject: [PATCH] widl: Support WinRT parameterized type parsing. And add IVectorView and IIterator parameterized interfaces to windows.foundation.idl for illustration and future use. They won't @@ -17,14 +17,14 @@ source. --- include/windows.foundation.idl | 29 +++++++++++++++++ tools/widl/expr.c | 2 ++ - tools/widl/header.c | 10 +++--- + tools/widl/header.c | 8 +++-- tools/widl/parser.y | 57 ++++++++++++++++++++++++++++++++-- tools/widl/typegen.c | 6 ++++ tools/widl/typelib.c | 2 ++ tools/widl/typetree.c | 30 ++++++++++++++++++ tools/widl/typetree.h | 4 +++ tools/widl/widltypes.h | 9 ++++++ - 9 files changed, 143 insertions(+), 6 deletions(-) + 9 files changed, 142 insertions(+), 5 deletions(-) diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl index 5e17062f399..ab7c4753c3b 100644 @@ -79,20 +79,18 @@ index 13bd5a889aa..c83e9aa5ec0 100644 break; case TYPE_ALIAS: diff --git a/tools/widl/header.c b/tools/widl/header.c -index 5c87a997349..283f2372fee 100644 +index dd4ba935af7..4de34a59d22 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c -@@ -501,7 +501,9 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i +@@ -501,6 +501,8 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i break; } case TYPE_APICONTRACT: -- /* handled elsewhere */ + case TYPE_PARAMETERIZED_TYPE: + case TYPE_PARAMETER: -+ /* handled elsewhere / shouldn't be here */ + /* shouldn't be here */ assert(0); break; - } @@ -568,6 +570,8 @@ void write_type_right(FILE *h, type_t *t, int is_field) case TYPE_RUNTIMECLASS: break; @@ -115,10 +113,10 @@ index 5c87a997349..283f2372fee 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 d24f8881147..aa6ded5ba89 100644 +index 4a464d28120..48135d4372e 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -80,6 +80,8 @@ static var_t *reg_const(var_t *var); +@@ -81,6 +81,8 @@ static var_t *reg_const(var_t *var); static void push_namespace(const char *name); static void pop_namespace(const char *name); static void push_lookup_namespace(const char *name); @@ -127,7 +125,7 @@ index d24f8881147..aa6ded5ba89 100644 static void check_arg_attrs(const var_t *arg); static void check_statements(const statement_list_t *stmts, int is_inside_library); -@@ -125,6 +127,7 @@ static struct namespace global_namespace = { +@@ -126,6 +128,7 @@ static struct namespace global_namespace = { static struct namespace *current_namespace = &global_namespace; static struct namespace *lookup_namespace = &global_namespace; @@ -135,7 +133,7 @@ index d24f8881147..aa6ded5ba89 100644 static typelib_t *current_typelib; -@@ -295,6 +298,8 @@ static typelib_t *current_typelib; +@@ -297,6 +300,8 @@ static typelib_t *current_typelib; %type base_type int_std %type enumdef structdef uniondef typedecl %type type qualified_type @@ -144,7 +142,7 @@ index d24f8881147..aa6ded5ba89 100644 %type requires required_types %type class_interface %type class_interfaces -@@ -1010,6 +1015,15 @@ interfacehdr: attributes interface { $$ = $2; +@@ -1014,6 +1019,15 @@ interfacehdr: attributes interface { $$ = $2; } ; @@ -160,7 +158,7 @@ index d24f8881147..aa6ded5ba89 100644 required_types: qualified_type { $$ = append_type(NULL, $1); } | required_types ',' required_types { $$ = append_types($1, $3); } -@@ -1025,6 +1039,13 @@ interfacedef: interfacehdr inherit requires +@@ -1029,6 +1043,13 @@ interfacedef: interfacehdr inherit requires type_interface_define($$, $2, $5, $3); check_async_uuid($$); } @@ -174,7 +172,7 @@ index d24f8881147..aa6ded5ba89 100644 /* MIDL is able to import the definition of a base class from inside the * definition of a derived class, I'll try to support it with this rule */ | interfacehdr ':' aIDENTIFIER requires -@@ -1037,6 +1058,11 @@ interfacedef: interfacehdr inherit requires +@@ -1041,6 +1062,11 @@ interfacedef: interfacehdr inherit requires interfacedec: interface ';' { $$ = $1; } @@ -186,7 +184,7 @@ index d24f8881147..aa6ded5ba89 100644 | dispinterface ';' { $$ = $1; } ; -@@ -1979,6 +2005,29 @@ static void push_lookup_namespace(const char *name) +@@ -2017,6 +2043,29 @@ static void push_lookup_namespace(const char *name) lookup_namespace = namespace; } @@ -216,7 +214,7 @@ index d24f8881147..aa6ded5ba89 100644 struct rtype { const char *name; type_t *type; -@@ -2110,7 +2159,8 @@ static type_t *find_qualified_type_or_error(const char *name, int t) +@@ -2148,7 +2197,8 @@ static type_t *find_qualified_type_or_error(const char *name, int t) static type_t *find_type_or_error(const char *name, int t) { type_t *type; @@ -226,7 +224,7 @@ index d24f8881147..aa6ded5ba89 100644 { error_loc("type '%s' not found\n", name); return NULL; -@@ -2130,7 +2180,8 @@ int is_type(const char *name) +@@ -2168,7 +2218,8 @@ int is_type(const char *name) if (lookup_namespace != &global_namespace) return find_type(name, lookup_namespace, 0) != NULL; else @@ -236,7 +234,7 @@ index d24f8881147..aa6ded5ba89 100644 } int is_namespace(const char *name) -@@ -2623,6 +2674,8 @@ static int is_allowed_conf_type(const type_t *type) +@@ -2666,6 +2717,8 @@ static int is_allowed_conf_type(const type_t *type) case TYPE_RUNTIMECLASS: return FALSE; case TYPE_APICONTRACT: @@ -246,7 +244,7 @@ index d24f8881147..aa6ded5ba89 100644 assert(0); break; diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c -index 86c010aa6ae..f37b54eb65d 100644 +index 2e9be0748c1..1b5fe16b6ec 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -377,6 +377,8 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att @@ -290,10 +288,10 @@ index ace6424e3a0..6f6c5f3ccc8 100644 assert(0); break; diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c -index 3d26fd23b26..bbd519d98ab 100644 +index 85e745bee37..429e61e43d9 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c -@@ -459,6 +459,36 @@ static unsigned int compute_method_indexes(type_t *iface) +@@ -463,6 +463,36 @@ static unsigned int compute_method_indexes(type_t *iface) return idx; } @@ -353,10 +351,10 @@ index 8c555b91656..b04a67f6b47 100644 break; } diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h -index 7ca770b67ea..e2ffec6da8a 100644 +index 345d1a90d01..8dd6958ba35 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -429,6 +429,12 @@ struct runtimeclass_details +@@ -437,6 +437,12 @@ struct runtimeclass_details ifref_list_t *ifaces; }; @@ -369,7 +367,7 @@ index 7ca770b67ea..e2ffec6da8a 100644 #define HASHMAX 64 struct namespace { -@@ -457,6 +463,8 @@ enum type_type +@@ -465,6 +471,8 @@ enum type_type TYPE_BITFIELD, TYPE_APICONTRACT, TYPE_RUNTIMECLASS, @@ -378,7 +376,7 @@ index 7ca770b67ea..e2ffec6da8a 100644 }; struct _type_t { -@@ -478,6 +486,7 @@ struct _type_t { +@@ -486,6 +494,7 @@ struct _type_t { struct bitfield_details bitfield; struct alias_details alias; struct runtimeclass_details runtimeclass; @@ -387,5 +385,5 @@ index 7ca770b67ea..e2ffec6da8a 100644 const char *c_name; unsigned int typestring_offset; -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0016-widl-Support-repeated-attributes-for-WinRT-static.patch b/patches/widl-winrt-support/0016-widl-Support-repeated-attributes-for-WinRT-static.patch deleted file mode 100644 index 8f2eeacb..00000000 --- a/patches/widl-winrt-support/0016-widl-Support-repeated-attributes-for-WinRT-static.patch +++ /dev/null @@ -1,299 +0,0 @@ -From c631587867eb72a1e166b016b08a7b1547e0c5a7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Tue, 13 Oct 2020 13:52:34 +0200 -Subject: [PATCH] widl: Support repeated attributes for WinRT static. - ---- - tools/widl/parser.y | 260 ++++++++++++++++++++++---------------------- - 1 file changed, 131 insertions(+), 129 deletions(-) - -diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index 37ab07ba1a3..eca878002ea 100644 ---- a/tools/widl/parser.y -+++ b/tools/widl/parser.y -@@ -1334,27 +1334,6 @@ static str_list_t *append_str(str_list_t *list, char *str) - return list; - } - --static attr_list_t *append_attr(attr_list_t *list, attr_t *attr) --{ -- attr_t *attr_existing; -- if (!attr) return list; -- if (!list) -- { -- list = xmalloc( sizeof(*list) ); -- list_init( list ); -- } -- LIST_FOR_EACH_ENTRY(attr_existing, list, attr_t, entry) -- if (attr_existing->type == attr->type) -- { -- parser_warning("duplicate attribute %s\n", get_attr_display_name(attr->type)); -- /* use the last attribute, like MIDL does */ -- list_remove(&attr_existing->entry); -- break; -- } -- list_add_tail( list, &attr->entry ); -- return list; --} -- - static attr_list_t *move_attr(attr_list_t *dst, attr_list_t *src, enum attr_type type) - { - attr_t *attr; -@@ -2227,6 +2206,8 @@ struct allowed_attr - { - unsigned int dce_compatible : 1; - unsigned int acf : 1; -+ unsigned int multiple : 1; -+ - unsigned int on_interface : 1; - unsigned int on_function : 1; - unsigned int on_arg : 1; -@@ -2247,116 +2228,137 @@ struct allowed_attr - - struct allowed_attr allowed_attr[] = - { -- /* attr { D ACF I Fn ARG T En Enm St Un Fi L DI M C AC R } */ -- /* ATTR_AGGREGATABLE */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "allocate" }, -- /* ATTR_ANNOTATION */ { 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, 1, 0, 0, "appobject" }, -- /* ATTR_ASYNC */ { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "async" }, -- /* ATTR_ASYNCUUID */ { 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, "async_uuid" }, -- /* ATTR_AUTO_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "auto_handle" }, -- /* ATTR_BINDABLE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "bindable" }, -- /* ATTR_BROADCAST */ { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "broadcast" }, -- /* ATTR_CALLAS */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "call_as" }, -- /* ATTR_CALLCONV */ { 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, 1, 0, 0, 0, 0, 0, 0, "case" }, -- /* ATTR_CODE */ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "code" }, -- /* ATTR_COMMSTATUS */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" }, -- /* ATTR_CONTRACT */ { 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, 1, 0, "contractversion" }, -- /* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, "control" }, -- /* ATTR_DECODE */ { 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "decode" }, -- /* ATTR_DEFAULT */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, "default" }, -- /* ATTR_DEFAULTBIND */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultbind" }, -- /* ATTR_DEFAULTCOLLELEM */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultcollelem" }, -- /* ATTR_DEFAULTVALUE */ { 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, 1, 0, 0, "defaultvtable" }, -- /* ATTR_DISABLECONSISTENCYCHECK */{ 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, NULL }, -- /* ATTR_DISPLAYBIND */ { 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, 1, 0, 0, 0, "dllname" }, -- /* ATTR_DUAL */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "dual" }, -- /* ATTR_ENABLEALLOCATE */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "enable_allocate" }, -- /* ATTR_ENCODE */ { 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "encode" }, -- /* ATTR_ENDPOINT */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "endpoint" }, -- /* ATTR_ENTRY */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "entry" }, -- /* ATTR_EVENTADD */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "eventadd" }, -- /* ATTR_EVENTREMOVE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "eventremove" }, -- /* ATTR_EXCLUSIVETO */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "exclusive_to" }, -- /* ATTR_EXPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "explicit_handle" }, -- /* ATTR_FAULTSTATUS */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "fault_status" }, -- /* ATTR_FLAGS */ { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "flags" }, -- /* ATTR_FORCEALLOCATE */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "handle" }, -- /* ATTR_HELPCONTEXT */ { 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, 1, 0, 0, 0, 0, 0, "helpfile" }, -- /* ATTR_HELPSTRING */ { 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, "helpstring" }, -- /* ATTR_HELPSTRINGCONTEXT */ { 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, 1, 0, 0, 0, 0, 0, "helpstringdll" }, -- /* ATTR_HIDDEN */ { 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, "hidden" }, -- /* ATTR_ID */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, "id" }, -- /* ATTR_IDEMPOTENT */ { 1, 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, 1, 0, 0, 0, 0, 0, 0, "ignore" }, -- /* ATTR_IIDIS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "iid_is" }, -- /* ATTR_IMMEDIATEBIND */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "immediatebind" }, -- /* ATTR_IMPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "implicit_handle" }, -- /* ATTR_IN */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "in" }, -- /* ATTR_INPUTSYNC */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "inputsync" }, -- /* ATTR_LENGTHIS */ { 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, 1, 0, 0, 0, 0, 0, "lcid" }, -- /* ATTR_LICENSED */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "licensed" }, -- /* ATTR_LOCAL */ { 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "local" }, -- /* ATTR_MARSHALING_BEHAVIOR */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "marshaling_behavior" }, -- /* ATTR_MAYBE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "maybe" }, -- /* ATTR_MESSAGE */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "message" }, -- /* ATTR_NOCODE */ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nocode" }, -- /* ATTR_NONBROWSABLE */ { 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, 1, 0, 0, "noncreatable" }, -- /* ATTR_NONEXTENSIBLE */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nonextensible" }, -- /* ATTR_NOTIFY */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "notify" }, -- /* ATTR_NOTIFYFLAG */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "notify_flag" }, -- /* ATTR_OBJECT */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "object" }, -- /* ATTR_ODL */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "odl" }, -- /* ATTR_OLEAUTOMATION */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "oleautomation" }, -- /* ATTR_OPTIMIZE */ { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "optimize" }, -- /* ATTR_OPTIONAL */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "optional" }, -- /* ATTR_OUT */ { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "out" }, -- /* ATTR_PARAMLCID */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "lcid" }, -- /* ATTR_PARTIALIGNORE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "partial_ignore" }, -- /* ATTR_POINTERDEFAULT */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "pointer_default" }, -- /* ATTR_POINTERTYPE */ { 1, 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, 1, 0, 0, "progid" }, -- /* ATTR_PROPGET */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propget" }, -- /* ATTR_PROPPUT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propput" }, -- /* ATTR_PROPPUTREF */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "propputref" }, -- /* ATTR_PROXY */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "public" }, -- /* ATTR_RANGE */ { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "range" }, -- /* ATTR_READONLY */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "represent_as" }, -- /* ATTR_REQUESTEDIT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "requestedit" }, -- /* ATTR_RESTRICTED */ { 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, "restricted" }, -- /* ATTR_RETVAL */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "retval" }, -- /* ATTR_SIZEIS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "size_is" }, -- /* ATTR_SOURCE */ { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "source" }, -- /* ATTR_STRICTCONTEXTHANDLE */ { 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, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "string" }, -- /* ATTR_SWITCHIS */ { 1, 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, 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, 1, 0, 1, "threading" }, -- /* ATTR_TRANSMITAS */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "transmit_as" }, -- /* ATTR_UIDEFAULT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "uidefault" }, -- /* ATTR_USESGETLASTERROR */ { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "user_marshal" }, -- /* ATTR_UUID */ { 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, "uuid" }, -- /* ATTR_V1ENUM */ { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "v1_enum" }, -- /* ATTR_VARARG */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "vararg" }, -- /* ATTR_VERSION */ { 1, 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, 1, 0, 0, "vi_progid" }, -- /* ATTR_WIREMARSHAL */ { 1, 0, 0, 0, 0, 1, 0, 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 } */ -+ /* 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_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_EVENTADD */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "eventadd" }, -+ /* ATTR_EVENTREMOVE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "eventremove" }, -+ /* 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_FLAGS */ { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "flags" }, -+ /* 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) -+{ -+ attr_t *attr_existing; -+ if (!attr) return list; -+ if (!list) -+ { -+ list = xmalloc( sizeof(*list) ); -+ list_init( list ); -+ } -+ LIST_FOR_EACH_ENTRY(attr_existing, list, attr_t, entry) -+ if (attr_existing->type == attr->type && !allowed_attr[attr->type].multiple) -+ { -+ parser_warning("duplicate attribute %s\n", get_attr_display_name(attr->type)); -+ /* use the last attribute, like MIDL does */ -+ list_remove(&attr_existing->entry); -+ break; -+ } -+ list_add_tail( list, &attr->entry ); -+ return list; -+} -+ - const char *get_attr_display_name(enum attr_type type) - { - return allowed_attr[type].display_name; --- -2.28.0 - diff --git a/patches/widl-winrt-support/0021-widl-Support-partially-specialized-parameterized-typ.patch b/patches/widl-winrt-support/0017-widl-Support-partially-specialized-parameterized-typ.patch similarity index 90% rename from patches/widl-winrt-support/0021-widl-Support-partially-specialized-parameterized-typ.patch rename to patches/widl-winrt-support/0017-widl-Support-partially-specialized-parameterized-typ.patch index 10019330..a6027ed4 100644 --- a/patches/widl-winrt-support/0021-widl-Support-partially-specialized-parameterized-typ.patch +++ b/patches/widl-winrt-support/0017-widl-Support-partially-specialized-parameterized-typ.patch @@ -1,7 +1,7 @@ -From dfec9f64f5f1058ce394c8a39ae759ea027106a8 Mon Sep 17 00:00:00 2001 +From 50bdc1b20819fb4dc4db3420726e7c2bc0c98193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 12 Oct 2020 23:23:18 +0200 -Subject: [PATCH 21/28] widl: Support partially specialized parameterized type. +Subject: [PATCH] widl: Support partially specialized parameterized type. This allows parameterized types to reference each other with a different set of parameters. This is required for instance for IIterable, that @@ -39,10 +39,10 @@ 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 aa6ded5ba89..c9806ced633 100644 +index 48135d4372e..14c9c5d007e 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -300,6 +300,8 @@ static typelib_t *current_typelib; +@@ -302,6 +302,8 @@ static typelib_t *current_typelib; %type type qualified_type %type type_parameter %type type_parameters @@ -51,7 +51,7 @@ index aa6ded5ba89..c9806ced633 100644 %type requires required_types %type class_interface %type class_interfaces -@@ -908,6 +910,20 @@ qualified_type: +@@ -912,6 +914,20 @@ qualified_type: | namespace_pfx aKNOWNTYPE { $$ = find_qualified_type_or_error($2, 0); } ; @@ -72,7 +72,7 @@ index aa6ded5ba89..c9806ced633 100644 coclass: tCOCLASS aIDENTIFIER { $$ = type_new_coclass($2); } | tCOCLASS aKNOWNTYPE { $$ = find_type($2, NULL, 0); if (type_get_type_detect_alias($$) != TYPE_COCLASS) -@@ -1000,6 +1016,7 @@ dispinterfacedef: dispinterfacehdr '{' +@@ -1004,6 +1020,7 @@ dispinterfacedef: dispinterfacehdr '{' inherit: { $$ = NULL; } | ':' qualified_type { $$ = $2; } @@ -80,7 +80,7 @@ index aa6ded5ba89..c9806ced633 100644 ; interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } -@@ -1026,6 +1043,7 @@ type_parameters: +@@ -1030,6 +1047,7 @@ type_parameters: required_types: qualified_type { $$ = append_type(NULL, $1); } @@ -88,7 +88,7 @@ index aa6ded5ba89..c9806ced633 100644 | required_types ',' required_types { $$ = append_types($1, $3); } requires: { $$ = NULL; } -@@ -1247,6 +1265,7 @@ structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, current_nam +@@ -1251,6 +1269,7 @@ structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, current_nam type: tVOID { $$ = type_new_void(); } | qualified_type { $$ = $1; } @@ -96,7 +96,7 @@ index aa6ded5ba89..c9806ced633 100644 | base_type { $$ = $1; } | enumdef { $$ = $1; } | tENUM aIDENTIFIER { $$ = type_new_enum($2, current_namespace, FALSE, NULL); } -@@ -3324,3 +3343,19 @@ static void check_def(const type_t *t) +@@ -3367,3 +3386,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,10 +117,10 @@ index aa6ded5ba89..c9806ced633 100644 + return type; +} diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c -index bbd519d98ab..9d50cabf172 100644 +index 429e61e43d9..971ed8c1d0d 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c -@@ -112,6 +112,22 @@ static int format_namespace_buffer(char *buf, size_t len, struct namespace *name +@@ -116,6 +116,22 @@ static int format_namespace_buffer(char *buf, size_t len, struct namespace *name return ret; } @@ -143,7 +143,7 @@ index bbd519d98ab..9d50cabf172 100644 #undef append_buf char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix) -@@ -122,6 +138,14 @@ char *format_namespace(struct namespace *namespace, const char *prefix, const ch +@@ -126,6 +142,14 @@ char *format_namespace(struct namespace *namespace, const char *prefix, const ch return buf; } @@ -158,7 +158,7 @@ index bbd519d98ab..9d50cabf172 100644 type_t *type_new_function(var_list_t *args) { var_t *arg; -@@ -459,6 +483,14 @@ static unsigned int compute_method_indexes(type_t *iface) +@@ -463,6 +487,14 @@ static unsigned int compute_method_indexes(type_t *iface) return idx; } @@ -187,10 +187,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 e2ffec6da8a..9863c4f72ff 100644 +index 8dd6958ba35..ff71a1859ae 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -643,6 +643,7 @@ void init_loc_info(loc_info_t *); +@@ -651,6 +651,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); @@ -199,5 +199,5 @@ index e2ffec6da8a..9863c4f72ff 100644 static inline enum type_type type_get_type_detect_alias(const type_t *type) { -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0022-widl-Support-WinRT-parameterized-interface-type.patch b/patches/widl-winrt-support/0018-widl-Support-WinRT-parameterized-interface-type.patch similarity index 94% rename from patches/widl-winrt-support/0022-widl-Support-WinRT-parameterized-interface-type.patch rename to patches/widl-winrt-support/0018-widl-Support-WinRT-parameterized-interface-type.patch index 04581c0e..ccd12625 100644 --- a/patches/widl-winrt-support/0022-widl-Support-WinRT-parameterized-interface-type.patch +++ b/patches/widl-winrt-support/0018-widl-Support-WinRT-parameterized-interface-type.patch @@ -1,4 +1,4 @@ -From 43b34f506ae48e95e8d977851b799886bb6495ab Mon Sep 17 00:00:00 2001 +From 3b4ac2090dc378d7dba378539670557efb80b50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 12 Oct 2020 17:38:53 +0200 Subject: [PATCH] widl: Support WinRT parameterized interface type. @@ -58,7 +58,7 @@ 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 283f2372fee..db83f3aac13 100644 +index 4de34a59d22..d607df5d1c9 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -1492,7 +1492,8 @@ static void write_forward(FILE *header, type_t *iface) @@ -87,7 +87,7 @@ index 283f2372fee..db83f3aac13 100644 if (type_iface_get_inherit(iface)) { diff --git a/tools/widl/parser.l b/tools/widl/parser.l -index 34d24794ee0..f1182071d25 100644 +index 0b6b51b847e..44deb9fee5c 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l @@ -276,6 +276,7 @@ static const struct keyword keywords[] = { @@ -99,10 +99,10 @@ index 34d24794ee0..f1182071d25 100644 {"dispinterface", tDISPINTERFACE, 0}, {"double", tDOUBLE, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index f99e2f8aff1..3453468cbc6 100644 +index 14c9c5d007e..4d0390fd606 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -83,6 +83,7 @@ static void push_lookup_namespace(const char *name); +@@ -84,6 +84,7 @@ static void push_lookup_namespace(const char *name); static void push_parameters_namespace(const char *name); static void pop_parameters_namespace(const char *name); @@ -110,7 +110,7 @@ index f99e2f8aff1..3453468cbc6 100644 static void check_arg_attrs(const var_t *arg); static void check_statements(const statement_list_t *stmts, int is_inside_library); static void check_all_user_types(const statement_list_t *stmts); -@@ -117,6 +118,7 @@ static statement_t *make_statement_importlib(const char *str); +@@ -118,6 +119,7 @@ static statement_t *make_statement_importlib(const char *str); static statement_t *make_statement_module(type_t *type); static statement_t *make_statement_typedef(var_list_t *names, int declonly); static statement_t *make_statement_import(const char *str); @@ -118,7 +118,7 @@ index f99e2f8aff1..3453468cbc6 100644 static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt); static statement_list_t *append_statements(statement_list_t *, statement_list_t *); static attr_list_t *append_attribs(attr_list_t *, attr_list_t *); -@@ -128,6 +130,7 @@ static struct namespace global_namespace = { +@@ -129,6 +131,7 @@ static struct namespace global_namespace = { static struct namespace *current_namespace = &global_namespace; static struct namespace *lookup_namespace = &global_namespace; static struct namespace *parameters_namespace = NULL; @@ -126,15 +126,15 @@ index f99e2f8aff1..3453468cbc6 100644 static typelib_t *current_typelib; -@@ -188,6 +191,7 @@ static typelib_t *current_typelib; - %token tCONTRACT +@@ -190,6 +193,7 @@ static typelib_t *current_typelib; %token tCONTRACTVERSION %token tCONTROL tCPPQUOTE + %token tCUSTOM +%token tDECLARE %token tDECODE tDEFAULT tDEFAULTBIND %token tDEFAULTCOLLELEM %token tDEFAULTVALUE -@@ -325,6 +329,8 @@ static typelib_t *current_typelib; +@@ -327,6 +331,8 @@ static typelib_t *current_typelib; %type library_start librarydef %type statement typedef pragma_warning %type gbl_statements imp_statements int_statements @@ -143,7 +143,7 @@ index f99e2f8aff1..3453468cbc6 100644 %type warnings %type allocate_option_list allocate_option -@@ -347,7 +353,8 @@ static typelib_t *current_typelib; +@@ -349,7 +355,8 @@ static typelib_t *current_typelib; %% @@ -153,7 +153,7 @@ index f99e2f8aff1..3453468cbc6 100644 check_all_user_types($1); write_header($1); write_id_data($1); -@@ -363,6 +370,22 @@ input: gbl_statements m_acf { check_statements($1, FALSE); +@@ -365,6 +372,22 @@ input: gbl_statements m_acf { check_statements($1, FALSE); m_acf: /* empty */ | aACF acf_statements @@ -176,7 +176,7 @@ index f99e2f8aff1..3453468cbc6 100644 gbl_statements: { $$ = NULL; } | gbl_statements namespacedef '{' { push_namespace($2); } gbl_statements '}' { pop_namespace($2); $$ = append_statements($1, $5); } -@@ -382,6 +405,7 @@ gbl_statements: { $$ = NULL; } +@@ -384,6 +407,7 @@ gbl_statements: { $$ = NULL; } | 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); } @@ -184,7 +184,7 @@ index f99e2f8aff1..3453468cbc6 100644 ; imp_statements: { $$ = NULL; } -@@ -402,6 +426,7 @@ imp_statements: { $$ = NULL; } +@@ -404,6 +428,7 @@ imp_statements: { $$ = NULL; } | imp_statements statement { $$ = append_statement($1, $2); } | imp_statements importlib { $$ = append_statement($1, make_statement_importlib($2)); } | imp_statements librarydef { $$ = append_statement($1, make_statement_library($2)); } @@ -192,7 +192,7 @@ index f99e2f8aff1..3453468cbc6 100644 ; int_statements: { $$ = NULL; } -@@ -3146,6 +3171,27 @@ static void check_async_uuid(type_t *iface) +@@ -3164,6 +3189,27 @@ static void check_async_uuid(type_t *iface) iface->details.iface->async_iface = async_iface->details.iface->async_iface = async_iface; } @@ -220,7 +220,7 @@ index f99e2f8aff1..3453468cbc6 100644 static void check_statements(const statement_list_t *stmts, int is_inside_library) { const statement_t *stmt; -@@ -3327,6 +3373,15 @@ static statement_t *make_statement_typedef(declarator_list_t *decls, int declonl +@@ -3345,6 +3391,15 @@ static statement_t *make_statement_typedef(declarator_list_t *decls, int declonl return stmt; } @@ -236,7 +236,7 @@ index f99e2f8aff1..3453468cbc6 100644 static statement_list_t *append_statements(statement_list_t *l1, statement_list_t *l2) { if (!l2) return l1; -@@ -3378,8 +3433,10 @@ type_t *find_parameterized_type(type_t *type, type_list_t *params, int t) +@@ -3396,8 +3451,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,10 +250,10 @@ index f99e2f8aff1..3453468cbc6 100644 free(name); return type; diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c -index 9d50cabf172..8f1e2d71aff 100644 +index 971ed8c1d0d..70e7ee436e9 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c -@@ -128,6 +128,21 @@ static int format_parameterized_type_name_buffer(char *buf, size_t len, type_t * +@@ -132,6 +132,21 @@ static int format_parameterized_type_name_buffer(char *buf, size_t len, type_t * return ret; } @@ -275,7 +275,7 @@ index 9d50cabf172..8f1e2d71aff 100644 #undef append_buf char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix) -@@ -146,6 +161,31 @@ char *format_parameterized_type_name(type_t *type, type_list_t *params) +@@ -150,6 +165,31 @@ char *format_parameterized_type_name(type_t *type, type_list_t *params) return buf; } @@ -307,7 +307,7 @@ index 9d50cabf172..8f1e2d71aff 100644 type_t *type_new_function(var_list_t *args) { var_t *arg; -@@ -483,6 +523,177 @@ static unsigned int compute_method_indexes(type_t *iface) +@@ -487,6 +527,177 @@ static unsigned int compute_method_indexes(type_t *iface) return idx; } @@ -485,7 +485,7 @@ index 9d50cabf172..8f1e2d71aff 100644 type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params) { type_t *new_type = duptype(type, 0); -@@ -491,6 +702,38 @@ type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *pa +@@ -495,6 +706,38 @@ type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *pa return new_type; } @@ -538,5 +538,5 @@ index 472fdf2d5fc..e1a52d21d09 100644 void type_parameterized_interface_declare(type_t *type, type_list_t *params); void type_parameterized_interface_define(type_t *type, type_list_t *params, type_t *inherit, statement_list_t *stmts); -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0023-widl-Support-WinRT-delegate-type.patch b/patches/widl-winrt-support/0019-widl-Support-WinRT-delegate-type.patch similarity index 92% rename from patches/widl-winrt-support/0023-widl-Support-WinRT-delegate-type.patch rename to patches/widl-winrt-support/0019-widl-Support-WinRT-delegate-type.patch index fe92a3e1..6e98564b 100644 --- a/patches/widl-winrt-support/0023-widl-Support-WinRT-delegate-type.patch +++ b/patches/widl-winrt-support/0019-widl-Support-WinRT-delegate-type.patch @@ -1,7 +1,7 @@ -From 82c354b2275a33863181fc7660f8e63db51c131a Mon Sep 17 00:00:00 2001 +From efa9ba51d5e9583f08934b6f7b4eea25e56caae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 24 Sep 2020 00:00:54 +0200 -Subject: [PATCH 23/28] widl: Support WinRT delegate type. +Subject: [PATCH] widl: Support WinRT delegate type. --- tools/widl/expr.c | 1 + @@ -28,7 +28,7 @@ index c83e9aa5ec0..88d59290d6b 100644 break; case TYPE_ALIAS: diff --git a/tools/widl/header.c b/tools/widl/header.c -index db83f3aac13..64faf89c36a 100644 +index d607df5d1c9..bde58b55472 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 @@ -77,7 +77,7 @@ index db83f3aac13..64faf89c36a 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 b7f8844c7a9..5de85e43a94 100644 +index 44deb9fee5c..6c1b0473ab4 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l @@ -278,6 +278,7 @@ static const struct keyword keywords[] = { @@ -89,10 +89,10 @@ index b7f8844c7a9..5de85e43a94 100644 {"double", tDOUBLE, 0}, {"enum", tENUM, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index 2fb73a46dc1..d0166eb3af2 100644 +index 4d0390fd606..569669dcfac 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -119,6 +119,7 @@ static statement_t *make_statement_module(type_t *type); +@@ -120,6 +120,7 @@ static statement_t *make_statement_module(type_t *type); static statement_t *make_statement_typedef(var_list_t *names, int declonly); static statement_t *make_statement_import(const char *str); static statement_t *make_statement_parameterized_type(type_t *type, type_list_t *params); @@ -100,15 +100,15 @@ index 2fb73a46dc1..d0166eb3af2 100644 static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt); static statement_list_t *append_statements(statement_list_t *, statement_list_t *); static attr_list_t *append_attribs(attr_list_t *, attr_list_t *); -@@ -193,6 +194,7 @@ static typelib_t *current_typelib; - %token tCONTROL tCPPQUOTE +@@ -195,6 +196,7 @@ static typelib_t *current_typelib; + %token tCUSTOM %token tDECLARE %token tDECODE tDEFAULT tDEFAULTBIND +%token tDELEGATE %token tDEFAULTCOLLELEM %token tDEFAULTVALUE %token tDEFAULTVTABLE -@@ -291,6 +293,7 @@ static typelib_t *current_typelib; +@@ -293,6 +295,7 @@ static typelib_t *current_typelib; %type contract_req %type static_attr %type interfacehdr @@ -116,7 +116,7 @@ index 2fb73a46dc1..d0166eb3af2 100644 %type storage_cls_spec %type type_qualifier m_type_qual_list %type function_specifier -@@ -390,6 +393,7 @@ gbl_statements: { $$ = NULL; } +@@ -393,6 +396,7 @@ gbl_statements: { $$ = NULL; } { pop_namespace($2); $$ = append_statements($1, $5); } | gbl_statements interfacedec { $$ = append_statement($1, make_statement_reference($2)); } | gbl_statements interfacedef { $$ = append_statement($1, make_statement_type_decl($2)); } @@ -124,7 +124,7 @@ index 2fb73a46dc1..d0166eb3af2 100644 | gbl_statements coclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); } -@@ -412,6 +416,7 @@ imp_statements: { $$ = NULL; } +@@ -415,6 +419,7 @@ imp_statements: { $$ = NULL; } | imp_statements namespacedef '{' { push_namespace($2); } imp_statements '}' { pop_namespace($2); $$ = append_statements($1, $5); } | imp_statements interfacedef { $$ = append_statement($1, make_statement_type_decl($2)); } @@ -132,7 +132,7 @@ index 2fb73a46dc1..d0166eb3af2 100644 | imp_statements coclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); } | imp_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2)); reg_type($2, $2->name, current_namespace, 0); -@@ -1066,6 +1071,17 @@ type_parameters: +@@ -1070,6 +1075,17 @@ type_parameters: | type_parameters ',' type_parameter { $$ = append_type($1, $3); } ; @@ -150,7 +150,7 @@ index 2fb73a46dc1..d0166eb3af2 100644 required_types: qualified_type { $$ = append_type(NULL, $1); } | parameterized_type { $$ = append_type(NULL, $1); } -@@ -2716,6 +2732,7 @@ static int is_allowed_conf_type(const type_t *type) +@@ -2759,6 +2775,7 @@ static int is_allowed_conf_type(const type_t *type) case TYPE_INTERFACE: case TYPE_BITFIELD: case TYPE_RUNTIMECLASS: @@ -158,7 +158,7 @@ index 2fb73a46dc1..d0166eb3af2 100644 return FALSE; case TYPE_APICONTRACT: case TYPE_PARAMETERIZED_TYPE: -@@ -3357,6 +3374,14 @@ static statement_t *make_statement_parameterized_type(type_t *type, type_list_t +@@ -3400,6 +3417,14 @@ static statement_t *make_statement_parameterized_type(type_t *type, type_list_t return stmt; } @@ -174,7 +174,7 @@ index 2fb73a46dc1..d0166eb3af2 100644 { if (!l2) return l1; diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c -index f37b54eb65d..4557d24b3ff 100644 +index 1b5fe16b6ec..ec85f149da1 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -354,6 +354,7 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att @@ -222,10 +222,10 @@ index 6f6c5f3ccc8..8b2a2401367 100644 case TYPE_VOID: diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c -index 8f1e2d71aff..15629113cec 100644 +index 70e7ee436e9..6abd20e565e 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c -@@ -523,6 +523,13 @@ static unsigned int compute_method_indexes(type_t *iface) +@@ -527,6 +527,13 @@ static unsigned int compute_method_indexes(type_t *iface) return idx; } @@ -239,7 +239,7 @@ index 8f1e2d71aff..15629113cec 100644 static type_t *replace_type_parameters_in_type(type_t *type, type_list_t *orig, type_list_t *repl); static type_list_t *replace_type_parameters_in_type_list(type_list_t *type_list, type_list_t *orig, type_list_t *repl) -@@ -635,6 +642,7 @@ static type_t *replace_type_parameters_in_type(type_t *type, type_list_t *orig, +@@ -639,6 +646,7 @@ static type_t *replace_type_parameters_in_type(type_t *type, type_list_t *orig, case TYPE_BITFIELD: case TYPE_INTERFACE: case TYPE_RUNTIMECLASS: @@ -247,7 +247,7 @@ index 8f1e2d71aff..15629113cec 100644 return type; case TYPE_PARAMETER: for (o = orig, r = repl; o && r; o = o->next, r = r->next) -@@ -778,6 +786,27 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm +@@ -782,6 +790,27 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm compute_method_indexes(iface); } @@ -310,10 +310,10 @@ index e1a52d21d09..de3db4e7c7e 100644 { type = type_get_real_type(type); diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h -index 9863c4f72ff..3938d0d5294 100644 +index ff71a1859ae..6feabafbefd 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -435,6 +435,11 @@ struct parameterized_details +@@ -443,6 +443,11 @@ struct parameterized_details type_list_t *params; }; @@ -325,7 +325,7 @@ index 9863c4f72ff..3938d0d5294 100644 #define HASHMAX 64 struct namespace { -@@ -465,6 +470,7 @@ enum type_type +@@ -473,6 +478,7 @@ enum type_type TYPE_RUNTIMECLASS, TYPE_PARAMETERIZED_TYPE, TYPE_PARAMETER, @@ -333,7 +333,7 @@ index 9863c4f72ff..3938d0d5294 100644 }; struct _type_t { -@@ -487,6 +493,7 @@ struct _type_t { +@@ -495,6 +501,7 @@ struct _type_t { struct alias_details alias; struct runtimeclass_details runtimeclass; struct parameterized_details parameterized; @@ -342,5 +342,5 @@ index 9863c4f72ff..3938d0d5294 100644 const char *c_name; unsigned int typestring_offset; -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0024-widl-Support-WinRT-parameterized-delegate-type.patch b/patches/widl-winrt-support/0020-widl-Support-WinRT-parameterized-delegate-type.patch similarity index 91% rename from patches/widl-winrt-support/0024-widl-Support-WinRT-parameterized-delegate-type.patch rename to patches/widl-winrt-support/0020-widl-Support-WinRT-parameterized-delegate-type.patch index 5beb4b1d..e77417b3 100644 --- a/patches/widl-winrt-support/0024-widl-Support-WinRT-parameterized-delegate-type.patch +++ b/patches/widl-winrt-support/0020-widl-Support-WinRT-parameterized-delegate-type.patch @@ -1,7 +1,7 @@ -From f8fa58f5bdfac8adc9fba4af5ff294a11f48b556 Mon Sep 17 00:00:00 2001 +From 3ae25e70794056ac73c03469095530d49920d2b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 28 Sep 2020 16:46:34 +0200 -Subject: [PATCH 24/28] widl: Support WinRT parameterized delegate type. +Subject: [PATCH] widl: Support WinRT parameterized delegate type. --- include/windows.foundation.idl | 6 ++++ @@ -28,10 +28,10 @@ index 5f7a49c38e4..9583fa5bcc8 100644 { [ diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index d0166eb3af2..f7fb7a303a8 100644 +index 569669dcfac..6811f80a088 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y -@@ -1080,6 +1080,17 @@ delegatedef: +@@ -1084,6 +1084,17 @@ delegatedef: type_delegate_define($$, append_statement(NULL, make_statement_delegate($3, $6))); check_async_uuid($$); } @@ -50,10 +50,10 @@ index d0166eb3af2..f7fb7a303a8 100644 required_types: diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c -index 15629113cec..03778aa75c3 100644 +index 6abd20e565e..3b147adaa01 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c -@@ -128,13 +128,13 @@ static int format_parameterized_type_name_buffer(char *buf, size_t len, type_t * +@@ -132,13 +132,13 @@ static int format_parameterized_type_name_buffer(char *buf, size_t len, type_t * return ret; } @@ -70,7 +70,7 @@ index 15629113cec..03778aa75c3 100644 for (entry = params; entry; entry = entry->next) { for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {} -@@ -166,11 +166,11 @@ static char const *parameterized_type_shorthands[][2] = { +@@ -170,11 +170,11 @@ static char const *parameterized_type_shorthands[][2] = { {"Windows_CFoundation_C", "__F"}, }; @@ -85,7 +85,7 @@ index 15629113cec..03778aa75c3 100644 for (i = 0; i < ARRAY_SIZE(parameterized_type_shorthands); ++i) { -@@ -702,6 +702,11 @@ static void type_parameterized_interface_specialize(type_t *tmpl, type_t *iface, +@@ -706,6 +706,11 @@ static void type_parameterized_interface_specialize(type_t *tmpl, type_t *iface, iface->details.iface->requires = NULL; } @@ -97,7 +97,7 @@ index 15629113cec..03778aa75c3 100644 type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params) { type_t *new_type = duptype(type, 0); -@@ -718,7 +723,15 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa +@@ -722,7 +727,15 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa new_type->namespace = type->namespace; new_type->name = format_parameterized_type_name(type, params); reg_type(new_type, new_type->name, new_type->namespace, 0); @@ -114,7 +114,7 @@ index 15629113cec..03778aa75c3 100644 return new_type; } -@@ -731,6 +744,8 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par +@@ -735,6 +748,8 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par if (tmpl->type_type == TYPE_INTERFACE) type_parameterized_interface_specialize(tmpl, iface, orig, params); @@ -123,7 +123,7 @@ index 15629113cec..03778aa75c3 100644 else { error_loc("Unsupported parameterized type template %d\n", tmpl->type_type); -@@ -738,6 +753,11 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par +@@ -742,6 +757,11 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par } iface->defined = TRUE; @@ -135,7 +135,7 @@ index 15629113cec..03778aa75c3 100644 compute_method_indexes(iface); return iface; } -@@ -807,6 +827,28 @@ void type_delegate_define(type_t *delegate, statement_list_t *stmts) +@@ -811,6 +831,28 @@ void type_delegate_define(type_t *delegate, statement_list_t *stmts) compute_delegate_iface_name(delegate); } @@ -177,5 +177,5 @@ index de3db4e7c7e..939bc5b412e 100644 void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface); void type_module_define(type_t *module, statement_list_t *stmts); -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0025-widl-Compute-signatures-for-parameterized-types.patch b/patches/widl-winrt-support/0021-widl-Compute-signatures-for-parameterized-types.patch similarity index 93% rename from patches/widl-winrt-support/0025-widl-Compute-signatures-for-parameterized-types.patch rename to patches/widl-winrt-support/0021-widl-Compute-signatures-for-parameterized-types.patch index 31ec45ae..7d4f818c 100644 --- a/patches/widl-winrt-support/0025-widl-Compute-signatures-for-parameterized-types.patch +++ b/patches/widl-winrt-support/0021-widl-Compute-signatures-for-parameterized-types.patch @@ -1,7 +1,7 @@ -From c98f225368cdeac02b7c67b14d1e448f80c645e4 Mon Sep 17 00:00:00 2001 +From 4841fd438903fda36ac3028892d1269966040fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 25 Sep 2020 13:39:08 +0200 -Subject: [PATCH 25/28] widl: Compute signatures for parameterized types. +Subject: [PATCH] widl: Compute signatures for parameterized types. --- tools/widl/typetree.c | 155 +++++++++++++++++++++++++++++++++++++++++ @@ -10,7 +10,7 @@ Subject: [PATCH 25/28] widl: Compute signatures for parameterized types. 3 files changed, 167 insertions(+) diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c -index 03778aa75c3..b3718b5dc6d 100644 +index 3b147adaa01..6466f9dad91 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -49,6 +49,7 @@ type_t *make_type(enum type_type type) @@ -21,7 +21,7 @@ index 03778aa75c3..b3718b5dc6d 100644 memset(&t->details, 0, sizeof(t->details)); t->typestring_offset = 0; t->ptrdesc = 0; -@@ -143,6 +144,142 @@ static int format_parameterized_type_c_name_buffer(char *buf, size_t len, type_t +@@ -147,6 +148,142 @@ static int format_parameterized_type_c_name_buffer(char *buf, size_t len, type_t return ret; } @@ -164,7 +164,7 @@ index 03778aa75c3..b3718b5dc6d 100644 #undef append_buf char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix) -@@ -161,6 +298,14 @@ char *format_parameterized_type_name(type_t *type, type_list_t *params) +@@ -165,6 +302,14 @@ char *format_parameterized_type_name(type_t *type, type_list_t *params) return buf; } @@ -179,7 +179,7 @@ index 03778aa75c3..b3718b5dc6d 100644 static char const *parameterized_type_shorthands[][2] = { {"Windows_CFoundation_CCollections_C", "__F"}, {"Windows_CFoundation_C", "__F"}, -@@ -186,6 +331,14 @@ static char *format_parameterized_type_c_name(type_t *type, type_list_t *params, +@@ -190,6 +335,14 @@ static char *format_parameterized_type_c_name(type_t *type, type_list_t *params, return buf; } @@ -194,7 +194,7 @@ index 03778aa75c3..b3718b5dc6d 100644 type_t *type_new_function(var_list_t *args) { var_t *arg; -@@ -752,10 +905,12 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par +@@ -756,10 +909,12 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par return NULL; } @@ -229,10 +229,10 @@ index 939bc5b412e..b4257fe615f 100644 { type = type_get_real_type(type); diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h -index 3938d0d5294..58828a4f8e2 100644 +index 6feabafbefd..c784ae4ce52 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -496,6 +496,7 @@ struct _type_t { +@@ -504,6 +504,7 @@ struct _type_t { struct delegate_details delegate; } details; const char *c_name; @@ -240,7 +240,7 @@ index 3938d0d5294..58828a4f8e2 100644 unsigned int typestring_offset; unsigned int ptrdesc; /* used for complex structs */ int typelib_idx; -@@ -651,6 +652,7 @@ void init_loc_info(loc_info_t *); +@@ -659,6 +660,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); @@ -249,5 +249,5 @@ index 3938d0d5294..58828a4f8e2 100644 static inline enum type_type type_get_type_detect_alias(const type_t *type) { -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0026-widl-Compute-uuids-for-parameterized-types.patch b/patches/widl-winrt-support/0022-widl-Compute-uuids-for-parameterized-types.patch similarity index 97% rename from patches/widl-winrt-support/0026-widl-Compute-uuids-for-parameterized-types.patch rename to patches/widl-winrt-support/0022-widl-Compute-uuids-for-parameterized-types.patch index 2358ade8..7e63c608 100644 --- a/patches/widl-winrt-support/0026-widl-Compute-uuids-for-parameterized-types.patch +++ b/patches/widl-winrt-support/0022-widl-Compute-uuids-for-parameterized-types.patch @@ -1,7 +1,7 @@ -From a8e1b96947308faf90d1686bf14743c5da7b90bd Mon Sep 17 00:00:00 2001 +From 9275f68d2c60036d17d7a1d5601aaa349e0e5811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 28 Sep 2020 17:00:41 +0200 -Subject: [PATCH 26/28] widl: Compute uuids for parameterized types. +Subject: [PATCH] widl: Compute uuids for parameterized types. --- tools/widl/hash.c | 178 ++++++++++++++++++++++++++++++++++++++++++ @@ -222,7 +222,7 @@ index 3c2fd2914bf..208b193ac87 100644 + #endif diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c -index b3718b5dc6d..2d060363d8e 100644 +index 6466f9dad91..10ec5828c71 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -29,6 +29,7 @@ @@ -233,7 +233,7 @@ index b3718b5dc6d..2d060363d8e 100644 type_t *duptype(type_t *t, int dupname) { -@@ -683,6 +684,57 @@ static void compute_delegate_iface_name(type_t *delegate) +@@ -687,6 +688,57 @@ static void compute_delegate_iface_name(type_t *delegate) delegate->details.delegate.iface->name = name; } @@ -291,7 +291,7 @@ index b3718b5dc6d..2d060363d8e 100644 static type_t *replace_type_parameters_in_type(type_t *type, type_list_t *orig, type_list_t *repl); static type_list_t *replace_type_parameters_in_type_list(type_list_t *type_list, type_list_t *orig, type_list_t *repl) -@@ -913,6 +965,7 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par +@@ -917,6 +969,7 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par iface->signature = format_parameterized_type_signature(type, params); iface->defined = TRUE; } @@ -313,5 +313,5 @@ index b4257fe615f..46a223d50e3 100644 error("type '%s' uuid not found\n", type->name); return ∅ -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0027-widl-Generate-helper-macros-for-WinRT-implementation.patch b/patches/widl-winrt-support/0023-widl-Generate-helper-macros-for-WinRT-implementation.patch similarity index 93% rename from patches/widl-winrt-support/0027-widl-Generate-helper-macros-for-WinRT-implementation.patch rename to patches/widl-winrt-support/0023-widl-Generate-helper-macros-for-WinRT-implementation.patch index d2b51606..71f7f0a0 100644 --- a/patches/widl-winrt-support/0027-widl-Generate-helper-macros-for-WinRT-implementation.patch +++ b/patches/widl-winrt-support/0023-widl-Generate-helper-macros-for-WinRT-implementation.patch @@ -1,7 +1,7 @@ -From d517b9b5856840f19b3a805b812153d5c0f6d0d9 Mon Sep 17 00:00:00 2001 +From b8f418d2c1bec9be59dcebfba6f9aadcde60f9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 26 Aug 2020 22:46:02 +0200 -Subject: [PATCH 27/28] widl: Generate helper macros for WinRT implementation. +Subject: [PATCH] widl: Generate helper macros for WinRT implementation. This generates additional macros to help keeping implementation simple, guarded with WIDL_USING ifdefs, like this: @@ -22,7 +22,7 @@ interface methods with the simple non-prefixed names instead. 3 files changed, 94 insertions(+), 2 deletions(-) diff --git a/tools/widl/header.c b/tools/widl/header.c -index 64faf89c36a..4aa6844ee99 100644 +index bde58b55472..24eb5260da0 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); @@ -127,7 +127,7 @@ index 64faf89c36a..4aa6844ee99 100644 fprintf(header, "\n"); fprintf(header, "#endif\n"); diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c -index 2d060363d8e..f62d0eb51dc 100644 +index 10ec5828c71..80ca18baad7 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -51,6 +51,7 @@ type_t *make_type(enum type_type type) @@ -138,7 +138,7 @@ index 2d060363d8e..f62d0eb51dc 100644 memset(&t->details, 0, sizeof(t->details)); t->typestring_offset = 0; t->ptrdesc = 0; -@@ -281,6 +282,19 @@ static int format_parameterized_type_signature_buffer(char *buf, size_t len, typ +@@ -285,6 +286,19 @@ static int format_parameterized_type_signature_buffer(char *buf, size_t len, typ return ret; } @@ -158,7 +158,7 @@ index 2d060363d8e..f62d0eb51dc 100644 #undef append_buf char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix) -@@ -340,6 +354,14 @@ static char *format_parameterized_type_signature(type_t *type, type_list_t *para +@@ -344,6 +358,14 @@ static char *format_parameterized_type_signature(type_t *type, type_list_t *para return buf; } @@ -173,7 +173,7 @@ index 2d060363d8e..f62d0eb51dc 100644 type_t *type_new_function(var_list_t *args) { var_t *arg; -@@ -929,6 +951,7 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa +@@ -933,6 +955,7 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa new_type->name = format_parameterized_type_name(type, params); reg_type(new_type, new_type->name, new_type->namespace, 0); new_type->c_name = format_parameterized_type_c_name(type, params, ""); @@ -181,7 +181,7 @@ index 2d060363d8e..f62d0eb51dc 100644 if (new_type->type_type == TYPE_DELEGATE) { -@@ -936,6 +959,7 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa +@@ -940,6 +963,7 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa compute_delegate_iface_name(new_type); new_type->details.delegate.iface->namespace = new_type->namespace; new_type->details.delegate.iface->c_name = format_parameterized_type_c_name(type, params, "I"); @@ -190,10 +190,10 @@ index 2d060363d8e..f62d0eb51dc 100644 return new_type; diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h -index 58828a4f8e2..d80e9c04d51 100644 +index c784ae4ce52..a5618646366 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h -@@ -497,6 +497,7 @@ struct _type_t { +@@ -505,6 +505,7 @@ struct _type_t { } details; const char *c_name; const char *signature; @@ -202,5 +202,5 @@ index 58828a4f8e2..d80e9c04d51 100644 unsigned int ptrdesc; /* used for complex structs */ int typelib_idx; -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/0028-include-Add-IVectorView-HSTRING-declaration-to-windo.patch b/patches/widl-winrt-support/0024-include-Add-IVectorView-HSTRING-declaration-to-windo.patch similarity index 81% rename from patches/widl-winrt-support/0028-include-Add-IVectorView-HSTRING-declaration-to-windo.patch rename to patches/widl-winrt-support/0024-include-Add-IVectorView-HSTRING-declaration-to-windo.patch index 8175e912..c38560e3 100644 --- a/patches/widl-winrt-support/0028-include-Add-IVectorView-HSTRING-declaration-to-windo.patch +++ b/patches/widl-winrt-support/0024-include-Add-IVectorView-HSTRING-declaration-to-windo.patch @@ -1,7 +1,7 @@ -From 5609ada48132040965e84cdbdd95cea9492a471d Mon Sep 17 00:00:00 2001 +From 5711f9c27cbd6436d51614df56d111490abc4c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 25 Sep 2020 17:05:17 +0200 -Subject: [PATCH 28/28] include: Add IVectorView declaration to +Subject: [PATCH] include: Add IVectorView declaration to windows.foundation.idl. --- @@ -25,5 +25,5 @@ index 9583fa5bcc8..9b9b40897be 100644 + } +} -- -2.28.0 +2.29.2 diff --git a/patches/widl-winrt-support/definition b/patches/widl-winrt-support/definition index a897a107..fdfd21b7 100644 --- a/patches/widl-winrt-support/definition +++ b/patches/widl-winrt-support/definition @@ -1,2 +1 @@ Fixes: [49998] widl - Support WinRT idls -Disabled: True diff --git a/patches/windows.gaming.input-dll/definition b/patches/windows.gaming.input-dll/definition index a4c0e7a5..120b5bff 100644 --- a/patches/windows.gaming.input-dll/definition +++ b/patches/windows.gaming.input-dll/definition @@ -6,4 +6,3 @@ # To support Death Stranding Fixes: [49756] windows.gaming.input: New DLL Depends: windows.media.speech.dll -Disabled: True diff --git a/patches/windows.globalization-dll/definition b/patches/windows.globalization-dll/definition index 778ef073..d2a356f4 100644 --- a/patches/windows.globalization-dll/definition +++ b/patches/windows.globalization-dll/definition @@ -1,4 +1,3 @@ Fixes: [49740] windows.globalization: New DLL Fixes: [49998] windows.globalization: New DLL Depends: windows.gaming.input-dll -Disabled: True diff --git a/patches/windows.media.speech.dll/definition b/patches/windows.media.speech.dll/definition index 092db67a..eb60c295 100644 --- a/patches/windows.media.speech.dll/definition +++ b/patches/windows.media.speech.dll/definition @@ -1,3 +1,2 @@ Fixes: [49740] windows.media.speech: New DLL Depends: widl-winrt-support -Disabled: True diff --git a/patches/windows.networking.connectivity.dll/definition b/patches/windows.networking.connectivity.dll/definition index 5e6b7a5b..4f248dd0 100644 --- a/patches/windows.networking.connectivity.dll/definition +++ b/patches/windows.networking.connectivity.dll/definition @@ -1,3 +1,2 @@ Fixes: [46534] windows.networking.connectivity: New DLL Depends: windows.globalization-dll -Disabled: True