[PATCH 10/14] rpcrt4: Write type format strings for Automation types.

Alexandre Julliard julliard at winehq.org
Mon Nov 5 08:57:34 CST 2018


Zebediah Figura <z.figura12 at gmail.com> writes:

> On 11/5/18 4:12 AM, Huw Davies wrote:
>> On Sat, Nov 03, 2018 at 06:07:22PM -0500, Zebediah Figura wrote:
>>> +ndr_typelib_generated.c: $(WIDL)
>>> +	echo > ndr_typelib_generated.c '/* Automatically generated from Makefile.in, do not edit */' && \
>>> +	echo >> ndr_typelib_generated.c '#include "oaidl.h"' && \
>>> +	echo >> ndr_typelib_generated.c '#include "rpcproxy.h"' && \
>>> +	echo > ndr_typelib_generated.idl 'import "oaidl.idl"; [object] interface dummy {void dummy(BSTR a, IUnknown *b, IDispatch *c, VARIANT d, LPSAFEARRAY e); }' && \
>>> +	$(WIDL) $(WIDLFLAGS) -I $(top_srcdir)/include -p -o ndr_typelib_generated_p.c ndr_typelib_generated.idl && \
>>> +	echo >> ndr_typelib_generated.c 'const unsigned char oleaut_tfs[] = {' && \
>>> +	awk '/__MIDL_TypeFormatString =/,/};/' ndr_typelib_generated_p.c | head -n -2 | tail -n +5 >> ndr_typelib_generated.c && \
>>> +	echo >> ndr_typelib_generated.c '};' && \
>>> +	sed -n -e 's/#define TYPE_FORMAT_STRING_SIZE \([0-9]\+\)/const size_t oleaut_tfs_size = \1;/p' ndr_typelib_generated_p.c >> ndr_typelib_generated.c && \
>>> +	echo >> ndr_typelib_generated.c 'const unsigned short oleaut_offsets[] = {' && \
>>> +	sed -n -e 's/.*&__MIDL_TypeFormatString.Format\[\([0-9]\+\)\].*/    \1,/p' ndr_typelib_generated_p.c | head -n 5 >> ndr_typelib_generated.c && \
>>> +	echo >> ndr_typelib_generated.c '};' && \
>>> +	echo >> ndr_typelib_generated.c 'const USER_MARSHAL_ROUTINE_QUADRUPLE oleaut_user_marshal[] = ' && \
>>> +	awk '/UserMarshalRoutines\[\] =/,/};/' ndr_typelib_generated_p.c | tail -n +2 >> ndr_typelib_generated.c && \
>>> +	rm ndr_typelib_generated_p.c ndr_typelib_generated.idl
>>
>> Did you consider adding a magic option to widl that would generate
>> this table?  IMHO, that would be much cleaner than this hack.
>>
>> FWIW, "head -n -num" isn't supported by macOS's native head.
>
> I believe I proposed it to Alexandre in an earlier conversation, and
> he seemed less than enthused, but I'll wait for his comment now that
> I've submitted the code.

A magic option is not great, but it would certainly be better than that
ugly command sequence ;-)

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list