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

widl: Factor the output functions.

parent e4679b0c
...@@ -44,18 +44,12 @@ ...@@ -44,18 +44,12 @@
static FILE* client; static FILE* client;
static int indent = 0; static int indent = 0;
static int print_client( const char *format, ... ) static void print_client( const char *format, ... )
{ {
va_list va; va_list va;
int i, r;
va_start(va, format); va_start(va, format);
if (format[0] != '\n') print(client, indent, format, va);
for (i = 0; i < indent; i++)
fprintf(client, " ");
r = vfprintf(client, format, va);
va_end(va); va_end(va);
return r;
} }
......
...@@ -51,18 +51,12 @@ static int indent = 0; ...@@ -51,18 +51,12 @@ static int indent = 0;
/* FIXME: support generation of stubless proxies */ /* FIXME: support generation of stubless proxies */
static int print_proxy( const char *format, ... ) static void print_proxy( const char *format, ... )
{ {
va_list va; va_list va;
int i, r;
va_start( va, format ); va_start( va, format );
if ( format[0] != '\n' ) print( proxy, indent, format, va );
for( i=0; i<indent; i++ )
fprintf( proxy, " " );
r = vfprintf( proxy, format, va );
va_end( va ); va_end( va );
return r;
} }
static void write_stubdescproto(void) static void write_stubdescproto(void)
......
...@@ -46,18 +46,12 @@ static FILE* server; ...@@ -46,18 +46,12 @@ static FILE* server;
static int indent = 0; static int indent = 0;
static int print_server(const char *format, ...) static void print_server(const char *format, ...)
{ {
va_list va; va_list va;
int i, r;
va_start(va, format); va_start(va, format);
if (format[0] != '\n') print(server, indent, format, va);
for (i = 0; i < indent; i++)
fprintf(server, " ");
r = vfprintf(server, format, va);
va_end(va); va_end(va);
return r;
} }
......
...@@ -254,19 +254,23 @@ static int compare_expr(const expr_t *a, const expr_t *b) ...@@ -254,19 +254,23 @@ static int compare_expr(const expr_t *a, const expr_t *b)
} \ } \
while (0) while (0)
static int print_file(FILE *file, int indent, const char *format, ...) static void print_file(FILE *file, int indent, const char *format, ...)
{ {
va_list va; va_list va;
int i, r;
if (!file) return 0;
va_start(va, format); va_start(va, format);
for (i = 0; i < indent; i++) print(file, indent, format, va);
fprintf(file, " ");
r = vfprintf(file, format, va);
va_end(va); va_end(va);
return r; }
void print(FILE *file, int indent, const char *format, va_list va)
{
if (file)
{
if (format[0] != '\n')
while (0 < indent--)
fprintf(file, " ");
vfprintf(file, format, va);
}
} }
static void write_formatdesc(FILE *f, int indent, const char *str) static void write_formatdesc(FILE *f, int indent, const char *str)
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <stdarg.h>
enum pass enum pass
{ {
...@@ -53,3 +54,4 @@ void write_endpoints( FILE *f, const char *prefix, const str_list_t *list ); ...@@ -53,3 +54,4 @@ void write_endpoints( FILE *f, const char *prefix, const str_list_t *list );
size_t type_memsize(const type_t *t, unsigned int *align); size_t type_memsize(const type_t *t, unsigned int *align);
int decl_indirect(const type_t *t); int decl_indirect(const type_t *t);
void write_parameters_init(const func_t *func); void write_parameters_init(const func_t *func);
void print(FILE *file, int indent, const char *format, va_list ap);
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