Commit graph

99 commits

Author SHA1 Message Date
Rémi Bernon 3d79c1f56d widl: Add source location information to attributes. 2023-03-24 21:49:27 +01:00
Rémi Bernon 7771a9ae79 widl: Simplify attribute creation with either int or ptr value. 2023-03-24 21:49:27 +01:00
Rémi Bernon 472b2ecad4 widl: Improve accuracy of error messages location. 2023-03-23 16:44:34 +01:00
Rémi Bernon be1e308253 widl: Allow source location to span over multiple lines. 2023-03-23 16:44:34 +01:00
Rémi Bernon edca5937fb widl: Rename (error|warning)_loc_info to (error|warning)_at. 2023-03-23 16:44:34 +01:00
Rémi Bernon a375ff9e65 widl: Use "g16" for GUID parameterized type signature. 2023-03-01 11:01:15 +01:00
Mohamad Al-Jaf ef43048c65 widl: Use "i2" / "u2" for INT16 parameterized type signature. 2023-03-01 11:01:15 +01:00
Mohamad Al-Jaf e427e893fc widl: Use "i4" / "u4" for LONG parameterized type signature. 2023-03-01 11:01:13 +01:00
Julian Klemann c8c7ff640a widl: Use "cinterface(IInspectable)" for IInspectable signature.
Fixes the UUID of ITypedEventHandler<DeviceWatcher*, IInspectable*> to
match MIDL.
2022-09-14 22:38:34 +02:00
Rémi Bernon 837297c21f widl: Support namespaces for union declarations.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
2022-07-07 19:10:02 +02:00
Rémi Bernon 25e1fb45db widl: Fix missing support for struct / union parameterized type replacement.
And we can just pass them through, as with other class types. This
fixes widl not accepting EventRegistrationToken method argument type
in a parameterized type.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
2022-07-07 19:10:02 +02:00
Alistair Leslie-Hughes 3f942a32c3 widl: Support basic BYTE type.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-04 10:01:32 +01:00
Rémi Bernon 21fa9fa36a widl: Fix sign handling in parameterized types signatures.
Unspecified sign should be mapped to signed integer / char.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-25 20:50:49 +01:00
Rémi Bernon 1af44e2670 widl: Use "string" for HSTRING in signatures for generated UUID.
Fixes the UUID of IVectorView<HSTRING*> to match MIDL for instance.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-25 20:50:49 +01:00
Rémi Bernon 1f2614c60b widl: Fix nested parameterized types C / short name output.
We append type->name from each parameter when constructing the c_name
of parameterized type. When the parameter is itself a parameterized type
this field contains C++-like name, with template brackets.

Instead this precomputes the names of parameterized types whenever they
are used as a parameter. In this case the format is the same as the C
name, except that __C is used as a namespace separator, instead of _C,
and that there's no namespace or abi prefix included.

Shorthands need to be applied too, altough they have to match the __C.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-25 20:50:49 +01:00
Rémi Bernon b2a1e381d8 widl: Clarify declaration type names vs (reference) type names.
Declaration type names prefer unqualified names whereas reference type
names prefer fully qualified names.

This makes C++ code use fully qualified names when referencing a type,
fixing cases where types from other namespaces are used. It also allows
to skip the enum / struct / union type prefix in WinRT C++ code.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-25 20:50:49 +01:00
Huw Davies f8adbf35ca widl: Remove the uuid_t typedef which causes conflicts on macOS.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-25 09:27:15 +01:00
Alexandre Julliard a7f0e61e6c widl: Avoid using Windows types where possible.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-24 12:27:47 +01:00
Rémi Bernon e137becb13 widl: Allow runtimeclass to not have a default interface.
Or any interfaces, as long as they have a static factory, as MIDL
requires.

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-03-10 18:43:15 +01:00
Rémi Bernon 4b24b6be06 widl: Fix missing delegate declaration namespace.
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-03-02 20:39:48 +01:00
Rémi Bernon dc65f88654 widl: Generate helper macros for WinRT implementation.
This generates additional macros to help keeping implementation simple,
guarded with WIDL_using ifdefs, like this:

    #ifdef WIDL_using_Windows_Foo
    #define IFooVtbl __x_ABI_CWindows_CFoo_CIFooVtbl
    #define IFoo __x_ABI_CWindows_CFoo_CIFoo
    #define IFoo_DoFoo __x_ABI_CWindows_CFoo_CIFoo_DoFoo
    #endif /* WIDL_using_Windows_Foo */

Implementation files can define the desired WIDL_using preprocessor
macros before including the header, and then implement or use the
interface methods with the simple non-prefixed names instead.

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-26 16:25:57 +01:00
Rémi Bernon 5f6fdb1838 widl: Strip last separator in append_namespaces if suffix is NULL.
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-26 16:25:55 +01:00
Rémi Bernon 31cbca5f07 widl: Make WinRT nested templates C++98 compatible.
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-26 16:25:51 +01:00
Rémi Bernon 41a3087394 widl: Use C++ template implementation for parameterized types.
Based on a patch from Steve Lhomme.

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-25 22:39:21 +01:00
Rémi Bernon ea9d98082a widl: Write C++ template declarations for parameterized types.
Based on a patch from Steve Lhomme.

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-25 22:39:21 +01:00
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
Steve Lhomme a78053743d widl: Never use the namespace ABI prefix for global types.
Otherwise we end up with types like ABI::IInspectable.

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 c5413e1258 widl: Compute signatures 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
Rémi Bernon 6341546fde widl: Introduce new strappend helper.
And use it for format_namespace to grow buffer as needed.

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:32 +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 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 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 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 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
Rémi Bernon a35ca92362 widl: Prefer mangled name over typedef in WinRT mode.
For types under a non-global namespace.

MIDL generates prefixed mangled name for every use of enum, struct and
union types. When the types are in the global namespace, the typedef
name is used instead.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-16 21:06:18 +01:00
Zebediah Figura 732f67ed38 widl: Generate a name for the encapsulated union type.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-21 20:03:52 +02:00