[3/4] widl: Represent arrays with type_t

Dan Hipschman dsh at linux.ucla.edu
Tue Jun 5 20:50:31 CDT 2007


This patch is almost the same as before, except with the get_name stuff
taken out and put in the preceding patch.  Also, I fixed two or three
little whitespace mishaps, print the generated headers slightly nicer,
and I chose a better name (declarray instead of array to indicate that
a type was declared with [] syntax).

Basically this patch changes the representation of arrays so they are
represented by the type_t structure, and can therefore be handled
generally, just as any other type.  It requires splitting the
write_type function (which outputs the C representation) into
write_type_left and write_type_right functions, because C syntax for
declaring variables is painful, but I kept write_type around and it
takes a format string which will be written where the variable name
should, so it's really not much different in most cases.  You might
notice I use write_type_left in a few places without a
write_type_right.  This is not a mistake, I do this for function
return types, which cannot be arrays and hence don't need
write_type_right.  If function signatures were represented as types
(which they should be, but it's not important at this time), or if the
parser actually understood and could create pointers to arrays and
things like that, then outputting types would require slightly more
work, but until then this works fine.

It also sticks the size_is and length_is info in with the type_t, again
instead of with var_t, which makes everything simpler.  It figures out
the type of the array up front, in the parser, so the functions that
handle all the types later on don't have to worry about it, and there's
no need to duplicate code that figures it out.

This gets fixed multidimensional working, as well as conformant and
varying arrays.  The tests pass on XP and wine with this patch.  The
patch is gzipped and attached.

---
 dlls/rpcrt4/tests/server.c   |   84 +++++-
 dlls/rpcrt4/tests/server.idl |    4 +
 tools/widl/client.c          |    7 +-
 tools/widl/header.c          |  122 ++++-----
 tools/widl/header.h          |   19 +-
 tools/widl/parser.y          |  162 +++++++++--
 tools/widl/proxy.c           |    6 +-
 tools/widl/server.c          |    2 +-
 tools/widl/typegen.c         |  667 ++++++++++++++++--------------------------
 tools/widl/typegen.h         |    1 +
 tools/widl/typelib.c         |   18 ++
 tools/widl/widltypes.h       |    5 +-
 tools/widl/write_msft.c      |   79 +++---
 13 files changed, 612 insertions(+), 564 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Represent-arrays-as-type_t.patch.gz
Type: application/octet-stream
Size: 15727 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20070605/56e87938/0003-Represent-arrays-as-type_t.patch-0001.obj


More information about the wine-patches mailing list