mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Support 'ref' and 'unique' attributes for pointers.
svn path=/trunk/; revision=14474
This commit is contained in:
parent
d840ae26ad
commit
938d6d1baf
9 changed files with 1349 additions and 991 deletions
|
@ -1,5 +1,15 @@
|
|||
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)
|
||||
|
||||
tools/widl/parser.y
|
||||
|
|
|
@ -187,6 +187,7 @@ static void write_typeformatstring(type_t *iface)
|
|||
var_t *var;
|
||||
int out_attr;
|
||||
int string_attr;
|
||||
int ptr_attr, ref_attr, unique_attr;
|
||||
|
||||
print_client("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n");
|
||||
print_client("{\n");
|
||||
|
@ -217,12 +218,27 @@ static void write_typeformatstring(type_t *iface)
|
|||
|
||||
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 (out_attr)
|
||||
print_client("0x11, 0x0c, /* FC_RP [allocated_on_stack] [simple_pointer] */\n");
|
||||
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 (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 string_attr;
|
||||
int nothing_printed = 1;
|
||||
int ptr_attr, ref_attr, unique_attr;
|
||||
var_t *var;
|
||||
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)
|
||||
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)
|
||||
continue;
|
||||
|
||||
if (var->ptr_level == 1 &&
|
||||
string_attr &&
|
||||
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
|
||||
if (var->ptr_level == 1)
|
||||
{
|
||||
size = 12;
|
||||
alignment = 0;
|
||||
if (last_size != -1)
|
||||
fprintf(client, " +");
|
||||
fprintf(client, " %dU", (size == 0) ? 0 : size + alignment);
|
||||
nothing_printed = 0;
|
||||
if (unique_attr)
|
||||
{
|
||||
if (string_attr &&
|
||||
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -377,20 +479,46 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset)
|
|||
if (!out_attr && !in_attr)
|
||||
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 (var->ptr_level == 1 &&
|
||||
string_attr &&
|
||||
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
|
||||
{
|
||||
print_client("NdrConformantStringBufferSize(\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 + 2);
|
||||
nothing_printed = 1;
|
||||
indent--;
|
||||
if (ptr_attr)
|
||||
{
|
||||
/* FIXME: not supported yet */
|
||||
}
|
||||
if (ref_attr)
|
||||
{
|
||||
print_client("NdrConformantStringBufferSize(\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 + 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 out_attr;
|
||||
int string_attr;
|
||||
int ptr_attr, ref_attr, unique_attr;
|
||||
var_t *var;
|
||||
|
||||
if (!func->args)
|
||||
|
@ -441,17 +570,103 @@ static void marshall_in_arguments(func_t *func, unsigned int *type_offset)
|
|||
return;
|
||||
}
|
||||
|
||||
if (var->ptr_level == 1 &&
|
||||
string_attr &&
|
||||
(var->type->type == RPC_FC_CHAR || var->type->type == RPC_FC_WCHAR))
|
||||
if (var->ptr_level == 1)
|
||||
{
|
||||
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");
|
||||
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 (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
|
||||
{
|
||||
|
@ -675,6 +890,9 @@ static void unmarshall_out_arguments(func_t *func)
|
|||
static void check_pointers(func_t *func)
|
||||
{
|
||||
var_t *var;
|
||||
int ptr_attr;
|
||||
int ref_attr;
|
||||
int unique_attr;
|
||||
|
||||
if (!func->args)
|
||||
return;
|
||||
|
@ -683,20 +901,50 @@ static void check_pointers(func_t *func)
|
|||
while (NEXT_LINK(var)) var = NEXT_LINK(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);
|
||||
print_client("{\n");
|
||||
indent++;
|
||||
print_client("RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
|
||||
indent--;
|
||||
print_client("}\n");
|
||||
fprintf(client, "\n");
|
||||
if (ptr_attr + ref_attr + unique_attr != 0)
|
||||
{
|
||||
error("The attributes [ptr], [ref] and [unique] can only be used for pointers!\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (var->ptr_level > 1)
|
||||
else
|
||||
{
|
||||
error("Pointer level %d not supported!\n", var->ptr_level);
|
||||
return;
|
||||
/* default to 'ref' attribute */
|
||||
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);
|
||||
|
|
|
@ -4555,6 +4555,7 @@ static struct keyword {
|
|||
{"propput", tPROPPUT},
|
||||
{"propputref", tPROPPUTREF},
|
||||
/* ... */
|
||||
{"ptr", tPTR},
|
||||
{"public", tPUBLIC},
|
||||
/* ... */
|
||||
{"readonly", tREADONLY},
|
||||
|
@ -4579,8 +4580,8 @@ static struct keyword {
|
|||
/* ... */
|
||||
{"transmit_as", tTRANSMITAS},
|
||||
{"typedef", tTYPEDEF},
|
||||
{"union", tUNION},
|
||||
/* ... */
|
||||
{"union", tUNION},
|
||||
{"unique", tUNIQUE},
|
||||
{"unsigned", tUNSIGNED},
|
||||
/* ... */
|
||||
|
|
|
@ -275,6 +275,7 @@ static struct keyword {
|
|||
{"propput", tPROPPUT},
|
||||
{"propputref", tPROPPUTREF},
|
||||
/* ... */
|
||||
{"ptr", tPTR},
|
||||
{"public", tPUBLIC},
|
||||
/* ... */
|
||||
{"readonly", tREADONLY},
|
||||
|
@ -299,8 +300,8 @@ static struct keyword {
|
|||
/* ... */
|
||||
{"transmit_as", tTRANSMITAS},
|
||||
{"typedef", tTYPEDEF},
|
||||
{"union", tUNION},
|
||||
/* ... */
|
||||
{"union", tUNION},
|
||||
{"unique", tUNIQUE},
|
||||
{"unsigned", tUNSIGNED},
|
||||
/* ... */
|
||||
|
|
|
@ -162,6 +162,7 @@ static type_t std_uhyper = { "MIDL_uhyper" };
|
|||
%token tPOINTERDEFAULT
|
||||
%token tPROPERTIES
|
||||
%token tPROPGET tPROPPUT tPROPPUTREF
|
||||
%token tPTR
|
||||
%token tPUBLIC
|
||||
%token tREADONLY tREF
|
||||
%token tRESTRICTED
|
||||
|
@ -373,8 +374,10 @@ attribute:
|
|||
| tPROPGET { $$ = make_attr(ATTR_PROPGET); }
|
||||
| tPROPPUT { $$ = make_attr(ATTR_PROPPUT); }
|
||||
| tPROPPUTREF { $$ = make_attr(ATTR_PROPPUTREF); }
|
||||
| tPTR { $$ = make_attr(ATTR_PTR); }
|
||||
| tPUBLIC { $$ = make_attr(ATTR_PUBLIC); }
|
||||
| tREADONLY { $$ = make_attr(ATTR_READONLY); }
|
||||
| tREF { $$ = make_attr(ATTR_REF); }
|
||||
| tRESTRICTED { $$ = make_attr(ATTR_RESTRICTED); }
|
||||
| tRETVAL { $$ = make_attr(ATTR_RETVAL); }
|
||||
| tSIZEIS '(' m_exprs ')' { $$ = make_attrp(ATTR_SIZEIS, $3); }
|
||||
|
@ -383,6 +386,7 @@ attribute:
|
|||
| tSWITCHIS '(' expr ')' { $$ = make_attrp(ATTR_SWITCHIS, $3); }
|
||||
| tSWITCHTYPE '(' type ')' { $$ = make_attrp(ATTR_SWITCHTYPE, type_ref($3)); }
|
||||
| tTRANSMITAS '(' type ')' { $$ = make_attrp(ATTR_TRANSMITAS, type_ref($3)); }
|
||||
| tUNIQUE { $$ = make_attr(ATTR_UNIQUE); }
|
||||
| tUUID '(' aUUID ')' { $$ = make_attrp(ATTR_UUID, $3); }
|
||||
| tV1ENUM { $$ = make_attr(ATTR_V1ENUM); }
|
||||
| tVARARG { $$ = make_attr(ATTR_VARARG); }
|
||||
|
|
|
@ -192,6 +192,7 @@ static void write_typeformatstring(type_t *iface)
|
|||
var_t *var;
|
||||
int out_attr;
|
||||
int string_attr;
|
||||
int ptr_attr, ref_attr, unique_attr;
|
||||
|
||||
print_server("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n");
|
||||
print_server("{\n");
|
||||
|
@ -222,12 +223,27 @@ static void write_typeformatstring(type_t *iface)
|
|||
|
||||
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 (out_attr)
|
||||
print_server("0x11, 0x0c, /* FC_RP [allocated_on_stack] [simple_pointer] */\n");
|
||||
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 (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 last_size = 0;
|
||||
var_t *var;
|
||||
int in_attr;
|
||||
int out_attr;
|
||||
int in_attr, out_attr;
|
||||
int string_attr;
|
||||
int ptr_attr, ref_attr, unique_attr;
|
||||
|
||||
if (!func->args)
|
||||
return;
|
||||
|
@ -460,18 +476,104 @@ static void unmarshall_in_arguments(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 == 1)
|
||||
{
|
||||
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");
|
||||
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 (ref_attr)
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -523,35 +625,15 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset)
|
|||
if (alignment != 0)
|
||||
print_server("_StubMsg.Buffer += %u;\n", alignment);
|
||||
|
||||
if (var->ptr_level == 0)
|
||||
{
|
||||
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 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -98,8 +98,10 @@ enum attr_type
|
|||
ATTR_PROPGET,
|
||||
ATTR_PROPPUT,
|
||||
ATTR_PROPPUTREF,
|
||||
ATTR_PTR,
|
||||
ATTR_PUBLIC,
|
||||
ATTR_READONLY,
|
||||
ATTR_REF,
|
||||
ATTR_RESTRICTED,
|
||||
ATTR_RETVAL,
|
||||
ATTR_SIZEIS,
|
||||
|
@ -108,6 +110,7 @@ enum attr_type
|
|||
ATTR_SWITCHIS,
|
||||
ATTR_SWITCHTYPE,
|
||||
ATTR_TRANSMITAS,
|
||||
ATTR_UNIQUE,
|
||||
ATTR_UUID,
|
||||
ATTR_V1ENUM,
|
||||
ATTR_VARARG,
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -98,40 +98,41 @@ typedef union {
|
|||
#define tPROPGET 341
|
||||
#define tPROPPUT 342
|
||||
#define tPROPPUTREF 343
|
||||
#define tPUBLIC 344
|
||||
#define tREADONLY 345
|
||||
#define tREF 346
|
||||
#define tRESTRICTED 347
|
||||
#define tRETVAL 348
|
||||
#define tSHORT 349
|
||||
#define tSIGNED 350
|
||||
#define tSIZEIS 351
|
||||
#define tSIZEOF 352
|
||||
#define tSMALL 353
|
||||
#define tSOURCE 354
|
||||
#define tSTDCALL 355
|
||||
#define tSTRING 356
|
||||
#define tSTRUCT 357
|
||||
#define tSWITCH 358
|
||||
#define tSWITCHIS 359
|
||||
#define tSWITCHTYPE 360
|
||||
#define tTRANSMITAS 361
|
||||
#define tTYPEDEF 362
|
||||
#define tUNION 363
|
||||
#define tUNIQUE 364
|
||||
#define tUNSIGNED 365
|
||||
#define tUUID 366
|
||||
#define tV1ENUM 367
|
||||
#define tVARARG 368
|
||||
#define tVERSION 369
|
||||
#define tVOID 370
|
||||
#define tWCHAR 371
|
||||
#define tWIREMARSHAL 372
|
||||
#define tPOINTERTYPE 373
|
||||
#define COND 374
|
||||
#define CAST 375
|
||||
#define PPTR 376
|
||||
#define NEG 377
|
||||
#define tPTR 344
|
||||
#define tPUBLIC 345
|
||||
#define tREADONLY 346
|
||||
#define tREF 347
|
||||
#define tRESTRICTED 348
|
||||
#define tRETVAL 349
|
||||
#define tSHORT 350
|
||||
#define tSIGNED 351
|
||||
#define tSIZEIS 352
|
||||
#define tSIZEOF 353
|
||||
#define tSMALL 354
|
||||
#define tSOURCE 355
|
||||
#define tSTDCALL 356
|
||||
#define tSTRING 357
|
||||
#define tSTRUCT 358
|
||||
#define tSWITCH 359
|
||||
#define tSWITCHIS 360
|
||||
#define tSWITCHTYPE 361
|
||||
#define tTRANSMITAS 362
|
||||
#define tTYPEDEF 363
|
||||
#define tUNION 364
|
||||
#define tUNIQUE 365
|
||||
#define tUNSIGNED 366
|
||||
#define tUUID 367
|
||||
#define tV1ENUM 368
|
||||
#define tVARARG 369
|
||||
#define tVERSION 370
|
||||
#define tVOID 371
|
||||
#define tWCHAR 372
|
||||
#define tWIREMARSHAL 373
|
||||
#define tPOINTERTYPE 374
|
||||
#define COND 375
|
||||
#define CAST 376
|
||||
#define PPTR 377
|
||||
#define NEG 378
|
||||
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
|
Loading…
Reference in a new issue