Module: wine Branch: master Commit: d9c120490fbea62f5696ed99c7f4d8390f9dfef4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d9c120490fbea62f5696ed99c7...
Author: Dan Hipschman dsh@linux.ucla.edu Date: Fri May 11 17:27:40 2007 -0700
widl: Handle pointers fields that point to structures.
---
dlls/rpcrt4/tests/server.c | 9 +++++++++ dlls/rpcrt4/tests/server.idl | 7 +++++++ tools/widl/typegen.c | 9 +++++++-- 3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index 0086b97..8fd107b 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -126,6 +126,12 @@ s_ptypes_sum(ptypes_t *pt) return *pt->pc + *pt->ps + *pt->pl + *pt->pf + *pt->pd; }
+int +s_dot_pvectors(pvectors_t *p) +{ + return p->pu->x * (*p->pv)->x + p->pu->y * (*p->pv)->y + p->pu->z * (*p->pv)->z; +} + void s_stop(void) { @@ -167,6 +173,8 @@ basic_tests(void) static char string[] = "I am a string"; static int f[5] = {1, 3, 0, -2, -4}; static vector_t a = {1, 3, 7}; + static vector_t vec1 = {4, -2, 1}, vec2 = {-5, 2, 3}, *pvec2 = &vec2; + static pvectors_t pvecs = {&vec1, &pvec2}; pints_t pints; ptypes_t ptypes; int i1, i2, i3, *pi2, *pi3, **ppi3; @@ -231,6 +239,7 @@ basic_tests(void) ptypes.pd = &u; ok(ptypes_sum(&ptypes) == 33.0, "RPC ptypes_sum\n");
+ ok(dot_pvectors(&pvecs) == -21, "RPC dot_pvectors\n"); ok(sum_fixed_array(f) == -2, "RPC sum_fixed_array\n"); }
diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl index 4830e8c..e087f1e 100644 --- a/dlls/rpcrt4/tests/server.idl +++ b/dlls/rpcrt4/tests/server.idl @@ -47,6 +47,12 @@ interface IServer double *pd; } ptypes_t;
+ typedef struct + { + vector_t *pu; + vector_t **pv; + } pvectors_t; + int int_return(void); int square(int x); int sum(int x, int y); @@ -60,5 +66,6 @@ interface IServer int sum_fixed_array(int a[5]); int pints_sum(pints_t *pints); double ptypes_sum(ptypes_t *ptypes); + int dot_pvectors(pvectors_t *pvectors); void stop(void); } diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 3bd133b..d2597b3 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -675,8 +675,10 @@ static size_t write_nonsimple_pointer(FILE *file, const type_t *type, size_t off { short absoff = type->ref->typestring_offset; short reloff = absoff - (offset + 2); - print_file(file, 2, "0x%02x, 0x10,\t/* %s */\n", - type->type, string_of_type(type->type)); + int ptr_attr = is_ptr(type->ref) ? 0x10 : 0x0; + + print_file(file, 2, "0x%02x, 0x%x,\t/* %s */\n", + type->type, ptr_attr, string_of_type(type->type)); print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%hd) */\n", reloff, reloff, absoff); return 4; @@ -1207,6 +1209,7 @@ static size_t write_struct_tfs(FILE *file, type_t *type, write_pointers(file, NULL, type, NULL, 0, typestring_offset);
start_offset = *typestring_offset; + type->typestring_offset = start_offset; if (type->type == RPC_FC_STRUCT) WRITE_FCTYPE(file, FC_STRUCT, *typestring_offset); else @@ -1249,6 +1252,7 @@ static size_t write_struct_tfs(FILE *file, type_t *type, write_pointers(file, NULL, type, NULL, 0, typestring_offset);
start_offset = *typestring_offset; + type->typestring_offset = start_offset; if (type->type == RPC_FC_CSTRUCT) WRITE_FCTYPE(file, FC_CSTRUCT, *typestring_offset); else @@ -1300,6 +1304,7 @@ static size_t write_struct_tfs(FILE *file, type_t *type, has_pointers = write_pointers(file, NULL, type, NULL, 0, typestring_offset);
start_offset = *typestring_offset; + type->typestring_offset = start_offset; WRITE_FCTYPE(file, FC_CVSTRUCT, *typestring_offset); /* alignment */ print_file(file, 2, "0x%02x,\n", align - 1);