Commit d9c12049 authored by Dan Hipschman's avatar Dan Hipschman Committed by Alexandre Julliard

widl: Handle pointers fields that point to structures.

parent faf50715
...@@ -126,6 +126,12 @@ s_ptypes_sum(ptypes_t *pt) ...@@ -126,6 +126,12 @@ s_ptypes_sum(ptypes_t *pt)
return *pt->pc + *pt->ps + *pt->pl + *pt->pf + *pt->pd; 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 void
s_stop(void) s_stop(void)
{ {
...@@ -167,6 +173,8 @@ basic_tests(void) ...@@ -167,6 +173,8 @@ basic_tests(void)
static char string[] = "I am a string"; static char string[] = "I am a string";
static int f[5] = {1, 3, 0, -2, -4}; static int f[5] = {1, 3, 0, -2, -4};
static vector_t a = {1, 3, 7}; 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; pints_t pints;
ptypes_t ptypes; ptypes_t ptypes;
int i1, i2, i3, *pi2, *pi3, **ppi3; int i1, i2, i3, *pi2, *pi3, **ppi3;
...@@ -231,6 +239,7 @@ basic_tests(void) ...@@ -231,6 +239,7 @@ basic_tests(void)
ptypes.pd = &u; ptypes.pd = &u;
ok(ptypes_sum(&ptypes) == 33.0, "RPC ptypes_sum\n"); 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"); ok(sum_fixed_array(f) == -2, "RPC sum_fixed_array\n");
} }
......
...@@ -47,6 +47,12 @@ interface IServer ...@@ -47,6 +47,12 @@ interface IServer
double *pd; double *pd;
} ptypes_t; } ptypes_t;
typedef struct
{
vector_t *pu;
vector_t **pv;
} pvectors_t;
int int_return(void); int int_return(void);
int square(int x); int square(int x);
int sum(int x, int y); int sum(int x, int y);
...@@ -60,5 +66,6 @@ interface IServer ...@@ -60,5 +66,6 @@ interface IServer
int sum_fixed_array(int a[5]); int sum_fixed_array(int a[5]);
int pints_sum(pints_t *pints); int pints_sum(pints_t *pints);
double ptypes_sum(ptypes_t *ptypes); double ptypes_sum(ptypes_t *ptypes);
int dot_pvectors(pvectors_t *pvectors);
void stop(void); void stop(void);
} }
...@@ -675,8 +675,10 @@ static size_t write_nonsimple_pointer(FILE *file, const type_t *type, size_t off ...@@ -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 absoff = type->ref->typestring_offset;
short reloff = absoff - (offset + 2); short reloff = absoff - (offset + 2);
print_file(file, 2, "0x%02x, 0x10,\t/* %s */\n", int ptr_attr = is_ptr(type->ref) ? 0x10 : 0x0;
type->type, string_of_type(type->type));
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", print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%hd) */\n",
reloff, reloff, absoff); reloff, reloff, absoff);
return 4; return 4;
...@@ -1207,6 +1209,7 @@ static size_t write_struct_tfs(FILE *file, type_t *type, ...@@ -1207,6 +1209,7 @@ static size_t write_struct_tfs(FILE *file, type_t *type,
write_pointers(file, NULL, type, NULL, 0, typestring_offset); write_pointers(file, NULL, type, NULL, 0, typestring_offset);
start_offset = *typestring_offset; start_offset = *typestring_offset;
type->typestring_offset = start_offset;
if (type->type == RPC_FC_STRUCT) if (type->type == RPC_FC_STRUCT)
WRITE_FCTYPE(file, FC_STRUCT, *typestring_offset); WRITE_FCTYPE(file, FC_STRUCT, *typestring_offset);
else else
...@@ -1249,6 +1252,7 @@ static size_t write_struct_tfs(FILE *file, type_t *type, ...@@ -1249,6 +1252,7 @@ static size_t write_struct_tfs(FILE *file, type_t *type,
write_pointers(file, NULL, type, NULL, 0, typestring_offset); write_pointers(file, NULL, type, NULL, 0, typestring_offset);
start_offset = *typestring_offset; start_offset = *typestring_offset;
type->typestring_offset = start_offset;
if (type->type == RPC_FC_CSTRUCT) if (type->type == RPC_FC_CSTRUCT)
WRITE_FCTYPE(file, FC_CSTRUCT, *typestring_offset); WRITE_FCTYPE(file, FC_CSTRUCT, *typestring_offset);
else else
...@@ -1300,6 +1304,7 @@ static size_t write_struct_tfs(FILE *file, type_t *type, ...@@ -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); has_pointers = write_pointers(file, NULL, type, NULL, 0, typestring_offset);
start_offset = *typestring_offset; start_offset = *typestring_offset;
type->typestring_offset = start_offset;
WRITE_FCTYPE(file, FC_CVSTRUCT, *typestring_offset); WRITE_FCTYPE(file, FC_CVSTRUCT, *typestring_offset);
/* alignment */ /* alignment */
print_file(file, 2, "0x%02x,\n", align - 1); print_file(file, 2, "0x%02x,\n", align - 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment