Commit 9b16916e authored by Dan Hipschman's avatar Dan Hipschman Committed by Alexandre Julliard

widl: Allow format-string functions to work with objects.

parent e8e501f4
...@@ -440,7 +440,7 @@ void write_client(ifref_t *ifaces) ...@@ -440,7 +440,7 @@ void write_client(ifref_t *ifaces)
if (!client) if (!client)
return; return;
write_formatstringsdecl(client, indent, ifaces); write_formatstringsdecl(client, indent, ifaces, 0);
for (; iface; iface = PREV_LINK(iface)) for (; iface; iface = PREV_LINK(iface))
{ {
...@@ -479,8 +479,8 @@ void write_client(ifref_t *ifaces) ...@@ -479,8 +479,8 @@ void write_client(ifref_t *ifaces)
fprintf(client, "\n"); fprintf(client, "\n");
write_procformatstring(client, ifaces); write_procformatstring(client, ifaces, 0);
write_typeformatstring(client, ifaces); write_typeformatstring(client, ifaces, 0);
fclose(client); fclose(client);
} }
...@@ -110,7 +110,7 @@ static void init_proxy(ifref_t *ifaces) ...@@ -110,7 +110,7 @@ static void init_proxy(ifref_t *ifaces)
print_proxy( "\n"); print_proxy( "\n");
print_proxy( "#include \"%s\"\n", header_name); print_proxy( "#include \"%s\"\n", header_name);
print_proxy( "\n"); print_proxy( "\n");
write_formatstringsdecl(proxy, indent, ifaces); write_formatstringsdecl(proxy, indent, ifaces, 1);
write_stubdescproto(); write_stubdescproto();
} }
...@@ -1031,8 +1031,8 @@ void write_proxies(ifref_t *ifaces) ...@@ -1031,8 +1031,8 @@ void write_proxies(ifref_t *ifaces)
print_proxy( "#error Currently only Wine and WIN32 are supported.\n"); print_proxy( "#error Currently only Wine and WIN32 are supported.\n");
print_proxy( "#endif\n"); print_proxy( "#endif\n");
print_proxy( "\n"); print_proxy( "\n");
write_procformatstring(proxy, ifaces); write_procformatstring(proxy, ifaces, 1);
write_typeformatstring(proxy, ifaces); write_typeformatstring(proxy, ifaces, 1);
fprintf(proxy, "const CInterfaceProxyVtbl* _%s_ProxyVtblList[] =\n", file_id); fprintf(proxy, "const CInterfaceProxyVtbl* _%s_ProxyVtblList[] =\n", file_id);
fprintf(proxy, "{\n"); fprintf(proxy, "{\n");
......
...@@ -582,7 +582,7 @@ void write_server(ifref_t *ifaces) ...@@ -582,7 +582,7 @@ void write_server(ifref_t *ifaces)
if (!server) if (!server)
return; return;
write_formatstringsdecl(server, indent, ifaces); write_formatstringsdecl(server, indent, ifaces, 0);
for (; iface; iface = PREV_LINK(iface)) for (; iface; iface = PREV_LINK(iface))
{ {
...@@ -620,8 +620,8 @@ void write_server(ifref_t *ifaces) ...@@ -620,8 +620,8 @@ void write_server(ifref_t *ifaces)
fprintf(server, "\n"); fprintf(server, "\n");
write_procformatstring(server, ifaces); write_procformatstring(server, ifaces, 0);
write_typeformatstring(server, ifaces); write_typeformatstring(server, ifaces, 0);
fclose(server); fclose(server);
} }
...@@ -142,13 +142,13 @@ static void write_formatdesc(FILE *f, int indent, const char *str) ...@@ -142,13 +142,13 @@ static void write_formatdesc(FILE *f, int indent, const char *str)
print_file(f, indent, "\n"); print_file(f, indent, "\n");
} }
void write_formatstringsdecl(FILE *f, int indent, ifref_t *ifaces) void write_formatstringsdecl(FILE *f, int indent, ifref_t *ifaces, int for_objects)
{ {
print_file(f, indent, "#define TYPE_FORMAT_STRING_SIZE %d\n", print_file(f, indent, "#define TYPE_FORMAT_STRING_SIZE %d\n",
get_size_typeformatstring(ifaces)); get_size_typeformatstring(ifaces, for_objects));
print_file(f, indent, "#define PROC_FORMAT_STRING_SIZE %d\n", print_file(f, indent, "#define PROC_FORMAT_STRING_SIZE %d\n",
get_size_procformatstring(ifaces)); get_size_procformatstring(ifaces, for_objects));
fprintf(f, "\n"); fprintf(f, "\n");
write_formatdesc(f, indent, "TYPE"); write_formatdesc(f, indent, "TYPE");
...@@ -275,7 +275,7 @@ static size_t write_procformatstring_var(FILE *file, int indent, ...@@ -275,7 +275,7 @@ static size_t write_procformatstring_var(FILE *file, int indent,
return size; return size;
} }
void write_procformatstring(FILE *file, const ifref_t *ifaces) void write_procformatstring(FILE *file, const ifref_t *ifaces, int for_objects)
{ {
const ifref_t *iface = ifaces; const ifref_t *iface = ifaces;
int indent = 0; int indent = 0;
...@@ -293,7 +293,7 @@ void write_procformatstring(FILE *file, const ifref_t *ifaces) ...@@ -293,7 +293,7 @@ void write_procformatstring(FILE *file, const ifref_t *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 (for_objects != is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
continue; continue;
if (iface->iface->funcs) if (iface->iface->funcs)
...@@ -1385,7 +1385,7 @@ static size_t write_typeformatstring_var(FILE *file, int indent, ...@@ -1385,7 +1385,7 @@ static size_t write_typeformatstring_var(FILE *file, int indent,
} }
void write_typeformatstring(FILE *file, const ifref_t *ifaces) void write_typeformatstring(FILE *file, const ifref_t *ifaces, int for_objects)
{ {
int indent = 0; int indent = 0;
var_t *var; var_t *var;
...@@ -1405,7 +1405,7 @@ void write_typeformatstring(FILE *file, const ifref_t *ifaces) ...@@ -1405,7 +1405,7 @@ void write_typeformatstring(FILE *file, const ifref_t *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 (for_objects != is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
continue; continue;
if (iface->iface->funcs) if (iface->iface->funcs)
...@@ -1900,7 +1900,7 @@ size_t get_size_typeformatstring_var(const var_t *var) ...@@ -1900,7 +1900,7 @@ size_t get_size_typeformatstring_var(const var_t *var)
return type_offset; return type_offset;
} }
size_t get_size_procformatstring(const ifref_t *ifaces) size_t get_size_procformatstring(const ifref_t *ifaces, int for_objects)
{ {
const ifref_t *iface = ifaces; const ifref_t *iface = ifaces;
size_t size = 1; size_t size = 1;
...@@ -1911,7 +1911,7 @@ size_t get_size_procformatstring(const ifref_t *ifaces) ...@@ -1911,7 +1911,7 @@ size_t get_size_procformatstring(const ifref_t *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 (for_objects != is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
continue; continue;
if (iface->iface->funcs) if (iface->iface->funcs)
...@@ -1946,7 +1946,7 @@ size_t get_size_procformatstring(const ifref_t *ifaces) ...@@ -1946,7 +1946,7 @@ size_t get_size_procformatstring(const ifref_t *ifaces)
return size; return size;
} }
size_t get_size_typeformatstring(const ifref_t *ifaces) size_t get_size_typeformatstring(const ifref_t *ifaces, int for_objects)
{ {
const ifref_t *iface = ifaces; const ifref_t *iface = ifaces;
size_t size = 3; size_t size = 3;
...@@ -1957,7 +1957,7 @@ size_t get_size_typeformatstring(const ifref_t *ifaces) ...@@ -1957,7 +1957,7 @@ size_t get_size_typeformatstring(const ifref_t *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 (for_objects != is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
continue; continue;
if (iface->iface->funcs) if (iface->iface->funcs)
......
...@@ -35,16 +35,16 @@ enum remoting_phase ...@@ -35,16 +35,16 @@ enum remoting_phase
PHASE_FREE PHASE_FREE
}; };
void write_formatstringsdecl(FILE *f, int indent, ifref_t *ifaces); void write_formatstringsdecl(FILE *f, int indent, ifref_t *ifaces, int for_objects);
void write_procformatstring(FILE *file, const ifref_t *ifaces); void write_procformatstring(FILE *file, const ifref_t *ifaces, int for_objects);
void write_typeformatstring(FILE *file, const ifref_t *ifaces); void write_typeformatstring(FILE *file, const ifref_t *ifaces, int for_objects);
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 ifref_t *ifaces); size_t get_size_procformatstring(const ifref_t *ifaces, int for_objects);
size_t get_size_typeformatstring(const ifref_t *ifaces); size_t get_size_typeformatstring(const ifref_t *ifaces, int for_objects);
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);
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