Commit Graph

308 Commits

Author SHA1 Message Date
Rob Shearman d38cc9acbc widl: Initialise ref pointers to basic and enum types to 0 in generated server code.
Previously it was only done for pointers.
2009-03-23 14:23:19 +01:00
Rob Shearman 48a5db074b widl: Output correct code for freeing of conformant-sized and non-conformant strings.
_StubMsg.pfnFree should be used instead of NdrPointerFree for
conformant-sized strings since the buffer will have been allocated
using NdrAllocate.

Non-conformant strings do not need any freeing since they use a buffer
that is allocated on the stack.
2009-03-23 14:22:41 +01:00
Rob Shearman 8cdda26897 widl: Returned pointers should default to being unique, not reference. 2009-03-11 10:29:20 +01:00
Rob Shearman 728a738a82 widl: Move type_basic_get_fc to typegen.c and rename it to get_basic_fc.
Move to using type_basic_get_type in other files where appropriate.
2009-03-09 12:14:35 +01:00
Rob Shearman 630b48941f widl: Fix a memory leak in the server/stub code when unmarshalling pointers to strings at the top level.
It is necessary for the first pointer to have an offset to a second
pointer instead of directly to the string type, since the second
pointer frees the memory for the string.
2009-03-09 12:13:53 +01:00
Rob Shearman f170f9b5d5 widl: Output server code for freeing returned types. 2009-03-09 12:12:57 +01:00
Rob Shearman 23673ca373 widl: Determine pointer fc at generation time instead of at parse time.
Avoid changing the details of a pointer once created.
Properly determine the pointer type for arrays.
2009-03-09 12:09:39 +01:00
Rob Shearman f8e36ab4ab widl: Consolidate non-simple pointer writing into one function. 2009-03-09 12:08:57 +01:00
Rob Shearman a8238dd142 widl: Pass var attrs into write_no_repeat_pointer_descriptions and use them for the string check. 2009-03-05 18:39:02 +01:00
Rob Shearman 277e0617d5 widl: Store the abstract identifier of the type in type object instead of an NDR format character. 2009-03-05 18:39:02 +01:00
Rob Shearman 7e08ff27c2 widl: Move declarray property to array_details.
Invert the property since an array being declared as a pointer is more
surprising than an array being declared as an array.

Provide an accessor, type_array_is_decl_as_ptr.
2009-03-05 16:34:00 +01:00
Rob Shearman 2c6e611c8a widl: Add typegen_detect_type and use it.
Add typegen_detect_type for detecting types useful during
client/server/proxy code generation.
2009-02-23 15:25:57 +01:00
Rob Shearman af0800729b widl: Use type_get_type to determine the types of types during C client, server and proxy code generation. 2009-02-23 15:25:53 +01:00
Rob Shearman fb934347b4 widl: Use type_get_type to determine the types during statement enumeration. 2009-02-23 15:25:20 +01:00
Rob Shearman 944f22db80 widl: Fix typos in write_remoting_arg which caused ref pointers to unions to not result in direct calls to NonEncapsulatedUnion/EncapsulatedUnion functions. 2009-02-19 12:51:40 +01:00
Rob Shearman 04484a4013 widl: Call Pointer function for freeing non-conformant strings and for all phases for returned non-conformant strings, as is done for conformant strings.
Also call Pointer functions for any string that isn't a reference pointer.
2009-02-16 15:35:14 +01:00
Rob Shearman e054c52cd1 widl: Call Struct and Union phase functions for reference pointers to structures and unions.
It's slightly quicker than calling pointer phase functions and does
the same job.
2009-02-16 15:35:14 +01:00
Rob Shearman 47c82ac472 widl: Fix marshalling/unmarshalling of enum arguments.
The generated code should use NdrSimpleType{Marshall,Unmarshall} instead
of direct buffer access, since the memory size isn't always equal to
the size on the wire and extra checks.
2009-02-16 15:35:14 +01:00
Alexandre Julliard 20e4cb98a7 widl: Change write_type_def_or_decl and write_type_decl to take an argument name instead of a printf format. 2009-02-10 12:32:36 +01:00
Alexandre Julliard 25624b677d widl: Print all NdrFcShort parameters as shorts to avoid warnings for negative values. 2009-02-06 14:54:03 +01:00
Alexandre Julliard fcc096083f widl: Add printf format attribute on all printf-like functions and fix resulting warnings. 2009-02-06 14:54:03 +01:00
Alexandre Julliard ef6971da40 widl: Replace unsigned long and size_t by unsigned int where appropriate. 2009-02-06 14:54:03 +01:00
Alexandre Julliard 844c8a1804 widl: Add a dummy reference to the filter function to avoid a warning. 2009-02-06 14:54:02 +01:00
Alexandre Julliard a0fb6246c0 widl: Avoid using GetExceptionCode outside of an exception handler. 2009-02-06 14:54:02 +01:00
Alexandre Julliard d02f9d1804 widl: We need an offset after the correlation descriptor for unencapsulated unions. 2009-01-23 16:47:51 +01:00
Rob Shearman bdb1321544 widl: Add a new function, type_alias_get_aliasee to wrap the retrieval of the type that the alias aliases. 2009-01-19 13:36:26 +01:00
Michael Karcher f80e4aa9d2 widl: Don't forget conformance info on [iid_is] void pointers. 2009-01-12 16:53:18 +01:00
Michael Stefaniuc 9192297345 widl: Move "inline" right after the storage class specifier. 2009-01-10 17:43:11 +01:00
Michael Karcher 656de48e4e widl: Write struct fields as signed fields. 2009-01-08 14:11:35 +01:00
Michael Karcher 5f7886925d widl: Make write_base_type take a format char instead of a type desc ptr. 2009-01-08 14:05:00 +01:00
Rob Shearman 77228b52e6 widl: Determine the type of an array entirely at code generation time instead of at parse time.
Previously, this was done partially (for fixed array types only).
2009-01-07 12:27:14 +01:00
Rob Shearman 8a976a7d78 widl: Replace uses of get_func_return_type with type_function_get_rettype.
Also replace direct accesses into the type structure to get the return
type of a function with the same function.
2009-01-06 14:36:25 +01:00
Rob Shearman 9b139018cf widl: Add new function, type_iface_get_stmts.
Use it to retrieve statements contained in interface types.
2009-01-06 12:58:41 +01:00
Rob Shearman 67ac03ae4e widl: Add a new function, type_pointer_get_ref.
Use it for retrieving the type that a pointer refers to.
2009-01-06 12:58:25 +01:00
Rob Shearman 2b87d269e1 widl: Add a new function, type_array_get_element.
Use it whenever retrieving the element type of an array.
2009-01-06 12:58:13 +01:00
Rob Shearman cb8d3322be widl: Add new type_is_alias and type_get_real_type helper functions.
Use type_is_alias to replace cumbersome "type->kind == TKIND_ALIAS" expressions.
Use type_get_real_type to simplify some code.
2009-01-06 12:56:51 +01:00
Rob Shearman 200ec53835 widl: Access array type properties through accessors instead of getting them directly.
Store array type properties in the details union to save a bit of
memory and to make the general properties more obvious.
2009-01-06 12:56:33 +01:00
Rob Shearman 901a42b7f9 widl: Move funcs and stmts fields from type_t structure to module_details and function_details. 2009-01-06 12:56:15 +01:00
Rob Shearman 10a422ae14 widl: Use is_string_type instead of is_attr(..., ATTR_STRING) for detecting strings.
Detecting strings is a bit harder than just looking for the string
attribute, so make sure to use the function which has the purpose of
doing just that.

Fixes compilation of generated server/proxy code when a parameter has
both the [out] and [string] attributes.
2009-01-02 14:27:43 +01:00
Rob Shearman 36c03f6a94 widl: Remove duplicate pointer handling code in get_struct_type.
Only make the structure complex if there is an interface pointer, not
if there is a pointer to a union or complex struct since these are
handled perfectly well by the pointer marshalling code.

Fix the detection of structures with ref-pointers or pointers in 64-bit code.
2008-12-31 12:35:49 +01:00
Rob Shearman 04a22cc412 widl: Hide the details of where arguments, fields, values and cases are stored in the type_t structure for functions, structures, enums and unions. 2008-12-29 14:42:47 +01:00
Rob Shearman 2e0aefc1fd widl: Structures and arrays with pointers should be complex when generating code for 64-bit platforms.
The non-complex variants depend on the wire size of the
structure/array matching the buffer size, but this no longer applies
when pointers are 8 bytes instead of 4.
2008-12-27 20:23:19 +01:00
Alexandre Julliard 53626dbd93 widl: Add support for generating 32-bit and/or 64-bit code for proxies/clients/servers. 2008-12-26 17:22:25 +01:00
Alexandre Julliard 9ca1382eae widl: Store the size of a pointer in a variable instead of hardcoding the value of the host compiler. 2008-12-26 17:20:53 +01:00
Alexandre Julliard a011f0cd5b widl: Move determination of the exact type of structures and array to the code generation phase.
The exact type can depend on the size of the type in memory, and that
can vary depending on whether we are generating 32-bit or 64-bit code.
2008-12-26 17:16:06 +01:00
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