widl: Factor the output functions.

This commit is contained in:
Dan Hipschman 2007-06-14 18:29:33 -07:00 committed by Alexandre Julliard
parent e4679b0c13
commit e36981e116
5 changed files with 21 additions and 33 deletions

View File

@ -44,18 +44,12 @@
static FILE* client;
static int indent = 0;
static int print_client( const char *format, ... )
static void print_client( const char *format, ... )
{
va_list va;
int i, r;
va_start(va, format);
if (format[0] != '\n')
for (i = 0; i < indent; i++)
fprintf(client, " ");
r = vfprintf(client, format, va);
print(client, indent, format, va);
va_end(va);
return r;
}

View File

@ -51,18 +51,12 @@ static int indent = 0;
/* FIXME: support generation of stubless proxies */
static int print_proxy( const char *format, ... )
static void print_proxy( const char *format, ... )
{
va_list va;
int i, r;
va_start( va, format );
if ( format[0] != '\n' )
for( i=0; i<indent; i++ )
fprintf( proxy, " " );
r = vfprintf( proxy, format, va );
print( proxy, indent, format, va );
va_end( va );
return r;
}
static void write_stubdescproto(void)

View File

@ -46,18 +46,12 @@ static FILE* server;
static int indent = 0;
static int print_server(const char *format, ...)
static void print_server(const char *format, ...)
{
va_list va;
int i, r;
va_start(va, format);
if (format[0] != '\n')
for (i = 0; i < indent; i++)
fprintf(server, " ");
r = vfprintf(server, format, va);
print(server, indent, format, va);
va_end(va);
return r;
}

View File

@ -254,19 +254,23 @@ static int compare_expr(const expr_t *a, const expr_t *b)
} \
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;
int i, r;
if (!file) return 0;
va_start(va, format);
for (i = 0; i < indent; i++)
fprintf(file, " ");
r = vfprintf(file, format, va);
print(file, indent, format, 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)

View File

@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
enum pass
{
@ -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);
int decl_indirect(const type_t *t);
void write_parameters_init(const func_t *func);
void print(FILE *file, int indent, const char *format, va_list ap);