Commit b7e7243a authored by Dan Hipschman's avatar Dan Hipschman Committed by Alexandre Julliard

widl: Move format-string declaration output to typegen.c.

parent cf649262
......@@ -395,37 +395,6 @@ static void write_clientinterfacedecl(type_t *iface)
}
static void write_formatdesc( const char *str )
{
print_client("typedef struct _MIDL_%s_FORMAT_STRING\n", str );
print_client("{\n");
indent++;
print_client("short Pad;\n");
print_client("unsigned char Format[%s_FORMAT_STRING_SIZE];\n", str);
indent--;
print_client("} MIDL_%s_FORMAT_STRING;\n", str);
print_client("\n");
}
static void write_formatstringsdecl(ifref_t *ifaces)
{
print_client("#define TYPE_FORMAT_STRING_SIZE %d\n",
get_size_typeformatstring(ifaces));
print_client("#define PROC_FORMAT_STRING_SIZE %d\n",
get_size_procformatstring(ifaces));
fprintf(client, "\n");
write_formatdesc("TYPE");
write_formatdesc("PROC");
fprintf(client, "\n");
print_client("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n");
print_client("static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n");
print_client("\n");
}
static void write_implicithandledecl(type_t *iface)
{
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
......@@ -471,7 +440,7 @@ void write_client(ifref_t *ifaces)
if (!client)
return;
write_formatstringsdecl(ifaces);
write_formatstringsdecl(client, indent, ifaces);
for (; iface; iface = PREV_LINK(iface))
{
......
......@@ -550,36 +550,6 @@ static void write_serverinterfacedecl(type_t *iface)
fprintf(server, "\n");
}
static void write_formatdesc( const char *str )
{
print_server("typedef struct _MIDL_%s_FORMAT_STRING\n", str );
print_server("{\n");
indent++;
print_server("short Pad;\n");
print_server("unsigned char Format[%s_FORMAT_STRING_SIZE];\n", str);
indent--;
print_server("} MIDL_%s_FORMAT_STRING;\n", str);
print_server("\n");
}
static void write_formatstringsdecl(ifref_t *ifaces)
{
print_server("#define TYPE_FORMAT_STRING_SIZE %d\n",
get_size_typeformatstring(ifaces));
print_server("#define PROC_FORMAT_STRING_SIZE %d\n",
get_size_procformatstring(ifaces));
fprintf(server, "\n");
write_formatdesc("TYPE");
write_formatdesc("PROC");
fprintf(server, "\n");
print_server("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n");
print_server("static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n");
print_server("\n");
}
static void init_server(void)
{
......@@ -612,7 +582,7 @@ void write_server(ifref_t *ifaces)
if (!server)
return;
write_formatstringsdecl(ifaces);
write_formatstringsdecl(server, indent, ifaces);
for (; iface; iface = PREV_LINK(iface))
{
......
......@@ -132,6 +132,33 @@ static int print_file(FILE *file, int indent, const char *format, ...)
return r;
}
static void write_formatdesc(FILE *f, int indent, const char *str)
{
print_file(f, indent, "typedef struct _MIDL_%s_FORMAT_STRING\n", str);
print_file(f, indent, "{\n");
print_file(f, indent + 1, "short Pad;\n");
print_file(f, indent + 1, "unsigned char Format[%s_FORMAT_STRING_SIZE];\n", str);
print_file(f, indent, "} MIDL_%s_FORMAT_STRING;\n", str);
print_file(f, indent, "\n");
}
void write_formatstringsdecl(FILE *f, int indent, ifref_t *ifaces)
{
print_file(f, indent, "#define TYPE_FORMAT_STRING_SIZE %d\n",
get_size_typeformatstring(ifaces));
print_file(f, indent, "#define PROC_FORMAT_STRING_SIZE %d\n",
get_size_procformatstring(ifaces));
fprintf(f, "\n");
write_formatdesc(f, indent, "TYPE");
write_formatdesc(f, indent, "PROC");
fprintf(f, "\n");
print_file(f, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n");
print_file(f, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n");
print_file(f, indent, "\n");
}
static inline int type_has_ref(const type_t *type)
{
return (type->type == 0 && type->ref);
......
......@@ -35,6 +35,7 @@ enum remoting_phase
PHASE_FREE
};
void write_formatstringsdecl(FILE *f, int indent, ifref_t *ifaces);
void write_procformatstring(FILE *file, const ifref_t *ifaces);
void write_typeformatstring(FILE *file, const ifref_t *ifaces);
size_t get_type_memsize(const type_t *type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment