Rob Shearman
cc51c30a63
widl: Fix optimisation for writing out ref pointers to simple structs and base types.
...
The optimisation in write_remoting_arg for sizing, marshalling,
unmarshalling and freeing ref pointers to base types directly was
broken in d458a599eb
and caused
unnecessary calls to pointer marshalling functions.
The same was true for a similar optimisation for simple structures
where their size can be pre-calculated, freeing omitted and the
NdrSimpleStructMarshall/Unmarshall functions called directly instead
of calling NdrPointerMarshall/Unmarshall first.
Fix this by looking at the type of the referrent instead of the type
of the pointer, making sure to not classify user types as simple
structures.
Additionally remove some dead code that would never be executed
because the code is in an RPC_FC_RP case, inside a !is_ptr if block
(and RPC_FC_RP is a pointer type).
2008-12-01 12:46:46 +01:00
Rob Shearman
41152b7929
widl: Output the correct buffer size required for parameters whose sizes are known at type-generation time.
...
Replace code to calculate the size of RPC_FC_STRUCT types with
fields_memsize since the memory size of these types will always be
equal to the buffer size.
Remove dead code in get_required_buffer_size.
2008-12-01 12:46:19 +01:00
Alexandre Julliard
584d2c9118
widl: Do not make the stub vtbl const for delegating interfaces since it needs to be patched up at run-time.
2008-12-01 11:30:05 +01:00
Alexandre Julliard
cb7a0da5db
widl: Fix the handling of proxy delegation.
...
Generate a BaseIIDList for delegated interface, and point directly to
the methods that have been defined in the same file instead of
delegating them.
2008-11-28 12:55:59 +01:00
Alexandre Julliard
0b7478a79f
widl: Make sure format strings for structure and union types are only output once.
2008-11-25 21:47:47 +01:00
Daniel Zimmermann
89cf227601
widl: Fix check for interface type in get_size_procformatstring.
2008-11-18 14:05:22 +01:00
Andrew Talbot
08c6f507b8
widl: Remove superfluous semicolons.
2008-11-17 13:11:47 +01:00
Dmitry Timoshkov
d560b7bbb0
widl: Make the generated string pointers const as well.
2008-11-11 11:40:50 +01:00
Huw Davies
81bab55a94
widl: Include errno.h.
2008-10-20 22:33:40 +02:00
Rob Shearman
cb3ea6843c
widl: Check for overflow when parsing integer constants.
2008-10-18 19:33:18 +02:00
Alexandre Julliard
b4b8a342d7
widl: Add support for attributes on enum, struct and union definitions.
2008-10-10 12:54:05 +02:00
Rob Shearman
2e8dec4115
widl: Don't automatically add DUMMYUNIONNAME and DUMMYSTRUCTNAME names to anonymous unions and structs.
...
It doesn't match what MIDL does.
2008-09-18 14:18:28 +02:00
Alexandre Julliard
f203263528
widl: Remove unnecessary casts in the generated code.
2008-09-15 19:40:51 +02:00
Alexandre Julliard
cdfec4da31
widl: Implemented RpcAbnormalTermination in the generic exception handling code.
2008-09-15 18:18:16 +02:00
Alexandre Julliard
654e78aa38
widl: Implemented __finally support in client functions.
2008-09-15 18:03:56 +02:00
Alexandre Julliard
0f12f358cd
widl: Implemented __finally support in server functions.
2008-09-15 18:03:49 +02:00
Alexandre Julliard
3bab54cf04
widl: Implemented __finally support in stub functions.
2008-09-15 18:03:44 +02:00
Alexandre Julliard
b8fb66c71a
widl: Separate declaration and initialisation for indirect arguments.
2008-09-15 16:46:33 +02:00
Alexandre Julliard
bf011b0f53
widl: Infrastructure for adding a prefix to local variable references.
2008-09-15 16:46:01 +02:00
Alexandre Julliard
3bdaba2a93
widl: Make the exception handling macros more general and use the same code everywhere.
2008-09-15 14:05:26 +02:00
Alexandre Julliard
1218aff94d
widl: Create an explicit structure for the function frame of all generated functions.
...
Store _StubMsg in the frame structure since it's needed for exception handling.
2008-09-15 14:02:26 +02:00
Rob Shearman
e0dd72162a
widl: Remove redundant code.
...
dispinterfaces now have a type of RPC_FC_IP instead of 0, so this code
will never be reached.
2008-09-11 11:45:33 +02:00
Rob Shearman
39978c68f9
widl: Fix the writing typedefs to dispinterfaces and pointers to interfaces.
...
Currently, stdole2.tlb isn't generated correctly and causes "<failed>"
to appear instead of "FontEvents" in the IFontEventsDisp typedef when
viewed with oleview.
The problem is that the typedef should just generate a VT_USERDEFINED
record, but ends up generating a VT_PTR -> VT_USERDEFINED. So remove
the extra writing of VT_PTR entries.
Fix the skipped pointers checks in encode_type and encode_type to
specifically detect VT_UNKNOWN and VT_DISPATCH types which don't need
one level of pointers, whereas interfaces encoded as VT_USERDEFINED
do.
2008-09-10 10:55:34 +02:00
Austin English
bfc34a3c9c
widl: Remove unreached code (Smatch).
2008-09-10 10:55:11 +02:00
Steven Edwards
6bdfc2fa2c
widl: Open files in binary mode to avoid corruption from text mode on Windows.
2008-09-10 10:40:18 +02:00
Dan Hipschman
a41de877da
widl: Output NULL for inherited methods in the vtbl.
2008-09-02 18:01:53 +02:00
Alexandre Julliard
5ce606e834
widl: Add support for finally function in proxy methods.
2008-08-30 11:25:22 +02:00
Alexandre Julliard
29e20b869c
widl: Replace write_name() by get_name() to make the code more readable.
2008-08-30 11:15:04 +02:00
Rob Shearman
6f2687a389
widl: Raise RPC_X_SS_IN_NULL_CONTEXT exception for NULL in-only context handles instead of RPC_X_NULL_REF_PTR.
...
Based on a patch by Michael Martin.
2008-08-27 13:21:21 +02:00
Alexandre Julliard
b3ec2e5f95
makefiles: Recurse into all directories for install-lib and install-dev too.
2008-08-25 14:27:03 +02:00
Dan Hipschman
790e6dcd29
widl: Honor typedef pointer attributes.
2008-08-18 14:34:10 +02:00
Alexandre Julliard
28a2179dd6
Add noinput directive to all lex files to avoid a compiler warning.
2008-07-07 12:31:33 +02:00
Alexandre Julliard
c0ebae42f1
widl: Fix a couple of uninitialized variable compiler warnings.
2008-07-07 12:16:51 +02:00
Rob Shearman
90d633cdd1
widl: Remove some unnecessary calls to duptype.
2008-07-07 12:11:23 +02:00
Rob Shearman
ed0c013849
widl: Rename find_type_helper, find_type and find_type2 to find_type, find_type_error and find_type_error2 respectively.
2008-07-07 12:11:23 +02:00
Alexandre Julliard
d6e76274d9
widl: Add support for exception handling in the generated proxy code.
2008-07-03 13:08:19 +02:00
Alexandre Julliard
900bc5697e
widl: Add support for exception handling in the generated server code.
2008-07-03 13:08:19 +02:00
Rob Shearman
d60dc3f88b
widl: Consolidate top-level parameter conformance/variance expression writing into a separate function.
...
Descend through as many pointer types as necessary to find the
fundamental type and determine whether it needs a top-level parameter
conformance/variance expression to be written.
Add support for writing top-level parameter conformance/variance
expressions for non-encapsulated unions.
2008-07-03 11:50:52 +02:00
Dan Hipschman
d87bc0520f
widl: Factor a small part of the grammar.
2008-07-02 11:41:31 +02:00
Dan Hipschman
6725c5d756
widl: Implement type redefinition checks.
...
This allows widl to catch type redefinitions and report an error, like MIDL.
However, this does a better job than MIDL since it also reports the location
of the originial definition, like GCC.
2008-07-02 11:40:50 +02:00
Rob Shearman
037fa861ab
widl: Check that the structure has been defined in check_remoting_args.
2008-07-02 11:38:50 +02:00
Rob Shearman
fb224429f7
widl: Increment the buffer offset by 8 for embedded pointers inside varying arrays in varying structures.
...
The 8 bytes are for the variance and offset and are added just before
the array, as seen in the marshalling code in rpcrt4. No offset needs
to be added for non-varying structures since the buffer mark is set
after the conformance in marshalled or unmarshalled.
2008-07-02 11:38:47 +02:00
Alexandre Julliard
e213ac9aca
widl: Add some support for unencapsulated unions that need a conformance descriptor.
2008-07-01 12:25:44 +02:00
Alexandre Julliard
6e9a6577c3
widl: [default] is an allowed attribute for union fields.
2008-06-26 21:10:32 +02:00
Rob Shearman
b2286fd45c
widl: Fix check_remoting_fields to enumerate the correct list of fields.
2008-06-24 11:48:15 +02:00
Rob Shearman
925a700574
widl: Fix type_memsize to follow aliases so that the correct size is calculated.
2008-06-24 11:48:11 +02:00
Rob Shearman
4997f1849b
widl: Fix the types of enums with the v1_enum attribute applied.
2008-06-24 11:48:03 +02:00
Rob Shearman
b3dde47ed7
widl: Fix crash in find_array_or_string_in_struct if the structure or union has no fields or cases.
2008-06-24 11:47:56 +02:00
Rob Shearman
ada3ca6f09
widl: Set the type of the type_t node constructured for dispinterfaces to RPC_FC_IP, like we do for interfaces.
2008-06-24 11:47:51 +02:00
Rob Shearman
50e54c0c15
widl: Factor out the finding of a registered type to reduce code duplication.
2008-06-24 11:47:46 +02:00
Rob Shearman
28a9b94afc
widl: Fix the embedded pointer offsets in generated code when the containing structure has padding.
...
Do so by calculating the alignment of members when iterating through
the structures and adding it onto the buffer and memory offsets.
Only call type_memsize once elsewhere in the embedded pointer
processing functions since the return value will be the same from the
second call.
2008-06-23 19:25:53 +02:00
Rob Shearman
5f1de5a11d
widl: Replace code to round up values and calculate padding with macros to improve readability.
2008-06-23 19:25:38 +02:00
Rob Shearman
bb647c9b67
widl: Fix generation of the type format string for conformant-varying structures.
...
The conformance needs to be added on to the offset in the buffer so
set this before calling each the writer of each class of pointer
description in write_pointer_description.
Pass the passed in offsets to buffer and memory to
write_pointer_description_offsets in
write_varying_array_pointer_descriptions.
2008-06-21 11:13:04 +02:00
Simon Richter
b5614f763f
widl: Write string lengths in host endianness.
...
Type libraries are currently parsed in host endianness, so byte arrays
that are going to be interpreted as integers need to be written in the
appropriate byte order.
2008-06-18 15:21:48 +02:00
Marcus Meissner
1ff216c874
widl: Mark non-returning functions as noreturn.
2008-05-07 12:07:54 +02:00
Francois Gouget
633ee950a1
Assorted spelling fixes.
2008-05-07 12:07:11 +02:00
Francois Gouget
d2364d5d27
Add a comment warning when a table must be kept sorted for later use with bsearch().
2008-05-06 16:11:09 +02:00
Gerald Pfeifer
652602f5c8
widl: Fix syntax to also work with older versions of bison.
2008-05-02 16:05:48 +02:00
Rob Shearman
033cade616
widl: Consolidate writing of COM and dispatch interfaces into one function to remove duplicated code.
...
Split up the writing into start and end to eventually support the style
MIDL uses where it writes declared types, etc. between the start and end
of the interface.
Make internal header functions take the file pointer to print to.
Don't write interface IDs for non-object interfaces and always write
handle declarations even if the interface has no methods, like MIDL does.
2008-05-01 18:11:26 +02:00
Rob Shearman
e71219e66e
widl: Add the parsing of storage classes into declaration-specifiers.
...
Support the static and register keywords.
This consolidates externdef and constdef rules into one declaration rule.
2008-04-30 16:59:47 +02:00
Rob Shearman
d64e4c26ee
widl: Prepare for supporting storage classes in declaration statements.
...
Return a decl_spec_t structure from decl_spec rules so that the storage
class and type qualifiers can both be returned.
2008-04-30 16:59:30 +02:00
Rob Shearman
e35c79efbf
widl: callback, code, comm_status and in_line are attribute names, not keywords.
2008-04-30 11:32:08 +02:00
Rob Shearman
48153a8944
widl: Allow pointer attributes to be applied to function pointers.
2008-04-30 11:31:51 +02:00
Rob Shearman
017213e11a
widl: Make constdef and externdef take a declarator instead of an ident so that functions and arrays can be defined using the statements.
2008-04-30 11:31:47 +02:00
Rob Shearman
4f8f89e6bb
widl: Add support for "inline" on function definitions.
...
Fix applying calling convention to function type.
2008-04-30 11:31:21 +02:00
Rob Shearman
146ef11b77
widl: Keep const attributes applied to pointers when writing out the type.
...
Use an attribute to store the const qualifier for the pointer and type.
Allow multiple type-qualifiers to be applied to a type by adding a
declaration-specifier rule that encompasses type-qualifiers and types.
2008-04-30 11:30:55 +02:00
Rob Shearman
0cb73cef0b
widl: Accept integer constant suffixes in the lexer.
2008-04-28 13:28:16 +02:00
Rob Shearman
62a6475593
widl: Support hex digits that use an uppercase 0X prefix.
2008-04-28 13:28:16 +02:00
Rob Shearman
80be9df3a7
widl: Add typedefs to typelibs which have the public or uuid attributes, not any other attribute.
2008-04-28 13:28:16 +02:00
Rob Shearman
242a8a02f5
widl: Move the func_declarator rule entirely into direct_declarator.
2008-04-25 12:10:42 +02:00
Rob Shearman
66fa9a714e
widl: Create a statement object for import statements.
...
Move the writing of include directives into the generated header into
header.c.
2008-04-25 12:10:34 +02:00
Rob Shearman
33c891e694
widl: Add support for string literals and wide-string literals in expressions.
2008-04-25 12:10:24 +02:00
Rob Shearman
957dd4b160
widl: Add support for declaring multiple fields of a structure in one statement.
2008-04-25 12:10:15 +02:00
Rob Shearman
14dd441c5b
widl: Make the rules for parsing fields in structures, encapsulated unions and non-encapsulated unions more strict.
...
Move the rules in fields that handle empty union cases into separate
union rules so that they can't erroneously be accepted for structures or
other types of unions.
2008-04-25 12:10:04 +02:00
Rob Shearman
21cd6865c8
widl: Rename pident to declarator and parse the array declarations as part of declarators.
...
This allows arrays to be used in typedefs and const statements.
2008-04-25 12:09:56 +02:00
Rob Shearman
2f381f30a6
widl: Consolidate most of the inner loop of reg_typedefs into set_type.
2008-04-25 12:09:46 +02:00
Rob Shearman
1fcc2084e8
widl: Add typedef statements to the statement lists.
2008-04-24 22:32:47 +02:00
Rob Shearman
df0e38c067
widl: Create a list of statements in the whole IDL file, instead of just a list of interfaces.
2008-04-24 22:32:20 +02:00
Rob Shearman
58be89230e
widl: Allow NULL to be used in expressions.
2008-04-24 22:31:47 +02:00
Rob Shearman
ec81a78f01
widl: Construct the pointer chain while parsing pointers, rather than storing a ptr_level.
...
This method is more flexible and somewhat simpler.
2008-04-24 22:31:37 +02:00
Rob Shearman
02f5412a53
widl: Implement lcid property on library declarations.
2008-04-24 22:31:20 +02:00
Rob Shearman
1a0d28bf02
widl: Remove duplicated code in the form of the write_struct_expr function by enhancing write_expr to allow toplevel identifiers to be prefixed by a string, if specified.
2008-04-22 13:05:18 +02:00
Rob Shearman
39a1fa672a
widl: Use expr_resolve_type to get the type of the identifier in write_conf_or_var_desc.
...
Remove the conversion of pointer types into base types as this was only
needed due to lack of proper type resolving.
2008-04-22 13:05:04 +02:00
Rob Shearman
80ab2a7c6d
widl: Move expression functions to a new file, expr.c.
2008-04-22 13:04:58 +02:00
Rob Shearman
6244565df3
widl: Check that expressions resolve so that expressions in generated code will compile.
...
Also check that expressions return the correct type for the attribute.
2008-04-22 13:04:45 +02:00
Rob Shearman
b88d82a14b
widl: Pass the actual type into check_remoting_fields and check_field_common instead of the type name.
2008-04-22 13:04:31 +02:00
Rob Shearman
b81904b8ee
widl: Don't free input_name in pop_import as we keep pointers to it in the var_t type now.
2008-04-22 13:04:24 +02:00
Rob Shearman
95ac84e20b
widl: Remove EXPR_MEMBERPTR and implement it using EXPR_PPTR and EXPR_MEMBER instead.
2008-04-22 13:04:19 +02:00
Rob Shearman
cc3682cf12
widl: Add support for comparison, exclusive or, logical not and positive operators in expressions.
2008-04-22 13:04:03 +02:00
Rob Shearman
6f9020290b
widl: Require a constant expression for case statements.
2008-04-22 13:03:39 +02:00
Rob Shearman
b599d2596b
widl: Fix operator precedence in expressions.
2008-04-22 13:03:34 +02:00
Rob Shearman
ea9932557a
widl: Add support for '%' operator in expressions.
2008-04-21 13:36:19 +02:00
Rob Shearman
d27c7601e5
widl: Add support for arrays in expressions.
2008-04-21 13:36:19 +02:00
Rob Shearman
03d5017416
widl: Add support for "->" and "." operators in expressions.
2008-04-21 13:36:19 +02:00
Rob Shearman
efd10742ec
widl: Issue an error instead of crashing for dividing by zero in a constant expression.
2008-04-21 13:36:19 +02:00
Rob Shearman
c46fcfb356
widl: Automatically add "handle_t IDL_handle" parameter to functions with no explicit handle specified whose containing interface has the explicit_handle attribute.
2008-04-21 13:36:19 +02:00
Rob Shearman
c4ca32bbda
widl: The implicit_handle attribute is allowed with a handle explicitly specified in the function parameters.
...
In that case, that handle is used instead of the implicit handle.
Fix the check for the explicit_handle attribute being specified without
a handle being specified in the function parameters, even though issuing
an error is wrong. (Thanks to Marcus Meissner & Coverity for spotting
that the check didn't do what it was supposed to do.)
2008-04-21 13:36:19 +02:00
Rob Shearman
15612e60fd
widl: Check that fields in structures and unions referenced by non-local functions can be marshalled and that their attributes are consistent.
2008-04-21 13:36:19 +02:00
Rob Shearman
6e27e7840f
widl: Stop looping in check_remoting_args when a context_handle or wire_marshal type is found as they are in effect fundamental types.
2008-04-21 13:36:19 +02:00
Rob Shearman
4b56ff7238
widl: Change alls calls to error in the parser to error_loc so that line number information is printed.
2008-04-16 14:07:35 +02:00