Fix [out, size_is, unique] parameter issues.
Modified: trunk/reactos/tools/widl/ChangeLog
Modified: trunk/reactos/tools/widl/client.c
Modified: trunk/reactos/tools/widl/server.c
_____
Modified: trunk/reactos/tools/widl/ChangeLog
--- trunk/reactos/tools/widl/ChangeLog 2005-10-16 14:24:11 UTC (rev
18498)
+++ trunk/reactos/tools/widl/ChangeLog 2005-10-16 15:27:38 UTC (rev
18499)
@@ -1,5 +1,12 @@
ChangeLog
+2005-10-16 ekohl
+
+ tools/widl/client.c
+ tools/widl/server.c
+
+- Fix [out, size_is, unique] parameter issues.
+
2005-10-09 ekohl
tools/widl/client.c
_____
Modified: trunk/reactos/tools/widl/client.c
--- trunk/reactos/tools/widl/client.c 2005-10-16 14:24:11 UTC (rev
18498)
+++ trunk/reactos/tools/widl/client.c 2005-10-16 15:27:38 UTC (rev
18499)
@@ -518,7 +518,13 @@
if (type != NULL)
type_type = type->type;
- print_client("0x11, 0x00, /* FC_RP */\n");
+ if (ref_attr)
+ print_client("0x11, 0x00, /* FC_RP
*/\n");
+ else if (unique_attr)
+ print_client("0x12, 0x00, /* FC_UP
*/\n");
+ else if (ptr_attr)
+ print_client("0x14, 0x00, /* FC_FP
*/\n");
+
print_client("NdrFcShort(0x02),\n");
if (string_attr)
@@ -873,10 +879,6 @@
if ((var->type->type == RPC_FC_CHAR ||
var->type->type == RPC_FC_WCHAR))
{
- if (ptr_attr)
- {
- /* FIXME: not supported yet */
- }
if (ref_attr)
{
print_client("NdrConformantStringBufferSize(\n");
@@ -899,6 +901,10 @@
nothing_printed = 1;
indent--;
}
+ else if (ptr_attr)
+ {
+ /* FIXME: not supported yet */
+ }
}
}
else
@@ -910,14 +916,32 @@
((var_t *)sizeis_attr)->name);
fprintf(client, "\n");
-
print_client("NdrConformantArrayBufferSize(\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);
- indent--;
- nothing_printed = 1;
+ if (ref_attr)
+ {
+
print_client("NdrConformantArrayBufferSize(\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);
+ indent--;
+ nothing_printed = 1;
+ }
+ 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--;
+ }
+ else if (ptr_attr)
+ {
+ /* FIXME: not supported yet */
+ }
}
}
}
@@ -945,6 +969,7 @@
int ptr_attr, ref_attr, unique_attr;
void *sizeis_attr;
var_t *var;
+ int default_align = 0;
if (!func->args)
return;
@@ -980,25 +1005,25 @@
string_attr = is_attr(var->attrs, ATTR_STRING);
sizeis_attr = get_attrp(var->attrs, ATTR_SIZEIS);
- if (sizeis_attr)
+ if (ref_attr)
{
- print_client("_StubMsg.MaxCount = %s;\n",
- ((var_t *)sizeis_attr)->name);
- fprintf(client, "\n");
+ if (sizeis_attr)
+ {
+ print_client("_StubMsg.MaxCount = %s;\n",
+ ((var_t *)sizeis_attr)->name);
+ fprintf(client, "\n");
- print_client("NdrConformantArrayMarshall(\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);
- indent--;
- fprintf(client, "\n");
- print_client("_StubMsg.Buffer = (unsigned char
__RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
- fprintf(client, "\n");
- }
- else if (ref_attr)
- {
+ print_client("NdrConformantArrayMarshall(\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);
+ indent--;
+ fprintf(client, "\n");
+ default_align = 1;
+ }
+ else
if (string_attr &&
(var->type->type == RPC_FC_CHAR ||
var->type->type == RPC_FC_WCHAR))
{
@@ -1010,8 +1035,7 @@
local_type_offset + 2);
indent--;
fprintf(client, "\n");
- print_client("_StubMsg.Buffer = (unsigned char
__RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
- fprintf(client, "\n");
+ default_align = 1;
}
else
{
@@ -1060,6 +1084,13 @@
if (size != 0)
{
+ if (default_align)
+ {
+ print_client("_StubMsg.Buffer =
(unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
+ fprintf(client, "\n");
+ default_align = 0;
+ }
+ else
if (alignment != 0)
print_client("_StubMsg.Buffer +=
%u;\n", alignment);
@@ -1081,6 +1112,13 @@
}
else if (unique_attr)
{
+ if (sizeis_attr)
+ {
+ print_client("_StubMsg.MaxCount = %s;\n",
+ ((var_t *)sizeis_attr)->name);
+ fprintf(client, "\n");
+ }
+
print_client("NdrPointerMarshall(\n");
indent++;
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
@@ -1089,6 +1127,7 @@
local_type_offset);
indent--;
fprintf(client, "\n");
+ default_align = 1;
}
}
else
@@ -1140,6 +1179,14 @@
if (size != 0)
{
+ if (default_align)
+ {
+ fprintf(client, "\n");
+ print_client("_StubMsg.Buffer = (unsigned
char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
+ fprintf(client, "\n");
+ default_align = 0;
+ }
+ else
if (alignment != 0)
print_client("_StubMsg.Buffer += %u;\n",
alignment);
@@ -1170,6 +1217,7 @@
local_type_offset + 4);
indent--;
fprintf(client, "\n");
+ default_align = 1;
}
}
}
@@ -1193,6 +1241,7 @@
var_t *var;
var_t *def;
unsigned int local_type_offset = *type_offset;
+ int default_align = 0;
def = func->def;
@@ -1236,8 +1285,7 @@
print_client("(unsigned char)0);\n");
indent--;
fprintf(client, "\n");
- print_client("_StubMsg.Buffer = (unsigned char
__RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
- fprintf(client, "\n");
+ default_align = 1;
}
else
{
@@ -1251,8 +1299,7 @@
print_client("(unsigned char)0);\n");
indent--;
fprintf(client, "\n");
- print_client("_StubMsg.Buffer = (unsigned char
__RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
- fprintf(client, "\n");
+ default_align = 1;
}
}
else if (is_base_type(var->type))
@@ -1304,12 +1351,9 @@
{
if (var->ptr_level == 1)
{
- fprintf(client, "\n");
- if (alignment != 0)
- print_client("_StubMsg.Buffer +=
%u;\n", alignment);
-
if (unique_attr)
{
+ fprintf(client, "\n");
print_client("NdrPointerUnmarshall(\n");
indent++;
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
@@ -1319,9 +1363,22 @@
print_client("(unsigned char)0);\n");
indent--;
fprintf(client, "\n");
+ default_align = 1;
}
else
{
+ fprintf(client, "\n");
+ if (default_align)
+ {
+ print_client("_StubMsg.Buffer =
(unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
+ fprintf(client, "\n");
+ default_align = 0;
+ }
+ else
+ if (alignment != 0)
+ print_client("_StubMsg.Buffer +=
%u;\n", alignment);
+
+
print_client("*");
write_name(client, var);
fprintf(client, " = *((");
@@ -1351,6 +1408,7 @@
print_client("(unsigned char)0);\n");
indent--;
fprintf(client, "\n");
+ default_align = 1;
}
}
else
@@ -1400,6 +1458,13 @@
}
fprintf(client, "\n");
+ if (default_align)
+ {
+ print_client("_StubMsg.Buffer = (unsigned char __RPC_FAR
*)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
+ fprintf(client, "\n");
+ default_align = 0;
+ }
+ else
if (alignment != 0)
print_client("_StubMsg.Buffer += %u;\n", alignment);
print_client("_RetVal = *((");
_____
Modified: trunk/reactos/tools/widl/server.c
--- trunk/reactos/tools/widl/server.c 2005-10-16 14:24:11 UTC (rev
18498)
+++ trunk/reactos/tools/widl/server.c 2005-10-16 15:27:38 UTC (rev
18499)
@@ -515,7 +515,12 @@
if (type != NULL)
type_type = type->type;
- print_server("0x11, 0x00, /* FC_RP */\n");
+ if (ref_attr)
+ print_server("0x11, 0x00, /* FC_RP
*/\n");
+ else if (unique_attr)
+ print_server("0x12, 0x00, /* FC_UP
*/\n");
+ else if (ptr_attr)
+ print_server("0x14, 0x00, /* FC_FP
*/\n");
print_server("NdrFcShort(0x02),\n");
if (string_attr)
@@ -622,7 +627,7 @@
int last_size = -1;
int in_attr;
int out_attr;
- int string_attr;
+ int string_attr, unique_attr;
void *sizeis_attr;
int empty_line;
var_t *var;
@@ -892,6 +897,7 @@
out_attr = is_attr(var->attrs, ATTR_OUT);
in_attr = is_attr(var->attrs, ATTR_IN);
string_attr = is_attr(var->attrs, ATTR_STRING);
+ unique_attr = is_attr(var->attrs, ATTR_UNIQUE);
/* set 'in' attribute if neither 'in' nor 'out' is
found */
if (!out_attr && !in_attr)
@@ -899,6 +905,7 @@
if (var->ptr_level == 1 &&
string_attr &&
+ unique_attr == 0 &&
(var->type->type == RPC_FC_BYTE ||
var->type->type == RPC_FC_CHAR ||
var->type->type == RPC_FC_WCHAR))
@@ -968,6 +975,7 @@
int string_attr;
int ptr_attr, ref_attr, unique_attr;
void *sizeis_attr;
+ int default_align = 0;
if (!func->args)
return;
@@ -1011,23 +1019,21 @@
print_server("(unsigned char)0);\n");
indent--;
fprintf(server, "\n");
- print_server("_StubMsg.Buffer = (unsigned
char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
- fprintf(server, "\n");
+ default_align = 1;
}
}
else if (sizeis_attr)
{
-
print_server("NdrConformantArrayUnmarshall(\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");
- print_server("_StubMsg.Buffer = (unsigned
char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
- fprintf(server, "\n");
+
print_server("NdrConformantArrayUnmarshall(\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");
+ default_align = 1;
}
else
{
@@ -1076,6 +1082,13 @@
if (size != 0)
{
+ if (default_align)
+ {
+ print_server("_StubMsg.Buffer =
(unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
+ fprintf(server, "\n");
+ default_align = 0;
+ }
+ else
if (alignment != 0)
print_server("_StubMsg.Buffer +=
%u;\n", alignment);
@@ -1104,6 +1117,7 @@
print_server("(unsigned char)0);\n");
indent--;
fprintf(server, "\n");
+ default_align = 1;
}
}
@@ -1156,6 +1170,13 @@
if (size != 0)
{
+ if (default_align)
+ {
+ print_server("_StubMsg.Buffer = (unsigned
char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
+ fprintf(server, "\n");
+ default_align = 0;
+ }
+ else
if (alignment != 0)
print_server("_StubMsg.Buffer += %u;\n",
alignment);
@@ -1185,6 +1206,7 @@
print_server("(unsigned char)0);\n");
indent--;
fprintf(server, "\n");
+ default_align = 1;
}
}
}
@@ -1208,6 +1230,7 @@
int ptr_attr, ref_attr, unique_attr;
void *sizeis_attr;
unsigned int local_type_offset = *type_offset;
+ int default_align = 0;
def = func->def;
@@ -1249,8 +1272,7 @@
local_type_offset + 4);
indent--;
fprintf(server, "\n");
- print_server("_StubMsg.Buffer = (unsigned char
__RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
- fprintf(server, "\n");
+ default_align = 1;
}
else
{
@@ -1269,8 +1291,7 @@
local_type_offset + 4);
indent--;
fprintf(server, "\n");
- print_server("_StubMsg.Buffer = (unsigned char
__RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
- fprintf(server, "\n");
+ default_align = 1;
}
}
else if (is_base_type(var->type))
@@ -1320,9 +1341,6 @@
if (size != 0)
{
- if (alignment != 0)
- print_server("_StubMsg.Buffer += %u;\n",
alignment);
-
if (var->ptr_level == 1)
{
if (unique_attr)
@@ -1335,9 +1353,20 @@
local_type_offset);
indent--;
fprintf(server, "\n");
+ default_align = 1;
}
else
{
+ if (default_align)
+ {
+ print_server("_StubMsg.Buffer =
(unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
+ fprintf(server, "\n");
+ default_align = 0;
+ }
+ else
+ if (alignment != 0)
+ print_server("_StubMsg.Buffer +=
%u;\n", alignment);
+
fprintf(server, "\n");
print_server("*((");
write_type(server, var->type, NULL,
var->tname);
@@ -1369,6 +1398,7 @@
print_server("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n",
local_type_offset + 4);
indent--;
+ default_align = 1;
}
}
@@ -1411,6 +1441,13 @@
}
fprintf(server, "\n");
+ if (default_align)
+ {
+ print_server("_StubMsg.Buffer = (unsigned char __RPC_FAR
*)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
+ fprintf(server, "\n");
+ default_align = 0;
+ }
+ else
if (alignment != 0)
print_server("_StubMsg.Buffer += %u;\n", alignment);
print_server("*((");
@@ -1450,7 +1487,7 @@
static void cleanup_return_buffer(func_t *func, unsigned int
*type_offset)
{
var_t *var;
- int string_attr;
+ int string_attr, unique_attr;
void *sizeis_attr;
unsigned int local_type_offset = *type_offset;
@@ -1464,8 +1501,9 @@
{
sizeis_attr = get_attrp(var->attrs, ATTR_SIZEIS);
string_attr = is_attr(var->attrs, ATTR_STRING);
+ unique_attr = is_attr(var->attrs, ATTR_UNIQUE);
- if (sizeis_attr != NULL)
+ if (sizeis_attr != NULL && unique_attr == 0)
{
if (first_arg == 0)
fprintf(server, "\n");