widl: Handle pointers fields that point to structures.
This commit is contained in:
parent
faf5071549
commit
d9c120490f
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue