On 11/05/2018 08:57 AM, Alexandre Julliard wrote:
Zebediah Figura z.figura12@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 ;-)
Sure, understandable; I'll send a v2 of this patch using that approach.
I'd like to find a cleaner method than either, but I'm hard-pressed to think of one. If anyone has any other ideas, please feel free to speak.
In the meantime I'll wait for other comments, to avoid sending ten revisions of a fourteen-patch series ;-)