widl: Write prototypes for context handle rundown rountines into generated header files.

This commit is contained in:
Rob Shearman 2007-09-27 17:38:13 -07:00 committed by Alexandre Julliard
parent 71d70f0fa1
commit a2fedc3769
5 changed files with 39 additions and 6 deletions

View File

@ -38,6 +38,8 @@
#include "header.h" #include "header.h"
static int indentation = 0; static int indentation = 0;
user_type_list_t user_type_list = LIST_INIT(user_type_list);
static context_handle_list_t context_handle_list = LIST_INIT(context_handle_list);
static void indent(FILE *h, int delta) static void indent(FILE *h, int delta)
{ {
@ -286,8 +288,6 @@ void write_type(FILE *h, type_t *t, int is_field, const char *fmt, ...)
write_type_right(h, t, is_field); write_type_right(h, t, is_field);
} }
user_type_list_t user_type_list = LIST_INIT(user_type_list);
static int user_type_registered(const char *name) static int user_type_registered(const char *name)
{ {
user_type_t *ut; user_type_t *ut;
@ -297,7 +297,16 @@ static int user_type_registered(const char *name)
return 0; return 0;
} }
void check_for_user_types(const var_list_t *list) static int context_handle_registered(const char *name)
{
context_handle_t *ch;
LIST_FOR_EACH_ENTRY(ch, &context_handle_list, context_handle_t, entry)
if (!strcmp(name, ch->name))
return 1;
return 0;
}
void check_for_user_types_and_context_handles(const var_list_t *list)
{ {
const var_t *v; const var_t *v;
@ -309,6 +318,16 @@ void check_for_user_types(const var_list_t *list)
const char *name = type->name; const char *name = type->name;
if (type->user_types_registered) continue; if (type->user_types_registered) continue;
type->user_types_registered = 1; type->user_types_registered = 1;
if (is_attr(type->attrs, ATTR_CONTEXTHANDLE)) {
if (!context_handle_registered(name))
{
context_handle_t *ch = xmalloc(sizeof(*ch));
ch->name = xstrdup(name);
list_add_tail(&context_handle_list, &ch->entry);
}
/* don't carry on parsing fields within this type */
break;
}
if (is_attr(type->attrs, ATTR_WIREMARSHAL)) { if (is_attr(type->attrs, ATTR_WIREMARSHAL)) {
if (!user_type_registered(name)) if (!user_type_registered(name))
{ {
@ -322,7 +341,7 @@ void check_for_user_types(const var_list_t *list)
} }
else else
{ {
check_for_user_types(type->fields); check_for_user_types_and_context_handles(type->fields);
} }
} }
} }
@ -341,6 +360,16 @@ void write_user_types(void)
} }
} }
void write_context_handle_rundowns(void)
{
context_handle_t *ch;
LIST_FOR_EACH_ENTRY(ch, &context_handle_list, context_handle_t, entry)
{
const char *name = ch->name;
fprintf(header, "void __RPC_USER %s_rundown(%s);\n", name, name);
}
}
void write_typedef(type_t *type) void write_typedef(type_t *type)
{ {
fprintf(header, "typedef "); fprintf(header, "typedef ");

View File

@ -52,6 +52,7 @@ extern void write_constdef(const var_t *v);
extern void write_externdef(const var_t *v); extern void write_externdef(const var_t *v);
extern void write_library(const char *name, const attr_list_t *attr); extern void write_library(const char *name, const attr_list_t *attr);
extern void write_user_types(void); extern void write_user_types(void);
extern void write_context_handle_rundowns(void);
extern const var_t* get_explicit_handle_var(const func_t* func); extern const var_t* get_explicit_handle_var(const func_t* func);
extern int has_out_arg_or_return(const func_t *func); extern int has_out_arg_or_return(const func_t *func);
extern void write_guid(FILE *f, const char *guid_prefix, const char *name, extern void write_guid(FILE *f, const char *guid_prefix, const char *name,

View File

@ -2021,6 +2021,6 @@ static void check_all_user_types(ifref_list_t *ifrefs)
{ {
const func_list_t *fs = ifref->iface->funcs; const func_list_t *fs = ifref->iface->funcs;
if (fs) LIST_FOR_EACH_ENTRY(f, fs, const func_t, entry) if (fs) LIST_FOR_EACH_ENTRY(f, fs, const func_t, entry)
check_for_user_types(f->args); check_for_user_types_and_context_handles(f->args);
} }
} }

View File

@ -409,6 +409,7 @@ int main(int argc,char *argv[])
fprintf(header, "/* Begin additional prototypes for all interfaces */\n"); fprintf(header, "/* Begin additional prototypes for all interfaces */\n");
fprintf(header, "\n"); fprintf(header, "\n");
write_user_types(); write_user_types();
write_context_handle_rundowns();
fprintf(header, "\n"); fprintf(header, "\n");
fprintf(header, "/* End additional prototypes */\n"); fprintf(header, "/* End additional prototypes */\n");
fprintf(header, "\n"); fprintf(header, "\n");

View File

@ -47,6 +47,7 @@ typedef struct _importlib_t importlib_t;
typedef struct _importinfo_t importinfo_t; typedef struct _importinfo_t importinfo_t;
typedef struct _typelib_t typelib_t; typedef struct _typelib_t typelib_t;
typedef struct _user_type_t user_type_t; typedef struct _user_type_t user_type_t;
typedef struct _user_type_t context_handle_t;
typedef struct list attr_list_t; typedef struct list attr_list_t;
typedef struct list str_list_t; typedef struct list str_list_t;
@ -57,6 +58,7 @@ typedef struct list pident_list_t;
typedef struct list ifref_list_t; typedef struct list ifref_list_t;
typedef struct list array_dims_t; typedef struct list array_dims_t;
typedef struct list user_type_list_t; typedef struct list user_type_list_t;
typedef struct list context_handle_list_t;
enum attr_type enum attr_type
{ {
@ -306,7 +308,7 @@ struct _user_type_t {
}; };
extern user_type_list_t user_type_list; extern user_type_list_t user_type_list;
void check_for_user_types(const var_list_t *list); void check_for_user_types_and_context_handles(const var_list_t *list);
void init_types(void); void init_types(void);