WIDL: output intermediate variables for the method to write into
in stubs
Mike McCormack
mike at codeweavers.com
Thu Sep 9 07:52:30 CDT 2004
ChangeLog:
* output intermediate variables for the method to write into in stubs
-------------- next part --------------
Index: tools/widl/proxy.c
===================================================================
RCS file: /home/wine/wine/tools/widl/proxy.c,v
retrieving revision 1.12
diff -u -r1.12 proxy.c
--- tools/widl/proxy.c 8 Sep 2004 19:01:42 -0000 1.12
+++ tools/widl/proxy.c 9 Sep 2004 11:20:44 -0000
@@ -377,21 +377,34 @@
print_proxy( "\n");
}
-static void stub_clear_output_vars( var_t *arg )
+static void stub_write_locals( var_t *arg )
{
+ int n = 0;
while (arg) {
- print_proxy("(");
+ int outptr = is_attr(arg->attrs, ATTR_OUT);
+
+ /* create a temporary variable to store the output */
+ if (outptr) {
+ var_t temp;
+ memset( &temp, 0, sizeof temp );
+ temp.ptr_level = arg->ptr_level - 1; /* dereference once */
+ print_proxy("");
+ write_type(proxy, arg->type, &temp, arg->tname);
+ fprintf(proxy, " _M%d;\n",n++);
+ }
+ print_proxy("");
write_type(proxy, arg->type, arg, arg->tname);
- fprintf(proxy, ") ");
+ fprintf(proxy, " ");
write_name(proxy, arg);
- fprintf(proxy, " = 0;\n");
+ /* if (outptr) fprintf(proxy, " = &_M%d;\n",n++); */
+ fprintf(proxy, ";\n");
arg = NEXT_LINK(arg);
}
- fprintf(proxy, "\n");
}
static void stub_unmarshall( var_t *arg )
{
+ int n = 0;
if (arg) {
while (NEXT_LINK(arg))
arg = NEXT_LINK(arg);
@@ -426,6 +439,12 @@
printf("FIXME: arg %s has unknown type %d\n", arg->name, type->type );
}
}
+ else if (is_attr(arg->attrs, ATTR_OUT)) {
+ print_proxy("");
+ write_name(proxy, arg);
+ fprintf(proxy," = &_M%d;\n", n);
+ print_proxy("_M%d = 0;\n", n++);
+ }
arg = PREV_LINK(arg);
}
}
@@ -549,7 +568,7 @@
print_proxy( "IRpcStubBuffer* This,\n");
print_proxy( "IRpcChannelBuffer* pRpcChannelBuffer,\n");
print_proxy( "PRPC_MESSAGE pRpcMessage,\n");
- print_proxy( "DWORD* pdwStubPhase)\n");
+ print_proxy( "DWORD* _pdwStubPhase)\n");
indent--;
print_proxy( "{\n");
indent++;
@@ -561,15 +580,7 @@
}
print_proxy("%s* _This = (%s*)((CStdStubBuffer*)This)->pvServerObject;\n", iface->name, iface->name);
print_proxy("MIDL_STUB_MESSAGE _StubMsg;\n");
- arg = cur->args;
- while (arg) {
- print_proxy("");
- write_type(proxy, arg->type, arg, arg->tname);
- fprintf(proxy, " ");
- write_name(proxy, arg);
- fprintf(proxy, ";\n");
- arg = NEXT_LINK(arg);
- }
+ stub_write_locals( cur->args );
fprintf(proxy, "\n");
/* FIXME: trace */
@@ -580,11 +591,12 @@
print_proxy("RpcTryFinally\n");
print_proxy("{\n");
indent++;
- stub_clear_output_vars( cur->args );
stub_unmarshall( cur->args );
+ fprintf(proxy, "\n");
- print_proxy("*pdwStubPhase = STUB_CALL_SERVER;\n");
+ print_proxy("*_pdwStubPhase = STUB_CALL_SERVER;\n");
+ fprintf(proxy, "\n");
print_proxy("");
if (has_ret) fprintf(proxy, "_Ret = ");
fprintf(proxy, "%s_", iface->name);
@@ -601,9 +613,12 @@
}
}
fprintf(proxy, ");\n");
- print_proxy("*pdwStubPhase = STUB_MARSHAL;\n");
+ fprintf(proxy, "\n");
+ print_proxy("*_pdwStubPhase = STUB_MARSHAL;\n");
+ fprintf(proxy, "\n");
stub_genmarshall( cur->args );
+ fprintf(proxy, "\n");
if (has_ret) {
/*
More information about the wine-patches
mailing list