- Support [out, unique] base type parameters.

svn path=/trunk/; revision=18370
This commit is contained in:
Eric Kohl 2005-10-09 08:36:50 +00:00
parent 9606cf5a82
commit c06ae87d5e
2 changed files with 93 additions and 66 deletions

View file

@ -333,7 +333,8 @@ static void write_procformatstring(type_t *iface)
if (is_base_type(var->type))
{
print_client("0x4e, /* FC_IN_PARAM_BASETYPE */\n");
print_client("0x%02x, /* FC_<type> */\n", get_base_type(var->type->type));
print_client("0x%02x, /* FC_<type> */\n",
get_base_type(var->type->type));
}
else if (var->type->type == RPC_FC_RP)
{
@ -361,8 +362,6 @@ static void write_procformatstring(type_t *iface)
}
else if (var->ptr_level == 1)
{
// if (is_base_type(var->type))
// {
if (in_attr & !out_attr)
print_client("0x4d, /* FC_IN_PARAM */\n");
else if (!in_attr & out_attr)
@ -375,13 +374,6 @@ static void write_procformatstring(type_t *iface)
print_client("0x02,\n");
fprintf(client, "#endif\n");
print_client("NdrFcShort(0x%x),\n", type_offset);
// }
// else
// {
// error("%s:%d Unknown/unsupported type 0x%x\n",
// __FUNCTION__,__LINE__, var->type->type);
// return;
// }
}
else
{
@ -576,7 +568,7 @@ static void write_typeformatstring(type_t *iface)
if (ref_attr)
print_client("0x11, 0x0c, /* FC_RP [allocated_on_stack] [simple_pointer] */\n");
else if (unique_attr)
print_client("0x12, 0x0c, /* FC_FP [allocated_on_stack] [simple_pointer] */\n");
print_client("0x12, 0x0c, /* FC_UP [allocated_on_stack] [simple_pointer] */\n");
else if (ptr_attr)
print_client("0x14, 0x0c, /* FC_FP [allocated_on_stack] [simple_pointer] */\n");
}
@ -1196,6 +1188,7 @@ static void unmarshall_out_arguments(func_t *func, unsigned int *type_offset)
unsigned int last_size = 0;
int out_attr;
int string_attr;
int ptr_attr, ref_attr, unique_attr;
void *sizeis_attr;
var_t *var;
var_t *def;
@ -1214,6 +1207,12 @@ static void unmarshall_out_arguments(func_t *func, unsigned int *type_offset)
sizeis_attr = get_attrp(var->attrs, ATTR_SIZEIS);
string_attr = is_attr(var->attrs, ATTR_STRING);
ptr_attr = is_attr(var->attrs, ATTR_PTR);
ref_attr = is_attr(var->attrs, ATTR_REF);
unique_attr = is_attr(var->attrs, ATTR_UNIQUE);
if (ptr_attr + ref_attr + unique_attr == 0)
ref_attr = 1;
if (out_attr)
{
if (var->ptr_level > 1)
@ -1309,6 +1308,20 @@ static void unmarshall_out_arguments(func_t *func, unsigned int *type_offset)
if (alignment != 0)
print_client("_StubMsg.Buffer += %u;\n", alignment);
if (unique_attr)
{
print_client("NdrPointerUnmarshall(\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",
local_type_offset);
print_client("(unsigned char)0);\n");
indent--;
fprintf(client, "\n");
}
else
{
print_client("*");
write_name(client, var);
fprintf(client, " = *((");
@ -1319,6 +1332,7 @@ static void unmarshall_out_arguments(func_t *func, unsigned int *type_offset)
write_type(client, var->type, NULL, var->tname);
fprintf(client, ");\n");
}
}
last_size = size;
}

View file

@ -338,7 +338,8 @@ static void write_procformatstring(type_t *iface)
if (is_base_type(var->type))
{
print_server("0x4e, /* FC_IN_PARAM_BASETYPE */\n");
print_server("0x%02x, /* FC_<type> */\n", get_base_type(var->type->type));
print_server("0x%02x, /* FC_<type> */\n",
get_base_type(var->type->type));
}
else if (var->type->type == RPC_FC_RP)
{
@ -364,8 +365,6 @@ static void write_procformatstring(type_t *iface)
}
else if (var->ptr_level == 1)
{
// if (is_base_type(var->type))
// {
if (in_attr & !out_attr)
print_server("0x4d, /* FC_IN_PARAM */\n");
else if (!in_attr & out_attr)
@ -378,13 +377,6 @@ static void write_procformatstring(type_t *iface)
print_server("0x02,\n");
fprintf(server, "#endif\n");
print_server("NdrFcShort(0x%x),\n", type_offset);
// }
// else
// {
// error("%s:%d Unknown/unsupported type 0x%x\n",
// __FUNCTION__,__LINE__, var->type->type);
// return;
// }
}
type_offset += get_var_type_offset(var);
@ -573,7 +565,7 @@ static void write_typeformatstring(type_t *iface)
if (ref_attr)
print_server("0x11, 0x0c, /* FC_RP [allocated_on_stack] [simple_pointer] */\n");
else if (unique_attr)
print_server("0x12, 0x0c, /* FC_FP [allocated_on_stack] [simple_pointer] */\n");
print_server("0x12, 0x0c, /* FC_UP [allocated_on_stack] [simple_pointer] */\n");
else if (ptr_attr)
print_server("0x14, 0x0c, /* FC_FP [allocated_on_stack] [simple_pointer] */\n");
}
@ -875,7 +867,7 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset)
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); /* FIXME */
local_type_offset + 4);
indent--;
fprintf(server,"\n");
}
@ -1213,6 +1205,7 @@ static void marshall_out_arguments(func_t *func, unsigned int *type_offset)
var_t *def;
int out_attr;
int string_attr;
int ptr_attr, ref_attr, unique_attr;
void *sizeis_attr;
unsigned int local_type_offset = *type_offset;
@ -1231,6 +1224,12 @@ static void marshall_out_arguments(func_t *func, unsigned int *type_offset)
sizeis_attr = get_attrp(var->attrs, ATTR_SIZEIS);
string_attr = is_attr(var->attrs, ATTR_STRING);
ptr_attr = is_attr(var->attrs, ATTR_PTR);
ref_attr = is_attr(var->attrs, ATTR_REF);
unique_attr = is_attr(var->attrs, ATTR_UNIQUE);
if (ptr_attr + ref_attr + unique_attr == 0)
ref_attr = 1;
if (sizeis_attr != NULL)
{
if (string_attr)
@ -1325,6 +1324,19 @@ static void marshall_out_arguments(func_t *func, unsigned int *type_offset)
print_server("_StubMsg.Buffer += %u;\n", alignment);
if (var->ptr_level == 1)
{
if (unique_attr)
{
print_server("NdrPointerMarshall(\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);
indent--;
fprintf(server, "\n");
}
else
{
fprintf(server, "\n");
print_server("*((");
@ -1337,6 +1349,7 @@ static void marshall_out_arguments(func_t *func, unsigned int *type_offset)
write_type(server, var->type, NULL, var->tname);
fprintf(server, ");");
}
}
else
{
error("Pointer level %d is not supported!\n", var->ptr_level);