2005-02-23 21:31:07 +01:00
|
|
|
/*
|
|
|
|
* IDL Compiler
|
|
|
|
*
|
2006-03-23 10:33:08 +01:00
|
|
|
* Copyright 2005-2006 Eric Kohl
|
2005-02-23 21:31:07 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-02-23 21:31:07 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
|
|
|
|
#include "widl.h"
|
|
|
|
#include "utils.h"
|
|
|
|
#include "parser.h"
|
|
|
|
#include "header.h"
|
|
|
|
|
|
|
|
#include "widltypes.h"
|
|
|
|
#include "typelib.h"
|
|
|
|
#include "typelib_struct.h"
|
2005-12-08 12:52:13 +01:00
|
|
|
#include "typegen.h"
|
2005-02-23 21:31:07 +01:00
|
|
|
|
|
|
|
static FILE* client;
|
|
|
|
static int indent = 0;
|
|
|
|
|
|
|
|
static int print_client( const char *format, ... )
|
|
|
|
{
|
|
|
|
va_list va;
|
|
|
|
int i, r;
|
|
|
|
|
|
|
|
va_start(va, format);
|
2006-08-11 19:15:55 +02:00
|
|
|
if (format[0] != '\n')
|
|
|
|
for (i = 0; i < indent; i++)
|
|
|
|
fprintf(client, " ");
|
2005-02-23 21:31:07 +01:00
|
|
|
r = vfprintf(client, format, va);
|
|
|
|
va_end(va);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-29 12:42:29 +02:00
|
|
|
static void check_pointers(const func_t *func)
|
2006-03-24 17:40:17 +01:00
|
|
|
{
|
2007-01-22 14:26:12 +01:00
|
|
|
const var_t *var;
|
2006-03-24 17:40:17 +01:00
|
|
|
|
|
|
|
if (!func->args)
|
2006-03-29 12:42:29 +02:00
|
|
|
return;
|
2006-03-24 17:40:17 +01:00
|
|
|
|
2007-01-22 14:26:12 +01:00
|
|
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
2006-03-24 17:40:17 +01:00
|
|
|
{
|
2006-08-29 23:27:27 +02:00
|
|
|
if (is_var_ptr(var) && cant_be_null(var))
|
2006-03-29 12:42:29 +02:00
|
|
|
{
|
2006-08-12 02:33:40 +02:00
|
|
|
print_client("if (!%s)\n", var->name);
|
|
|
|
print_client("{\n");
|
|
|
|
indent++;
|
|
|
|
print_client("RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
|
|
|
|
indent--;
|
|
|
|
print_client("}\n\n");
|
2006-03-29 12:42:29 +02:00
|
|
|
}
|
2006-03-24 17:40:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-01 16:40:10 +02:00
|
|
|
static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsigned int *type_offset)
|
2005-02-23 21:31:07 +01:00
|
|
|
{
|
2007-01-22 14:23:08 +01:00
|
|
|
const func_t *func;
|
2006-02-07 12:31:43 +01:00
|
|
|
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
2005-12-12 12:14:03 +01:00
|
|
|
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
2007-01-22 14:26:12 +01:00
|
|
|
const var_t *var;
|
2005-02-23 21:31:07 +01:00
|
|
|
int method_count = 0;
|
|
|
|
|
2007-01-22 14:23:08 +01:00
|
|
|
if (iface->funcs) LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
|
2005-02-23 21:31:07 +01:00
|
|
|
{
|
2006-02-07 12:31:43 +01:00
|
|
|
const var_t *def = func->def;
|
|
|
|
const var_t* explicit_handle_var;
|
2006-01-31 18:05:33 +01:00
|
|
|
unsigned int type_offset_func;
|
2005-12-12 12:14:03 +01:00
|
|
|
|
|
|
|
/* check for a defined binding handle */
|
|
|
|
explicit_handle_var = get_explicit_handle_var(func);
|
|
|
|
if (explicit_handle)
|
|
|
|
{
|
|
|
|
if (!explicit_handle_var)
|
|
|
|
{
|
|
|
|
error("%s() does not define an explicit binding handle!\n", def->name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (implicit_handle)
|
|
|
|
{
|
|
|
|
if (explicit_handle_var)
|
|
|
|
{
|
|
|
|
error("%s() must not define a binding handle!\n", def->name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2005-02-23 21:31:07 +01:00
|
|
|
|
|
|
|
write_type(client, def->type, def, def->tname);
|
|
|
|
fprintf(client, " ");
|
|
|
|
write_name(client, def);
|
|
|
|
fprintf(client, "(\n");
|
|
|
|
indent++;
|
2005-12-08 12:45:45 +01:00
|
|
|
if (func->args)
|
|
|
|
write_args(client, func->args, iface->name, 0, TRUE);
|
2005-02-23 21:31:07 +01:00
|
|
|
else
|
|
|
|
print_client("void");
|
|
|
|
fprintf(client, ")\n");
|
|
|
|
indent--;
|
|
|
|
|
|
|
|
/* write the functions body */
|
|
|
|
fprintf(client, "{\n");
|
|
|
|
indent++;
|
|
|
|
|
|
|
|
/* declare return value '_RetVal' */
|
|
|
|
if (!is_void(def->type, NULL))
|
|
|
|
{
|
|
|
|
print_client("");
|
|
|
|
write_type(client, def->type, def, def->tname);
|
|
|
|
fprintf(client, " _RetVal;\n");
|
|
|
|
}
|
|
|
|
|
2005-12-12 12:14:03 +01:00
|
|
|
if (implicit_handle || explicit_handle_var)
|
2005-02-23 21:31:07 +01:00
|
|
|
print_client("RPC_BINDING_HANDLE _Handle = 0;\n");
|
|
|
|
|
|
|
|
print_client("RPC_MESSAGE _RpcMessage;\n");
|
|
|
|
print_client("MIDL_STUB_MESSAGE _StubMsg;\n");
|
|
|
|
fprintf(client, "\n");
|
2006-03-29 12:42:29 +02:00
|
|
|
|
|
|
|
/* check pointers */
|
|
|
|
check_pointers(func);
|
|
|
|
|
2005-02-23 21:31:07 +01:00
|
|
|
print_client("RpcTryFinally\n");
|
|
|
|
print_client("{\n");
|
|
|
|
indent++;
|
|
|
|
|
|
|
|
print_client("NdrClientInitializeNew(\n");
|
|
|
|
indent++;
|
|
|
|
print_client("(PRPC_MESSAGE)&_RpcMessage,\n");
|
|
|
|
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
|
|
|
print_client("(PMIDL_STUB_DESC)&%s_StubDesc,\n", iface->name);
|
|
|
|
print_client("%d);\n", method_count);
|
|
|
|
indent--;
|
|
|
|
fprintf(client, "\n");
|
|
|
|
|
2005-12-08 12:45:45 +01:00
|
|
|
if (implicit_handle)
|
2005-12-08 12:48:44 +01:00
|
|
|
{
|
2005-12-08 12:45:45 +01:00
|
|
|
print_client("_Handle = %s;\n", implicit_handle);
|
2005-12-08 12:48:44 +01:00
|
|
|
fprintf(client, "\n");
|
|
|
|
}
|
2005-12-12 12:14:03 +01:00
|
|
|
else if (explicit_handle_var)
|
|
|
|
{
|
|
|
|
print_client("_Handle = %s;\n", explicit_handle_var->name);
|
|
|
|
fprintf(client, "\n");
|
|
|
|
}
|
2005-12-08 12:48:44 +01:00
|
|
|
|
2006-06-01 16:40:10 +02:00
|
|
|
type_offset_func = *type_offset;
|
2006-03-29 12:42:29 +02:00
|
|
|
write_remoting_arguments(client, indent, func, &type_offset_func, PASS_IN, PHASE_BUFFERSIZE);
|
|
|
|
|
2005-02-23 21:31:07 +01:00
|
|
|
print_client("NdrGetBuffer(\n");
|
|
|
|
indent++;
|
|
|
|
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
|
|
|
print_client("_StubMsg.BufferLength,\n");
|
2005-12-12 12:14:03 +01:00
|
|
|
if (implicit_handle || explicit_handle_var)
|
2005-12-12 12:12:50 +01:00
|
|
|
print_client("_Handle);\n");
|
2005-02-23 21:31:07 +01:00
|
|
|
else
|
|
|
|
print_client("%s__MIDL_AutoBindHandle);\n", iface->name);
|
|
|
|
indent--;
|
|
|
|
fprintf(client, "\n");
|
|
|
|
|
|
|
|
|
2006-01-31 18:05:33 +01:00
|
|
|
/* make a copy so we don't increment the type offset twice */
|
2006-06-01 16:40:10 +02:00
|
|
|
type_offset_func = *type_offset;
|
2006-01-31 18:05:33 +01:00
|
|
|
|
2005-12-08 12:52:13 +01:00
|
|
|
/* marshal arguments */
|
2006-02-07 12:32:24 +01:00
|
|
|
write_remoting_arguments(client, indent, func, &type_offset_func, PASS_IN, PHASE_MARSHAL);
|
2005-12-08 12:52:13 +01:00
|
|
|
|
2005-03-02 14:53:50 +01:00
|
|
|
/* send/receive message */
|
2005-02-23 21:31:07 +01:00
|
|
|
/* print_client("NdrNsSendReceive(\n"); */
|
2005-12-12 12:12:50 +01:00
|
|
|
/* print_client("(unsigned char *)_StubMsg.Buffer,\n"); */
|
|
|
|
/* print_client("(RPC_BINDING_HANDLE *) &%s__MIDL_AutoBindHandle);\n", iface->name); */
|
2005-02-23 21:31:07 +01:00
|
|
|
print_client("NdrSendReceive(\n");
|
|
|
|
indent++;
|
|
|
|
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
2005-12-26 13:20:59 +01:00
|
|
|
print_client("(unsigned char *)_StubMsg.Buffer);\n\n");
|
2005-02-23 21:31:07 +01:00
|
|
|
indent--;
|
|
|
|
|
2005-12-12 12:12:50 +01:00
|
|
|
print_client("_StubMsg.BufferStart = (unsigned char *)_RpcMessage.Buffer;\n");
|
2006-03-24 17:40:17 +01:00
|
|
|
print_client("_StubMsg.BufferEnd = _StubMsg.BufferStart + _RpcMessage.BufferLength;\n");
|
2005-12-26 13:21:38 +01:00
|
|
|
|
2006-03-24 17:40:17 +01:00
|
|
|
if (has_out_arg_or_return(func))
|
2005-02-23 21:31:07 +01:00
|
|
|
{
|
|
|
|
fprintf(client, "\n");
|
|
|
|
|
|
|
|
print_client("if ((_RpcMessage.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n");
|
|
|
|
indent++;
|
|
|
|
print_client("NdrConvert(\n");
|
|
|
|
indent++;
|
|
|
|
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
2006-06-01 16:40:10 +02:00
|
|
|
print_client("(PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", *proc_offset);
|
2005-02-23 21:31:07 +01:00
|
|
|
indent -= 2;
|
2006-03-24 17:40:17 +01:00
|
|
|
}
|
2005-02-23 21:31:07 +01:00
|
|
|
|
2006-03-24 17:40:17 +01:00
|
|
|
/* unmarshall arguments */
|
|
|
|
fprintf(client, "\n");
|
2006-06-01 16:40:10 +02:00
|
|
|
write_remoting_arguments(client, indent, func, type_offset, PASS_OUT, PHASE_UNMARSHAL);
|
2006-03-24 17:40:17 +01:00
|
|
|
|
|
|
|
/* unmarshal return value */
|
|
|
|
if (!is_void(def->type, NULL))
|
2006-03-31 13:49:36 +02:00
|
|
|
print_phase_basetype(client, indent, PHASE_UNMARSHAL, PASS_RETURN, def, "_RetVal");
|
2005-02-23 21:31:07 +01:00
|
|
|
|
2005-12-08 12:48:44 +01:00
|
|
|
/* update proc_offset */
|
|
|
|
if (func->args)
|
|
|
|
{
|
2007-01-22 14:26:12 +01:00
|
|
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
2006-06-18 19:45:50 +02:00
|
|
|
*proc_offset += get_size_procformatstring_var(var);
|
2005-02-23 21:31:07 +01:00
|
|
|
}
|
2005-12-26 13:05:29 +01:00
|
|
|
if (!is_void(def->type, NULL))
|
2006-06-18 19:45:50 +02:00
|
|
|
*proc_offset += get_size_procformatstring_var(def);
|
2006-03-18 14:33:39 +01:00
|
|
|
else
|
2006-06-18 19:45:50 +02:00
|
|
|
*proc_offset += 2; /* FC_END and FC_PAD */
|
2005-02-23 21:31:07 +01:00
|
|
|
|
|
|
|
indent--;
|
|
|
|
print_client("}\n");
|
|
|
|
print_client("RpcFinally\n");
|
|
|
|
print_client("{\n");
|
|
|
|
indent++;
|
|
|
|
|
|
|
|
|
|
|
|
/* FIXME: emit client finally code */
|
|
|
|
|
|
|
|
print_client("NdrFreeBuffer((PMIDL_STUB_MESSAGE)&_StubMsg);\n");
|
|
|
|
|
|
|
|
indent--;
|
|
|
|
print_client("}\n");
|
|
|
|
print_client("RpcEndFinally\n");
|
|
|
|
|
|
|
|
|
|
|
|
/* emit return code */
|
|
|
|
if (!is_void(def->type, NULL))
|
|
|
|
{
|
|
|
|
fprintf(client, "\n");
|
|
|
|
print_client("return _RetVal;\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
indent--;
|
|
|
|
fprintf(client, "}\n");
|
|
|
|
fprintf(client, "\n");
|
|
|
|
|
|
|
|
method_count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void write_bindinghandledecl(type_t *iface)
|
|
|
|
{
|
|
|
|
print_client("static RPC_BINDING_HANDLE %s__MIDL_AutoBindHandle;\n", iface->name);
|
|
|
|
fprintf(client, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void write_stubdescdecl(type_t *iface)
|
|
|
|
{
|
2006-04-16 10:39:37 +02:00
|
|
|
print_client("static const MIDL_STUB_DESC %s_StubDesc;\n", iface->name);
|
2005-02-23 21:31:07 +01:00
|
|
|
fprintf(client, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-27 12:53:32 +01:00
|
|
|
static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
|
2005-02-23 21:31:07 +01:00
|
|
|
{
|
2006-02-07 12:31:43 +01:00
|
|
|
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
2005-02-23 21:31:07 +01:00
|
|
|
|
|
|
|
print_client("static const MIDL_STUB_DESC %s_StubDesc =\n", iface->name);
|
|
|
|
print_client("{\n");
|
|
|
|
indent++;
|
2005-12-12 11:51:11 +01:00
|
|
|
print_client("(void *)& %s___RpcClientInterface,\n", iface->name);
|
2005-02-23 21:31:07 +01:00
|
|
|
print_client("MIDL_user_allocate,\n");
|
|
|
|
print_client("MIDL_user_free,\n");
|
2006-03-31 13:46:28 +02:00
|
|
|
print_client("{\n");
|
|
|
|
indent++;
|
2005-12-08 12:45:45 +01:00
|
|
|
if (implicit_handle)
|
|
|
|
print_client("&%s,\n", implicit_handle);
|
2005-02-23 21:31:07 +01:00
|
|
|
else
|
|
|
|
print_client("&%s__MIDL_AutoBindHandle,\n", iface->name);
|
2006-03-31 13:46:28 +02:00
|
|
|
indent--;
|
|
|
|
print_client("},\n");
|
2005-02-23 21:31:07 +01:00
|
|
|
print_client("0,\n");
|
|
|
|
print_client("0,\n");
|
2006-01-27 12:53:32 +01:00
|
|
|
if (expr_eval_routines)
|
|
|
|
print_client("ExprEvalRoutines,\n");
|
|
|
|
else
|
|
|
|
print_client("0,\n");
|
2005-02-23 21:31:07 +01:00
|
|
|
print_client("0,\n");
|
|
|
|
print_client("__MIDL_TypeFormatString.Format,\n");
|
|
|
|
print_client("1, /* -error bounds_check flag */\n");
|
|
|
|
print_client("0x10001, /* Ndr library version */\n");
|
|
|
|
print_client("0,\n");
|
|
|
|
print_client("0x50100a4, /* MIDL Version 5.1.164 */\n");
|
|
|
|
print_client("0,\n");
|
|
|
|
print_client("0,\n");
|
|
|
|
print_client("0, /* notify & notify_flag routine table */\n");
|
|
|
|
print_client("1, /* Flags */\n");
|
|
|
|
print_client("0, /* Reserved3 */\n");
|
|
|
|
print_client("0, /* Reserved4 */\n");
|
|
|
|
print_client("0 /* Reserved5 */\n");
|
|
|
|
indent--;
|
|
|
|
print_client("};\n");
|
|
|
|
fprintf(client, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void write_clientinterfacedecl(type_t *iface)
|
|
|
|
{
|
|
|
|
unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
|
2006-02-07 12:31:43 +01:00
|
|
|
const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
|
2005-02-23 21:31:07 +01:00
|
|
|
|
|
|
|
print_client("static const RPC_CLIENT_INTERFACE %s___RpcClientInterface =\n", iface->name );
|
|
|
|
print_client("{\n");
|
|
|
|
indent++;
|
|
|
|
print_client("sizeof(RPC_CLIENT_INTERFACE),\n");
|
|
|
|
print_client("{{0x%08lx,0x%04x,0x%04x,{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}},{%d,%d}},\n",
|
|
|
|
uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1],
|
|
|
|
uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6],
|
|
|
|
uuid->Data4[7], LOWORD(ver), HIWORD(ver));
|
|
|
|
print_client("{{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},\n"); /* FIXME */
|
|
|
|
print_client("0,\n");
|
|
|
|
print_client("0,\n");
|
|
|
|
print_client("0,\n");
|
|
|
|
print_client("0,\n");
|
|
|
|
print_client("0,\n");
|
|
|
|
print_client("0,\n");
|
|
|
|
indent--;
|
|
|
|
print_client("};\n");
|
2006-04-22 21:52:51 +02:00
|
|
|
if (old_names)
|
|
|
|
print_client("RPC_IF_HANDLE %s_ClientIfHandle = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
|
|
|
|
iface->name, iface->name);
|
|
|
|
else
|
|
|
|
print_client("RPC_IF_HANDLE %s_v%d_%d_c_ifspec = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
|
|
|
|
iface->name, LOWORD(ver), HIWORD(ver), iface->name);
|
2005-02-23 21:31:07 +01:00
|
|
|
fprintf(client, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void write_implicithandledecl(type_t *iface)
|
|
|
|
{
|
2006-02-07 12:31:43 +01:00
|
|
|
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
2005-02-23 21:31:07 +01:00
|
|
|
|
2005-12-08 12:48:44 +01:00
|
|
|
if (implicit_handle)
|
2005-02-23 21:31:07 +01:00
|
|
|
{
|
2005-12-08 12:48:44 +01:00
|
|
|
fprintf(client, "handle_t %s;\n", implicit_handle);
|
2005-02-23 21:31:07 +01:00
|
|
|
fprintf(client, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void init_client(void)
|
|
|
|
{
|
|
|
|
if (client) return;
|
|
|
|
if (!(client = fopen(client_name, "w")))
|
|
|
|
error("Could not open %s for output\n", client_name);
|
|
|
|
|
2006-08-11 01:51:28 +02:00
|
|
|
print_client("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
|
2005-04-15 16:09:45 +02:00
|
|
|
print_client("#include <string.h>\n");
|
2005-02-23 21:31:07 +01:00
|
|
|
print_client("#ifdef _ALPHA_\n");
|
2005-04-15 16:09:45 +02:00
|
|
|
print_client("#include <stdarg.h>\n");
|
2005-02-23 21:31:07 +01:00
|
|
|
print_client("#endif\n");
|
|
|
|
fprintf(client, "\n");
|
2005-04-15 16:09:45 +02:00
|
|
|
print_client("#include \"%s\"\n", header_name);
|
2005-02-23 21:31:07 +01:00
|
|
|
fprintf(client, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-22 14:21:56 +01:00
|
|
|
void write_client(ifref_list_t *ifaces)
|
2005-02-23 21:31:07 +01:00
|
|
|
{
|
2006-06-01 16:40:10 +02:00
|
|
|
unsigned int proc_offset = 0;
|
|
|
|
unsigned int type_offset = 2;
|
2007-01-22 14:21:56 +01:00
|
|
|
ifref_t *iface;
|
2005-02-23 21:31:07 +01:00
|
|
|
|
|
|
|
if (!do_client)
|
|
|
|
return;
|
2007-01-19 12:46:19 +01:00
|
|
|
if (do_everything && !ifaces)
|
2005-02-23 21:31:07 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
init_client();
|
|
|
|
if (!client)
|
|
|
|
return;
|
|
|
|
|
2006-08-18 03:08:38 +02:00
|
|
|
write_formatstringsdecl(client, indent, ifaces, 0);
|
2006-06-01 16:40:10 +02:00
|
|
|
|
2007-01-22 14:21:56 +01:00
|
|
|
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, ifref_t, entry )
|
2005-12-12 12:11:44 +01:00
|
|
|
{
|
2006-03-31 13:44:04 +02:00
|
|
|
if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
|
|
|
|
continue;
|
|
|
|
|
2005-12-12 12:11:44 +01:00
|
|
|
fprintf(client, "/*****************************************************************************\n");
|
|
|
|
fprintf(client, " * %s interface\n", iface->iface->name);
|
|
|
|
fprintf(client, " */\n");
|
|
|
|
fprintf(client, "\n");
|
2005-02-23 21:31:07 +01:00
|
|
|
|
2005-12-26 13:08:51 +01:00
|
|
|
if (iface->iface->funcs)
|
|
|
|
{
|
2006-01-27 12:53:32 +01:00
|
|
|
int expr_eval_routines;
|
|
|
|
|
2005-12-26 13:08:51 +01:00
|
|
|
write_implicithandledecl(iface->iface);
|
|
|
|
|
|
|
|
write_clientinterfacedecl(iface->iface);
|
|
|
|
write_stubdescdecl(iface->iface);
|
|
|
|
write_bindinghandledecl(iface->iface);
|
|
|
|
|
2006-06-01 16:40:10 +02:00
|
|
|
write_function_stubs(iface->iface, &proc_offset, &type_offset);
|
2005-12-12 12:11:44 +01:00
|
|
|
|
2006-01-27 12:53:32 +01:00
|
|
|
print_client("#if !defined(__RPC_WIN32__)\n");
|
|
|
|
print_client("#error Invalid build platform for this stub.\n");
|
|
|
|
print_client("#endif\n");
|
2005-02-23 21:31:07 +01:00
|
|
|
|
2006-01-27 12:53:32 +01:00
|
|
|
fprintf(client, "\n");
|
|
|
|
|
|
|
|
expr_eval_routines = write_expr_eval_routines(client, iface->iface->name);
|
|
|
|
if (expr_eval_routines)
|
|
|
|
write_expr_eval_routine_list(client, iface->iface->name);
|
|
|
|
write_stubdescriptor(iface->iface, expr_eval_routines);
|
|
|
|
}
|
2005-12-12 12:11:44 +01:00
|
|
|
}
|
2005-02-23 21:31:07 +01:00
|
|
|
|
2006-06-01 16:40:10 +02:00
|
|
|
fprintf(client, "\n");
|
|
|
|
|
2006-08-18 03:08:38 +02:00
|
|
|
write_procformatstring(client, ifaces, 0);
|
|
|
|
write_typeformatstring(client, ifaces, 0);
|
2006-06-01 16:40:10 +02:00
|
|
|
|
2005-02-23 21:31:07 +01:00
|
|
|
fclose(client);
|
|
|
|
}
|