widl: Only write one procformat string and one typeformat string per file.
This commit is contained in:
parent
bae6d23c5c
commit
6f85f989f5
|
@ -41,14 +41,6 @@
|
||||||
#include "typelib_struct.h"
|
#include "typelib_struct.h"
|
||||||
#include "typegen.h"
|
#include "typegen.h"
|
||||||
|
|
||||||
#define END_OF_LIST(list) \
|
|
||||||
do { \
|
|
||||||
if (list) { \
|
|
||||||
while (NEXT_LINK(list)) \
|
|
||||||
list = NEXT_LINK(list); \
|
|
||||||
} \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
static FILE* client;
|
static FILE* client;
|
||||||
static int indent = 0;
|
static int indent = 0;
|
||||||
|
|
||||||
|
@ -120,15 +112,13 @@ static void check_pointers(const func_t *func)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_function_stubs(type_t *iface)
|
static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsigned int *type_offset)
|
||||||
{
|
{
|
||||||
const func_t *func = iface->funcs;
|
const func_t *func = iface->funcs;
|
||||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||||
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
||||||
var_t *var;
|
var_t *var;
|
||||||
int method_count = 0;
|
int method_count = 0;
|
||||||
unsigned int proc_offset = 0;
|
|
||||||
unsigned int type_offset = 2;
|
|
||||||
|
|
||||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||||
while (func)
|
while (func)
|
||||||
|
@ -219,7 +209,7 @@ static void write_function_stubs(type_t *iface)
|
||||||
print_message_buffer_size(func);
|
print_message_buffer_size(func);
|
||||||
fprintf(client, ";\n");
|
fprintf(client, ";\n");
|
||||||
|
|
||||||
type_offset_func = type_offset;
|
type_offset_func = *type_offset;
|
||||||
write_remoting_arguments(client, indent, func, &type_offset_func, PASS_IN, PHASE_BUFFERSIZE);
|
write_remoting_arguments(client, indent, func, &type_offset_func, PASS_IN, PHASE_BUFFERSIZE);
|
||||||
|
|
||||||
print_client("NdrGetBuffer(\n");
|
print_client("NdrGetBuffer(\n");
|
||||||
|
@ -235,7 +225,7 @@ static void write_function_stubs(type_t *iface)
|
||||||
|
|
||||||
|
|
||||||
/* make a copy so we don't increment the type offset twice */
|
/* make a copy so we don't increment the type offset twice */
|
||||||
type_offset_func = type_offset;
|
type_offset_func = *type_offset;
|
||||||
|
|
||||||
/* marshal arguments */
|
/* marshal arguments */
|
||||||
write_remoting_arguments(client, indent, func, &type_offset_func, PASS_IN, PHASE_MARSHAL);
|
write_remoting_arguments(client, indent, func, &type_offset_func, PASS_IN, PHASE_MARSHAL);
|
||||||
|
@ -262,13 +252,13 @@ static void write_function_stubs(type_t *iface)
|
||||||
print_client("NdrConvert(\n");
|
print_client("NdrConvert(\n");
|
||||||
indent++;
|
indent++;
|
||||||
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||||
print_client("(PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", proc_offset);
|
print_client("(PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", *proc_offset);
|
||||||
indent -= 2;
|
indent -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unmarshall arguments */
|
/* unmarshall arguments */
|
||||||
fprintf(client, "\n");
|
fprintf(client, "\n");
|
||||||
write_remoting_arguments(client, indent, func, &type_offset, PASS_OUT, PHASE_UNMARSHAL);
|
write_remoting_arguments(client, indent, func, type_offset, PASS_OUT, PHASE_UNMARSHAL);
|
||||||
|
|
||||||
/* unmarshal return value */
|
/* unmarshal return value */
|
||||||
if (!is_void(def->type, NULL))
|
if (!is_void(def->type, NULL))
|
||||||
|
@ -425,13 +415,13 @@ static void write_formatdesc( const char *str )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void write_formatstringsdecl(type_t *iface)
|
static void write_formatstringsdecl(ifref_t *ifaces)
|
||||||
{
|
{
|
||||||
print_client("#define TYPE_FORMAT_STRING_SIZE %d\n",
|
print_client("#define TYPE_FORMAT_STRING_SIZE %d\n",
|
||||||
get_size_typeformatstring(iface));
|
get_size_typeformatstring(ifaces));
|
||||||
|
|
||||||
print_client("#define PROC_FORMAT_STRING_SIZE %d\n",
|
print_client("#define PROC_FORMAT_STRING_SIZE %d\n",
|
||||||
get_size_procformatstring(iface));
|
get_size_procformatstring(ifaces));
|
||||||
|
|
||||||
fprintf(client, "\n");
|
fprintf(client, "\n");
|
||||||
write_formatdesc("TYPE");
|
write_formatdesc("TYPE");
|
||||||
|
@ -474,6 +464,8 @@ static void init_client(void)
|
||||||
|
|
||||||
void write_client(ifref_t *ifaces)
|
void write_client(ifref_t *ifaces)
|
||||||
{
|
{
|
||||||
|
unsigned int proc_offset = 0;
|
||||||
|
unsigned int type_offset = 2;
|
||||||
ifref_t *iface = ifaces;
|
ifref_t *iface = ifaces;
|
||||||
|
|
||||||
if (!do_client)
|
if (!do_client)
|
||||||
|
@ -486,6 +478,8 @@ void write_client(ifref_t *ifaces)
|
||||||
if (!client)
|
if (!client)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
write_formatstringsdecl(ifaces);
|
||||||
|
|
||||||
for (; iface; iface = PREV_LINK(iface))
|
for (; iface; iface = PREV_LINK(iface))
|
||||||
{
|
{
|
||||||
if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
|
if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
|
||||||
|
@ -500,22 +494,17 @@ void write_client(ifref_t *ifaces)
|
||||||
{
|
{
|
||||||
int expr_eval_routines;
|
int expr_eval_routines;
|
||||||
|
|
||||||
write_formatstringsdecl(iface->iface);
|
|
||||||
write_implicithandledecl(iface->iface);
|
write_implicithandledecl(iface->iface);
|
||||||
|
|
||||||
write_clientinterfacedecl(iface->iface);
|
write_clientinterfacedecl(iface->iface);
|
||||||
write_stubdescdecl(iface->iface);
|
write_stubdescdecl(iface->iface);
|
||||||
write_bindinghandledecl(iface->iface);
|
write_bindinghandledecl(iface->iface);
|
||||||
|
|
||||||
write_function_stubs(iface->iface);
|
write_function_stubs(iface->iface, &proc_offset, &type_offset);
|
||||||
|
|
||||||
print_client("#if !defined(__RPC_WIN32__)\n");
|
print_client("#if !defined(__RPC_WIN32__)\n");
|
||||||
print_client("#error Invalid build platform for this stub.\n");
|
print_client("#error Invalid build platform for this stub.\n");
|
||||||
print_client("#endif\n");
|
print_client("#endif\n");
|
||||||
fprintf(client, "\n");
|
|
||||||
|
|
||||||
write_procformatstring(client, iface->iface);
|
|
||||||
write_typeformatstring(client, iface->iface);
|
|
||||||
|
|
||||||
fprintf(client, "\n");
|
fprintf(client, "\n");
|
||||||
|
|
||||||
|
@ -526,5 +515,10 @@ void write_client(ifref_t *ifaces)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(client, "\n");
|
||||||
|
|
||||||
|
write_procformatstring(client, ifaces);
|
||||||
|
write_typeformatstring(client, ifaces);
|
||||||
|
|
||||||
fclose(client);
|
fclose(client);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,14 +42,6 @@
|
||||||
#include "typelib_struct.h"
|
#include "typelib_struct.h"
|
||||||
#include "typegen.h"
|
#include "typegen.h"
|
||||||
|
|
||||||
#define END_OF_LIST(list) \
|
|
||||||
do { \
|
|
||||||
if (list) { \
|
|
||||||
while (NEXT_LINK(list)) \
|
|
||||||
list = NEXT_LINK(list); \
|
|
||||||
} \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
static FILE* server;
|
static FILE* server;
|
||||||
static int indent = 0;
|
static int indent = 0;
|
||||||
|
|
||||||
|
@ -189,15 +181,13 @@ static void assign_out_args(const func_t *func)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void write_function_stubs(type_t *iface)
|
static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsigned int *type_offset)
|
||||||
{
|
{
|
||||||
char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||||
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
||||||
const func_t *func = iface->funcs;
|
const func_t *func = iface->funcs;
|
||||||
const var_t *var;
|
const var_t *var;
|
||||||
const var_t* explicit_handle_var;
|
const var_t* explicit_handle_var;
|
||||||
unsigned int proc_offset = 0;
|
|
||||||
unsigned int type_offset = 2;
|
|
||||||
|
|
||||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||||
while (func)
|
while (func)
|
||||||
|
@ -289,7 +279,7 @@ static void write_function_stubs(type_t *iface)
|
||||||
fprintf(server, "\n");
|
fprintf(server, "\n");
|
||||||
|
|
||||||
/* make a copy so we don't increment the type offset twice */
|
/* make a copy so we don't increment the type offset twice */
|
||||||
type_offset_func = type_offset;
|
type_offset_func = *type_offset;
|
||||||
|
|
||||||
/* unmarshall arguments */
|
/* unmarshall arguments */
|
||||||
write_remoting_arguments(server, indent, func, &type_offset_func, PASS_IN, PHASE_UNMARSHAL);
|
write_remoting_arguments(server, indent, func, &type_offset_func, PASS_IN, PHASE_UNMARSHAL);
|
||||||
|
@ -377,7 +367,7 @@ static void write_function_stubs(type_t *iface)
|
||||||
fprintf(server, "\n");
|
fprintf(server, "\n");
|
||||||
print_server("_StubMsg.BufferLength = %u;\n", buffer_size);
|
print_server("_StubMsg.BufferLength = %u;\n", buffer_size);
|
||||||
|
|
||||||
type_offset_func = type_offset;
|
type_offset_func = *type_offset;
|
||||||
write_remoting_arguments(server, indent, func, &type_offset_func, PASS_OUT, PHASE_BUFFERSIZE);
|
write_remoting_arguments(server, indent, func, &type_offset_func, PASS_OUT, PHASE_BUFFERSIZE);
|
||||||
|
|
||||||
print_server("_pRpcMessage->BufferLength = _StubMsg.BufferLength;\n");
|
print_server("_pRpcMessage->BufferLength = _StubMsg.BufferLength;\n");
|
||||||
|
@ -392,10 +382,10 @@ static void write_function_stubs(type_t *iface)
|
||||||
fprintf(server, "\n");
|
fprintf(server, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
type_offset_func = type_offset;
|
type_offset_func = *type_offset;
|
||||||
|
|
||||||
/* marshall arguments */
|
/* marshall arguments */
|
||||||
write_remoting_arguments(server, indent, func, &type_offset, PASS_OUT, PHASE_MARSHAL);
|
write_remoting_arguments(server, indent, func, type_offset, PASS_OUT, PHASE_MARSHAL);
|
||||||
|
|
||||||
/* marshall the return value */
|
/* marshall the return value */
|
||||||
if (!is_void(def->type, NULL))
|
if (!is_void(def->type, NULL))
|
||||||
|
@ -570,13 +560,13 @@ static void write_formatdesc( const char *str )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void write_formatstringsdecl(type_t *iface)
|
static void write_formatstringsdecl(ifref_t *ifaces)
|
||||||
{
|
{
|
||||||
print_server("#define TYPE_FORMAT_STRING_SIZE %d\n",
|
print_server("#define TYPE_FORMAT_STRING_SIZE %d\n",
|
||||||
get_size_typeformatstring(iface));
|
get_size_typeformatstring(ifaces));
|
||||||
|
|
||||||
print_server("#define PROC_FORMAT_STRING_SIZE %d\n",
|
print_server("#define PROC_FORMAT_STRING_SIZE %d\n",
|
||||||
get_size_procformatstring(iface));
|
get_size_procformatstring(ifaces));
|
||||||
|
|
||||||
fprintf(server, "\n");
|
fprintf(server, "\n");
|
||||||
write_formatdesc("TYPE");
|
write_formatdesc("TYPE");
|
||||||
|
@ -605,6 +595,8 @@ static void init_server(void)
|
||||||
|
|
||||||
void write_server(ifref_t *ifaces)
|
void write_server(ifref_t *ifaces)
|
||||||
{
|
{
|
||||||
|
unsigned int proc_offset = 0;
|
||||||
|
unsigned int type_offset = 2;
|
||||||
ifref_t *iface = ifaces;
|
ifref_t *iface = ifaces;
|
||||||
|
|
||||||
if (!do_server)
|
if (!do_server)
|
||||||
|
@ -617,6 +609,8 @@ void write_server(ifref_t *ifaces)
|
||||||
if (!server)
|
if (!server)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
write_formatstringsdecl(ifaces);
|
||||||
|
|
||||||
for (; iface; iface = PREV_LINK(iface))
|
for (; iface; iface = PREV_LINK(iface))
|
||||||
{
|
{
|
||||||
if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
|
if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
|
||||||
|
@ -631,19 +625,14 @@ void write_server(ifref_t *ifaces)
|
||||||
{
|
{
|
||||||
int expr_eval_routines;
|
int expr_eval_routines;
|
||||||
|
|
||||||
write_formatstringsdecl(iface->iface);
|
|
||||||
write_serverinterfacedecl(iface->iface);
|
write_serverinterfacedecl(iface->iface);
|
||||||
write_stubdescdecl(iface->iface);
|
write_stubdescdecl(iface->iface);
|
||||||
|
|
||||||
write_function_stubs(iface->iface);
|
write_function_stubs(iface->iface, &proc_offset, &type_offset);
|
||||||
|
|
||||||
print_server("#if !defined(__RPC_WIN32__)\n");
|
print_server("#if !defined(__RPC_WIN32__)\n");
|
||||||
print_server("#error Invalid build platform for this stub.\n");
|
print_server("#error Invalid build platform for this stub.\n");
|
||||||
print_server("#endif\n");
|
print_server("#endif\n");
|
||||||
fprintf(server, "\n");
|
|
||||||
|
|
||||||
write_procformatstring(server, iface->iface);
|
|
||||||
write_typeformatstring(server, iface->iface);
|
|
||||||
|
|
||||||
fprintf(server, "\n");
|
fprintf(server, "\n");
|
||||||
|
|
||||||
|
@ -656,5 +645,10 @@ void write_server(ifref_t *ifaces)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(server, "\n");
|
||||||
|
|
||||||
|
write_procformatstring(server, ifaces);
|
||||||
|
write_typeformatstring(server, ifaces);
|
||||||
|
|
||||||
fclose(server);
|
fclose(server);
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,8 +239,9 @@ static size_t write_procformatstring_var(FILE *file, int indent,
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_procformatstring(FILE *file, type_t *iface)
|
void write_procformatstring(FILE *file, const ifref_t *ifaces)
|
||||||
{
|
{
|
||||||
|
const ifref_t *iface = ifaces;
|
||||||
int indent = 0;
|
int indent = 0;
|
||||||
var_t *var;
|
var_t *var;
|
||||||
unsigned int type_offset = 2;
|
unsigned int type_offset = 2;
|
||||||
|
@ -252,36 +253,44 @@ void write_procformatstring(FILE *file, type_t *iface)
|
||||||
print_file(file, indent, "{\n");
|
print_file(file, indent, "{\n");
|
||||||
indent++;
|
indent++;
|
||||||
|
|
||||||
if (iface->funcs)
|
END_OF_LIST(iface);
|
||||||
|
|
||||||
|
for (; iface; iface = PREV_LINK(iface))
|
||||||
{
|
{
|
||||||
func_t *func = iface->funcs;
|
if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
|
||||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
continue;
|
||||||
for (; func; func = PREV_LINK(func))
|
|
||||||
|
if (iface->iface->funcs)
|
||||||
{
|
{
|
||||||
/* emit argument data */
|
func_t *func = iface->iface->funcs;
|
||||||
if (func->args)
|
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||||
|
for (; func; func = PREV_LINK(func))
|
||||||
{
|
{
|
||||||
var = func->args;
|
/* emit argument data */
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
if (func->args)
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
write_procformatstring_var(file, indent, var, FALSE,
|
var = func->args;
|
||||||
&type_offset);
|
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||||
|
while (var)
|
||||||
|
{
|
||||||
|
write_procformatstring_var(file, indent, var, FALSE,
|
||||||
|
&type_offset);
|
||||||
|
|
||||||
var = PREV_LINK(var);
|
var = PREV_LINK(var);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* emit return value data */
|
/* emit return value data */
|
||||||
var = func->def;
|
var = func->def;
|
||||||
if (is_void(var->type, NULL))
|
if (is_void(var->type, NULL))
|
||||||
{
|
{
|
||||||
print_file(file, indent, "0x5b, /* FC_END */\n");
|
print_file(file, indent, "0x5b, /* FC_END */\n");
|
||||||
print_file(file, indent, "0x5c, /* FC_PAD */\n");
|
print_file(file, indent, "0x5c, /* FC_PAD */\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
write_procformatstring_var(file, indent, var, TRUE,
|
||||||
|
&type_offset);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
write_procformatstring_var(file, indent, var, TRUE,
|
|
||||||
&type_offset);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1337,11 +1346,12 @@ static size_t write_typeformatstring_var(FILE *file, int indent,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void write_typeformatstring(FILE *file, type_t *iface)
|
void write_typeformatstring(FILE *file, const ifref_t *ifaces)
|
||||||
{
|
{
|
||||||
int indent = 0;
|
int indent = 0;
|
||||||
var_t *var;
|
var_t *var;
|
||||||
size_t typeformat_offset;
|
size_t typeformat_offset;
|
||||||
|
const ifref_t *iface = ifaces;
|
||||||
|
|
||||||
print_file(file, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n");
|
print_file(file, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n");
|
||||||
print_file(file, indent, "{\n");
|
print_file(file, indent, "{\n");
|
||||||
|
@ -1352,22 +1362,30 @@ void write_typeformatstring(FILE *file, type_t *iface)
|
||||||
print_file(file, indent, "NdrFcShort(0x0),\n");
|
print_file(file, indent, "NdrFcShort(0x0),\n");
|
||||||
typeformat_offset = 2;
|
typeformat_offset = 2;
|
||||||
|
|
||||||
if (iface->funcs)
|
END_OF_LIST(iface);
|
||||||
|
|
||||||
|
for (; iface; iface = PREV_LINK(iface))
|
||||||
{
|
{
|
||||||
func_t *func = iface->funcs;
|
if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
|
||||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
continue;
|
||||||
for (; func; func = PREV_LINK(func))
|
|
||||||
|
if (iface->iface->funcs)
|
||||||
{
|
{
|
||||||
current_func = func;
|
func_t *func = iface->iface->funcs;
|
||||||
if (func->args)
|
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||||
|
for (; func; func = PREV_LINK(func))
|
||||||
{
|
{
|
||||||
var = func->args;
|
current_func = func;
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
if (func->args)
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
write_typeformatstring_var(file, indent, var,
|
var = func->args;
|
||||||
&typeformat_offset);
|
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||||
var = PREV_LINK(var);
|
while (var)
|
||||||
|
{
|
||||||
|
write_typeformatstring_var(file, indent, var,
|
||||||
|
&typeformat_offset);
|
||||||
|
var = PREV_LINK(var);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1842,63 +1860,81 @@ size_t get_size_typeformatstring_var(const var_t *var)
|
||||||
return type_offset;
|
return type_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t get_size_procformatstring(const type_t *iface)
|
size_t get_size_procformatstring(const ifref_t *ifaces)
|
||||||
{
|
{
|
||||||
|
const ifref_t *iface = ifaces;
|
||||||
size_t size = 1;
|
size_t size = 1;
|
||||||
func_t *func;
|
func_t *func;
|
||||||
var_t *var;
|
var_t *var;
|
||||||
|
|
||||||
if (iface->funcs)
|
END_OF_LIST(iface);
|
||||||
{
|
|
||||||
func = iface->funcs;
|
|
||||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
|
||||||
while (func)
|
|
||||||
{
|
|
||||||
/* argument list size */
|
|
||||||
if (func->args)
|
|
||||||
{
|
|
||||||
var = func->args;
|
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
|
||||||
size += get_size_procformatstring_var(var);
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* return value size */
|
for (; iface; iface = PREV_LINK(iface))
|
||||||
size += 2; /* FIXME: determine real size */
|
{
|
||||||
func = PREV_LINK(func);
|
if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (iface->iface->funcs)
|
||||||
|
{
|
||||||
|
func = iface->iface->funcs;
|
||||||
|
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||||
|
while (func)
|
||||||
|
{
|
||||||
|
/* argument list size */
|
||||||
|
if (func->args)
|
||||||
|
{
|
||||||
|
var = func->args;
|
||||||
|
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||||
|
while (var)
|
||||||
|
{
|
||||||
|
size += get_size_procformatstring_var(var);
|
||||||
|
var = PREV_LINK(var);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return value size */
|
||||||
|
size += 2; /* FIXME: determine real size */
|
||||||
|
func = PREV_LINK(func);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t get_size_typeformatstring(const type_t *iface)
|
size_t get_size_typeformatstring(const ifref_t *ifaces)
|
||||||
{
|
{
|
||||||
|
const ifref_t *iface = ifaces;
|
||||||
size_t size = 3;
|
size_t size = 3;
|
||||||
func_t *func;
|
func_t *func;
|
||||||
var_t *var;
|
var_t *var;
|
||||||
|
|
||||||
if (iface->funcs)
|
END_OF_LIST(iface);
|
||||||
{
|
|
||||||
func = iface->funcs;
|
|
||||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
|
||||||
while (func)
|
|
||||||
{
|
|
||||||
/* argument list size */
|
|
||||||
if (func->args)
|
|
||||||
{
|
|
||||||
var = func->args;
|
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
|
||||||
size += get_size_typeformatstring_var(var);
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func = PREV_LINK(func);
|
for (; iface; iface = PREV_LINK(iface))
|
||||||
|
{
|
||||||
|
if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (iface->iface->funcs)
|
||||||
|
{
|
||||||
|
func = iface->iface->funcs;
|
||||||
|
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||||
|
while (func)
|
||||||
|
{
|
||||||
|
/* argument list size */
|
||||||
|
if (func->args)
|
||||||
|
{
|
||||||
|
var = func->args;
|
||||||
|
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||||
|
while (var)
|
||||||
|
{
|
||||||
|
size += get_size_typeformatstring_var(var);
|
||||||
|
var = PREV_LINK(var);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func = PREV_LINK(func);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
|
|
|
@ -35,15 +35,15 @@ enum remoting_phase
|
||||||
PHASE_FREE
|
PHASE_FREE
|
||||||
};
|
};
|
||||||
|
|
||||||
void write_procformatstring(FILE *file, type_t *iface);
|
void write_procformatstring(FILE *file, const ifref_t *ifaces);
|
||||||
void write_typeformatstring(FILE *file, type_t *iface);
|
void write_typeformatstring(FILE *file, const ifref_t *ifaces);
|
||||||
size_t get_type_memsize(const type_t *type);
|
size_t get_type_memsize(const type_t *type);
|
||||||
unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment, enum pass pass);
|
unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment, enum pass pass);
|
||||||
void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, enum pass pass, const var_t *var, const char *varname);
|
void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, enum pass pass, const var_t *var, const char *varname);
|
||||||
void write_remoting_arguments(FILE *file, int indent, const func_t *func, unsigned int *type_offset, enum pass pass, enum remoting_phase phase);
|
void write_remoting_arguments(FILE *file, int indent, const func_t *func, unsigned int *type_offset, enum pass pass, enum remoting_phase phase);
|
||||||
size_t get_size_procformatstring_var(const var_t *var);
|
size_t get_size_procformatstring_var(const var_t *var);
|
||||||
size_t get_size_typeformatstring_var(const var_t *var);
|
size_t get_size_typeformatstring_var(const var_t *var);
|
||||||
size_t get_size_procformatstring(const type_t *iface);
|
size_t get_size_procformatstring(const ifref_t *ifaces);
|
||||||
size_t get_size_typeformatstring(const type_t *iface);
|
size_t get_size_typeformatstring(const ifref_t *ifaces);
|
||||||
int write_expr_eval_routines(FILE *file, const char *iface);
|
int write_expr_eval_routines(FILE *file, const char *iface);
|
||||||
void write_expr_eval_routine_list(FILE *file, const char *iface);
|
void write_expr_eval_routine_list(FILE *file, const char *iface);
|
||||||
|
|
|
@ -56,6 +56,14 @@ typedef struct _typelib_t typelib_t;
|
||||||
#define NEXT_LINK(x) ((x)->l_next)
|
#define NEXT_LINK(x) ((x)->l_next)
|
||||||
#define PREV_LINK(x) ((x)->l_prev)
|
#define PREV_LINK(x) ((x)->l_prev)
|
||||||
|
|
||||||
|
#define END_OF_LIST(list) \
|
||||||
|
do { \
|
||||||
|
if (list) { \
|
||||||
|
while (NEXT_LINK(list)) \
|
||||||
|
list = NEXT_LINK(list); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
enum attr_type
|
enum attr_type
|
||||||
{
|
{
|
||||||
ATTR_AGGREGATABLE,
|
ATTR_AGGREGATABLE,
|
||||||
|
|
Loading…
Reference in New Issue