Rebase against 447924a6d68f7919bd451661314a52aa99cab709.

This commit is contained in:
Alistair Leslie-Hughes 2020-12-02 09:52:16 +11:00
parent d3b70d6278
commit 023588ac34
28 changed files with 392 additions and 1392 deletions

View File

@ -1,4 +1,4 @@
From d81e8108c6c13eb865b9588eca19a777b6e22986 Mon Sep 17 00:00:00 2001
From b5c84083ecc13c2911928a881b25d2924d8ca967 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 20:56:49 -0700
Subject: [PATCH] ntdll: Add support for junction point creation.
@ -14,20 +14,20 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
create mode 100644 include/ntifs.h
diff --git a/configure.ac b/configure.ac
index cf3df03cc9..ed2ebcd653 100644
index fec43bcb194..10b6a2778c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2210,6 +2210,8 @@ AC_CHECK_FUNCS(\
@@ -2215,6 +2215,8 @@ AC_CHECK_FUNCS(\
proc_pidinfo \
pwrite \
readdir \
readlink \
+ renameat \
+ renameat2 \
sched_yield \
select \
setproctitle \
setprogname \
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 1492797b0c..10bdef5d81 100644
index 8cfdb72ae97..6359c5bcd48 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -38,6 +38,7 @@
@ -38,7 +38,7 @@ index 1492797b0c..10bdef5d81 100644
#ifndef IO_COMPLETION_ALL_ACCESS
#define IO_COMPLETION_ALL_ACCESS 0x001F0003
@@ -5141,6 +5142,105 @@ static void test_mailslot_name(void)
@@ -5153,6 +5154,105 @@ static void test_mailslot_name(void)
CloseHandle( device );
}
@ -144,7 +144,7 @@ index 1492797b0c..10bdef5d81 100644
START_TEST(file)
{
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
@@ -5213,5 +5313,6 @@ START_TEST(file)
@@ -5225,5 +5325,6 @@ START_TEST(file)
test_ioctl();
test_query_ea();
test_flush_buffers_file();
@ -152,7 +152,7 @@ index 1492797b0c..10bdef5d81 100644
test_mailslot_name();
}
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 290e18e54c..c0a3dee181 100644
index 4d96a327f90..7390e7b9187 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -36,6 +36,7 @@
@ -163,7 +163,7 @@ index 290e18e54c..c0a3dee181 100644
#include <limits.h>
#ifdef HAVE_MNTENT_H
#include <mntent.h>
@@ -132,6 +133,7 @@
@@ -139,6 +140,7 @@
#include "wine/list.h"
#include "wine/debug.h"
#include "unix_private.h"
@ -171,7 +171,7 @@ index 290e18e54c..c0a3dee181 100644
WINE_DEFAULT_DEBUG_CHANNEL(file);
WINE_DECLARE_DEBUG_CHANNEL(winediag);
@@ -146,6 +148,10 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
@@ -153,6 +155,10 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
#undef EXT2_IOC_GETFLAGS
#undef EXT4_CASEFOLD_FL
@ -182,7 +182,7 @@ index 290e18e54c..c0a3dee181 100644
#ifdef linux
/* We want the real kernel dirent structure, not the libc one */
@@ -457,6 +463,32 @@ static int xattr_set( const char *path, const char *name, void *value, size_t si
@@ -467,6 +473,32 @@ static int xattr_set( const char *path, const char *name, void *value, size_t si
#endif
}
@ -215,7 +215,7 @@ index 290e18e54c..c0a3dee181 100644
/* get space from the current directory data buffer, allocating a new one if necessary */
static void *get_dir_data_space( struct dir_data *data, unsigned int size )
{
@@ -5731,6 +5763,116 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
@@ -5748,6 +5780,116 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
}
@ -332,7 +332,7 @@ index 290e18e54c..c0a3dee181 100644
/******************************************************************************
* NtFsControlFile (NTDLL.@)
*/
@@ -5813,6 +5955,23 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
@@ -5830,6 +5972,23 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
break;
}
@ -357,10 +357,10 @@ index 290e18e54c..c0a3dee181 100644
TRACE("FSCTL_SET_SPARSE: Ignoring request\n");
io->Information = 0;
diff --git a/include/Makefile.in b/include/Makefile.in
index 91a02645c3..9345b75c00 100644
index 468ee5edf47..8e8ffc26615 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -523,6 +523,7 @@ SOURCES = \
@@ -531,6 +531,7 @@ SOURCES = \
ntddvdeo.h \
ntdef.h \
ntdsapi.h \
@ -370,7 +370,7 @@ index 91a02645c3..9345b75c00 100644
ntsecapi.h \
diff --git a/include/ntifs.h b/include/ntifs.h
new file mode 100644
index 0000000000..21d42e1732
index 00000000000..21d42e17325
--- /dev/null
+++ b/include/ntifs.h
@@ -0,0 +1,42 @@
@ -417,5 +417,5 @@ index 0000000000..21d42e1732
+
+#endif /* __WINE_NTIFS_H */
--
2.28.0
2.29.2

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "2ad09b01673381261815bfc804a2f69ce4d85f86"
echo "447924a6d68f7919bd451661314a52aa99cab709"
}
# Show version information
@ -4215,36 +4215,33 @@ fi
# | * [#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
# | * include/Makefile.in, include/windows.foundation.idl, include/windows.media.speechsynthesis.idl, tools/widl/expr.c,
# | tools/widl/hash.c, tools/widl/hash.h, tools/widl/header.c, tools/widl/parser.l, tools/widl/parser.y,
# | tools/widl/typegen.c, tools/widl/typelib.c, tools/widl/typetree.c, tools/widl/typetree.h, tools/widl/utils.c,
# | tools/widl/utils.h, tools/widl/widltypes.h
# |
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
patch_apply widl-winrt-support/0001-include-Add-windows.media.speechsynthesis.idl-draft.patch
patch_apply widl-winrt-support/0002-widl-Support-WinRT-marshaling_behavior-attribute-par.patch
patch_apply widl-winrt-support/0003-widl-Support-WinRT-mta-threading-attribute-parsing.patch
patch_apply widl-winrt-support/0004-widl-Support-WinRT-exclusiveto-attribute-parsing.patch
patch_apply widl-winrt-support/0005-widl-Support-WinRT-runtimeclass-type.patch
patch_apply widl-winrt-support/0006-widl-Support-WinRT-eventadd-eventremove-attributes.patch
patch_apply widl-winrt-support/0007-widl-Support-WinRT-flags-attribute-parsing.patch
patch_apply widl-winrt-support/0008-widl-Support-using-qualified-names-for-interfaces.patch
patch_apply widl-winrt-support/0009-widl-Support-WinRT-static-attribute-parsing.patch
patch_apply widl-winrt-support/0010-widl-Support-WinRT-requires-keyword.patch
patch_apply widl-winrt-support/0011-widl-Support-WinRT-activatable-attribute.patch
patch_apply widl-winrt-support/0012-widl-Support-WinRT-parameterized-type-parsing.patch
patch_apply widl-winrt-support/0013-widl-Introduce-new-strappend-helper.patch
patch_apply widl-winrt-support/0014-widl-Support-partially-specialized-parameterized-typ.patch
patch_apply widl-winrt-support/0015-widl-Support-WinRT-parameterized-interface-type.patch
patch_apply widl-winrt-support/0016-widl-Support-WinRT-delegate-type.patch
patch_apply widl-winrt-support/0017-widl-Support-WinRT-parameterized-delegate-type.patch
patch_apply widl-winrt-support/0018-widl-Compute-signatures-for-parameterized-types.patch
patch_apply widl-winrt-support/0019-widl-Compute-uuids-for-parameterized-types.patch
patch_apply widl-winrt-support/0020-widl-Generate-helper-macros-for-WinRT-implementation.patch
patch_apply widl-winrt-support/0021-include-Add-IVectorView-HSTRING-declaration-to-windo.patch
fi
# Patchset windows.media.speech.dll

View File

@ -1,4 +1,4 @@
From 01f45ef12247bf784f27b3edb78b5ce0969c50a0 Mon Sep 17 00:00:00 2001
From 28aeb185f875c4668ff26c8896863742e49e8bcd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Wed, 23 Sep 2020 19:23:45 +0200
Subject: [PATCH] include: Add windows.media.speechsynthesis.idl draft.

View File

@ -1,133 +0,0 @@
From ba7d12c53e656fcc0dd638a7758d60a332d3bb7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Wed, 23 Sep 2020 14:14:01 +0200
Subject: [PATCH] widl: Introduce format_namespace_buffer helper.
To compute format_namespace length and write to an existing buffer.
Also add explicit abi_prefix parameter.
---
tools/widl/header.c | 2 +-
tools/widl/parser.y | 2 +-
tools/widl/typetree.c | 58 +++++++++++++++++++++---------------------
tools/widl/widltypes.h | 3 ++-
4 files changed, 33 insertions(+), 32 deletions(-)
diff --git a/tools/widl/header.c b/tools/widl/header.c
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
static void write_uuid_decl(FILE *f, type_t *type, const UUID *uuid)
{
- char *name = format_namespace(type->namespace, "", "::", type->name);
+ char *name = format_namespace(type->namespace, "", "::", type->name, use_abi_namespace ? "ABI" : NULL);
fprintf(f, "#ifdef __CRT_UUID_DECL\n");
fprintf(f, "__CRT_UUID_DECL(%s, 0x%08x, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x,"
"0x%02x,0x%02x,0x%02x,0x%02x,0x%02x)\n",
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 160e4029a6e..1bbb2e78f7e 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -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
- type->c_name = format_namespace(namespace, "__x_", "_C", name);
+ type->c_name = format_namespace(namespace, "__x_", "_C", name, use_abi_namespace ? "ABI" : NULL);
nt->type = type;
nt->t = t;
nt->next = namespace->type_hash[hash];
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index c0547b36a96..d211fa8d277 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -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;
- strcpy(ptr, "ABI");
- strcat(ptr, separator);
- return ptr + strlen(ptr);
- }
-
- ptr = append_namespace(ptr, namespace->parent, separator);
- strcpy(ptr, namespace->name);
- strcat(ptr, separator);
- return ptr + strlen(ptr);
+ const char *name = namespace && !is_global_namespace(namespace) ? namespace->name : abi_prefix;
+ int ret = 0;
+ if (!name) return 0;
+ if (namespace && !is_global_namespace(namespace)) append_buf(append_namespace, namespace->parent, separator, abi_prefix);
+ append_buf(snprintf, "%s%s", name, separator);
+ return ret;
}
-char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix)
+static int format_namespace_buffer(char *buf, size_t len, struct namespace *namespace, const char *prefix,
+ const char *separator, const char *suffix, const char *abi_prefix)
{
- unsigned len = strlen(prefix) + strlen(suffix);
- unsigned sep_len = strlen(separator);
- struct namespace *iter;
- char *ret, *ptr;
-
- if(use_abi_namespace && !is_global_namespace(namespace))
- len += 3 /* strlen("ABI") */ + sep_len;
-
- for(iter = namespace; !is_global_namespace(iter); iter = iter->parent)
- len += strlen(iter->name) + sep_len;
+ int ret = 0;
+ append_buf(snprintf, "%s", prefix);
+ append_buf(append_namespace, namespace, separator, abi_prefix);
+ append_buf(snprintf, "%s", suffix);
+ return ret;
+}
- ret = xmalloc(len+1);
- strcpy(ret, prefix);
- ptr = append_namespace(ret + strlen(ret), namespace, separator);
- strcpy(ptr, suffix);
+#undef append_buf
- return ret;
+char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix)
+{
+ int len = format_namespace_buffer(NULL, 0, namespace, prefix, separator, suffix, abi_prefix);
+ char *buf = xmalloc(len + 1);
+ format_namespace_buffer(buf, len + 1, namespace, prefix, separator, suffix, abi_prefix);
+ return buf;
}
type_t *type_new_function(var_list_t *args)
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index b02b80e122c..7a43e517698 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -613,7 +613,8 @@ var_list_t *append_var(var_list_t *list, var_t *var);
void init_loc_info(loc_info_t *);
-char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix);
+char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix,
+ const char *abi_prefix);
static inline enum type_type type_get_type_detect_alias(const type_t *type)
{
--
2.29.2

View File

@ -1,89 +0,0 @@
From 724457cf02d0e14878bcb2354732656637141f8b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
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 <declarator> m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator
%type <declarator_list> declarator_list struct_declarator_list
%type <type> coclass coclasshdr coclassdef
+%type <num> contract_ver
%type <num> pointer_type threading_type version
%type <str> libraryhdr callconv cppquote importlib import t_ident
%type <uuid> 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

View File

@ -1,4 +1,4 @@
From 96f79d868d6311262a9d30fe96b25cc120216531 Mon Sep 17 00:00:00 2001
From 5711afaf5c3b751c66f5f2b309b7dcc0f5dc7086 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 12 Oct 2020 20:34:28 +0200
Subject: [PATCH] widl: Support WinRT marshaling_behavior attribute parsing.

View File

@ -1,558 +0,0 @@
From 10cbcc558ccda4af0f1151786b95f1fae0438d66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
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 <declarator> m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator
%type <declarator_list> declarator_list struct_declarator_list
%type <type> coclass coclasshdr coclassdef
+%type <type> apicontract
%type <num> contract_ver
%type <num> pointer_type threading_type version
%type <str> 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 <display name> } */
- /* 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 <display name> } */
+ /* ATTR_AGGREGATABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "aggregatable" },
+ /* ATTR_ALLOCATE */ { 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "allocate" },
+ /* ATTR_ANNOTATION */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "annotation" },
+ /* ATTR_APPOBJECT */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "appobject" },
+ /* ATTR_ASYNC */ { 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "async" },
+ /* ATTR_ASYNCUUID */ { 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, "async_uuid" },
+ /* ATTR_AUTO_HANDLE */ { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "auto_handle" },
+ /* ATTR_BINDABLE */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "bindable" },
+ /* ATTR_BROADCAST */ { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "broadcast" },
+ /* ATTR_CALLAS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "call_as" },
+ /* ATTR_CALLCONV */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL },
+ /* ATTR_CASE */ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, "case" },
+ /* ATTR_CODE */ { 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "code" },
+ /* ATTR_COMMSTATUS */ { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "comm_status" },
+ /* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" },
+ /* ATTR_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

View File

@ -1,4 +1,4 @@
From b7c63f88f9c751933f2734eda85da6bb90c2b4ae Mon Sep 17 00:00:00 2001
From 017c4d1e286ea57eaa1cb89d401704ae3155545d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 11:35:49 +0200
Subject: [PATCH] widl: Support WinRT mta threading attribute parsing.

View File

@ -1,319 +0,0 @@
From 1b6d9ab9462963fd6465840a726fadf2ad612bcb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Wed, 23 Sep 2020 19:23:45 +0200
Subject: [PATCH] widl: Support WinRT contract attribute.
---
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 2a38e9f671b..5e17062f399 100644
--- a/include/windows.foundation.idl
+++ b/include/windows.foundation.idl
@@ -28,7 +28,7 @@ import "windowscontracts.idl";
namespace Windows {
namespace Foundation {
- [version(0x06020000)]
+ [contract(Windows.Foundation.FoundationContract, 1.0)]
enum PropertyType {
Empty = 0,
UInt8 = 1,
@@ -73,19 +73,19 @@ namespace Windows {
OtherTypeArray = 1044
};
- [version(0x06020000)]
+ [contract(Windows.Foundation.FoundationContract, 1.0)]
struct Point {
FLOAT X;
FLOAT Y;
};
- [version(0x06020000)]
+ [contract(Windows.Foundation.FoundationContract, 1.0)]
struct Size {
FLOAT Width;
FLOAT Height;
};
- [version(0x06020000)]
+ [contract(Windows.Foundation.FoundationContract, 1.0)]
struct Rect {
FLOAT X;
FLOAT Y;
@@ -93,18 +93,18 @@ namespace Windows {
FLOAT Height;
};
- [version(0x06020000)]
+ [contract(Windows.Foundation.FoundationContract, 1.0)]
struct DateTime {
INT64 UniversalTime;
};
- [version(0x06020000)]
+ [contract(Windows.Foundation.FoundationContract, 1.0)]
struct TimeSpan {
INT64 Duration;
};
[
- version(0x06030000),
+ contract(Windows.Foundation.FoundationContract, 1.0),
uuid(96369f54-8eb6-48f0-abce-c1b211e627c3)
]
interface IStringable : IInspectable
diff --git a/tools/widl/header.c b/tools/widl/header.c
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);
static void write_type_v(FILE *f, const decl_spec_t *t, int is_field, int declonly, const char *name, enum name_type name_type);
+static void write_winrt_type_comments(FILE *header, const type_t *type);
+
+static void write_apicontract_guard_start(FILE *header, const expr_t *expr);
+static void write_apicontract_guard_end(FILE *header, const expr_t *expr);
+
static void indent(FILE *h, int delta)
{
int c;
@@ -218,7 +223,9 @@ static void write_fields(FILE *h, var_list_t *fields, enum name_type name_type)
}
LIST_FOR_EACH_ENTRY( v, fields, var_t, entry ) {
+ expr_t *contract = get_attrp(v->attrs, ATTR_CONTRACT);
if (!v || !v->declspec.type) continue;
+ if (contract) write_apicontract_guard_start(h, contract);
indent(h, 0);
name = v->name;
@@ -252,6 +259,7 @@ static void write_fields(FILE *h, var_list_t *fields, enum name_type name_type)
}
write_type_v(h, &v->declspec, TRUE, v->declonly, name, name_type);
fprintf(h, ";\n");
+ if (contract) write_apicontract_guard_end(h, contract);
}
}
@@ -261,6 +269,8 @@ static void write_enums(FILE *h, var_list_t *enums, const char *enum_name)
if (!enums) return;
LIST_FOR_EACH_ENTRY( v, enums, var_t, entry )
{
+ expr_t *contract = get_attrp(v->attrs, ATTR_CONTRACT);
+ if (contract) write_apicontract_guard_start(h, contract);
if (v->name) {
indent(h, 0);
if(!enum_name)
@@ -273,8 +283,9 @@ static void write_enums(FILE *h, var_list_t *enums, const char *enum_name)
}
}
if (list_next( enums, &v->entry )) fprintf(h, ",\n");
+ else fprintf(h, "\n");
+ if (contract) write_apicontract_guard_end(h, contract);
}
- fprintf(h, "\n");
}
int needs_space_after(type_t *t)
@@ -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};
+ expr_t *contract = get_attrp(t->attrs, ATTR_CONTRACT);
+ if (contract) write_apicontract_guard_start(f, contract);
if(in_namespace) {
fprintf(f, "#ifdef __cplusplus\n");
fprintf(f, "} /* extern \"C\" */\n");
@@ -581,6 +594,7 @@ static void write_type_definition(FILE *f, type_t *t, int declonly)
fprintf(f, ";\n");
fprintf(f, "#endif\n\n");
}
+ if (contract) write_apicontract_guard_end(f, contract);
}
void write_type_decl(FILE *f, const decl_spec_t *t, const char *name)
@@ -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)
+{
+ expr_t *contract = get_attrp(type->attrs, ATTR_CONTRACT);
+ fprintf(header, " *\n");
+ if (contract)
+ {
+ const type_t *type = contract->u.tref.type;
+ char *name = format_namespace(type->namespace, "", ".", type->name, NULL);
+ int ver = contract->ref->u.lval;
+ fprintf(header, " * Introduced to %s in version %d.%d\n *\n", name, (ver >> 16) & 0xffff, ver & 0xffff);
+ free(name);
+ }
+}
+
+static void write_apicontract_guard_start(FILE *header, const expr_t *expr)
+{
+ const type_t *type;
+ char *name;
+ int ver;
+ if (!winrt_mode) return;
+ type = expr->u.tref.type;
+ ver = expr->ref->u.lval;
+ name = format_apicontract_macro(type);
+ fprintf(header, "#if %s_VERSION >= %#x\n", name, ver);
+ free(name);
+}
+
+static void write_apicontract_guard_end(FILE *header, const expr_t *expr)
+{
+ const type_t *type;
+ char *name;
+ int ver;
+ if (!winrt_mode) return;
+ type = expr->u.tref.type;
+ ver = expr->ref->u.lval;
+ name = format_apicontract_macro(type);
+ fprintf(header, "#endif /* %s_VERSION >= %#x */\n", name, ver);
+ free(name);
+}
+
static void write_com_interface_start(FILE *header, const type_t *iface)
{
int dispinterface = is_attr(iface->attrs, ATTR_DISPINTERFACE);
+ expr_t *contract = get_attrp(iface->attrs, ATTR_CONTRACT);
fprintf(header, "/*****************************************************************************\n");
fprintf(header, " * %s %sinterface\n", iface->name, dispinterface ? "disp" : "");
+ if (winrt_mode) write_winrt_type_comments(header, iface);
fprintf(header, " */\n");
+ if (contract) write_apicontract_guard_start(header, contract);
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" : "");
}
@@ -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);
+ expr_t *contract = get_attrp(iface->attrs, ATTR_CONTRACT);
type_t *type;
if (uuid)
@@ -1559,17 +1617,22 @@ static void write_com_interface_end(FILE *header, type_t *iface)
write_locals(header, iface, FALSE);
fprintf(header, "\n");
}
- fprintf(header,"#endif /* __%s_%sINTERFACE_DEFINED__ */\n\n", iface->c_name, dispinterface ? "DISP" : "");
+ fprintf(header, "#endif /* __%s_%sINTERFACE_DEFINED__ */\n", iface->c_name, dispinterface ? "DISP" : "");
+ if (contract) write_apicontract_guard_end(header, contract);
+ fprintf(header, "\n");
}
static void write_rpc_interface_start(FILE *header, const type_t *iface)
{
unsigned int ver = get_attrv(iface->attrs, ATTR_VERSION);
const var_t *var = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
+ expr_t *contract = get_attrp(iface->attrs, ATTR_CONTRACT);
fprintf(header, "/*****************************************************************************\n");
fprintf(header, " * %s interface (v%d.%d)\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
+ if (winrt_mode) write_winrt_type_comments(header, iface);
fprintf(header, " */\n");
+ if (contract) write_apicontract_guard_start(header, contract);
fprintf(header,"#ifndef __%s_INTERFACE_DEFINED__\n", iface->name);
fprintf(header,"#define __%s_INTERFACE_DEFINED__\n\n", iface->name);
if (var)
@@ -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)
{
- fprintf(header,"\n#endif /* __%s_INTERFACE_DEFINED__ */\n\n", iface->name);
+ expr_t *contract = get_attrp(iface->attrs, ATTR_CONTRACT);
+ fprintf(header, "\n#endif /* __%s_INTERFACE_DEFINED__ */\n", iface->name);
+ if (contract) write_apicontract_guard_end(header, contract);
+ fprintf(header, "\n");
}
static void write_coclass(FILE *header, type_t *cocl)
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 6a9bb65a483..9dce03577c6 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -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},
{"custom", tCUSTOM, 0},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 5b4bd518a0b..1d413ca74f4 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -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> str_list
%type <expr> m_expr expr expr_const expr_int_const array m_bitfield
%type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
+%type <expr> contract_req
%type <type> interfacehdr
%type <stgclass> storage_cls_spec
%type <type_qualifier> type_qualifier m_type_qual_list
@@ -508,6 +510,12 @@ contract_ver:
| aNUM '.' aNUM { $$ = MAKEVERSION($3, $1); }
;
+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);
+ $$ = make_exprt(EXPR_GTREQL, declare_var(NULL, $1, make_declarator(NULL), 0), $$);
+ }
+
attribute: { $$ = NULL; }
| tAGGREGATABLE { $$ = make_attr(ATTR_AGGREGATABLE); }
| tANNOTATION '(' aSTRING ')' { $$ = make_attrp(ATTR_ANNOTATION, $3); }
@@ -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); }
| 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 878650d9c27..d5862426ad4 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_CONTRACT,
ATTR_CONTRACTVERSION,
ATTR_CONTROL,
ATTR_CUSTOM,
--
2.29.2

View File

@ -1,4 +1,4 @@
From b50209766aa6b602ebee9b7c17f274d30e238ee9 Mon Sep 17 00:00:00 2001
From e9ad63c63f1d364ef4e049c3021e559e1c79383e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 00:11:08 +0200
Subject: [PATCH] widl: Support WinRT exclusiveto attribute parsing.

View File

@ -1,4 +1,4 @@
From 84586a64342dd0da353d56579fd58927feca226d Mon Sep 17 00:00:00 2001
From 02e1c811eca9385791b013452394fadc6aa1f08a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 20 Nov 2020 11:06:18 +0100
Subject: [PATCH] widl: Support WinRT runtimeclass type.
@ -621,7 +621,7 @@ index faf76440f93..ace6424e3a0 100644
case TYPE_VOID:
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index d211fa8d277..9bddba90681 100644
index df883576915..107a2d36a2f 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -215,6 +215,16 @@ type_t *type_new_coclass(char *name)

View File

@ -1,4 +1,4 @@
From 8e4ce83c6e6b23b81c0ec70699fd1884b004dc73 Mon Sep 17 00:00:00 2001
From 48d82198138c3523b551d00afae967062e04a1bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 1 Oct 2020 20:10:02 +0200
Subject: [PATCH] widl: Support WinRT eventadd/eventremove attributes.

View File

@ -1,4 +1,4 @@
From 3fbc18351dcd54b48c1441e428a90efd8c68ffd5 Mon Sep 17 00:00:00 2001
From 4f57bc2b14ec1007b631a5ff4c13c2590c6dffaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 12 Oct 2020 18:02:59 +0200
Subject: [PATCH] widl: Support WinRT flags attribute parsing.

View File

@ -1,4 +1,4 @@
From 9250fdc20535cf4126a953fc4eb6a95b40279efa Mon Sep 17 00:00:00 2001
From eef393b9065d80ed648e651f37122ca6b85eaeb7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 25 Sep 2020 17:13:47 +0200
Subject: [PATCH] widl: Support using qualified names for interfaces.

View File

@ -1,4 +1,4 @@
From 383521b26b11d59b9a45fd6b1d1fcb7744028595 Mon Sep 17 00:00:00 2001
From 6b4c1d42dcf5cf3125f0cb9b5f413d41f4b42dcc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 14:30:32 +0200
Subject: [PATCH] widl: Support WinRT static attribute parsing.

View File

@ -1,4 +1,4 @@
From 1cdacef37ec25c6069b6cd6d1d8c9d1754b771fc Mon Sep 17 00:00:00 2001
From 5c6a83997b1125ab3800a6f38ff984e6bbd0e8b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 00:31:57 +0200
Subject: [PATCH] widl: Support WinRT requires keyword.
@ -174,7 +174,7 @@ index 908e7b6d4da..bf89ba771ac 100644
}
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 9bddba90681..85e745bee37 100644
index 107a2d36a2f..90c34302ca1 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -463,7 +463,7 @@ static unsigned int compute_method_indexes(type_t *iface)

View File

@ -1,4 +1,4 @@
From 1b9a28bd1800db506745628cc718f4a84d185fb1 Mon Sep 17 00:00:00 2001
From b61b29f1d1eb924346e8c05af9c6cce7eb961b69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 11:35:29 +0200
Subject: [PATCH] widl: Support WinRT activatable attribute.

View File

@ -1,4 +1,4 @@
From 0f685576a7a76025edeae6c06f380c32c3e0541b Mon Sep 17 00:00:00 2001
From cae5cc34cb1852e38d6f1e20663fbfc92e6d90d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 16:31:16 +0200
Subject: [PATCH] widl: Support WinRT parameterized type parsing.
@ -288,7 +288,7 @@ index ace6424e3a0..6f6c5f3ccc8 100644
assert(0);
break;
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 85e745bee37..429e61e43d9 100644
index 90c34302ca1..b9bc4a1f075 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -463,6 +463,36 @@ static unsigned int compute_method_indexes(type_t *iface)

View File

@ -0,0 +1,136 @@
From 68867c961b01c85c26d37809e7791f4ecc2eed12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 1 Dec 2020 14:41:01 +0100
Subject: [PATCH] widl: Introduce new strappend helper.
And use it for format_namespace to grow buffer as needed.
---
tools/widl/typetree.c | 46 ++++++++++++++-----------------------------
tools/widl/utils.c | 37 ++++++++++++++++++++++++++++++++++
tools/widl/utils.h | 1 +
3 files changed, 53 insertions(+), 31 deletions(-)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index b9bc4a1f075..3cf324cc7f6 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -89,41 +89,25 @@ const char *type_get_name(const type_t *type, enum name_type name_type)
return NULL;
}
-static char *append_namespace(char *ptr, struct namespace *namespace, const char *separator, const char *abi_prefix)
+static size_t append_namespace(char **buf, size_t *len, size_t pos, struct namespace *namespace, const char *separator, const char *abi_prefix)
{
- if(is_global_namespace(namespace)) {
- if(!abi_prefix) return ptr;
- strcpy(ptr, abi_prefix);
- strcat(ptr, separator);
- return ptr + strlen(ptr);
- }
-
- ptr = append_namespace(ptr, namespace->parent, separator, abi_prefix);
- strcpy(ptr, namespace->name);
- strcat(ptr, separator);
- return ptr + strlen(ptr);
+ int nested = namespace && !is_global_namespace(namespace);
+ const char *name = nested ? namespace->name : abi_prefix;
+ size_t n = 0;
+ if (!name) return 0;
+ if (nested) n += append_namespace(buf, len, pos + n, namespace->parent, separator, abi_prefix);
+ n += strappend(buf, len, pos + n, "%s%s", name, separator);
+ return n;
}
-char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix,
- const char *abi_prefix)
+char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix)
{
- unsigned len = strlen(prefix) + strlen(suffix);
- unsigned sep_len = strlen(separator);
- struct namespace *iter;
- char *ret, *ptr;
-
- if(abi_prefix)
- len += strlen(abi_prefix) + sep_len;
-
- for(iter = namespace; !is_global_namespace(iter); iter = iter->parent)
- len += strlen(iter->name) + sep_len;
-
- ret = xmalloc(len+1);
- strcpy(ret, prefix);
- ptr = append_namespace(ret + strlen(ret), namespace, separator, abi_prefix);
- strcpy(ptr, suffix);
-
- return ret;
+ size_t len = 0, pos = 0;
+ char *buf = NULL;
+ pos += strappend(&buf, &len, pos, "%s", prefix);
+ pos += append_namespace(&buf, &len, pos, namespace, separator, abi_prefix);
+ pos += strappend(&buf, &len, pos, "%s", suffix);
+ return buf;
}
type_t *type_new_function(var_list_t *args)
diff --git a/tools/widl/utils.c b/tools/widl/utils.c
index ea92372c8c7..634bd12a0ba 100644
--- a/tools/widl/utils.c
+++ b/tools/widl/utils.c
@@ -245,6 +245,43 @@ char *strmake( const char* fmt, ... )
}
}
+size_t strappend(char **buf, size_t *len, size_t pos, const char* fmt, ...)
+{
+ size_t size;
+ va_list ap;
+ char *ptr;
+ int n;
+
+ assert( buf && len );
+ assert( (*len == 0 && *buf == NULL) || (*len != 0 && *buf != NULL) );
+
+ if (*buf)
+ {
+ size = *len;
+ ptr = *buf;
+ }
+ else
+ {
+ size = 100;
+ ptr = xmalloc( size );
+ }
+
+ for (;;)
+ {
+ va_start( ap, fmt );
+ n = vsnprintf( ptr + pos, size - pos, fmt, ap );
+ va_end( ap );
+ if (n == -1) size *= 2;
+ else if (pos + (size_t)n >= size) size = pos + n + 1;
+ else break;
+ ptr = xrealloc( ptr, size );
+ }
+
+ *len = size;
+ *buf = ptr;
+ return n;
+}
+
char *xstrdup(const char *str)
{
char *s;
diff --git a/tools/widl/utils.h b/tools/widl/utils.h
index 37406656504..82e0a6ae489 100644
--- a/tools/widl/utils.h
+++ b/tools/widl/utils.h
@@ -45,6 +45,7 @@ void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
void warning_loc_info(const loc_info_t *, const char *s, ...) __attribute__((format (printf, 2, 3)));
void chat(const char *s, ...) __attribute__((format (printf, 1, 2)));
char *strmake(const char* fmt, ...) __attribute__((__format__ (__printf__, 1, 2 )));
+size_t strappend(char **buf, size_t *len, size_t pos, const char* fmt, ...) __attribute__((__format__ (__printf__, 4, 5 )));
char *dup_basename(const char *name, const char *ext);
size_t widl_getline(char **linep, size_t *lenp, FILE *fp);
--
2.29.2

View File

@ -1,4 +1,4 @@
From 50bdc1b20819fb4dc4db3420726e7c2bc0c98193 Mon Sep 17 00:00:00 2001
From d05826e88b00d743e8692c9c6cf90fb54a5bd661 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 12 Oct 2020 23:23:18 +0200
Subject: [PATCH] widl: Support partially specialized parameterized type.
@ -11,12 +11,12 @@ The partial specialization is recorded by adding a new parameterized
type, referencing the original one as its template. The parameterized
type chain will be resolved all at once when the type is declared.
---
include/windows.foundation.idl | 9 +++++++++
tools/widl/parser.y | 35 ++++++++++++++++++++++++++++++++++
tools/widl/typetree.c | 32 +++++++++++++++++++++++++++++++
include/windows.foundation.idl | 9 ++++++++
tools/widl/parser.y | 35 +++++++++++++++++++++++++++++
tools/widl/typetree.c | 41 +++++++++++++++++++++++++++++++---
tools/widl/typetree.h | 2 ++
tools/widl/widltypes.h | 1 +
5 files changed, 79 insertions(+)
5 files changed, 85 insertions(+), 3 deletions(-)
diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl
index ab7c4753c3b..5f7a49c38e4 100644
@ -117,48 +117,54 @@ index 48135d4372e..14c9c5d007e 100644
+ return type;
+}
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 429e61e43d9..971ed8c1d0d 100644
index 3cf324cc7f6..e2d0a573c0d 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -116,6 +116,22 @@ static int format_namespace_buffer(char *buf, size_t len, struct namespace *name
return ret;
@@ -100,13 +100,40 @@ static size_t append_namespace(char **buf, size_t *len, size_t pos, struct names
return n;
}
+static int format_parameterized_type_name_buffer(char *buf, size_t len, type_t *type, type_list_t *params)
+static size_t append_namespaces(char **buf, size_t *len, size_t pos, struct namespace *namespace, const char *prefix,
+ const char *separator, const char *suffix, const char *abi_prefix)
+{
+ type_list_t *entry;
+ int ret = 0;
+ append_buf(snprintf, "%s<", type->name);
+ for (entry = params; entry; entry = entry->next)
+ {
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
+ append_buf(format_namespace_buffer, type->namespace, "", "::", type->name, use_abi_namespace ? "ABI" : NULL);
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) append_buf(snprintf, "*");
+ if (entry->next) append_buf(snprintf, ",");
+ }
+ append_buf(snprintf, ">");
+ return ret;
+ size_t n = 0;
+ n += strappend(buf, len, pos + n, "%s", prefix);
+ n += append_namespace(buf, len, pos + n, namespace, separator, abi_prefix);
+ n += strappend(buf, len, pos + n, "%s", suffix);
+ return n;
+}
+
#undef append_buf
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix)
@@ -126,6 +142,14 @@ char *format_namespace(struct namespace *namespace, const char *prefix, const ch
return buf;
}
+char *format_parameterized_type_name(type_t *type, type_list_t *params)
+{
+ int len = format_parameterized_type_name_buffer(NULL, 0, type, params);
+ char *buf = xmalloc(len + 1);
+ format_parameterized_type_name_buffer(buf, len + 1, type, params);
+ size_t len = 0;
+ char *buf = NULL;
+ append_namespaces(&buf, &len, 0, namespace, prefix, separator, suffix, abi_prefix);
+ return buf;
+}
+
type_t *type_new_function(var_list_t *args)
+char *format_parameterized_type_name(type_t *type, type_list_t *params)
{
var_t *arg;
@@ -463,6 +487,14 @@ static unsigned int compute_method_indexes(type_t *iface)
size_t len = 0, pos = 0;
char *buf = NULL;
- pos += strappend(&buf, &len, pos, "%s", prefix);
- pos += append_namespace(&buf, &len, pos, namespace, separator, abi_prefix);
- pos += strappend(&buf, &len, pos, "%s", suffix);
+ type_list_t *entry;
+
+ pos += strappend(&buf, &len, pos, "%s<", type->name);
+ for (entry = params; entry; entry = entry->next)
+ {
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
+ pos += append_namespaces(&buf, &len, pos, type->namespace, "", "::", type->name, use_abi_namespace ? "ABI" : NULL);
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) pos += strappend(&buf, &len, pos, "*");
+ if (entry->next) pos += strappend(&buf, &len, pos, ",");
+ }
+ pos += strappend(&buf, &len, pos, ">");
+
return buf;
}
@@ -447,6 +474,14 @@ static unsigned int compute_method_indexes(type_t *iface)
return idx;
}

View File

@ -1,6 +1,6 @@
From 3b4ac2090dc378d7dba378539670557efb80b50c Mon Sep 17 00:00:00 2001
From ebb2a57af572a80547cd60580c37aa403189183b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 12 Oct 2020 17:38:53 +0200
Date: Tue, 1 Dec 2020 17:34:23 +0100
Subject: [PATCH] widl: Support WinRT parameterized interface type.
This allows parameterized interfaces to be instanciated in declare
@ -8,13 +8,13 @@ blocks, in the same way MIDL does, generating a new interface to the
header from the parameterized type template, replacing its parameters
with the given types.
---
include/windows.media.speechsynthesis.idl | 23 ++
include/windows.media.speechsynthesis.idl | 23 +++
tools/widl/header.c | 7 +-
tools/widl/parser.l | 1 +
tools/widl/parser.y | 63 +++++-
tools/widl/typetree.c | 243 ++++++++++++++++++++++
tools/widl/typetree.c | 238 ++++++++++++++++++++++
tools/widl/typetree.h | 2 +
6 files changed, 334 insertions(+), 5 deletions(-)
6 files changed, 329 insertions(+), 5 deletions(-)
diff --git a/include/windows.media.speechsynthesis.idl b/include/windows.media.speechsynthesis.idl
index 89fe616b9b3..40c45c82051 100644
@ -250,32 +250,10 @@ index 14c9c5d007e..4d0390fd606 100644
free(name);
return type;
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 971ed8c1d0d..70e7ee436e9 100644
index e2d0a573c0d..a9a1ab390e8 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -132,6 +132,21 @@ static int format_parameterized_type_name_buffer(char *buf, size_t len, type_t *
return ret;
}
+static int format_parameterized_type_c_name_buffer(char *buf, size_t len, type_t *type, type_list_t *params)
+{
+ type_list_t *entry;
+ int ret = 0, count = 0;
+ append_buf(format_namespace_buffer, type->namespace, "__x_", "_C", type->name, use_abi_namespace ? "ABI" : NULL);
+ for (entry = params; entry; entry = entry->next) count++;
+ append_buf(snprintf, "_%d", count);
+ for (entry = params; entry; entry = entry->next)
+ {
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
+ append_buf(format_namespace_buffer, type->namespace, "_", "__C", type->name, NULL);
+ }
+ return ret;
+}
+
#undef append_buf
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix)
@@ -150,6 +165,31 @@ char *format_parameterized_type_name(type_t *type, type_list_t *params)
@@ -137,6 +137,41 @@ char *format_parameterized_type_name(type_t *type, type_list_t *params)
return buf;
}
@ -286,9 +264,19 @@ index 971ed8c1d0d..70e7ee436e9 100644
+
+static char *format_parameterized_type_c_name(type_t *type, type_list_t *params)
+{
+ int i, len = format_parameterized_type_c_name_buffer(NULL, 0, type, params);
+ char *buf = xmalloc(len + 1), *tmp;
+ format_parameterized_type_c_name_buffer(buf, len + 1, type, params);
+ size_t len = 0, pos = 0;
+ char *buf = NULL, *tmp;
+ type_list_t *entry;
+ int i, count = 0;
+
+ pos += append_namespaces(&buf, &len, pos, type->namespace, "__x_", "_C", type->name, use_abi_namespace ? "ABI" : NULL);
+ for (entry = params; entry; entry = entry->next) count++;
+ pos += strappend(&buf, &len, pos, "_%d", count);
+ for (entry = params; entry; entry = entry->next)
+ {
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
+ pos += append_namespaces(&buf, &len, pos, type->namespace, "_", "__C", type->name, NULL);
+ }
+
+ for (i = 0; i < ARRAY_SIZE(parameterized_type_shorthands); ++i)
+ {
@ -307,7 +295,7 @@ index 971ed8c1d0d..70e7ee436e9 100644
type_t *type_new_function(var_list_t *args)
{
var_t *arg;
@@ -487,6 +527,177 @@ static unsigned int compute_method_indexes(type_t *iface)
@@ -474,6 +509,177 @@ static unsigned int compute_method_indexes(type_t *iface)
return idx;
}
@ -485,7 +473,7 @@ index 971ed8c1d0d..70e7ee436e9 100644
type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params)
{
type_t *new_type = duptype(type, 0);
@@ -495,6 +706,38 @@ type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *pa
@@ -482,6 +688,38 @@ type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *pa
return new_type;
}

View File

@ -1,4 +1,4 @@
From efa9ba51d5e9583f08934b6f7b4eea25e56caae0 Mon Sep 17 00:00:00 2001
From e5a6a7504ff3fd5cbc557b3bdcbc07d1932da570 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 24 Sep 2020 00:00:54 +0200
Subject: [PATCH] widl: Support WinRT delegate type.
@ -222,10 +222,10 @@ index 6f6c5f3ccc8..8b2a2401367 100644
case TYPE_VOID:
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 70e7ee436e9..6abd20e565e 100644
index a9a1ab390e8..dd870fb964b 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -527,6 +527,13 @@ static unsigned int compute_method_indexes(type_t *iface)
@@ -509,6 +509,13 @@ static unsigned int compute_method_indexes(type_t *iface)
return idx;
}
@ -239,7 +239,7 @@ index 70e7ee436e9..6abd20e565e 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)
@@ -639,6 +646,7 @@ static type_t *replace_type_parameters_in_type(type_t *type, type_list_t *orig,
@@ -621,6 +628,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 70e7ee436e9..6abd20e565e 100644
return type;
case TYPE_PARAMETER:
for (o = orig, r = repl; o && r; o = o->next, r = r->next)
@@ -782,6 +790,27 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm
@@ -764,6 +772,27 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm
compute_method_indexes(iface);
}

View File

@ -1,14 +1,14 @@
From 3ae25e70794056ac73c03469095530d49920d2b2 Mon Sep 17 00:00:00 2001
From 6ce4a0c81ded0e350b65e21b42650db157d16708 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 28 Sep 2020 16:46:34 +0200
Date: Tue, 1 Dec 2020 17:43:01 +0100
Subject: [PATCH] widl: Support WinRT parameterized delegate type.
---
include/windows.foundation.idl | 6 ++++
tools/widl/parser.y | 11 +++++++
tools/widl/typetree.c | 56 +++++++++++++++++++++++++++++-----
tools/widl/parser.y | 11 ++++++++
tools/widl/typetree.c | 50 +++++++++++++++++++++++++++++++---
tools/widl/typetree.h | 1 +
4 files changed, 67 insertions(+), 7 deletions(-)
4 files changed, 64 insertions(+), 4 deletions(-)
diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl
index 5f7a49c38e4..9583fa5bcc8 100644
@ -50,42 +50,30 @@ index 569669dcfac..6811f80a088 100644
required_types:
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 6abd20e565e..3b147adaa01 100644
index dd870fb964b..d0bd5e4e5e6 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -132,13 +132,13 @@ static int format_parameterized_type_name_buffer(char *buf, size_t len, type_t *
return ret;
}
-static int format_parameterized_type_c_name_buffer(char *buf, size_t len, type_t *type, type_list_t *params)
+static int format_parameterized_type_c_name_buffer(char *buf, size_t len, type_t *type, type_list_t *params, const char *prefix)
{
type_list_t *entry;
int ret = 0, count = 0;
- append_buf(format_namespace_buffer, type->namespace, "__x_", "_C", type->name, use_abi_namespace ? "ABI" : NULL);
+ append_buf(format_namespace_buffer, type->namespace, "__x_", "_C", "", use_abi_namespace ? "ABI" : NULL);
for (entry = params; entry; entry = entry->next) count++;
- append_buf(snprintf, "_%d", count);
+ append_buf(snprintf, "%s%s_%d", prefix, type->name, count);
for (entry = params; entry; entry = entry->next)
{
for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
@@ -170,11 +170,11 @@ static char const *parameterized_type_shorthands[][2] = {
@@ -142,16 +142,16 @@ static char const *parameterized_type_shorthands[][2] = {
{"Windows_CFoundation_C", "__F"},
};
-static char *format_parameterized_type_c_name(type_t *type, type_list_t *params)
+static char *format_parameterized_type_c_name(type_t *type, type_list_t *params, const char *prefix)
{
- int i, len = format_parameterized_type_c_name_buffer(NULL, 0, type, params);
+ int i, len = format_parameterized_type_c_name_buffer(NULL, 0, type, params, prefix);
char *buf = xmalloc(len + 1), *tmp;
- format_parameterized_type_c_name_buffer(buf, len + 1, type, params);
+ format_parameterized_type_c_name_buffer(buf, len + 1, type, params, prefix);
size_t len = 0, pos = 0;
char *buf = NULL, *tmp;
type_list_t *entry;
int i, count = 0;
for (i = 0; i < ARRAY_SIZE(parameterized_type_shorthands); ++i)
- pos += append_namespaces(&buf, &len, pos, type->namespace, "__x_", "_C", type->name, use_abi_namespace ? "ABI" : NULL);
+ pos += append_namespaces(&buf, &len, pos, type->namespace, "__x_", "_C", "", use_abi_namespace ? "ABI" : NULL);
for (entry = params; entry; entry = entry->next) count++;
- pos += strappend(&buf, &len, pos, "_%d", count);
+ pos += strappend(&buf, &len, pos, "%s%s_%d", prefix, type->name, count);
for (entry = params; entry; entry = entry->next)
{
@@ -706,6 +706,11 @@ static void type_parameterized_interface_specialize(type_t *tmpl, type_t *iface,
for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
@@ -688,6 +688,11 @@ static void type_parameterized_interface_specialize(type_t *tmpl, type_t *iface,
iface->details.iface->requires = NULL;
}
@ -97,7 +85,7 @@ index 6abd20e565e..3b147adaa01 100644
type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params)
{
type_t *new_type = duptype(type, 0);
@@ -722,7 +727,15 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa
@@ -704,7 +709,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 +102,7 @@ index 6abd20e565e..3b147adaa01 100644
return new_type;
}
@@ -735,6 +748,8 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
@@ -717,6 +730,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 +111,7 @@ index 6abd20e565e..3b147adaa01 100644
else
{
error_loc("Unsupported parameterized type template %d\n", tmpl->type_type);
@@ -742,6 +757,11 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
@@ -724,6 +739,11 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
}
iface->defined = TRUE;
@ -135,7 +123,7 @@ index 6abd20e565e..3b147adaa01 100644
compute_method_indexes(iface);
return iface;
}
@@ -811,6 +831,28 @@ void type_delegate_define(type_t *delegate, statement_list_t *stmts)
@@ -793,6 +813,28 @@ void type_delegate_define(type_t *delegate, statement_list_t *stmts)
compute_delegate_iface_name(delegate);
}

View File

@ -1,16 +1,16 @@
From 4841fd438903fda36ac3028892d1269966040fb3 Mon Sep 17 00:00:00 2001
From 9e0f6fbe59ebb3a6a2baf76defd44f99a7956721 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 25 Sep 2020 13:39:08 +0200
Date: Tue, 1 Dec 2020 17:44:43 +0100
Subject: [PATCH] widl: Compute signatures for parameterized types.
---
tools/widl/typetree.c | 155 +++++++++++++++++++++++++++++++++++++++++
tools/widl/typetree.c | 151 +++++++++++++++++++++++++++++++++++++++++
tools/widl/typetree.h | 10 +++
tools/widl/widltypes.h | 2 +
3 files changed, 167 insertions(+)
3 files changed, 163 insertions(+)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 3b147adaa01..6466f9dad91 100644
index d0bd5e4e5e6..61defa177a7 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -49,6 +49,7 @@ type_t *make_type(enum type_type type)
@ -21,87 +21,88 @@ index 3b147adaa01..6466f9dad91 100644
memset(&t->details, 0, sizeof(t->details));
t->typestring_offset = 0;
t->ptrdesc = 0;
@@ -147,6 +148,142 @@ static int format_parameterized_type_c_name_buffer(char *buf, size_t len, type_t
return ret;
@@ -110,6 +111,125 @@ static size_t append_namespaces(char **buf, size_t *len, size_t pos, struct name
return n;
}
+static int format_type_signature_buffer(char *buf, size_t len, type_t *type);
+static size_t append_type_signature(char **buf, size_t *len, size_t pos, type_t *type);
+
+static int format_var_list_signature_buffer(char *buf, size_t len, var_list_t *var_list)
+static size_t append_var_list_signature(char **buf, size_t *len, size_t pos, var_list_t *var_list)
+{
+ var_t *var;
+ int ret = 0;
+ if (!var_list) append_buf(snprintf, ";");
+ size_t n = 0;
+ if (!var_list) n += strappend(buf, len, pos + n, ";");
+ else LIST_FOR_EACH_ENTRY(var, var_list, var_t, entry)
+ {
+ append_buf(snprintf, ";");
+ append_buf(format_type_signature_buffer, var->declspec.type);
+ n += strappend(buf, len, pos + n, ";");
+ n += append_type_signature(buf, len, pos + n, var->declspec.type);
+ }
+ return ret;
+ return n;
+}
+
+static int format_type_signature_buffer(char *buf, size_t len, type_t *type)
+static size_t append_type_signature(char **buf, size_t *len, size_t pos, type_t *type)
+{
+ const GUID *uuid;
+ int ret = 0;
+ size_t n = 0;
+ if (!type) return 0;
+ switch (type->type_type)
+ {
+ case TYPE_INTERFACE:
+ if (type->signature) append_buf(snprintf, "%s", type->signature);
+ if (type->signature) n += strappend(buf, len, pos + n, "%s", type->signature);
+ else
+ {
+ uuid = type_get_uuid(type);
+ append_buf(snprintf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+ uuid->Data1, uuid->Data2, uuid->Data3,
+ uuid->Data4[0], uuid->Data4[1], uuid->Data4[2], uuid->Data4[3],
+ uuid->Data4[4], uuid->Data4[5], uuid->Data4[6], uuid->Data4[7]);
+ n += strappend(buf, len, pos + n, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+ uuid->Data1, uuid->Data2, uuid->Data3,
+ uuid->Data4[0], uuid->Data4[1], uuid->Data4[2], uuid->Data4[3],
+ uuid->Data4[4], uuid->Data4[5], uuid->Data4[6], uuid->Data4[7]);
+ }
+ return ret;
+ return n;
+ case TYPE_DELEGATE:
+ append_buf(snprintf, "delegate(");
+ append_buf(format_type_signature_buffer, type_delegate_get_iface(type));
+ append_buf(snprintf, ")");
+ return ret;
+ n += strappend(buf, len, pos + n, "delegate(");
+ n += append_type_signature(buf, len, pos + n, type_delegate_get_iface(type));
+ n += strappend(buf, len, pos + n, ")");
+ return n;
+ case TYPE_RUNTIMECLASS:
+ append_buf(snprintf, "rc(");
+ append_buf(format_namespace_buffer, type->namespace, "", ".", type->name, NULL);
+ append_buf(snprintf, ";");
+ append_buf(format_type_signature_buffer, type_runtimeclass_get_default_iface(type));
+ append_buf(snprintf, ")");
+ return ret;
+ n += strappend(buf, len, pos + n, "rc(");
+ n += append_namespaces(buf, len, pos + n, type->namespace, "", ".", type->name, NULL);
+ n += strappend(buf, len, pos + n, ";");
+ n += append_type_signature(buf, len, pos + n, type_runtimeclass_get_default_iface(type));
+ n += strappend(buf, len, pos + n, ")");
+ return n;
+ case TYPE_POINTER:
+ return format_type_signature_buffer(buf, len, type->details.pointer.ref.type);
+ n += append_type_signature(buf, len, pos + n, type->details.pointer.ref.type);
+ return n;
+ case TYPE_ALIAS:
+ if (!strcmp(type->name, "boolean")) append_buf(snprintf, "b1");
+ else ret = format_type_signature_buffer(buf, len, type->details.alias.aliasee.type);
+ return ret;
+ if (!strcmp(type->name, "boolean")) n += strappend(buf, len, pos + n, "b1");
+ else n += append_type_signature(buf, len, pos + n, type->details.alias.aliasee.type);
+ return n;
+ case TYPE_STRUCT:
+ append_buf(snprintf, "struct(");
+ append_buf(format_namespace_buffer, type->namespace, "", ".", type->name, NULL);
+ append_buf(format_var_list_signature_buffer, type->details.structure->fields);
+ append_buf(snprintf, ")");
+ return ret;
+ n += strappend(buf, len, pos + n, "struct(");
+ n += append_namespaces(buf, len, pos + n, type->namespace, "", ".", type->name, NULL);
+ n += append_var_list_signature(buf, len, pos + n, type->details.structure->fields);
+ n += strappend(buf, len, pos + n, ")");
+ return n;
+ case TYPE_BASIC:
+ switch (type_basic_get_type(type))
+ {
+ case TYPE_BASIC_INT:
+ case TYPE_BASIC_INT32:
+ append_buf(snprintf, type_basic_get_sign(type) < 0 ? "i4" : "u4");
+ return ret;
+ n += strappend(buf, len, pos + n, type_basic_get_sign(type) < 0 ? "i4" : "u4");
+ return n;
+ case TYPE_BASIC_INT64:
+ append_buf(snprintf, type_basic_get_sign(type) < 0 ? "i8" : "u8");
+ return ret;
+ n += strappend(buf, len, pos + n, type_basic_get_sign(type) < 0 ? "i8" : "u8");
+ return n;
+ case TYPE_BASIC_INT8:
+ assert(type_basic_get_sign(type) >= 0); /* signature string for signed char isn't specified */
+ append_buf(snprintf, "u1");
+ return ret;
+ n += strappend(buf, len, pos + n, "u1");
+ return n;
+ case TYPE_BASIC_FLOAT:
+ append_buf(snprintf, "f4");
+ return ret;
+ n += strappend(buf, len, pos + n, "f4");
+ return n;
+ case TYPE_BASIC_DOUBLE:
+ append_buf(snprintf, "f8");
+ return ret;
+ n += strappend(buf, len, pos + n, "f8");
+ return n;
+ case TYPE_BASIC_INT16:
+ case TYPE_BASIC_INT3264:
+ case TYPE_BASIC_LONG:
@ -116,12 +117,12 @@ index 3b147adaa01..6466f9dad91 100644
+ break;
+ }
+ case TYPE_ENUM:
+ append_buf(snprintf, "enum(");
+ append_buf(format_namespace_buffer, type->namespace, "", ".", type->name, NULL);
+ if (is_attr(type->attrs, ATTR_FLAGS)) append_buf(snprintf, ";u4");
+ else append_buf(snprintf, ";i4");
+ append_buf(snprintf, ")");
+ return ret;
+ n += strappend(buf, len, pos + n, "enum(");
+ n += append_namespaces(buf, len, pos + n, type->namespace, "", ".", type->name, NULL);
+ if (is_attr(type->attrs, ATTR_FLAGS)) n += strappend(buf, len, pos + n, ";u4");
+ else n += strappend(buf, len, pos + n, ";i4");
+ n += strappend(buf, len, pos + n, ")");
+ return n;
+ case TYPE_ARRAY:
+ case TYPE_ENCAPSULATED_UNION:
+ case TYPE_UNION:
@ -140,61 +141,56 @@ index 3b147adaa01..6466f9dad91 100644
+ break;
+ }
+
+ return ret;
+ return n;
+}
+
+static int format_parameterized_type_signature_buffer(char *buf, size_t len, type_t *type, type_list_t *params)
+{
+ type_list_t *entry;
+ const GUID *uuid = type_get_uuid(type);
+ int ret = 0;
+ append_buf(snprintf, "pinterface({%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+ uuid->Data1, uuid->Data2, uuid->Data3,
+ uuid->Data4[0], uuid->Data4[1], uuid->Data4[2], uuid->Data4[3],
+ uuid->Data4[4], uuid->Data4[5], uuid->Data4[6], uuid->Data4[7]);
+ for (entry = params; entry; entry = entry->next)
+ {
+ append_buf(snprintf, ";");
+ append_buf(format_type_signature_buffer, entry->type);
+ }
+ append_buf(snprintf, ")");
+ return ret;
+}
+
#undef append_buf
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix)
@@ -165,6 +302,14 @@ char *format_parameterized_type_name(type_t *type, type_list_t *params)
{
size_t len = 0;
@@ -137,6 +257,14 @@ char *format_parameterized_type_name(type_t *type, type_list_t *params)
return buf;
}
+char *format_type_signature(type_t *type)
+{
+ int len = format_type_signature_buffer(NULL, 0, type);
+ char *buf = xmalloc(len + 1);
+ format_type_signature_buffer(buf, len + 1, type);
+ size_t len = 0;
+ char *buf = NULL;
+ append_type_signature(&buf, &len, 0, type);
+ return buf;
+}
+
static char const *parameterized_type_shorthands[][2] = {
{"Windows_CFoundation_CCollections_C", "__F"},
{"Windows_CFoundation_C", "__F"},
@@ -190,6 +335,14 @@ static char *format_parameterized_type_c_name(type_t *type, type_list_t *params,
@@ -172,6 +300,27 @@ static char *format_parameterized_type_c_name(type_t *type, type_list_t *params,
return buf;
}
+static char *format_parameterized_type_signature(type_t *type, type_list_t *params)
+{
+ int len = format_parameterized_type_signature_buffer(NULL, 0, type, params);
+ char *buf = xmalloc(len + 1);
+ format_parameterized_type_signature_buffer(buf, len + 1, type, params);
+ size_t len = 0, pos = 0;
+ char *buf = NULL;
+ type_list_t *entry;
+
+ const GUID *uuid = type_get_uuid(type);
+ pos += strappend(&buf, &len, pos, "pinterface({%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+ uuid->Data1, uuid->Data2, uuid->Data3,
+ uuid->Data4[0], uuid->Data4[1], uuid->Data4[2], uuid->Data4[3],
+ uuid->Data4[4], uuid->Data4[5], uuid->Data4[6], uuid->Data4[7]);
+ for (entry = params; entry; entry = entry->next)
+ {
+ pos += strappend(&buf, &len, pos, ";");
+ pos += append_type_signature(&buf, &len, pos, entry->type);
+ }
+ pos += strappend(&buf, &len, pos, ")");
+
+ return buf;
+}
+
type_t *type_new_function(var_list_t *args)
{
var_t *arg;
@@ -756,10 +909,12 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
@@ -738,10 +887,12 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
return NULL;
}

View File

@ -1,4 +1,4 @@
From 9275f68d2c60036d17d7a1d5601aaa349e0e5811 Mon Sep 17 00:00:00 2001
From df4252c0e8d2905a9ba0f5e068590e588c8ca290 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 28 Sep 2020 17:00:41 +0200
Subject: [PATCH] widl: Compute uuids for parameterized types.
@ -222,7 +222,7 @@ index 3c2fd2914bf..208b193ac87 100644
+
#endif
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 6466f9dad91..10ec5828c71 100644
index 61defa177a7..99599710a04 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -29,6 +29,7 @@
@ -233,7 +233,7 @@ index 6466f9dad91..10ec5828c71 100644
type_t *duptype(type_t *t, int dupname)
{
@@ -687,6 +688,57 @@ static void compute_delegate_iface_name(type_t *delegate)
@@ -665,6 +666,57 @@ static void compute_delegate_iface_name(type_t *delegate)
delegate->details.delegate.iface->name = name;
}
@ -291,7 +291,7 @@ index 6466f9dad91..10ec5828c71 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)
@@ -917,6 +969,7 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
@@ -895,6 +947,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;
}

View File

@ -1,4 +1,4 @@
From b8f418d2c1bec9be59dcebfba6f9aadcde60f9ec Mon Sep 17 00:00:00 2001
From 140a726843c3abbc4fb0fd3cf41f2e43d42733f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Wed, 26 Aug 2020 22:46:02 +0200
Subject: [PATCH] widl: Generate helper macros for WinRT implementation.
@ -17,9 +17,9 @@ macros before including the header, and then implement or use the
interface methods with the simple non-prefixed names instead.
---
tools/widl/header.c | 71 ++++++++++++++++++++++++++++++++++++++++--
tools/widl/typetree.c | 24 ++++++++++++++
tools/widl/typetree.c | 19 +++++++++++
tools/widl/widltypes.h | 1 +
3 files changed, 94 insertions(+), 2 deletions(-)
3 files changed, 89 insertions(+), 2 deletions(-)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index bde58b55472..24eb5260da0 100644
@ -127,7 +127,7 @@ index bde58b55472..24eb5260da0 100644
fprintf(header, "\n");
fprintf(header, "#endif\n");
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 10ec5828c71..80ca18baad7 100644
index 99599710a04..faa6e29fb34 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -51,6 +51,7 @@ type_t *make_type(enum type_type type)
@ -138,42 +138,30 @@ index 10ec5828c71..80ca18baad7 100644
memset(&t->details, 0, sizeof(t->details));
t->typestring_offset = 0;
t->ptrdesc = 0;
@@ -285,6 +286,19 @@ static int format_parameterized_type_signature_buffer(char *buf, size_t len, typ
return ret;
}
+static int format_parameterized_type_short_name_buffer(char *buf, size_t len, type_t *type, type_list_t *params, const char *prefix)
+{
+ type_list_t *entry;
+ int ret = 0;
+ append_buf(snprintf, "%s%s", prefix, type->name);
+ for (entry = params; entry; entry = entry->next)
+ {
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
+ append_buf(snprintf, "_%s", type->name);
+ }
+ return ret;
+}
+
#undef append_buf
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix)
@@ -344,6 +358,14 @@ static char *format_parameterized_type_signature(type_t *type, type_list_t *para
@@ -322,6 +323,22 @@ static char *format_parameterized_type_signature(type_t *type, type_list_t *para
return buf;
}
+static char *format_parameterized_type_short_name(type_t *type, type_list_t *params, const char *prefix)
+{
+ int len = format_parameterized_type_short_name_buffer(NULL, 0, type, params, prefix);
+ char *buf = xmalloc(len + 1);
+ format_parameterized_type_short_name_buffer(buf, len + 1, type, params, prefix);
+ size_t len = 0, pos = 0;
+ char *buf = NULL;
+ type_list_t *entry;
+
+ pos += strappend(&buf, &len, pos, "%s%s", prefix, type->name);
+ for (entry = params; entry; entry = entry->next)
+ {
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
+ pos += strappend(&buf, &len, pos, "_%s", type->name);
+ }
+
+ return buf;
+}
+
type_t *type_new_function(var_list_t *args)
{
var_t *arg;
@@ -933,6 +955,7 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa
@@ -911,6 +928,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 +169,7 @@ index 10ec5828c71..80ca18baad7 100644
if (new_type->type_type == TYPE_DELEGATE)
{
@@ -940,6 +963,7 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa
@@ -918,6 +936,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");

View File

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

View File

@ -1 +1 @@
2ad09b01673381261815bfc804a2f69ce4d85f86
447924a6d68f7919bd451661314a52aa99cab709