Commit Graph

409 Commits

Author SHA1 Message Date
Steve Lhomme fc533ddf32 widl: Precompute qualified type names, and use them for C++ interfaces.
This is what MIDL does and avoid mismatching and even fixes some compiling issues.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-19 23:46:30 +01:00
Rémi Bernon b1e9326f5a widl: Compute uuids for parameterized types.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-18 22:39:33 +01:00
Rémi Bernon fecfd245a1 widl: Support WinRT parameterized delegate type.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban<jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-18 22:39:33 +01:00
Rémi Bernon 2326d7226d widl: Support WinRT delegate type.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban<jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-18 22:39:33 +01:00
Rémi Bernon d3c7aa2915 widl: Support WinRT parameterized interface type.
This allows parameterized interfaces to be instanciated in declare
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.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 22:21:06 +01:00
Rémi Bernon d5bf8f4e8a widl: Support partially specialized parameterized type.
This allows parameterized types to reference each other with a different
set of parameters. This is required for instance for IIterable<T>, that
needs to reference IIterator<T>.

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.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 21:42:18 +01:00
Rémi Bernon 94b5af4b34 widl: Replace type_list_t with typeref_list_t.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 21:42:18 +01:00
Rémi Bernon 84966c9b59 widl: Rename ifref_list_t to typeref_list_t.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 21:42:18 +01:00
Rémi Bernon 7987c6f9ba widl: Rename ifref_t to typeref_t.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 21:42:18 +01:00
Rémi Bernon db580fe9db widl: Rename ifref_t iface member to type.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 21:42:18 +01:00
Andrew Boyarshin a55a37d1da widl: Support midl_pragma default option.
Signed-off-by: Andrew Boyarshin <andrew.boyarshin@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-16 23:01:38 +01:00
Rémi Bernon ed21c29481 widl: Support WinRT parameterized type parsing.
And add IVectorView<T> and IIterator<T> parameterized interfaces to
windows.foundation.idl for illustration and future use. They won't
generate any additional code until they are fully specialized.

This is a WIDL-specific feature, but MIDL has some magic knowledge of
these Windows.Foundation.Collections interface templates, and we need a
way to instruct WIDL about them too.

Having these interfaces declared in the IDL, guarded with __WIDL__ ifdef
is easier and more flexible than re-creating the types by hand in WIDL
source.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-12 14:46:29 +01:00
Rémi Bernon daba929a52 widl: Support WinRT requires keyword.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-09 21:16:16 +01:00
Rémi Bernon 1442ddf942 widl: Support WinRT static attribute parsing.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-09 21:16:14 +01:00
Rémi Bernon 30129c2837 widl: Support WinRT activatable attribute parsing.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-09 21:16:11 +01:00
Rémi Bernon 2bfcfcc0a9 widl: Support referencing qualified interface names.
And split the dispinterface case, which is not supported in WinRT mode.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-08 20:09:21 +01:00
Rémi Bernon 509daf4d23 widl: Fold inherit cases by using typename rule in qualified_type.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-08 20:09:19 +01:00
Rémi Bernon 374321f836 widl: Remove aNAMESPACE token from the lexer.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-08 20:09:15 +01:00
Rémi Bernon f5b7a76b28 widl: Disallow qualified types in expressions.
MIDL WinRT mode only supports a limited subset of original IDL syntax
anyway, and this will save some conflicts when removing the lexer trick
for namespaces.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-08 20:09:12 +01:00
Rémi Bernon 47a256c648 widl: Use explicit namespace parameter for qualified names.
Instead of buggy lookup namespace stack.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-08 20:09:07 +01:00
Rémi Bernon f76f3d152f widl: Add explicit namespace parameter to find_type_or_error.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-08 20:09:04 +01:00
Rémi Bernon 36597eda3d widl: Fold aIDENTIFIER / aKNOWNTYPE rules together.
Splitting t_ident rule as typename / m_typename rules.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-05 22:53:46 +01:00
Rémi Bernon 6f1308cd62 widl: Factor and cleanup module type declaration and definition.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-05 22:53:46 +01:00
Rémi Bernon 62c58eb8a0 widl: Factor and cleanup apicontract type declaration and definition.
And remove unused check_def helper.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-05 22:53:46 +01:00
Rémi Bernon ce14877436 widl: Factor and cleanup dispinterface type declaration and definition.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-05 22:53:46 +01:00
Rémi Bernon f8684cf953 widl: Factor and cleanup interface type declaration and definition.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-05 22:53:46 +01:00
Rémi Bernon 621b4fa697 widl: Distinguish interface declarations from interface references.
Interface referencing should probably check for a previous type
declaration, but Wine IDLs currently have many places where this is
broken.

This is for instance the case when a coclass use the inner interface
statement to declare an interface without any previous declaration.

And in mimeole.idl, coclass are being declared with the same name as
their interface, to generate the corresponding CLSID.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-04 23:11:22 +01:00
Rémi Bernon 7a01eb2aad widl: Factor and cleanup runtimeclass type declaration and definition.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-04 23:11:22 +01:00
Rémi Bernon 84b7faeb52 widl: Factor and cleanup coclass type declaration and definition.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-04 23:11:22 +01:00
Rémi Bernon 6a1b6a20a3 widl: Remove constant t parameter from find_type_or_error.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-04 23:11:22 +01:00
Rémi Bernon b3f807a142 widl: Remove useless find_type_or_error2 helper.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-04 23:11:22 +01:00
Rémi Bernon 8233b3d537 widl: Support WinRT eventadd/eventremove attributes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-01 10:50:17 +01:00
Rémi Bernon 1a62712e25 widl: Support WinRT flags attribute parsing.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-01 10:50:12 +01:00
Rémi Bernon f46c077d5e widl: Support WinRT runtimeclass type parsing.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-28 09:41:46 +01:00
Rémi Bernon 73e0f5e212 widl: Support WinRT exclusiveto attribute parsing.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-26 19:26:22 +01:00
Rémi Bernon 1abdd8c89a widl: Support WinRT mta threading attribute parsing.
As an alias to free-threaded model.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-26 19:26:19 +01:00
Rémi Bernon 2129e335f2 widl: Support WinRT marshaling_behavior attribute parsing.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-25 21:04:04 +01:00
Jacek Caban 6653a381cb widl: Don't apply call_as methods to async interface.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-18 16:25:02 +01:00
Rémi Bernon 54035a2101 widl: Support WinRT contract attribute.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 19:50:04 +01:00
Rémi Bernon ee490ee26c widl: Support WinRT apicontract type.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 19:49:52 +01:00
Rémi Bernon 19b5f3e060 widl: Support WinRT contractversion attribute parsing.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 19:49:49 +01:00
Rémi Bernon 13592f0cdb widl: Add abi_prefix parameter to format_namespace.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 19:49:47 +01:00
Kevin Puetz 7afd550f34 widl: Parse attribute custom(guid,expr).
Signed-off-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-18 22:27:51 +01:00
Rémi Bernon 92eb5ef5a1 widl: Support repetition for some attributes.
Some attributes can be specified multiple times, this is the case for
instance for "custom" attribute, as well as WinRT "static".

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: PuetzKevinA@JohnDeere.com
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-16 21:06:18 +01:00
Eric Kohl ba72ef6c22 widl: Add the [allocate] acf attribute.
Signed-off-by: Eric Kohl <eric.kohl@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-27 21:04:46 +01:00
Nikolay Sivov d7b166976d widl: Allow [restricted] for coclass-es.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-24 15:03:32 +02:00
Nikolay Sivov 0a49202109 widl: Allow [hidden] attribute on enum members.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-23 18:42:51 +02:00
Nikolay Sivov 8eb756c699 widl: Enable [hidden] attribute for enums.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-23 18:42:31 +02:00
Rémi Bernon 280932536f widl: Support fully qualified names in WinRT mode.
Interfaces are going to reference each other across namespaces, so this
implements a type lookup with the full name.

It supports the following idl syntax in WinRT mode:

    #ifdef __WIDL__
    #pragma winrt ns_prefix
    #endif

    import "wtypes.idl";

    namespace Windows {
        namespace Foo {
            [object]
            interface IFoo {}
        }
        namespace Bar {
            [object]
            interface IBar { HRESULT DoBar([in] Windows.Foo.IFoo *foo); }
        }
    }

That was previously failing to parse the Windows.Foo.IFoo part and to
lookup the corresponding type.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-07 21:07:00 +02:00
Rémi Bernon f4f612a077 widl: Search for known types in current namespace.
Fixes the following error with this sample idl:

    #ifdef __WIDL__
    #pragma winrt ns_prefix
    #endif

    import "wtypes.idl";

    namespace Windows {
        [object]
        interface IFoo {}

        [object]
        interface IBar { HRESULT DoBar([in] IFoo *foo); }
    }

$ widl -o windows.foo.h windows.foo.idl
windows.foo.idl:13: error: type 'IFoo' not found

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-07 21:07:00 +02:00