Support 'ref' and 'unique' attributes for pointers.

svn path=/trunk/; revision=14474
This commit is contained in:
Eric Kohl 2005-04-03 12:49:25 +00:00
parent d840ae26ad
commit 938d6d1baf
9 changed files with 1349 additions and 991 deletions

View file

@ -1,5 +1,15 @@
ChangeLog ChangeLog
2005-04-03 ekohl
tools/widl/client.c
tools/widl/parser.l
tools/widl/parser.y
tools/widl/server.c
tools/widl/widltypes.h
Support 'ref' and 'unique' attributes for pointers.
2005-03-27 Jacek Caban (from WINE) 2005-03-27 Jacek Caban (from WINE)
tools/widl/parser.y tools/widl/parser.y

View file

@ -187,6 +187,7 @@ static void write_typeformatstring(type_t *iface)
var_t *var; var_t *var;
int out_attr; int out_attr;
int string_attr; int string_attr;
int ptr_attr, ref_attr, unique_attr;
print_client("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n"); print_client("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n");
print_client("{\n"); print_client("{\n");
@ -217,12 +218,27 @@ static void write_typeformatstring(type_t *iface)
if (var->ptr_level == 1) if (var->ptr_level == 1)
{ {
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 (is_base_type(var->type)) if (is_base_type(var->type))
{ {
if (out_attr) if (out_attr)
print_client("0x11, 0x0c, /* FC_RP [allocated_on_stack] [simple_pointer] */\n"); print_client("0x11, 0x0c, /* FC_RP [allocated_on_stack] [simple_pointer] */\n");
else else
print_client("0x11, 0x08, /* FC_RP [simple_pointer] */\n"); {
if (ptr_attr)
print_client("0x14, 0x08, /* FC_FP [simple_pointer] */\n");
else if (ref_attr)
print_client("0x11, 0x08, /* FC_RP [simple_pointer] */\n");
else if (unique_attr)
print_client("0x12, 0x08, /* FC_UP [simple_pointer] */\n");
}
if (string_attr) if (string_attr)
{ {
if (var->type->type == RPC_FC_CHAR) if (var->type->type == RPC_FC_CHAR)
@ -268,6 +284,7 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset)
int out_attr; int out_attr;
int string_attr; int string_attr;
int nothing_printed = 1; int nothing_printed = 1;
int ptr_attr, ref_attr, unique_attr;
var_t *var; var_t *var;
unsigned int local_type_offset = *type_offset; unsigned int local_type_offset = *type_offset;
@ -286,19 +303,104 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset)
if (!out_attr && !in_attr) if (!out_attr && !in_attr)
in_attr = 1; in_attr = 1;
ptr_attr = is_attr(var->attrs, ATTR_PTR);
ref_attr = is_attr(var->attrs, ATTR_REF);
unique_attr = is_attr(var->attrs, ATTR_UNIQUE);
/* default to 'ref' attribute */
if (ptr_attr + ref_attr + unique_attr == 0)
ref_attr = 1;
if (!in_attr) if (!in_attr)
continue; continue;
if (var->ptr_level == 1 && if (var->ptr_level == 1)
string_attr &&
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
{ {
size = 12; if (unique_attr)
alignment = 0; {
if (last_size != -1) if (string_attr &&
fprintf(client, " +"); (var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
fprintf(client, " %dU", (size == 0) ? 0 : size + alignment); {
nothing_printed = 0; size = 16;
alignment = 0;
if (last_size != -1)
fprintf(client, " +");
fprintf(client, " %dU", (size == 0) ? 0 : size + alignment);
nothing_printed = 0;
}
else
{
size = 8;
alignment = 0;
if (last_size != -1)
fprintf(client, " +");
fprintf(client, " %dU", (size == 0) ? 0 : size + alignment);
nothing_printed = 0;
}
}
else if (ref_attr)
{
if (string_attr &&
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
{
size = 12;
alignment = 0;
if (last_size != -1)
fprintf(client, " +");
fprintf(client, " %dU", (size == 0) ? 0 : size + alignment);
nothing_printed = 0;
}
else
{
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 (last_size != -1)
fprintf(client, " +");
fprintf(client, " %dU", (size == 0) ? 0 : size + alignment);
nothing_printed = 0;
}
}
} }
else else
{ {
@ -377,20 +479,46 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset)
if (!out_attr && !in_attr) if (!out_attr && !in_attr)
in_attr = 1; in_attr = 1;
ptr_attr = is_attr(var->attrs, ATTR_PTR);
ref_attr = is_attr(var->attrs, ATTR_REF);
unique_attr = is_attr(var->attrs, ATTR_UNIQUE);
/* default to 'ref' attribute */
if (ptr_attr + ref_attr + unique_attr == 0)
ref_attr = 1;
if (in_attr) if (in_attr)
{ {
if (var->ptr_level == 1 && if (var->ptr_level == 1 &&
string_attr && string_attr &&
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR)) (var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
{ {
print_client("NdrConformantStringBufferSize(\n"); if (ptr_attr)
indent++; {
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n"); /* FIXME: not supported yet */
print_client("(unsigned char __RPC_FAR *)%s,\n", var->name); }
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n", if (ref_attr)
local_type_offset + 2); {
nothing_printed = 1; print_client("NdrConformantStringBufferSize(\n");
indent--; 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 + 2);
nothing_printed = 1;
indent--;
}
else if (unique_attr)
{
print_client("NdrPointerBufferSize(\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);
nothing_printed = 1;
indent--;
}
} }
} }
@ -415,6 +543,7 @@ static void marshall_in_arguments(func_t *func, unsigned int *type_offset)
int in_attr; int in_attr;
int out_attr; int out_attr;
int string_attr; int string_attr;
int ptr_attr, ref_attr, unique_attr;
var_t *var; var_t *var;
if (!func->args) if (!func->args)
@ -441,17 +570,103 @@ static void marshall_in_arguments(func_t *func, unsigned int *type_offset)
return; return;
} }
if (var->ptr_level == 1 && if (var->ptr_level == 1)
string_attr &&
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
{ {
print_client("NdrConformantStringMarshall(\n"); ptr_attr = is_attr(var->attrs, ATTR_PTR);
indent++; ref_attr = is_attr(var->attrs, ATTR_REF);
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n"); unique_attr = is_attr(var->attrs, ATTR_UNIQUE);
print_client("(unsigned char __RPC_FAR *)%s,\n", var->name); if (ptr_attr + ref_attr + unique_attr == 0)
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n", *type_offset + 2); ref_attr = 1;
indent--;
fprintf(client, "\n"); if (ref_attr)
{
if (string_attr &&
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
{
print_client("NdrConformantStringMarshall(\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 + 2);
indent--;
fprintf(client, "\n");
}
else
{
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 (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;
}
}
}
else if (unique_attr)
{
print_client("NdrPointerMarshall(\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);
indent--;
fprintf(client, "\n");
}
} }
else else
{ {
@ -675,6 +890,9 @@ static void unmarshall_out_arguments(func_t *func)
static void check_pointers(func_t *func) static void check_pointers(func_t *func)
{ {
var_t *var; var_t *var;
int ptr_attr;
int ref_attr;
int unique_attr;
if (!func->args) if (!func->args)
return; return;
@ -683,20 +901,50 @@ static void check_pointers(func_t *func)
while (NEXT_LINK(var)) var = NEXT_LINK(var); while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var) while (var)
{ {
if (var->ptr_level == 1) 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 (var->ptr_level == 0)
{ {
print_client("if (!%s)\n", var->name); if (ptr_attr + ref_attr + unique_attr != 0)
print_client("{\n"); {
indent++; error("The attributes [ptr], [ref] and [unique] can only be used for pointers!\n");
print_client("RpcRaiseException(RPC_X_NULL_REF_POINTER);\n"); return;
indent--; }
print_client("}\n");
fprintf(client, "\n");
} }
else if (var->ptr_level > 1) else
{ {
error("Pointer level %d not supported!\n", var->ptr_level); /* default to 'ref' attribute */
return; if (ptr_attr + ref_attr + unique_attr == 0)
{
ref_attr = 1;
}
if (ptr_attr + ref_attr + unique_attr > 1)
{
error("The attributes [ptr], [ref] and [unique] are mutually exclusive!\n");
return;
}
if (var->ptr_level == 1)
{
if (ref_attr)
{
print_client("if (!%s)\n", var->name);
print_client("{\n");
indent++;
print_client("RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
indent--;
print_client("}\n");
fprintf(client, "\n");
}
}
else if (var->ptr_level > 1)
{
error("Pointer level %d not supported!\n", var->ptr_level);
return;
}
} }
var = PREV_LINK(var); var = PREV_LINK(var);

View file

@ -4555,6 +4555,7 @@ static struct keyword {
{"propput", tPROPPUT}, {"propput", tPROPPUT},
{"propputref", tPROPPUTREF}, {"propputref", tPROPPUTREF},
/* ... */ /* ... */
{"ptr", tPTR},
{"public", tPUBLIC}, {"public", tPUBLIC},
/* ... */ /* ... */
{"readonly", tREADONLY}, {"readonly", tREADONLY},
@ -4579,8 +4580,8 @@ static struct keyword {
/* ... */ /* ... */
{"transmit_as", tTRANSMITAS}, {"transmit_as", tTRANSMITAS},
{"typedef", tTYPEDEF}, {"typedef", tTYPEDEF},
{"union", tUNION},
/* ... */ /* ... */
{"union", tUNION},
{"unique", tUNIQUE}, {"unique", tUNIQUE},
{"unsigned", tUNSIGNED}, {"unsigned", tUNSIGNED},
/* ... */ /* ... */

View file

@ -275,6 +275,7 @@ static struct keyword {
{"propput", tPROPPUT}, {"propput", tPROPPUT},
{"propputref", tPROPPUTREF}, {"propputref", tPROPPUTREF},
/* ... */ /* ... */
{"ptr", tPTR},
{"public", tPUBLIC}, {"public", tPUBLIC},
/* ... */ /* ... */
{"readonly", tREADONLY}, {"readonly", tREADONLY},
@ -299,8 +300,8 @@ static struct keyword {
/* ... */ /* ... */
{"transmit_as", tTRANSMITAS}, {"transmit_as", tTRANSMITAS},
{"typedef", tTYPEDEF}, {"typedef", tTYPEDEF},
{"union", tUNION},
/* ... */ /* ... */
{"union", tUNION},
{"unique", tUNIQUE}, {"unique", tUNIQUE},
{"unsigned", tUNSIGNED}, {"unsigned", tUNSIGNED},
/* ... */ /* ... */

View file

@ -162,6 +162,7 @@ static type_t std_uhyper = { "MIDL_uhyper" };
%token tPOINTERDEFAULT %token tPOINTERDEFAULT
%token tPROPERTIES %token tPROPERTIES
%token tPROPGET tPROPPUT tPROPPUTREF %token tPROPGET tPROPPUT tPROPPUTREF
%token tPTR
%token tPUBLIC %token tPUBLIC
%token tREADONLY tREF %token tREADONLY tREF
%token tRESTRICTED %token tRESTRICTED
@ -373,8 +374,10 @@ attribute:
| tPROPGET { $$ = make_attr(ATTR_PROPGET); } | tPROPGET { $$ = make_attr(ATTR_PROPGET); }
| tPROPPUT { $$ = make_attr(ATTR_PROPPUT); } | tPROPPUT { $$ = make_attr(ATTR_PROPPUT); }
| tPROPPUTREF { $$ = make_attr(ATTR_PROPPUTREF); } | tPROPPUTREF { $$ = make_attr(ATTR_PROPPUTREF); }
| tPTR { $$ = make_attr(ATTR_PTR); }
| tPUBLIC { $$ = make_attr(ATTR_PUBLIC); } | tPUBLIC { $$ = make_attr(ATTR_PUBLIC); }
| tREADONLY { $$ = make_attr(ATTR_READONLY); } | tREADONLY { $$ = make_attr(ATTR_READONLY); }
| tREF { $$ = make_attr(ATTR_REF); }
| tRESTRICTED { $$ = make_attr(ATTR_RESTRICTED); } | tRESTRICTED { $$ = make_attr(ATTR_RESTRICTED); }
| tRETVAL { $$ = make_attr(ATTR_RETVAL); } | tRETVAL { $$ = make_attr(ATTR_RETVAL); }
| tSIZEIS '(' m_exprs ')' { $$ = make_attrp(ATTR_SIZEIS, $3); } | tSIZEIS '(' m_exprs ')' { $$ = make_attrp(ATTR_SIZEIS, $3); }
@ -383,6 +386,7 @@ attribute:
| tSWITCHIS '(' expr ')' { $$ = make_attrp(ATTR_SWITCHIS, $3); } | tSWITCHIS '(' expr ')' { $$ = make_attrp(ATTR_SWITCHIS, $3); }
| tSWITCHTYPE '(' type ')' { $$ = make_attrp(ATTR_SWITCHTYPE, type_ref($3)); } | tSWITCHTYPE '(' type ')' { $$ = make_attrp(ATTR_SWITCHTYPE, type_ref($3)); }
| tTRANSMITAS '(' type ')' { $$ = make_attrp(ATTR_TRANSMITAS, type_ref($3)); } | tTRANSMITAS '(' type ')' { $$ = make_attrp(ATTR_TRANSMITAS, type_ref($3)); }
| tUNIQUE { $$ = make_attr(ATTR_UNIQUE); }
| tUUID '(' aUUID ')' { $$ = make_attrp(ATTR_UUID, $3); } | tUUID '(' aUUID ')' { $$ = make_attrp(ATTR_UUID, $3); }
| tV1ENUM { $$ = make_attr(ATTR_V1ENUM); } | tV1ENUM { $$ = make_attr(ATTR_V1ENUM); }
| tVARARG { $$ = make_attr(ATTR_VARARG); } | tVARARG { $$ = make_attr(ATTR_VARARG); }

View file

@ -192,6 +192,7 @@ static void write_typeformatstring(type_t *iface)
var_t *var; var_t *var;
int out_attr; int out_attr;
int string_attr; int string_attr;
int ptr_attr, ref_attr, unique_attr;
print_server("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n"); print_server("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n");
print_server("{\n"); print_server("{\n");
@ -222,12 +223,27 @@ static void write_typeformatstring(type_t *iface)
if (var->ptr_level == 1) if (var->ptr_level == 1)
{ {
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 (is_base_type(var->type)) if (is_base_type(var->type))
{ {
if (out_attr) if (out_attr)
print_server("0x11, 0x0c, /* FC_RP [allocated_on_stack] [simple_pointer] */\n"); print_server("0x11, 0x0c, /* FC_RP [allocated_on_stack] [simple_pointer] */\n");
else else
print_server("0x11, 0x08, /* FC_RP [simple_pointer] */\n"); {
if (ptr_attr)
print_server("0x14, 0x08, /* FC_FP [simple_pointer] */\n");
else if (ref_attr)
print_server("0x11, 0x08, /* FC_RP [simple_pointer] */\n");
else if (unique_attr)
print_server("0x12, 0x08, /* FC_UP [simple_pointer] */\n");
}
if (string_attr) if (string_attr)
{ {
if (var->type->type == RPC_FC_CHAR) if (var->type->type == RPC_FC_CHAR)
@ -439,9 +455,9 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset)
unsigned int size; unsigned int size;
unsigned int last_size = 0; unsigned int last_size = 0;
var_t *var; var_t *var;
int in_attr; int in_attr, out_attr;
int out_attr;
int string_attr; int string_attr;
int ptr_attr, ref_attr, unique_attr;
if (!func->args) if (!func->args)
return; return;
@ -460,18 +476,104 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset)
if (in_attr) if (in_attr)
{ {
if (var->ptr_level == 1 && if (var->ptr_level == 1)
string_attr &&
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
{ {
print_server("NdrConformantStringUnmarshall(\n"); ptr_attr = is_attr(var->attrs, ATTR_PTR);
indent++; ref_attr = is_attr(var->attrs, ATTR_REF);
print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n"); unique_attr = is_attr(var->attrs, ATTR_UNIQUE);
print_server("(unsigned char __RPC_FAR * __RPC_FAR *)&%s,\n", var->name); if (ptr_attr + ref_attr + unique_attr == 0)
print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n", *type_offset + 2); ref_attr = 1;
print_server("(unsigned char)0);\n");
indent--; if (ref_attr)
fprintf(server, "\n"); {
if (string_attr &&
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
{
print_server("NdrConformantStringUnmarshall(\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", *type_offset + 2);
print_server("(unsigned char)0);\n");
indent--;
fprintf(server, "\n");
}
else
{
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 (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;
}
}
}
else if (unique_attr)
{
print_server("NdrPointerUnmarshall(\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", *type_offset);
print_server("(unsigned char)0);\n");
indent--;
fprintf(server, "\n");
}
} }
else else
{ {
@ -523,35 +625,15 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset)
if (alignment != 0) if (alignment != 0)
print_server("_StubMsg.Buffer += %u;\n", alignment); print_server("_StubMsg.Buffer += %u;\n", alignment);
if (var->ptr_level == 0) print_server("");
{ write_name(server, var);
print_server(""); fprintf(server, " = *((");
write_name(server, var); write_type(server, var->type, NULL, var->tname);
fprintf(server, " = *(("); fprintf(server, " __RPC_FAR*)_StubMsg.Buffer);\n");
write_type(server, var->type, NULL, var->tname); print_server("_StubMsg.Buffer += sizeof(");
fprintf(server, " __RPC_FAR*)_StubMsg.Buffer);\n"); write_type(server, var->type, NULL, var->tname);
print_server("_StubMsg.Buffer += sizeof("); fprintf(server, ");\n");
write_type(server, var->type, NULL, var->tname); fprintf(server, "\n");
fprintf(server, ");\n");
fprintf(server, "\n");
}
else if (var->ptr_level == 1)
{
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");
}
else
{
error("Pointer level %d is not supported!\n", var->ptr_level);
return;
}
last_size = size; last_size = size;
} }

View file

@ -98,8 +98,10 @@ enum attr_type
ATTR_PROPGET, ATTR_PROPGET,
ATTR_PROPPUT, ATTR_PROPPUT,
ATTR_PROPPUTREF, ATTR_PROPPUTREF,
ATTR_PTR,
ATTR_PUBLIC, ATTR_PUBLIC,
ATTR_READONLY, ATTR_READONLY,
ATTR_REF,
ATTR_RESTRICTED, ATTR_RESTRICTED,
ATTR_RETVAL, ATTR_RETVAL,
ATTR_SIZEIS, ATTR_SIZEIS,
@ -108,6 +110,7 @@ enum attr_type
ATTR_SWITCHIS, ATTR_SWITCHIS,
ATTR_SWITCHTYPE, ATTR_SWITCHTYPE,
ATTR_TRANSMITAS, ATTR_TRANSMITAS,
ATTR_UNIQUE,
ATTR_UUID, ATTR_UUID,
ATTR_V1ENUM, ATTR_V1ENUM,
ATTR_VARARG, ATTR_VARARG,

File diff suppressed because it is too large Load diff

View file

@ -98,40 +98,41 @@ typedef union {
#define tPROPGET 341 #define tPROPGET 341
#define tPROPPUT 342 #define tPROPPUT 342
#define tPROPPUTREF 343 #define tPROPPUTREF 343
#define tPUBLIC 344 #define tPTR 344
#define tREADONLY 345 #define tPUBLIC 345
#define tREF 346 #define tREADONLY 346
#define tRESTRICTED 347 #define tREF 347
#define tRETVAL 348 #define tRESTRICTED 348
#define tSHORT 349 #define tRETVAL 349
#define tSIGNED 350 #define tSHORT 350
#define tSIZEIS 351 #define tSIGNED 351
#define tSIZEOF 352 #define tSIZEIS 352
#define tSMALL 353 #define tSIZEOF 353
#define tSOURCE 354 #define tSMALL 354
#define tSTDCALL 355 #define tSOURCE 355
#define tSTRING 356 #define tSTDCALL 356
#define tSTRUCT 357 #define tSTRING 357
#define tSWITCH 358 #define tSTRUCT 358
#define tSWITCHIS 359 #define tSWITCH 359
#define tSWITCHTYPE 360 #define tSWITCHIS 360
#define tTRANSMITAS 361 #define tSWITCHTYPE 361
#define tTYPEDEF 362 #define tTRANSMITAS 362
#define tUNION 363 #define tTYPEDEF 363
#define tUNIQUE 364 #define tUNION 364
#define tUNSIGNED 365 #define tUNIQUE 365
#define tUUID 366 #define tUNSIGNED 366
#define tV1ENUM 367 #define tUUID 367
#define tVARARG 368 #define tV1ENUM 368
#define tVERSION 369 #define tVARARG 369
#define tVOID 370 #define tVERSION 370
#define tWCHAR 371 #define tVOID 371
#define tWIREMARSHAL 372 #define tWCHAR 372
#define tPOINTERTYPE 373 #define tWIREMARSHAL 373
#define COND 374 #define tPOINTERTYPE 374
#define CAST 375 #define COND 375
#define PPTR 376 #define CAST 376
#define NEG 377 #define PPTR 377
#define NEG 378
extern YYSTYPE yylval; extern YYSTYPE yylval;