mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
Support in-pointers to structs.
svn path=/trunk/; revision=14628
This commit is contained in:
parent
fc68dda45d
commit
9a53101c31
5 changed files with 1099 additions and 403 deletions
|
@ -1,5 +1,13 @@
|
|||
ChangeLog
|
||||
|
||||
2005-04-15 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/parser.y
|
||||
tools/widl/server.c
|
||||
|
||||
Support in-pointers to structs.
|
||||
|
||||
2005-04-03 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
|
|
|
@ -75,6 +75,65 @@ get_base_type(unsigned char type)
|
|||
}
|
||||
|
||||
|
||||
static int get_type_size(type_t *type, int alignment)
|
||||
{
|
||||
int size;
|
||||
var_t *field;
|
||||
|
||||
switch(type->type)
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
size = ((size + alignment - 1) & ~(alignment -1));
|
||||
break;
|
||||
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
size = ((size + alignment - 1) & ~(alignment -1));
|
||||
break;
|
||||
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
size = ((size + alignment - 1) & ~(alignment -1));
|
||||
break;
|
||||
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
size = ((size + alignment - 1) & ~(alignment -1));
|
||||
break;
|
||||
|
||||
case RPC_FC_IGNORE:
|
||||
size = 0;
|
||||
break;
|
||||
|
||||
case RPC_FC_STRUCT:
|
||||
field = type->fields;
|
||||
size = 0;
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
size += get_type_size(field->type, alignment);
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, type->type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
static void write_procformatstring(type_t *iface)
|
||||
{
|
||||
func_t *func = iface->funcs;
|
||||
|
@ -113,8 +172,39 @@ static void write_procformatstring(type_t *iface)
|
|||
print_client("0x4e, /* FC_IN_PARAM_BASETYPE */\n");
|
||||
print_client("0x%02x, /* FC_<type> */\n", get_base_type(var->type->type));
|
||||
}
|
||||
else if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
var_t *field = var->type->ref->ref->fields;
|
||||
int size;
|
||||
|
||||
if (in_attr & !out_attr)
|
||||
print_client("0x4d, /* FC_IN_PARAM */\n");
|
||||
else if (!in_attr & out_attr)
|
||||
print_client("0x51, /* FC_OUT_PARAM */\n");
|
||||
else if (in_attr & out_attr)
|
||||
print_client("0x50, /* FC_IN_OUT_PARAM */\n");
|
||||
fprintf(client, "#ifndef _ALPHA_\n");
|
||||
print_client("0x01,\n");
|
||||
fprintf(client, "#else\n");
|
||||
print_client("0x02,\n");
|
||||
fprintf(client, "#endif\n");
|
||||
print_client("NdrFcShort(0x%x),\n", type_offset);
|
||||
|
||||
size = 9;
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
size++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (size % 2)
|
||||
size++;
|
||||
type_offset += size;
|
||||
}
|
||||
else
|
||||
{
|
||||
print_client("0x4d, /* FC_IN_PARAM */\n");
|
||||
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
|
@ -122,8 +212,8 @@ static void write_procformatstring(type_t *iface)
|
|||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
if (is_base_type(var->type))
|
||||
{
|
||||
// if (is_base_type(var->type))
|
||||
// {
|
||||
if (in_attr & !out_attr)
|
||||
print_client("0x4d, /* FC_IN_PARAM */\n");
|
||||
else if (!in_attr & out_attr)
|
||||
|
@ -137,13 +227,19 @@ static void write_procformatstring(type_t *iface)
|
|||
fprintf(client, "#endif\n");
|
||||
print_client("NdrFcShort(0x%x),\n", type_offset);
|
||||
type_offset += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
// __FUNCTION__,__LINE__, var->type->type);
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
error("%s:%d Pointer level %d is not supported!\n",
|
||||
__FUNCTION__,__LINE__, var->ptr_level);
|
||||
return;
|
||||
}
|
||||
|
||||
var = PREV_LINK(var);
|
||||
|
@ -185,7 +281,7 @@ static void write_typeformatstring(type_t *iface)
|
|||
{
|
||||
func_t *func = iface->funcs;
|
||||
var_t *var;
|
||||
int out_attr;
|
||||
int in_attr, out_attr;
|
||||
int string_attr;
|
||||
int ptr_attr, ref_attr, unique_attr;
|
||||
|
||||
|
@ -195,7 +291,7 @@ static void write_typeformatstring(type_t *iface)
|
|||
print_client("0,\n");
|
||||
print_client("{\n");
|
||||
indent++;
|
||||
print_client("NdrFcShort(0x0),\n");
|
||||
print_client("NdrFcShort(0x00),\n");
|
||||
|
||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||
while (func)
|
||||
|
@ -206,6 +302,7 @@ static void write_typeformatstring(type_t *iface)
|
|||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
in_attr = is_attr(var->attrs, ATTR_IN);
|
||||
out_attr = is_attr(var->attrs, ATTR_OUT);
|
||||
string_attr = is_attr(var->attrs, ATTR_STRING);
|
||||
|
||||
|
@ -216,7 +313,50 @@ static void write_typeformatstring(type_t *iface)
|
|||
return;
|
||||
}
|
||||
|
||||
if (var->ptr_level == 1)
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
if (!is_base_type(var->type))
|
||||
{
|
||||
if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
var_t *field;
|
||||
int tsize = 9;
|
||||
unsigned char flags = 0;
|
||||
|
||||
if (!in_attr && out_attr)
|
||||
flags |= RPC_FC_P_ONSTACK;
|
||||
|
||||
print_client("0x11, 0x%02X, /* FC_RP, [flags] */\n", flags);
|
||||
print_client("NdrFcShort(0x%02X),\n", 0x02);
|
||||
print_client("0x%02X,\n", var->type->ref->ref->type);
|
||||
print_client("0x%02X,\n", 3); /* alignment -1 */
|
||||
print_client("NdrFcShort(0x%02X),\n", get_type_size(var->type->ref->ref, 4));
|
||||
|
||||
field = var->type->ref->ref->fields;
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
print_client("0x%02X,\n", get_base_type(field->type->type));
|
||||
tsize++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (tsize % 2)
|
||||
{
|
||||
print_client("0x5c, /* FC_PAD */\n");
|
||||
tsize++;
|
||||
}
|
||||
print_client("0x5b, /* FC_END */\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
ptr_attr = is_attr(var->attrs, ATTR_PTR);
|
||||
ref_attr = is_attr(var->attrs, ATTR_REF);
|
||||
|
@ -389,6 +529,17 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset)
|
|||
size = 0;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
printf("%s\n", __FUNCTION__);
|
||||
printf("ptr_level %d\n", var->ptr_level);
|
||||
printf("Type %p\n", var->type);
|
||||
printf("Type %x\n", var->type->type);
|
||||
printf("Type name: %s\n", var->type->name);
|
||||
printf("Tref %p\n", var->type->ref);
|
||||
printf("Tref->name %s\n", var->type->ref->name);
|
||||
printf("Tref->ref %p\n", var->type->ref->ref);
|
||||
return;
|
||||
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
|
@ -441,6 +592,12 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset)
|
|||
size = 0;
|
||||
break;
|
||||
|
||||
case RPC_FC_RP:
|
||||
case RPC_FC_UP:
|
||||
case RPC_FC_FP:
|
||||
size = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
|
@ -489,9 +646,24 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset)
|
|||
|
||||
if (in_attr)
|
||||
{
|
||||
if (var->ptr_level == 1 &&
|
||||
string_attr &&
|
||||
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
|
||||
if (var->ptr_level == 0 &&
|
||||
var->type->type == RPC_FC_RP)
|
||||
{
|
||||
if (var->type->ref->ref->type == RPC_FC_STRUCT)
|
||||
{
|
||||
print_client("NdrSimpleStructBufferSize(\n");
|
||||
indent++;
|
||||
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_client("(unsigned char __RPC_FAR *)%s,\n", var->name);
|
||||
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n",
|
||||
local_type_offset + 4);
|
||||
nothing_printed = 1;
|
||||
indent--;
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1 &&
|
||||
string_attr &&
|
||||
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
|
||||
{
|
||||
if (ptr_attr)
|
||||
{
|
||||
|
@ -523,7 +695,27 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset)
|
|||
}
|
||||
|
||||
/* calculate the next type offset */
|
||||
if (var->ptr_level == 1)
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
if ((var->type->type == RPC_FC_RP) &&
|
||||
(var->type->ref->ref->type == RPC_FC_STRUCT))
|
||||
{
|
||||
var_t *field = var->type->ref->ref->fields;
|
||||
int tsize = 9;
|
||||
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
tsize++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (tsize % 2)
|
||||
tsize++;
|
||||
|
||||
local_type_offset += tsize;
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
local_type_offset += 4;
|
||||
}
|
||||
|
@ -545,6 +737,7 @@ static void marshall_in_arguments(func_t *func, unsigned int *type_offset)
|
|||
int string_attr;
|
||||
int ptr_attr, ref_attr, unique_attr;
|
||||
var_t *var;
|
||||
unsigned int local_type_offset = *type_offset;
|
||||
|
||||
if (!func->args)
|
||||
return;
|
||||
|
@ -670,81 +863,118 @@ static void marshall_in_arguments(func_t *func, unsigned int *type_offset)
|
|||
}
|
||||
else
|
||||
{
|
||||
alignment = 0;
|
||||
switch (var->type->type)
|
||||
if (is_base_type(var->type))
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
alignment = 0;
|
||||
break;
|
||||
switch (var->type->type)
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
alignment = 0;
|
||||
break;
|
||||
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
if (last_size > 0 && last_size < 2)
|
||||
alignment = (2 - last_size);
|
||||
break;
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
if (last_size > 0 && last_size < 2)
|
||||
alignment = (2 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_IGNORE:
|
||||
size = 0;
|
||||
break;
|
||||
case RPC_FC_IGNORE:
|
||||
size = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (size != 0)
|
||||
{
|
||||
if (alignment != 0)
|
||||
print_client("_StubMsg.Buffer += %u;\n", alignment);
|
||||
|
||||
print_client("*((");
|
||||
write_type(client, var->type, NULL, var->tname);
|
||||
fprintf(client, " __RPC_FAR*)_StubMsg.Buffer) = ");
|
||||
if (var->ptr_level == 1)
|
||||
fprintf(client, "*");
|
||||
write_name(client, var);
|
||||
fprintf(client, ";\n");
|
||||
print_client("_StubMsg.Buffer += sizeof(");
|
||||
write_type(client, var->type, NULL, var->tname);
|
||||
fprintf(client, ");\n");
|
||||
fprintf(client, "\n");
|
||||
|
||||
last_size = size;
|
||||
}
|
||||
}
|
||||
|
||||
if (size != 0)
|
||||
else if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
if (alignment != 0)
|
||||
print_client("_StubMsg.Buffer += %u;\n", alignment);
|
||||
|
||||
print_client("*((");
|
||||
write_type(client, var->type, NULL, var->tname);
|
||||
fprintf(client, " __RPC_FAR*)_StubMsg.Buffer) = ");
|
||||
if (var->ptr_level == 1)
|
||||
fprintf(client, "*");
|
||||
write_name(client, var);
|
||||
fprintf(client, ";\n");
|
||||
print_client("_StubMsg.Buffer += sizeof(");
|
||||
write_type(client, var->type, NULL, var->tname);
|
||||
fprintf(client, ");\n");
|
||||
fprintf(client, "\n");
|
||||
|
||||
last_size = size;
|
||||
if (var->type->ref->ref->type == RPC_FC_STRUCT)
|
||||
{
|
||||
print_client("NdrSimpleStructMarshall(\n");
|
||||
indent++;
|
||||
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_client("(unsigned char __RPC_FAR *)%s,\n", var->name);
|
||||
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n",
|
||||
*type_offset + 4);
|
||||
indent--;
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* calculate the next type offset */
|
||||
if (var->ptr_level == 1)
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
*type_offset += 4;
|
||||
if ((var->type->type == RPC_FC_RP) &&
|
||||
(var->type->ref->ref->type == RPC_FC_STRUCT))
|
||||
{
|
||||
var_t *field = var->type->ref->ref->fields;
|
||||
int tsize = 9;
|
||||
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
tsize++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (tsize % 2)
|
||||
tsize++;
|
||||
|
||||
local_type_offset += tsize;
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
local_type_offset += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void unmarshall_out_arguments(func_t *func)
|
||||
static void unmarshall_out_arguments(func_t *func, unsigned int *type_offset)
|
||||
{
|
||||
unsigned int alignment;
|
||||
unsigned int size;
|
||||
|
@ -752,6 +982,7 @@ static void unmarshall_out_arguments(func_t *func)
|
|||
int out_attr;
|
||||
var_t *var;
|
||||
var_t *def;
|
||||
unsigned int local_type_offset = *type_offset;
|
||||
|
||||
def = func->def;
|
||||
|
||||
|
@ -763,79 +994,130 @@ static void unmarshall_out_arguments(func_t *func)
|
|||
for (; var; var = PREV_LINK(var))
|
||||
{
|
||||
out_attr = is_attr(var->attrs, ATTR_OUT);
|
||||
if (!out_attr)
|
||||
continue;
|
||||
|
||||
if (var->ptr_level > 1)
|
||||
if (out_attr)
|
||||
{
|
||||
error("Function '%s' argument '%s': Pointer level %d not supported!\n",
|
||||
func->def->name, var->name, var->ptr_level);
|
||||
return;
|
||||
}
|
||||
|
||||
alignment = 0;
|
||||
switch (var->type->type)
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
alignment = 0;
|
||||
break;
|
||||
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
if (last_size > 0 && last_size < 2)
|
||||
alignment = (2 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_IGNORE:
|
||||
size = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (size != 0)
|
||||
{
|
||||
if (var->ptr_level == 1)
|
||||
if (var->ptr_level > 1)
|
||||
{
|
||||
fprintf(client, "\n");
|
||||
if (alignment != 0)
|
||||
print_client("_StubMsg.Buffer += %u;\n", alignment);
|
||||
|
||||
print_client("*");
|
||||
write_name(client, var);
|
||||
fprintf(client, " = *((");
|
||||
write_type(client, var->type, NULL, var->tname);
|
||||
fprintf(client, " __RPC_FAR *)_StubMsg.Buffer);\n");
|
||||
|
||||
print_client("_StubMsg.Buffer += sizeof(");
|
||||
write_type(client, var->type, NULL, var->tname);
|
||||
fprintf(client, ");\n");
|
||||
error("Function '%s' argument '%s': Pointer level %d not supported!\n",
|
||||
func->def->name, var->name, var->ptr_level);
|
||||
return;
|
||||
}
|
||||
|
||||
last_size = size;
|
||||
if (is_base_type(var->type))
|
||||
{
|
||||
alignment = 0;
|
||||
switch (var->type->type)
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
alignment = 0;
|
||||
break;
|
||||
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
if (last_size > 0 && last_size < 2)
|
||||
alignment = (2 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_IGNORE:
|
||||
size = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (size != 0)
|
||||
{
|
||||
if (var->ptr_level == 1)
|
||||
{
|
||||
fprintf(client, "\n");
|
||||
if (alignment != 0)
|
||||
print_client("_StubMsg.Buffer += %u;\n", alignment);
|
||||
|
||||
print_client("*");
|
||||
write_name(client, var);
|
||||
fprintf(client, " = *((");
|
||||
write_type(client, var->type, NULL, var->tname);
|
||||
fprintf(client, " __RPC_FAR *)_StubMsg.Buffer);\n");
|
||||
|
||||
print_client("_StubMsg.Buffer += sizeof(");
|
||||
write_type(client, var->type, NULL, var->tname);
|
||||
fprintf(client, ");\n");
|
||||
}
|
||||
|
||||
last_size = size;
|
||||
}
|
||||
}
|
||||
else if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
if (var->type->ref->ref->type == RPC_FC_STRUCT)
|
||||
{
|
||||
fprintf(client, "\n");
|
||||
print_client("NdrSimpleStructUnmarshall(\n");
|
||||
indent++;
|
||||
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_client("(unsigned char __RPC_FAR * __RPC_FAR *)&%s,\n", var->name);
|
||||
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n",
|
||||
*type_offset + 4);
|
||||
print_client("(unsigned char)0);\n");
|
||||
indent--;
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* calculate the next type offset */
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
if ((var->type->type == RPC_FC_RP) &&
|
||||
(var->type->ref->ref->type == RPC_FC_STRUCT))
|
||||
{
|
||||
var_t *field = var->type->ref->ref->fields;
|
||||
int tsize = 9;
|
||||
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
tsize++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (tsize % 2)
|
||||
tsize++;
|
||||
|
||||
local_type_offset += tsize;
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
local_type_offset += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1102,7 +1384,42 @@ static void write_function_stubs(type_t *iface)
|
|||
indent -= 2;
|
||||
|
||||
/* unmarshal out arguments */
|
||||
unmarshall_out_arguments(func);
|
||||
unmarshall_out_arguments(func, &type_offset);
|
||||
}
|
||||
|
||||
/* update type_offset */
|
||||
if (func->args)
|
||||
{
|
||||
var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
if ((var->type->type == RPC_FC_RP) &&
|
||||
(var->type->ref->ref->type == RPC_FC_STRUCT))
|
||||
{
|
||||
var_t *field = var->type->ref->ref->fields;
|
||||
int tsize = 9;
|
||||
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
tsize++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (tsize % 2)
|
||||
tsize++;
|
||||
|
||||
type_offset += tsize;
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
type_offset += 4;
|
||||
}
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
}
|
||||
|
||||
/* update proc_offset */
|
||||
|
@ -1267,7 +1584,7 @@ static int get_type_format_string_size(type_t *iface)
|
|||
func_t *func;
|
||||
var_t *var;
|
||||
|
||||
/* determine the proc format string size */
|
||||
/* determine the type format string size */
|
||||
func = iface->funcs;
|
||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||
while (func)
|
||||
|
@ -1279,7 +1596,25 @@ static int get_type_format_string_size(type_t *iface)
|
|||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
if (var->ptr_level == 1)
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
var_t *field = var->type->ref->ref->fields;
|
||||
int tsize = 9;
|
||||
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
tsize ++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (tsize % 2)
|
||||
tsize++;
|
||||
size += tsize;
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
if (is_base_type(var->type))
|
||||
size += 4;
|
||||
|
@ -1319,6 +1654,8 @@ static int get_proc_format_string_size(type_t *iface)
|
|||
case 0:
|
||||
if (is_base_type(var->type))
|
||||
size += 2;
|
||||
else if (var->type->type == RPC_FC_RP)
|
||||
size += 4;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
|
|
@ -593,7 +593,8 @@ coclass: tCOCLASS aIDENTIFIER { $$ = make_class($2); }
|
|||
|
||||
coclasshdr: attributes coclass { $$ = $2;
|
||||
$$->attrs = $1;
|
||||
if (!parse_only && do_header) write_coclass($$);
|
||||
if (!parse_only && do_header)
|
||||
write_coclass($$);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -725,6 +726,7 @@ pointer_type:
|
|||
structdef: tSTRUCT t_ident '{' fields '}' { $$ = get_typev(RPC_FC_STRUCT, $2, tsSTRUCT);
|
||||
/* overwrite RPC_FC_STRUCT with a more exact type */
|
||||
$$->type = get_struct_type( $4 );
|
||||
$$->name = $2->name;
|
||||
$$->fields = $4;
|
||||
$$->defined = TRUE;
|
||||
if(in_typelib)
|
||||
|
@ -744,14 +746,15 @@ type: tVOID { $$ = make_tref(NULL, make_type(0, NULL)); }
|
|||
| tUNION aIDENTIFIER { $$ = make_tref(NULL, find_type2($2, tsUNION)); }
|
||||
;
|
||||
|
||||
typedef: tTYPEDEF m_attributes type pident_list { typeref_t *tref = uniq_tref($3);
|
||||
typedef: tTYPEDEF m_attributes type pident_list { typeref_t *tref = uniq_tref($3);
|
||||
$4->tname = tref->name;
|
||||
tref->name = NULL;
|
||||
$$ = type_ref(tref);
|
||||
$$->attrs = $2;
|
||||
if (!parse_only && do_header) write_typedef($$, $4);
|
||||
if (in_typelib && $$->attrs)
|
||||
add_typedef($$, $4);
|
||||
if (!parse_only && do_header)
|
||||
write_typedef($$, $4);
|
||||
if (in_typelib && $$->attrs)
|
||||
add_typedef($$, $4);
|
||||
reg_types($$, $4, 0);
|
||||
}
|
||||
;
|
||||
|
@ -1114,6 +1117,7 @@ static type_t *reg_type(type_t *type, char *name, int t)
|
|||
nt->t = t;
|
||||
nt->next = type_hash[hash];
|
||||
type_hash[hash] = nt;
|
||||
type->name = name;
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@ -1136,7 +1140,14 @@ static unsigned char get_pointer_type( type_t *type )
|
|||
}
|
||||
t = get_attrv( type->attrs, ATTR_POINTERTYPE );
|
||||
if (t) return t;
|
||||
return RPC_FC_FP;
|
||||
|
||||
if(is_attr( type->attrs, ATTR_PTR ))
|
||||
return RPC_FC_FP;
|
||||
|
||||
if(is_attr( type->attrs, ATTR_UNIQUE ))
|
||||
return RPC_FC_UP;
|
||||
|
||||
return RPC_FC_RP;
|
||||
}
|
||||
|
||||
static type_t *reg_types(type_t *type, var_t *names, int t)
|
||||
|
|
|
@ -80,6 +80,65 @@ get_base_type(unsigned char type)
|
|||
}
|
||||
|
||||
|
||||
static int get_type_size(type_t *type, int alignment)
|
||||
{
|
||||
int size;
|
||||
var_t *field;
|
||||
|
||||
switch(type->type)
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
size = ((size + alignment - 1) & ~(alignment -1));
|
||||
break;
|
||||
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
size = ((size + alignment - 1) & ~(alignment -1));
|
||||
break;
|
||||
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
size = ((size + alignment - 1) & ~(alignment -1));
|
||||
break;
|
||||
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
size = ((size + alignment - 1) & ~(alignment -1));
|
||||
break;
|
||||
|
||||
case RPC_FC_IGNORE:
|
||||
size = 0;
|
||||
break;
|
||||
|
||||
case RPC_FC_STRUCT:
|
||||
field = type->fields;
|
||||
size = 0;
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
size += get_type_size(field->type, alignment);
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, type->type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
static void write_procformatstring(type_t *iface)
|
||||
{
|
||||
func_t *func = iface->funcs;
|
||||
|
@ -118,6 +177,35 @@ static void write_procformatstring(type_t *iface)
|
|||
print_server("0x4e, /* FC_IN_PARAM_BASETYPE */\n");
|
||||
print_server("0x%02x, /* FC_<type> */\n", get_base_type(var->type->type));
|
||||
}
|
||||
else if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
var_t *field = var->type->ref->ref->fields;
|
||||
int size;
|
||||
|
||||
if (in_attr & !out_attr)
|
||||
print_server("0x4d, /* FC_IN_PARAM */\n");
|
||||
else if (!in_attr & out_attr)
|
||||
print_server("0x51, /* FC_OUT_PARAM */\n");
|
||||
else if (in_attr & out_attr)
|
||||
print_server("0x50, /* FC_IN_OUT_PARAM */\n");
|
||||
fprintf(server, "#ifndef _ALPHA_\n");
|
||||
print_server("0x01,\n");
|
||||
fprintf(server, "#else\n");
|
||||
print_server("0x02,\n");
|
||||
fprintf(server, "#endif\n");
|
||||
print_server("NdrFcShort(0x%x),\n", type_offset);
|
||||
|
||||
size = 9;
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
size++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (size % 2)
|
||||
size++;
|
||||
type_offset += size;
|
||||
}
|
||||
else
|
||||
{
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
|
@ -127,8 +215,8 @@ static void write_procformatstring(type_t *iface)
|
|||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
if (is_base_type(var->type))
|
||||
{
|
||||
// if (is_base_type(var->type))
|
||||
// {
|
||||
if (in_attr & !out_attr)
|
||||
print_server("0x4d, /* FC_IN_PARAM */\n");
|
||||
else if (!in_attr & out_attr)
|
||||
|
@ -142,13 +230,13 @@ static void write_procformatstring(type_t *iface)
|
|||
fprintf(server, "#endif\n");
|
||||
print_server("NdrFcShort(0x%x),\n", type_offset);
|
||||
type_offset += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
// __FUNCTION__,__LINE__, var->type->type);
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
var = PREV_LINK(var);
|
||||
|
@ -190,7 +278,7 @@ static void write_typeformatstring(type_t *iface)
|
|||
{
|
||||
func_t *func = iface->funcs;
|
||||
var_t *var;
|
||||
int out_attr;
|
||||
int in_attr, out_attr;
|
||||
int string_attr;
|
||||
int ptr_attr, ref_attr, unique_attr;
|
||||
|
||||
|
@ -211,6 +299,7 @@ static void write_typeformatstring(type_t *iface)
|
|||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
in_attr = is_attr(var->attrs, ATTR_IN);
|
||||
out_attr = is_attr(var->attrs, ATTR_OUT);
|
||||
string_attr = is_attr(var->attrs, ATTR_STRING);
|
||||
|
||||
|
@ -221,7 +310,50 @@ static void write_typeformatstring(type_t *iface)
|
|||
return;
|
||||
}
|
||||
|
||||
if (var->ptr_level == 1)
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
if (!is_base_type(var->type))
|
||||
{
|
||||
if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
var_t *field;
|
||||
int tsize = 9;
|
||||
unsigned char flags = 0;
|
||||
|
||||
if (!in_attr & out_attr)
|
||||
flags |= RPC_FC_P_ONSTACK;
|
||||
|
||||
print_server("0x11, 0x%02X, /* FC_RP, [flags] */\n", flags);
|
||||
print_server("NdrFcShort(0x%02X),\n", 0x02);
|
||||
print_server("0x%02X,\n", var->type->ref->ref->type);
|
||||
print_server("0x%02X,\n", 3); /* alignment -1 */
|
||||
print_server("NdrFcShort(0x%02X),\n", get_type_size(var->type->ref->ref, 4));
|
||||
|
||||
field = var->type->ref->ref->fields;
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
print_server("0x%02X,\n", get_base_type(field->type->type));
|
||||
tsize++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (tsize % 2)
|
||||
{
|
||||
print_server("0x5c, /* FC_PAD */\n");
|
||||
tsize++;
|
||||
}
|
||||
print_server("0x5b, /* FC_END */\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
ptr_attr = is_attr(var->attrs, ATTR_PTR);
|
||||
ref_attr = is_attr(var->attrs, ATTR_REF);
|
||||
|
@ -300,53 +432,83 @@ static void print_message_buffer_size(func_t *func)
|
|||
for (; var; var = PREV_LINK(var))
|
||||
{
|
||||
out_attr = is_attr(var->attrs, ATTR_OUT);
|
||||
if (!out_attr)
|
||||
continue;
|
||||
|
||||
alignment = 0;
|
||||
switch (var->type->type)
|
||||
if (out_attr)
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
alignment = 0;
|
||||
break;
|
||||
if (is_base_type(var->type))
|
||||
{
|
||||
if (size != 0 && last_size != 0)
|
||||
{
|
||||
print_server("_StubMsg.BufferLength +=");
|
||||
}
|
||||
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
if (last_size > 0 && last_size < 2)
|
||||
alignment += (2 - last_size);
|
||||
break;
|
||||
alignment = 0;
|
||||
switch (var->type->type)
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
alignment = 0;
|
||||
break;
|
||||
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment += (4 - last_size);
|
||||
break;
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
if (last_size > 0 && last_size < 2)
|
||||
alignment += (2 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment += (4 - last_size);
|
||||
break;
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment += (4 - last_size);
|
||||
break;
|
||||
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
if (last_size > 0 && last_size < 4)
|
||||
alignment += (4 - last_size);
|
||||
break;
|
||||
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (last_size != -1)
|
||||
fprintf(server, " +");
|
||||
fprintf(server, " %dU", (size == 0) ? 0 : size + alignment);
|
||||
|
||||
last_size = size;
|
||||
}
|
||||
else if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
if (size == 0)
|
||||
{
|
||||
fprintf(server, " 0;\n");
|
||||
}
|
||||
else if (last_size != 0)
|
||||
{
|
||||
fprintf(server, ";\n");
|
||||
last_size = 0;
|
||||
}
|
||||
|
||||
fprintf(server,"\n");
|
||||
print_server("NdrSimpleStructBufferSize(\n");
|
||||
indent++;
|
||||
print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_server("(unsigned char __RPC_FAR *)%s,\n", var->name);
|
||||
print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n",
|
||||
0); /* FIXME */
|
||||
indent--;
|
||||
fprintf(server,"\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (last_size != -1)
|
||||
fprintf(server, " +");
|
||||
fprintf(server, " %dU", (size == 0) ? 0 : size + alignment);
|
||||
|
||||
last_size = size;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -431,7 +593,16 @@ static void init_pointers (func_t *func)
|
|||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
if (var->ptr_level == 1)
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
print_server("(");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
fprintf(server, ")%s = 0;\n", var->name);
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
print_server("(");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
|
@ -458,6 +629,7 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset)
|
|||
int in_attr, out_attr;
|
||||
int string_attr;
|
||||
int ptr_attr, ref_attr, unique_attr;
|
||||
unsigned int local_type_offset = *type_offset;
|
||||
|
||||
if (!func->args)
|
||||
return;
|
||||
|
@ -493,7 +665,8 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset)
|
|||
indent++;
|
||||
print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_server("(unsigned char __RPC_FAR * __RPC_FAR *)&%s,\n", var->name);
|
||||
print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n", *type_offset + 2);
|
||||
print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n",
|
||||
local_type_offset + 2);
|
||||
print_server("(unsigned char)0);\n");
|
||||
indent--;
|
||||
fprintf(server, "\n");
|
||||
|
@ -568,7 +741,8 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset)
|
|||
indent++;
|
||||
print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_server("(unsigned char __RPC_FAR * __RPC_FAR *)&%s,\n", var->name);
|
||||
print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n", *type_offset);
|
||||
print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n",
|
||||
local_type_offset);
|
||||
print_server("(unsigned char)0);\n");
|
||||
indent--;
|
||||
fprintf(server, "\n");
|
||||
|
@ -577,79 +751,117 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset)
|
|||
}
|
||||
else
|
||||
{
|
||||
alignment = 0;
|
||||
switch (var->type->type)
|
||||
if (is_base_type(var->type))
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
alignment = 0;
|
||||
break;
|
||||
switch (var->type->type)
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
alignment = 0;
|
||||
break;
|
||||
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
if (last_size != 0 && last_size < 2)
|
||||
alignment = (2 - last_size);
|
||||
break;
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
if (last_size != 0 && last_size < 2)
|
||||
alignment = (2 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
if (last_size != 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
if (last_size != 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
if (last_size != 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
if (last_size != 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_IGNORE:
|
||||
size = 0;
|
||||
break;
|
||||
case RPC_FC_IGNORE:
|
||||
size = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (size != 0)
|
||||
{
|
||||
if (alignment != 0)
|
||||
print_server("_StubMsg.Buffer += %u;\n", alignment);
|
||||
|
||||
print_server("");
|
||||
write_name(server, var);
|
||||
fprintf(server, " = *((");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
fprintf(server, " __RPC_FAR*)_StubMsg.Buffer);\n");
|
||||
print_server("_StubMsg.Buffer += sizeof(");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
fprintf(server, ");\n");
|
||||
fprintf(server, "\n");
|
||||
|
||||
last_size = size;
|
||||
}
|
||||
}
|
||||
|
||||
if (size != 0)
|
||||
else if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
if (alignment != 0)
|
||||
print_server("_StubMsg.Buffer += %u;\n", alignment);
|
||||
|
||||
print_server("");
|
||||
write_name(server, var);
|
||||
fprintf(server, " = *((");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
fprintf(server, " __RPC_FAR*)_StubMsg.Buffer);\n");
|
||||
print_server("_StubMsg.Buffer += sizeof(");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
fprintf(server, ");\n");
|
||||
fprintf(server, "\n");
|
||||
|
||||
last_size = size;
|
||||
if (var->type->ref->ref->type == RPC_FC_STRUCT)
|
||||
{
|
||||
print_server("NdrSimpleStructUnmarshall(\n");
|
||||
indent++;
|
||||
print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_server("(unsigned char __RPC_FAR * __RPC_FAR *)&%s,\n", var->name);
|
||||
print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n",
|
||||
local_type_offset + 4);
|
||||
print_server("(unsigned char)0);\n");
|
||||
indent--;
|
||||
fprintf(server, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* calculate the next type offset */
|
||||
if (var->ptr_level == 1)
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
*type_offset += 4;
|
||||
if ((var->type->type == RPC_FC_RP) &&
|
||||
(var->type->ref->ref->type == RPC_FC_STRUCT))
|
||||
{
|
||||
var_t *field = var->type->ref->ref->fields;
|
||||
int tsize = 9;
|
||||
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
tsize++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (tsize % 2)
|
||||
tsize++;
|
||||
|
||||
local_type_offset += tsize;
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
local_type_offset += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void marshall_out_arguments(func_t *func)
|
||||
static void marshall_out_arguments(func_t *func, unsigned int *type_offset)
|
||||
{
|
||||
unsigned int alignment = 0;
|
||||
unsigned int size = 0;
|
||||
|
@ -657,6 +869,7 @@ static void marshall_out_arguments(func_t *func)
|
|||
var_t *var;
|
||||
var_t *def;
|
||||
int out_attr;
|
||||
unsigned int local_type_offset = *type_offset;
|
||||
|
||||
def = func->def;
|
||||
|
||||
|
@ -668,77 +881,117 @@ static void marshall_out_arguments(func_t *func)
|
|||
for (; var; var = PREV_LINK(var))
|
||||
{
|
||||
out_attr = is_attr(var->attrs, ATTR_OUT);
|
||||
if (!out_attr)
|
||||
continue;
|
||||
|
||||
alignment = 0;
|
||||
switch (var->type->type)
|
||||
if (out_attr)
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
alignment = 0;
|
||||
break;
|
||||
if (is_base_type(var->type))
|
||||
{
|
||||
alignment = 0;
|
||||
switch (var->type->type)
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_SMALL:
|
||||
size = 1;
|
||||
alignment = 0;
|
||||
break;
|
||||
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
if (last_size != 0 && last_size < 2)
|
||||
alignment = (2 - last_size);
|
||||
break;
|
||||
case RPC_FC_WCHAR:
|
||||
case RPC_FC_USHORT:
|
||||
case RPC_FC_SHORT:
|
||||
size = 2;
|
||||
if (last_size != 0 && last_size < 2)
|
||||
alignment = (2 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
if (last_size != 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
case RPC_FC_ULONG:
|
||||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
size = 4;
|
||||
if (last_size != 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
if (last_size != 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
case RPC_FC_HYPER:
|
||||
case RPC_FC_DOUBLE:
|
||||
size = 8;
|
||||
if (last_size != 0 && last_size < 4)
|
||||
alignment = (4 - last_size);
|
||||
break;
|
||||
|
||||
case RPC_FC_IGNORE:
|
||||
size = 0;
|
||||
break;
|
||||
case RPC_FC_IGNORE:
|
||||
size = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
error("%s:%d Unknown/unsupported type 0x%x\n",
|
||||
__FUNCTION__,__LINE__, var->type->type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (size != 0)
|
||||
{
|
||||
if (alignment != 0)
|
||||
print_server("_StubMsg.Buffer += %u;\n", alignment);
|
||||
if (size != 0)
|
||||
{
|
||||
if (alignment != 0)
|
||||
print_server("_StubMsg.Buffer += %u;\n", alignment);
|
||||
|
||||
if (var->ptr_level == 1)
|
||||
if (var->ptr_level == 1)
|
||||
{
|
||||
fprintf(server, "\n");
|
||||
print_server("*((");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
fprintf(server, " __RPC_FAR *)_StubMsg.Buffer) = *");
|
||||
write_name(server, var);
|
||||
fprintf(server, ";\n");
|
||||
|
||||
print_server("_StubMsg.Buffer += sizeof(");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
fprintf(server, ");");
|
||||
}
|
||||
else
|
||||
{
|
||||
error("Pointer level %d is not supported!\n", var->ptr_level);
|
||||
return;
|
||||
}
|
||||
|
||||
last_size = size;
|
||||
}
|
||||
}
|
||||
else if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
fprintf(server, "\n");
|
||||
print_server("*((");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
fprintf(server, " __RPC_FAR *)_StubMsg.Buffer) = *");
|
||||
write_name(server, var);
|
||||
fprintf(server, ";\n");
|
||||
|
||||
print_server("_StubMsg.Buffer += sizeof(");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
fprintf(server, ");");
|
||||
print_server("NdrSimpleStructMarshall(\n");
|
||||
indent++;
|
||||
print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_server("(unsigned char __RPC_FAR *)%s,\n", var->name);
|
||||
print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n",
|
||||
local_type_offset + 4);
|
||||
indent--;
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
/* calculate the next type offset */
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
if ((var->type->type == RPC_FC_RP) &&
|
||||
(var->type->ref->ref->type == RPC_FC_STRUCT))
|
||||
{
|
||||
error("Pointer level %d is not supported!\n", var->ptr_level);
|
||||
return;
|
||||
}
|
||||
var_t *field = var->type->ref->ref->fields;
|
||||
int tsize = 9;
|
||||
|
||||
last_size = size;
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
tsize++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (tsize % 2)
|
||||
tsize++;
|
||||
|
||||
local_type_offset += tsize;
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
local_type_offset += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -821,7 +1074,7 @@ static void write_function_stubs(type_t *iface)
|
|||
var_t* explicit_handle_var;
|
||||
unsigned int proc_offset = 0;
|
||||
unsigned int type_offset = 2;
|
||||
unsigned int i;
|
||||
unsigned int i, sep;
|
||||
int in_attr;
|
||||
int out_attr;
|
||||
|
||||
|
@ -883,10 +1136,19 @@ static void write_function_stubs(type_t *iface)
|
|||
in_attr = 1;
|
||||
if (!in_attr)
|
||||
{
|
||||
print_server("");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
fprintf(server, " _W%u;\n", i);
|
||||
i++;
|
||||
if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
print_server("struct ");
|
||||
write_type(server, NULL, NULL, var->type->ref->ref->name);
|
||||
fprintf(server, " _%sW;\n", var->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_server("");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
fprintf(server, " _W%u;\n", i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
print_server("");
|
||||
|
@ -962,6 +1224,7 @@ static void write_function_stubs(type_t *iface)
|
|||
/* assign out arguments */
|
||||
if (func->args)
|
||||
{
|
||||
sep = 0;
|
||||
i = 0;
|
||||
var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
|
@ -973,16 +1236,27 @@ static void write_function_stubs(type_t *iface)
|
|||
in_attr = 1;
|
||||
if (!in_attr)
|
||||
{
|
||||
print_server("");
|
||||
write_name(server, var);
|
||||
fprintf(server, " = &_W%u;\n", i);
|
||||
i++;
|
||||
if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
print_server("");
|
||||
write_name(server, var);
|
||||
fprintf(server, " = &_%sW;\n", var->name);
|
||||
sep = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print_server("");
|
||||
write_name(server, var);
|
||||
fprintf(server, " = &_W%u;\n", i);
|
||||
i++;
|
||||
sep = 1;
|
||||
}
|
||||
}
|
||||
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
|
||||
if (i)
|
||||
if (sep)
|
||||
fprintf(server, "\n");
|
||||
}
|
||||
|
||||
|
@ -1034,7 +1308,7 @@ static void write_function_stubs(type_t *iface)
|
|||
print_server("_StubMsg.Buffer = (unsigned char __RPC_FAR *)_pRpcMessage->Buffer;\n");
|
||||
|
||||
/* marshall the out arguments */
|
||||
marshall_out_arguments(func);
|
||||
marshall_out_arguments(func, &type_offset);
|
||||
}
|
||||
|
||||
indent--;
|
||||
|
@ -1054,6 +1328,41 @@ static void write_function_stubs(type_t *iface)
|
|||
fprintf(server, "}\n");
|
||||
fprintf(server, "\n");
|
||||
|
||||
/* update type_offset */
|
||||
if (func->args)
|
||||
{
|
||||
var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
if ((var->type->type == RPC_FC_RP) &&
|
||||
(var->type->ref->ref->type == RPC_FC_STRUCT))
|
||||
{
|
||||
var_t *field = var->type->ref->ref->fields;
|
||||
int tsize = 9;
|
||||
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
tsize++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (tsize % 2)
|
||||
tsize++;
|
||||
|
||||
type_offset += tsize;
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
type_offset += 4;
|
||||
}
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
}
|
||||
|
||||
/* update proc_offset */
|
||||
if (func->args)
|
||||
{
|
||||
|
@ -1208,7 +1517,25 @@ static int get_type_format_string_size(type_t *iface)
|
|||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
if (var->ptr_level == 1)
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
if (var->type->type == RPC_FC_RP)
|
||||
{
|
||||
var_t *field = var->type->ref->ref->fields;
|
||||
int tsize = 9;
|
||||
|
||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
||||
while (field)
|
||||
{
|
||||
tsize ++;
|
||||
field = PREV_LINK(field);
|
||||
}
|
||||
if (tsize % 2)
|
||||
tsize++;
|
||||
size += tsize;
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
if (is_base_type(var->type))
|
||||
size += 4;
|
||||
|
@ -1248,6 +1575,8 @@ static int get_proc_format_string_size(type_t *iface)
|
|||
case 0:
|
||||
if (is_base_type(var->type))
|
||||
size += 2;
|
||||
else if (var->type->type == RPC_FC_RP)
|
||||
size += 4;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
|
|
@ -437,12 +437,12 @@ static const short yyrline[] = { 0,
|
|||
517, 518, 521, 524, 535, 536, 539, 540, 541, 544,
|
||||
546, 547, 548, 549, 552, 553, 554, 555, 556, 568,
|
||||
570, 571, 572, 573, 574, 577, 578, 581, 582, 583,
|
||||
584, 585, 586, 587, 590, 591, 594, 600, 605, 606,
|
||||
609, 613, 614, 617, 629, 630, 633, 634, 637, 652,
|
||||
653, 656, 657, 660, 668, 676, 683, 686, 688, 691,
|
||||
692, 695, 700, 706, 707, 710, 711, 712, 715, 717,
|
||||
720, 722, 725, 735, 736, 737, 738, 739, 740, 741,
|
||||
742, 743, 744, 747, 759, 763, 776, 778
|
||||
584, 585, 586, 587, 590, 591, 594, 601, 606, 607,
|
||||
610, 614, 615, 618, 630, 631, 634, 635, 638, 653,
|
||||
654, 657, 658, 661, 669, 677, 684, 687, 689, 692,
|
||||
693, 696, 701, 707, 708, 711, 712, 713, 716, 718,
|
||||
721, 723, 726, 737, 738, 739, 740, 741, 742, 743,
|
||||
744, 745, 746, 749, 762, 766, 779, 781
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -2172,37 +2172,38 @@ case 197:
|
|||
#line 594 "parser.y"
|
||||
{ yyval.clas = yyvsp[0].clas;
|
||||
yyval.clas->attrs = yyvsp[-1].attr;
|
||||
if (!parse_only && do_header) write_coclass(yyval.clas);
|
||||
if (!parse_only && do_header)
|
||||
write_coclass(yyval.clas);
|
||||
;
|
||||
break;}
|
||||
case 198:
|
||||
#line 600 "parser.y"
|
||||
#line 601 "parser.y"
|
||||
{ yyval.clas = yyvsp[-3].clas;
|
||||
yyval.clas->ifaces = yyvsp[-1].ifref;
|
||||
;
|
||||
break;}
|
||||
case 199:
|
||||
#line 605 "parser.y"
|
||||
#line 606 "parser.y"
|
||||
{ yyval.ifref = NULL; ;
|
||||
break;}
|
||||
case 200:
|
||||
#line 606 "parser.y"
|
||||
#line 607 "parser.y"
|
||||
{ LINK(yyvsp[0].ifref, yyvsp[-1].ifref); yyval.ifref = yyvsp[0].ifref; ;
|
||||
break;}
|
||||
case 201:
|
||||
#line 610 "parser.y"
|
||||
#line 611 "parser.y"
|
||||
{ yyval.ifref = make_ifref(yyvsp[0].type); yyval.ifref->attrs = yyvsp[-1].attr; ;
|
||||
break;}
|
||||
case 202:
|
||||
#line 613 "parser.y"
|
||||
{ yyval.type = get_type(0, yyvsp[0].str, 0); ;
|
||||
break;}
|
||||
case 203:
|
||||
#line 614 "parser.y"
|
||||
{ yyval.type = get_type(0, yyvsp[0].str, 0); ;
|
||||
break;}
|
||||
case 203:
|
||||
#line 615 "parser.y"
|
||||
{ yyval.type = get_type(0, yyvsp[0].str, 0); ;
|
||||
break;}
|
||||
case 204:
|
||||
#line 617 "parser.y"
|
||||
#line 618 "parser.y"
|
||||
{ yyval.type = yyvsp[0].type;
|
||||
if (yyval.type->defined) yyerror("multiple definition error\n");
|
||||
yyval.type->attrs = yyvsp[-1].attr;
|
||||
|
@ -2215,23 +2216,23 @@ case 204:
|
|||
;
|
||||
break;}
|
||||
case 205:
|
||||
#line 629 "parser.y"
|
||||
#line 630 "parser.y"
|
||||
{ yyval.var = NULL; ;
|
||||
break;}
|
||||
case 206:
|
||||
#line 630 "parser.y"
|
||||
#line 631 "parser.y"
|
||||
{ LINK(yyvsp[-1].var, yyvsp[-2].var); yyval.var = yyvsp[-1].var; ;
|
||||
break;}
|
||||
case 207:
|
||||
#line 633 "parser.y"
|
||||
#line 634 "parser.y"
|
||||
{ yyval.func = NULL; ;
|
||||
break;}
|
||||
case 208:
|
||||
#line 634 "parser.y"
|
||||
#line 635 "parser.y"
|
||||
{ LINK(yyvsp[-1].func, yyvsp[-2].func); yyval.func = yyvsp[-1].func; ;
|
||||
break;}
|
||||
case 209:
|
||||
#line 640 "parser.y"
|
||||
#line 641 "parser.y"
|
||||
{ yyval.type = yyvsp[-4].type;
|
||||
yyval.type->fields = yyvsp[-2].var;
|
||||
yyval.type->funcs = yyvsp[-1].func;
|
||||
|
@ -2239,23 +2240,23 @@ case 209:
|
|||
;
|
||||
break;}
|
||||
case 210:
|
||||
#line 652 "parser.y"
|
||||
#line 653 "parser.y"
|
||||
{ yyval.type = NULL; ;
|
||||
break;}
|
||||
case 211:
|
||||
#line 653 "parser.y"
|
||||
#line 654 "parser.y"
|
||||
{ yyval.type = find_type2(yyvsp[0].str, 0); ;
|
||||
break;}
|
||||
case 212:
|
||||
#line 656 "parser.y"
|
||||
{ yyval.type = get_type(RPC_FC_IP, yyvsp[0].str, 0); ;
|
||||
break;}
|
||||
case 213:
|
||||
#line 657 "parser.y"
|
||||
{ yyval.type = get_type(RPC_FC_IP, yyvsp[0].str, 0); ;
|
||||
break;}
|
||||
case 213:
|
||||
#line 658 "parser.y"
|
||||
{ yyval.type = get_type(RPC_FC_IP, yyvsp[0].str, 0); ;
|
||||
break;}
|
||||
case 214:
|
||||
#line 660 "parser.y"
|
||||
#line 661 "parser.y"
|
||||
{ yyval.type = yyvsp[0].type;
|
||||
if (yyval.type->defined) yyerror("multiple definition error\n");
|
||||
yyval.type->attrs = yyvsp[-1].attr;
|
||||
|
@ -2264,7 +2265,7 @@ case 214:
|
|||
;
|
||||
break;}
|
||||
case 215:
|
||||
#line 669 "parser.y"
|
||||
#line 670 "parser.y"
|
||||
{ yyval.type = yyvsp[-4].type;
|
||||
yyval.type->ref = yyvsp[-3].type;
|
||||
yyval.type->funcs = yyvsp[-1].func;
|
||||
|
@ -2272,7 +2273,7 @@ case 215:
|
|||
;
|
||||
break;}
|
||||
case 216:
|
||||
#line 677 "parser.y"
|
||||
#line 678 "parser.y"
|
||||
{ yyval.type = yyvsp[-6].type;
|
||||
yyval.type->ref = find_type2(yyvsp[-4].str, 0);
|
||||
if (!yyval.type->ref) yyerror("base class %s not found in import\n", yyvsp[-4].str);
|
||||
|
@ -2281,67 +2282,68 @@ case 216:
|
|||
;
|
||||
break;}
|
||||
case 217:
|
||||
#line 683 "parser.y"
|
||||
#line 684 "parser.y"
|
||||
{ yyval.type = yyvsp[0].type; ;
|
||||
break;}
|
||||
case 218:
|
||||
#line 687 "parser.y"
|
||||
{ yyval.type = yyvsp[-1].type; if (!parse_only && do_header) write_forward(yyval.type); ;
|
||||
break;}
|
||||
case 219:
|
||||
#line 688 "parser.y"
|
||||
{ yyval.type = yyvsp[-1].type; if (!parse_only && do_header) write_forward(yyval.type); ;
|
||||
break;}
|
||||
case 220:
|
||||
#line 691 "parser.y"
|
||||
{ yyval.type = make_type(0, NULL); yyval.type->name = yyvsp[0].str; ;
|
||||
case 219:
|
||||
#line 689 "parser.y"
|
||||
{ yyval.type = yyvsp[-1].type; if (!parse_only && do_header) write_forward(yyval.type); ;
|
||||
break;}
|
||||
case 221:
|
||||
case 220:
|
||||
#line 692 "parser.y"
|
||||
{ yyval.type = make_type(0, NULL); yyval.type->name = yyvsp[0].str; ;
|
||||
break;}
|
||||
case 221:
|
||||
#line 693 "parser.y"
|
||||
{ yyval.type = make_type(0, NULL); yyval.type->name = yyvsp[0].str; ;
|
||||
break;}
|
||||
case 222:
|
||||
#line 695 "parser.y"
|
||||
#line 696 "parser.y"
|
||||
{ yyval.type = yyvsp[0].type;
|
||||
yyval.type->attrs = yyvsp[-1].attr;
|
||||
;
|
||||
break;}
|
||||
case 223:
|
||||
#line 700 "parser.y"
|
||||
#line 701 "parser.y"
|
||||
{ yyval.type = yyvsp[-3].type;
|
||||
yyval.type->funcs = yyvsp[-1].func;
|
||||
/* FIXME: if (!parse_only && do_header) write_module($$); */
|
||||
;
|
||||
break;}
|
||||
case 224:
|
||||
#line 706 "parser.y"
|
||||
#line 707 "parser.y"
|
||||
{ yyval.var = yyvsp[0].var; yyval.var->ptr_level++; ;
|
||||
break;}
|
||||
case 225:
|
||||
#line 707 "parser.y"
|
||||
#line 708 "parser.y"
|
||||
{ yyval.var = yyvsp[0].var; /* FIXME */ ;
|
||||
break;}
|
||||
case 228:
|
||||
#line 712 "parser.y"
|
||||
#line 713 "parser.y"
|
||||
{ yyval.var = yyvsp[-1].var; ;
|
||||
break;}
|
||||
case 230:
|
||||
#line 717 "parser.y"
|
||||
#line 718 "parser.y"
|
||||
{ LINK(yyvsp[0].var, yyvsp[-2].var); yyval.var = yyvsp[0].var; ;
|
||||
break;}
|
||||
case 231:
|
||||
#line 721 "parser.y"
|
||||
#line 722 "parser.y"
|
||||
{ yyval.num = RPC_FC_RP; ;
|
||||
break;}
|
||||
case 232:
|
||||
#line 722 "parser.y"
|
||||
#line 723 "parser.y"
|
||||
{ yyval.num = RPC_FC_UP; ;
|
||||
break;}
|
||||
case 233:
|
||||
#line 725 "parser.y"
|
||||
#line 726 "parser.y"
|
||||
{ yyval.type = get_typev(RPC_FC_STRUCT, yyvsp[-3].var, tsSTRUCT);
|
||||
/* overwrite RPC_FC_STRUCT with a more exact type */
|
||||
yyval.type->type = get_struct_type( yyvsp[-1].var );
|
||||
yyval.type->name = yyvsp[-3].var->name;
|
||||
yyval.type->fields = yyvsp[-1].var;
|
||||
yyval.type->defined = TRUE;
|
||||
if(in_typelib)
|
||||
|
@ -2349,67 +2351,68 @@ case 233:
|
|||
;
|
||||
break;}
|
||||
case 234:
|
||||
#line 735 "parser.y"
|
||||
#line 737 "parser.y"
|
||||
{ yyval.tref = make_tref(NULL, make_type(0, NULL)); ;
|
||||
break;}
|
||||
case 235:
|
||||
#line 736 "parser.y"
|
||||
#line 738 "parser.y"
|
||||
{ yyval.tref = make_tref(yyvsp[0].str, find_type(yyvsp[0].str, 0)); ;
|
||||
break;}
|
||||
case 236:
|
||||
#line 737 "parser.y"
|
||||
{ yyval.tref = make_tref(NULL, yyvsp[0].type); ;
|
||||
break;}
|
||||
case 237:
|
||||
#line 738 "parser.y"
|
||||
{ yyval.tref = uniq_tref(yyvsp[0].tref); yyval.tref->ref->is_const = TRUE; ;
|
||||
break;}
|
||||
case 238:
|
||||
#line 739 "parser.y"
|
||||
{ yyval.tref = make_tref(NULL, yyvsp[0].type); ;
|
||||
break;}
|
||||
case 239:
|
||||
case 237:
|
||||
#line 740 "parser.y"
|
||||
{ yyval.tref = make_tref(NULL, find_type2(yyvsp[0].str, tsENUM)); ;
|
||||
{ yyval.tref = uniq_tref(yyvsp[0].tref); yyval.tref->ref->is_const = TRUE; ;
|
||||
break;}
|
||||
case 240:
|
||||
case 238:
|
||||
#line 741 "parser.y"
|
||||
{ yyval.tref = make_tref(NULL, yyvsp[0].type); ;
|
||||
break;}
|
||||
case 241:
|
||||
case 239:
|
||||
#line 742 "parser.y"
|
||||
{ yyval.tref = make_tref(NULL, get_type(RPC_FC_STRUCT, yyvsp[0].str, tsSTRUCT)); ;
|
||||
{ yyval.tref = make_tref(NULL, find_type2(yyvsp[0].str, tsENUM)); ;
|
||||
break;}
|
||||
case 242:
|
||||
case 240:
|
||||
#line 743 "parser.y"
|
||||
{ yyval.tref = make_tref(NULL, yyvsp[0].type); ;
|
||||
break;}
|
||||
case 243:
|
||||
case 241:
|
||||
#line 744 "parser.y"
|
||||
{ yyval.tref = make_tref(NULL, get_type(RPC_FC_STRUCT, yyvsp[0].str, tsSTRUCT)); ;
|
||||
break;}
|
||||
case 242:
|
||||
#line 745 "parser.y"
|
||||
{ yyval.tref = make_tref(NULL, yyvsp[0].type); ;
|
||||
break;}
|
||||
case 243:
|
||||
#line 746 "parser.y"
|
||||
{ yyval.tref = make_tref(NULL, find_type2(yyvsp[0].str, tsUNION)); ;
|
||||
break;}
|
||||
case 244:
|
||||
#line 747 "parser.y"
|
||||
{ typeref_t *tref = uniq_tref(yyvsp[-1].tref);
|
||||
#line 749 "parser.y"
|
||||
{ typeref_t *tref = uniq_tref(yyvsp[-1].tref);
|
||||
yyvsp[0].var->tname = tref->name;
|
||||
tref->name = NULL;
|
||||
yyval.type = type_ref(tref);
|
||||
yyval.type->attrs = yyvsp[-2].attr;
|
||||
if (!parse_only && do_header) write_typedef(yyval.type, yyvsp[0].var);
|
||||
if (in_typelib && yyval.type->attrs)
|
||||
add_typedef(yyval.type, yyvsp[0].var);
|
||||
if (!parse_only && do_header)
|
||||
write_typedef(yyval.type, yyvsp[0].var);
|
||||
if (in_typelib && yyval.type->attrs)
|
||||
add_typedef(yyval.type, yyvsp[0].var);
|
||||
reg_types(yyval.type, yyvsp[0].var, 0);
|
||||
;
|
||||
break;}
|
||||
case 245:
|
||||
#line 759 "parser.y"
|
||||
#line 762 "parser.y"
|
||||
{ yyval.type = get_typev(RPC_FC_NON_ENCAPSULATED_UNION, yyvsp[-3].var, tsUNION);
|
||||
yyval.type->fields = yyvsp[-1].var;
|
||||
yyval.type->defined = TRUE;
|
||||
;
|
||||
break;}
|
||||
case 246:
|
||||
#line 765 "parser.y"
|
||||
#line 768 "parser.y"
|
||||
{ var_t *u = yyvsp[-3].var;
|
||||
yyval.type = get_typev(RPC_FC_ENCAPSULATED_UNION, yyvsp[-8].var, tsUNION);
|
||||
if (!u) u = make_var("tagged_union");
|
||||
|
@ -2421,11 +2424,11 @@ case 246:
|
|||
;
|
||||
break;}
|
||||
case 247:
|
||||
#line 777 "parser.y"
|
||||
#line 780 "parser.y"
|
||||
{ yyval.num = MAKELONG(yyvsp[0].num, 0); ;
|
||||
break;}
|
||||
case 248:
|
||||
#line 778 "parser.y"
|
||||
#line 781 "parser.y"
|
||||
{ yyval.num = MAKELONG(yyvsp[-2].num, yyvsp[0].num); ;
|
||||
break;}
|
||||
}
|
||||
|
@ -2650,7 +2653,7 @@ yyerrhandle:
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
#line 781 "parser.y"
|
||||
#line 784 "parser.y"
|
||||
|
||||
|
||||
static attr_t *make_attr(enum attr_type type)
|
||||
|
@ -2987,6 +2990,7 @@ static type_t *reg_type(type_t *type, char *name, int t)
|
|||
nt->t = t;
|
||||
nt->next = type_hash[hash];
|
||||
type_hash[hash] = nt;
|
||||
type->name = name;
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@ -3009,7 +3013,14 @@ static unsigned char get_pointer_type( type_t *type )
|
|||
}
|
||||
t = get_attrv( type->attrs, ATTR_POINTERTYPE );
|
||||
if (t) return t;
|
||||
return RPC_FC_FP;
|
||||
|
||||
if(is_attr( type->attrs, ATTR_PTR ))
|
||||
return RPC_FC_FP;
|
||||
|
||||
if(is_attr( type->attrs, ATTR_UNIQUE ))
|
||||
return RPC_FC_UP;
|
||||
|
||||
return RPC_FC_RP;
|
||||
}
|
||||
|
||||
static type_t *reg_types(type_t *type, var_t *names, int t)
|
||||
|
|
Loading…
Reference in a new issue