Commit Graph

263 Commits

Author SHA1 Message Date
Alexandre Julliard 34613835a7 widl: Use ULONG_PTR instead of unsigned long for pointer casts in generated code. 2008-12-15 20:08:39 +01:00
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 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
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 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
Alexandre Julliard 29e20b869c widl: Replace write_name() by get_name() to make the code more readable. 2008-08-30 11:15:04 +02:00
Alexandre Julliard c0ebae42f1 widl: Fix a couple of uninitialized variable compiler warnings. 2008-07-07 12:16:51 +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
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
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 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 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
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 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 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 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 6a0c5a4fe9 widl: Store function and function pointer types completely within type_t type. 2008-04-02 19:53:09 +02:00
Rob Shearman a04b150839 widl: Add a function to get the return type of a parsed function.
This clarifies its use in code and makes it simpler to change the way 
functions are parsed into types.
2008-04-02 19:52:49 +02:00
Rob Shearman f8ea9ec163 widl: Make sure that string types are always written out by write_string_tfs and not write_simple_pointer.
This is because write_string_tfs has support for the full range of 
string types, write_simple_pointer doesn't have access to the var 
attributes which are needed to properly detect strings, and 
write_string_tfs sets the typestring offset to after the pointer is 
written and write_remoting_arg depends on this.
2008-03-27 17:33:09 +01:00
Rob Shearman f4a9619364 widl: Fix detection of non-pointer context handles.
is_ptr cannot be used because it follows the chain of types into the 
type which has the context_handle attribute, which is typically "void *" 
and so causes these context handles to be incorrectly detected as 
context handles. Instead, we can use is_aliaschain_ptr to follow the 
chain of aliases without following pointers and the absence of the 
context_handle attribute indicates that it must be present on a type 
after following a pointer.
2008-03-27 17:33:06 +01:00
Rob Shearman 8a0cb2b5c5 widl: Use is_string_type for detecting strings in write_typeformatstring_var to make it consistent with write_remoting_arg.
Fix the is_string_type function used for detecting strings by only 
examining aliases instead of both aliases and pointers. This is due to 
the requirement that pointers to strings be handled as pointers and so 
not detected as strings.
2008-03-27 17:32:58 +01:00
Dan Hipschman 2d7b1f18b1 widl: Allow is_string_type to work for typedef'd types. 2008-02-22 12:04:26 +01:00
Rob Shearman c233ba105e widl: Remove unused headers. 2008-02-15 11:06:21 +01:00
Rob Shearman 661b01f922 widl: Output code for initialising and freeing full pointer translation tables. 2008-02-04 11:49:13 +01:00
Rob Shearman 5af6012fba widl: Write out code for initialising out-only client context handles. 2008-01-21 11:39:13 +01:00
Austin English 90f89fa74d tools: Spelling fixes. 2008-01-18 12:52:09 +01:00
Rob Shearman a3040cea58 widl: Use symbolic names for some of the context handle attributes. 2008-01-07 21:33:53 +01:00
Rob Shearman 06ed169bc5 widl: Fix context handle "cannot be null" detection.
The "cannot be null" attibute is applied to a parameter if and only if 
it is in-only.
2008-01-07 21:33:50 +01:00
Rob Shearman e998892a23 widl: Fix the conditions under which array freeing code is output.
It doesn't matter whether or not the array is declared as a pointer or 
is declared using array subscripts - the array is still allocated by the 
unmarshalling function and so needs to be freed.

Fix a typo that caused varying arrays never to be freed.

Fix another typo with the check for conformant arrays being performed 
twice, redundantly.
2008-01-07 12:37:08 +01:00
Rob Shearman 15af19c6ec widl: Add support for strict context handles. 2008-01-07 12:32:21 +01:00
Rob Shearman 807001441d widl: Output calls for the new versions of the marshalling and unmarshalling routines for server context handles.
This needs to be done to match the call to NdrContextHandleInitialize 
and because we default to using strict context handles.
2008-01-07 12:32:00 +01:00
Rob Shearman 13f9c71960 widl: Make the offset of conformant string types point to the start of the conformant string format chars, not the pointer type.
Otherwise, writing a type at top-level could cause the pointer format 
string to be used in non-top-level places which may cause memory 
corruption during freeing.
2008-01-07 12:02:57 +01:00
Rob Shearman 9aaff94fb7 widl: Check that the buffer has enough space before unmarshalling base types in generated code. 2007-12-31 17:13:46 +01:00
Rob Shearman 6e7dcde26e widl: Add support for generating code for out-only context handles by calling NdrContextHandleInitialize. 2007-12-26 13:27:06 +01:00