Commit eed74e4e authored by Alexandre Julliard's avatar Alexandre Julliard

widl: Convert variable lists to standard Wine lists.

parent 58827d02
......@@ -65,16 +65,13 @@ static void print_message_buffer_size(const func_t *func)
if (func->args)
{
const var_t *var = func->args;
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
const var_t *var;
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
{
unsigned int alignment;
total_size += get_required_buffer_size(var, &alignment, PASS_IN);
total_size += alignment;
var = PREV_LINK(var);
}
}
fprintf(client, " %u", total_size);
......@@ -82,14 +79,12 @@ static void print_message_buffer_size(const func_t *func)
static void check_pointers(const func_t *func)
{
var_t *var;
const var_t *var;
if (!func->args)
return;
var = func->args;
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
{
if (is_var_ptr(var) && cant_be_null(var))
{
......@@ -100,8 +95,6 @@ static void check_pointers(const func_t *func)
indent--;
print_client("}\n\n");
}
var = PREV_LINK(var);
}
}
......@@ -110,7 +103,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
const func_t *func;
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
var_t *var;
const var_t *var;
int method_count = 0;
if (iface->funcs) LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
......@@ -259,13 +252,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
/* update proc_offset */
if (func->args)
{
var = func->args;
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
{
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
*proc_offset += get_size_procformatstring_var(var);
var = PREV_LINK(var);
}
}
if (!is_void(def->type, NULL))
*proc_offset += get_size_procformatstring_var(def);
......
......@@ -164,23 +164,19 @@ static void write_field(FILE *h, var_t *v)
}
}
static void write_fields(FILE *h, var_t *v)
static void write_fields(FILE *h, var_list_t *fields)
{
var_t *first = v;
if (!v) return;
while (NEXT_LINK(v)) v = NEXT_LINK(v);
while (v) {
write_field(h, v);
if (v == first) break;
v = PREV_LINK(v);
}
var_t *v;
if (!fields) return;
LIST_FOR_EACH_ENTRY( v, fields, var_t, entry ) write_field(h, v);
}
static void write_enums(FILE *h, var_t *v)
static void write_enums(FILE *h, var_list_t *enums)
{
if (!v) return;
while (NEXT_LINK(v)) v = NEXT_LINK(v);
while (v) {
var_t *v;
if (!enums) return;
LIST_FOR_EACH_ENTRY( v, enums, var_t, entry )
{
if (get_name(v)) {
indent(h, 0);
write_name(h, v);
......@@ -189,9 +185,7 @@ static void write_enums(FILE *h, var_t *v)
write_expr(h, v->eval, 0);
}
}
if (PREV_LINK(v))
fprintf(h, ",\n");
v = PREV_LINK(v);
if (list_next( enums, &v->entry )) fprintf(h, ",\n");
}
fprintf(h, "\n");
}
......@@ -292,9 +286,13 @@ static int user_type_registered(const char *name)
return 0;
}
static void check_for_user_types(const var_t *v)
static void check_for_user_types(const var_list_t *list)
{
while (v) {
const var_t *v;
if (!list) return;
LIST_FOR_EACH_ENTRY( v, list, const var_t, entry )
{
type_t *type;
for (type = v->type; type; type = type->kind == TKIND_ALIAS ? type->orig : type->ref) {
const char *name = type->name;
......@@ -312,14 +310,11 @@ static void check_for_user_types(const var_t *v)
* using a wire marshaled type */
break;
}
else if (type->fields)
else
{
const var_t *fields = type->fields;
while (NEXT_LINK(fields)) fields = NEXT_LINK(fields);
check_for_user_types(fields);
check_for_user_types(type->fields);
}
}
v = PREV_LINK(v);
}
}
......@@ -456,22 +451,16 @@ const var_t* get_explicit_handle_var(const func_t* func)
if (!func->args)
return NULL;
var = func->args;
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
{
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
if (var->type->type == RPC_FC_BIND_PRIMITIVE)
return var;
var = PREV_LINK(var);
}
return NULL;
}
int has_out_arg_or_return(const func_t *func)
{
var_t *var;
const var_t *var;
if (!is_void(func->def->type, NULL))
return 1;
......@@ -479,15 +468,10 @@ int has_out_arg_or_return(const func_t *func)
if (!func->args)
return 0;
var = func->args;
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
{
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
if (is_attr(var->attrs, ATTR_OUT))
return 1;
var = PREV_LINK(var);
}
return 0;
}
......@@ -525,13 +509,11 @@ static void write_method_macro(const type_t *iface, const char *name)
{
var_t *def = cur->def;
if (!is_callas(def->attrs)) {
var_t *arg = cur->args;
const var_t *arg;
int argc = 0;
int c;
while (arg) {
arg = NEXT_LINK(arg);
argc++;
}
if (cur->args) LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry ) argc++;
fprintf(header, "#define %s_", name);
write_name(header,def);
......@@ -550,13 +532,11 @@ static void write_method_macro(const type_t *iface, const char *name)
}
}
void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent)
void write_args(FILE *h, const var_list_t *args, const char *name, int method, int do_indent)
{
const var_t *arg;
int count = 0;
if (arg) {
while (NEXT_LINK(arg))
arg = NEXT_LINK(arg);
}
if (do_indent)
{
indentation++;
......@@ -566,7 +546,7 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent
fprintf(h, "%s* This", name);
count++;
}
while (arg) {
if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) {
if (count) {
if (do_indent)
{
......@@ -591,7 +571,6 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent
write_name(h, arg);
}
write_array(h, arg->array, 0);
arg = PREV_LINK(arg);
count++;
}
if (do_indent) indentation--;
......@@ -664,7 +643,7 @@ static void write_method_proto(const type_t *iface)
{
const var_t *def = cur->def;
const var_t *cas = is_callas(def->attrs);
const var_t *args;
if (!is_local(def->attrs)) {
/* proxy prototype */
write_type(header, def->type, def, def->tname);
......@@ -681,13 +660,7 @@ static void write_method_proto(const type_t *iface)
fprintf(header, " IRpcChannelBuffer* pRpcChannelBuffer,\n");
fprintf(header, " PRPC_MESSAGE pRpcMessage,\n");
fprintf(header, " DWORD* pdwStubPhase);\n");
args = cur->args;
if (args) {
while (NEXT_LINK(args))
args = NEXT_LINK(args);
}
check_for_user_types(args);
check_for_user_types(cur->args);
}
if (cas) {
const func_t *m;
......
......@@ -31,7 +31,7 @@ extern void write_type(FILE *h, type_t *t, const var_t *v, const char *n);
extern int is_object(const attr_list_t *list);
extern int is_local(const attr_list_t *list);
extern const var_t *is_callas(const attr_list_t *list);
extern void write_args(FILE *h, var_t *arg, const char *name, int obj, int do_indent);
extern void write_args(FILE *h, const var_list_t *arg, const char *name, int obj, int do_indent);
extern void write_array(FILE *h, const expr_t *v, int field);
extern void write_forward(type_t *iface);
extern void write_interface(type_t *iface);
......
......@@ -106,26 +106,28 @@ static void init_proxy(ifref_list_t *ifaces)
write_stubdescproto();
}
static void clear_output_vars( var_t *arg )
static void clear_output_vars( const var_list_t *args )
{
END_OF_LIST(arg);
while (arg) {
const var_t *arg;
if (!args) return;
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
{
if (is_attr(arg->attrs, ATTR_OUT) && !is_attr(arg->attrs, ATTR_IN)) {
print_proxy( "if(%s)\n", arg->name );
indent++;
print_proxy( "MIDL_memset( %s, 0, sizeof( *%s ));\n", arg->name, arg->name );
indent--;
}
arg = PREV_LINK(arg);
}
}
int is_var_ptr(var_t *v)
int is_var_ptr(const var_t *v)
{
return v->ptr_level || is_ptr(v->type);
}
int cant_be_null(var_t *v)
int cant_be_null(const var_t *v)
{
/* Search backwards for the most recent pointer attribute. */
const attr_list_t *attrs = v->attrs;
......@@ -159,7 +161,7 @@ int cant_be_null(var_t *v)
return 1; /* Default is RPC_FC_RP. */
}
static int is_user_derived(var_t *v)
static int is_user_derived(const var_t *v)
{
const attr_list_t *attrs = v->attrs;
const type_t *type = v->type;
......@@ -187,21 +189,23 @@ static int is_user_derived(var_t *v)
return 0;
}
static void proxy_check_pointers( var_t *arg )
static void proxy_check_pointers( const var_list_t *args )
{
END_OF_LIST(arg);
while (arg) {
const var_t *arg;
if (!args) return;
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
{
if (is_var_ptr(arg) && cant_be_null(arg)) {
print_proxy( "if(!%s)\n", arg->name );
indent++;
print_proxy( "RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
indent--;
}
arg = PREV_LINK(arg);
}
}
static void marshall_size_arg( var_t *arg )
static void marshall_size_arg( const var_t *arg )
{
int index = 0;
const type_t *type = arg->type;
......@@ -289,22 +293,23 @@ static void marshall_size_arg( var_t *arg )
}
}
static void proxy_gen_marshall_size( var_t *arg )
static void proxy_gen_marshall_size( const var_list_t *args )
{
print_proxy( "_StubMsg.BufferLength = 0U;\n" );
const var_t *arg;
END_OF_LIST(arg);
while (arg) {
if (is_attr(arg->attrs, ATTR_IN))
print_proxy( "_StubMsg.BufferLength = 0U;\n" );
if (!args) return;
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
{
if (is_attr(arg->attrs, ATTR_IN))
{
marshall_size_arg( arg );
fprintf(proxy, "\n");
}
arg = PREV_LINK(arg);
}
}
static void marshall_copy_arg( var_t *arg )
static void marshall_copy_arg( const var_t *arg )
{
int index = 0;
type_t *type = arg->type;
......@@ -390,34 +395,36 @@ static void marshall_copy_arg( var_t *arg )
}
}
static void gen_marshall_copydata( var_t *arg )
static void gen_marshall_copydata( const var_list_t *args )
{
END_OF_LIST(arg);
while (arg) {
if (is_attr(arg->attrs, ATTR_IN))
const var_t *arg;
if (!args) return;
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
{
if (is_attr(arg->attrs, ATTR_IN))
{
marshall_copy_arg( arg );
fprintf(proxy, "\n");
}
arg = PREV_LINK(arg);
}
}
static void gen_marshall( var_t *arg )
static void gen_marshall( const var_list_t *args )
{
/* generated code to determine the size of the buffer required */
proxy_gen_marshall_size( arg );
proxy_gen_marshall_size( args );
/* generated code to allocate the buffer */
print_proxy( "NdrProxyGetBuffer(This, &_StubMsg);\n" );
/* generated code to copy the args into the buffer */
gen_marshall_copydata( arg );
gen_marshall_copydata( args );
print_proxy( "\n");
}
static void unmarshall_copy_arg( var_t *arg )
static void unmarshall_copy_arg( const var_t *arg )
{
int index = 0;
type_t *type = arg->type;
......@@ -501,20 +508,22 @@ static void unmarshall_copy_arg( var_t *arg )
}
}
static void gen_unmarshall( var_t *arg )
static void gen_unmarshall( var_list_t *args )
{
END_OF_LIST(arg);
while (arg) {
if (is_attr(arg->attrs, ATTR_OUT))
const var_t *arg;
if (!args) return;
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
{
if (is_attr(arg->attrs, ATTR_OUT))
{
unmarshall_copy_arg( arg );
fprintf(proxy, "\n");
}
arg = PREV_LINK(arg);
}
}
static void free_variable( var_t *arg )
static void free_variable( const var_t *arg )
{
var_t *constraint;
int index = 0; /* FIXME */
......@@ -563,16 +572,18 @@ static void free_variable( var_t *arg )
}
}
static void proxy_free_variables( var_t *arg )
static void proxy_free_variables( var_list_t *args )
{
END_OF_LIST(arg);
while (arg) {
if (is_attr(arg->attrs, ATTR_OUT))
const var_t *arg;
if (!args) return;
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
{
if (is_attr(arg->attrs, ATTR_OUT))
{
free_variable( arg );
fprintf(proxy, "\n");
}
arg = PREV_LINK(arg);
}
}
......@@ -670,11 +681,14 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx)
print_proxy( "\n");
}
static void stub_write_locals( var_t *arg )
static void stub_write_locals( var_list_t *args )
{
int n = 0;
END_OF_LIST(arg);
while (arg) {
const var_t *arg;
if (!args) return;
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
{
int outptr = is_attr(arg->attrs, ATTR_OUT)
&& ! is_attr(arg->attrs, ATTR_IN);
......@@ -692,15 +706,17 @@ static void stub_write_locals( var_t *arg )
fprintf(proxy, " ");
write_name(proxy, arg);
fprintf(proxy, ";\n");
arg = PREV_LINK(arg);
}
}
static void stub_unmarshall( var_t *arg )
static void stub_unmarshall( const var_list_t *args )
{
int n = 0;
END_OF_LIST(arg);
while (arg) {
const var_t *arg;
if (!args) return;
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
{
if (is_attr(arg->attrs, ATTR_IN))
{
unmarshall_copy_arg( arg );
......@@ -726,33 +742,32 @@ static void stub_unmarshall( var_t *arg )
break;
}
}
arg = PREV_LINK(arg);
}
}
static void stub_gen_marshall_size( var_t *arg )
static void stub_gen_marshall_size( const var_list_t *args )
{
const var_t *arg;
print_proxy( "_StubMsg.BufferLength = 0U;\n" );
END_OF_LIST(arg);
while (arg) {
if (!args) return;
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
if (is_attr(arg->attrs, ATTR_OUT))
marshall_size_arg( arg );
arg = PREV_LINK(arg);
}
}
static void stub_gen_marshall_copydata( var_t *arg )
static void stub_gen_marshall_copydata( const var_list_t *args )
{
END_OF_LIST(arg);
while (arg) {
const var_t *arg;
if (!args) return;
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
if (is_attr(arg->attrs, ATTR_OUT))
marshall_copy_arg( arg );
arg = PREV_LINK(arg);
}
}
static void stub_genmarshall( var_t *args )
static void stub_genmarshall( const var_list_t *args )
{
/* FIXME: size buffer */
stub_gen_marshall_size( args );
......@@ -765,7 +780,7 @@ static void stub_genmarshall( var_t *args )
static void gen_stub(type_t *iface, const func_t *cur, const char *cas)
{
var_t *def = cur->def;
var_t *arg;
const var_t *arg;
int has_ret = !is_void(def->type, def);
indent = 0;
......@@ -816,14 +831,14 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas)
if (cas) fprintf(proxy, "%s_Stub", cas);
else write_name(proxy, def);
fprintf(proxy, "(_This");
arg = cur->args;
if (arg) {
END_OF_LIST(arg);
while (arg) {
fprintf(proxy, ", ");
write_name(proxy, arg);
arg = PREV_LINK(arg);
}
if (cur->args)
{
LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry )
{
fprintf(proxy, ", ");
write_name(proxy, arg);
}
}
fprintf(proxy, ");\n");
fprintf(proxy, "\n");
......
......@@ -68,15 +68,10 @@ static void write_parameters_init(const func_t *func)
if (!func->args)
return;
var = func->args;
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
{
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
if (var->type->type != RPC_FC_BIND_PRIMITIVE)
print_server("%s = 0;\n", var->name);
var = PREV_LINK(var);
}
fprintf(server, "\n");
}
......@@ -85,14 +80,12 @@ static void declare_args(const func_t *func)
{
int in_attr, out_attr;
int i = 0;
var_t *var;
const var_t *var;
if (!func->args)
return;
var = func->args;
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
{
const expr_t *size_is = get_attrp(var->attrs, ATTR_SIZEIS);
int has_size = size_is && (size_is->type != EXPR_VOID);
......@@ -119,8 +112,6 @@ static void declare_args(const func_t *func)
write_name(server, var);
write_array(server, var->array, 0);
fprintf(server, ";\n");
var = PREV_LINK(var);
}
}
......@@ -129,16 +120,14 @@ static void assign_out_args(const func_t *func)
{
int in_attr, out_attr;
int i = 0, sep = 0;
var_t *var;
const var_t *var;
const expr_t *size_is;
int has_size;
if (!func->args)
return;
var = func->args;
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
{
int is_string = is_attr(var->attrs, ATTR_STRING);
size_is = get_attrp(var->attrs, ATTR_SIZEIS);
......@@ -173,8 +162,6 @@ static void assign_out_args(const func_t *func)
sep = 1;
}
var = PREV_LINK(var);
}
if (sep)
......@@ -319,9 +306,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
fprintf(server, "(\n");
indent++;
var = func->args;
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
{
if (first_arg)
first_arg = 0;
......@@ -329,7 +314,6 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
fprintf(server, ",\n");
print_server("");
write_name(server, var);
var = PREV_LINK(var);
}
fprintf(server, ");\n");
indent--;
......@@ -341,9 +325,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
if (func->args)
{
const var_t *var = func->args;
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
{
if (is_attr(var->attrs, ATTR_OUT))
{
......@@ -351,8 +333,6 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
buffer_size += get_required_buffer_size(var, &alignment, PASS_OUT);
buffer_size += alignment;
}
var = PREV_LINK(var);
}
}
......@@ -417,13 +397,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
/* update proc_offset */
if (func->args)
{
var = func->args;
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
{
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
*proc_offset += get_size_procformatstring_var(var);
var = PREV_LINK(var);
}
}
if (!is_void(def->type, NULL))
*proc_offset += get_size_procformatstring_var(def);
......
......@@ -48,6 +48,7 @@ typedef struct _typelib_t typelib_t;
typedef struct list attr_list_t;
typedef struct list func_list_t;
typedef struct list var_list_t;
typedef struct list ifref_list_t;
#define DECL_LINK(type) \
......@@ -210,7 +211,7 @@ struct _type_t {
struct _type_t *ref;
const attr_list_t *attrs;
func_list_t *funcs; /* interfaces and modules */
var_t *fields; /* interfaces, structures and enumerations */
var_list_t *fields; /* interfaces, structures and enumerations */
ifref_list_t *ifaces; /* coclasses */
type_t *orig; /* dup'd types */
int ignore, is_const, sign;
......@@ -231,18 +232,18 @@ struct _var_t {
int ptr_level;
expr_t *array;
type_t *type;
var_t *args; /* for function pointers */
var_list_t *args; /* for function pointers */
const char *tname;
attr_list_t *attrs;
expr_t *eval;
/* parser-internal */
DECL_LINK(var_t);
struct list entry;
};
struct _func_t {
var_t *def;
var_t *args;
var_list_t *args;
int ignore, idx;
/* parser-internal */
......@@ -301,7 +302,7 @@ type_t *duptype(type_t *t, int dupname);
type_t *alias(type_t *t, const char *name);
int is_ptr(const type_t *t);
int is_var_ptr(var_t *v);
int cant_be_null(var_t *v);
int is_var_ptr(const var_t *v);
int cant_be_null(const var_t *v);
#endif
......@@ -1250,7 +1250,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
int i, id, next_idx;
int decoded_size, extra_attr = 0;
int num_params = 0, num_defaults = 0;
var_t *arg, *last_arg = NULL;
var_t *arg;
char *namedata;
const attr_t *attr;
unsigned int funcflags = 0, callconv = 4 /* CC_STDCALL */;
......@@ -1279,8 +1279,9 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
return S_FALSE;
}
for(arg = func->args; arg; arg = NEXT_LINK(arg)) {
last_arg = arg;
if (func->args)
LIST_FOR_EACH_ENTRY( arg, func->args, var_t, entry )
{
num_params++;
if (arg->attrs) LIST_FOR_EACH_ENTRY( attr, arg->attrs, const attr_t, entry ) {
if(attr->type == ATTR_DEFAULTVALUE_EXPR || attr->type == ATTR_DEFAULTVALUE_STRING) {
......@@ -1288,7 +1289,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
break;
}
}
}
}
chat("add_func_desc: num of params %d\n", num_params);
......@@ -1433,7 +1434,11 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
warning("unknown number of optional attrs\n");
}
for (arg = last_arg, i = 0; arg; arg = PREV_LINK(arg), i++) {
if (func->args)
{
i = 0;
LIST_FOR_EACH_ENTRY( arg, func->args, var_t, entry )
{
const attr_t *attr;
int paramflags = 0;
int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3;
......@@ -1491,6 +1496,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
paramdata[1] = -1;
paramdata[2] = paramflags;
typedata[3] += decoded_size << 16;
i++;
}
}
if(typeinfo->funcs_allocated == 0) {
......@@ -1541,10 +1548,16 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
if(invokekind != 0x4 /* INVOKE_PROPERTYPUT */ && invokekind != 0x8 /* INVOKE_PROPERTYPUTREF */) {
/* don't give the arg of a [propput*] func a name */
for (arg = last_arg, i = 0; arg; arg = PREV_LINK(arg), i++) {
if (func->args)
{
i = 0;
LIST_FOR_EACH_ENTRY( arg, func->args, var_t, entry )
{
int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3;
offset = ctl2_alloc_name(typeinfo->typelib, arg->name);
paramdata[1] = offset;
i++;
}
}
}
return S_OK;
......@@ -1919,14 +1932,9 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
if (dispinterface->funcs)
LIST_FOR_EACH_ENTRY( func, dispinterface->funcs, const func_t, entry ) idx++;
if((var = dispinterface->fields)) {
while(NEXT_LINK(var)) var = NEXT_LINK(var);
while(var) {
add_var_desc(msft_typeinfo, idx, var);
idx++;
var = PREV_LINK(var);
}
}
if (dispinterface->fields)
LIST_FOR_EACH_ENTRY( var, dispinterface->fields, var_t, entry )
add_var_desc(msft_typeinfo, idx++, var);
if (dispinterface->funcs)
{
......@@ -1998,7 +2006,7 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure)
{
int idx = 0;
var_t *cur = structure->fields;
var_t *cur;
msft_typeinfo_t *msft_typeinfo;
if (-1 < structure->typelib_idx)
......@@ -2008,30 +2016,24 @@ static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure)
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_RECORD, structure->name, structure->attrs);
msft_typeinfo->typeinfo->size = 0;
while(NEXT_LINK(cur)) cur = NEXT_LINK(cur);
while(cur) {
add_var_desc(msft_typeinfo, idx, cur);
idx++;
cur = PREV_LINK(cur);
}
if (structure->fields)
LIST_FOR_EACH_ENTRY( cur, structure->fields, var_t, entry )
add_var_desc(msft_typeinfo, idx++, cur);
}
static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration)
{
int idx = 0;
var_t *cur = enumeration->fields;
var_t *cur;
msft_typeinfo_t *msft_typeinfo;
enumeration->typelib_idx = typelib->typelib_header.nrtypeinfos;
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ENUM, enumeration->name, enumeration->attrs);
msft_typeinfo->typeinfo->size = 0;
while(NEXT_LINK(cur)) cur = NEXT_LINK(cur);
while(cur) {
add_var_desc(msft_typeinfo, idx, cur);
idx++;
cur = PREV_LINK(cur);
}
if (enumeration->fields)
LIST_FOR_EACH_ENTRY( cur, enumeration->fields, var_t, entry )
add_var_desc(msft_typeinfo, idx++, cur);
}
static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
......
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