On Wed, Jan 19, 2005 at 09:50:09PM +0000, Luke Kenneth Casson Leighton wrote:
sorry: _i_ copy the file to that location, _you_ get to see it at:
http://hands.com/~lkcl/test_cstub.cxx
- dceidl is fussy about switch_type on nonencapsulated unions.
i.e. i had to add one: switch_type(short) - see 4) as to why i picked short not char - and then had to change all uses of an argument as the switch type to short.
typedef [switch_type(short)] union NonEncapsulated { [case(1)] char ch; [case(2)] short s; [case(4)] long l; [case(5)] FakeString str; } NonEncapsulated;
void NonEncapsulatedUnionIn([in] short type, [in, switch_is(type)] union NonEncapsulated * u);
- case statements where the switch variable is a char i
couldn't be bothered to find a way to let it be happy with case(1) it was bitching about 1 not being a char so i converted to a short and it stopped bitching.
postscript:
16) i enabled the "expressioning" stuff and got this:
lkcl@highfield:~/src/wine-test/dcom-test/RpcTest$ /opt/dce/bin/dceidl test.idl Warning: Semantic checking prevented by other reported errors idl: File test.idl, line 99: void SubOneConformanceArrayIn([in] long size, [in, length_is(size-1)] unsigned char Array[10]); idl: Syntax error near "-1" Syntax error in attribute list idl: File test.idl, line 100: void CallbackConformanceArrayIn([in] long size, [in, length_is(size*2+1)] unsigned char Array[10]); Only simple expressions allowed for now
so... that sort-of tells me that although wez and i worked on and successfully completed size/2, size*2, size+1, things like size-1 cause a syntax error but "size - 1" work, but size*2+1 we _haven't_ added because it's a bit of a lairy nightmare.
... hm, i'm _sure_ i've seen (size+7)&~0x7 work.
i think, basically, that we added things that "have been encountered" rather than going "the whole hog".
this is also what is supported by MIDL in their "type format strings" as you call them, rob. if you look closely at matty's "muddle" compiler it supports the MIDL 2-operator "thing" and also makes it clear that if it gets any more complex than that, an external function is called to "deal with it".
so MS did their best on this, basically.
wez and i at least made a start - enough to support dcom.idl's size_is(size+7)&~0x7 and lsarpc.idl and samr.idl's UNICODE_STRING which uses size_t size, [string, length_is(size/2] WCHAR *string.
17) i enabled the #if 0 to #if 1 around the transmit_as stuff.
i think you'll be impressed - dceidl doesn't complain! i couldn't tell you what transmit_as _is_ but it looks hopeful :)
all the things 1-16 are not insurmountable problems - they've just not been necessary for the tasks to which dceidl has been put.
... shall i carry on? :)
l.