widl: Use type_get_type to determine the types of types during C client, server and proxy code generation.

This commit is contained in:
Rob Shearman 2009-02-23 13:48:34 +00:00 committed by Alexandre Julliard
parent 28a2c06cf7
commit af0800729b
3 changed files with 773 additions and 615 deletions

View File

@ -153,8 +153,6 @@ int is_var_ptr(const var_t *v)
int cant_be_null(const 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;
const type_t *type = v->type; const type_t *type = v->type;
/* context handles have their own checking so they can be null for the /* context handles have their own checking so they can be null for the
@ -165,32 +163,7 @@ int cant_be_null(const var_t *v)
if (is_user_type(type)) if (is_user_type(type))
return 0; return 0;
if (!attrs && is_ptr(type)) return (get_pointer_fc(type) == RPC_FC_RP);
{
attrs = type->attrs;
type = type_pointer_get_ref(type);
}
while (attrs)
{
int t = get_attrv(attrs, ATTR_POINTERTYPE);
if (t == RPC_FC_FP || t == RPC_FC_OP || t == RPC_FC_UP)
return 0;
if (t == RPC_FC_RP)
return 1;
if (is_ptr(type))
{
attrs = type->attrs;
type = type_pointer_get_ref(type);
}
else
attrs = NULL;
}
return 1; /* Default is RPC_FC_RP. */
} }
static int need_delegation(const type_t *iface) static int need_delegation(const type_t *iface)
@ -252,22 +225,21 @@ static void free_variable( const var_t *arg, const char *local_var_prefix )
return; return;
} }
switch( type->type ) switch (type_get_type(type))
{ {
case RPC_FC_BYTE: case TYPE_ENUM:
case RPC_FC_CHAR: case TYPE_BASIC:
case RPC_FC_WCHAR:
case RPC_FC_SHORT:
case RPC_FC_USHORT:
case RPC_FC_ENUM16:
case RPC_FC_LONG:
case RPC_FC_ULONG:
case RPC_FC_ENUM32:
case RPC_FC_STRUCT:
break; break;
case RPC_FC_FP: case TYPE_STRUCT:
case RPC_FC_IP: if (get_struct_fc(type) != RPC_FC_STRUCT)
print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type_get_type(type) );
break;
case TYPE_POINTER:
case TYPE_INTERFACE:
if (type_get_type(type) == TYPE_INTERFACE || get_pointer_fc(type) == RPC_FC_FP)
{
iid = get_attrp( arg->attrs, ATTR_IIDIS ); iid = get_attrp( arg->attrs, ATTR_IIDIS );
if( iid ) if( iid )
{ {
@ -278,10 +250,13 @@ static void free_variable( const var_t *arg, const char *local_var_prefix )
print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, "); print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, ");
fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset ); fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
fprintf(proxy, "(void*)%s );\n", arg->name ); fprintf(proxy, "(void*)%s );\n", arg->name );
}
else
print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type_get_type(type) );
break; break;
default: default:
print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type->type ); print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type_get_type(type) );
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -66,3 +66,5 @@ expr_t *get_size_is_expr(const type_t *t, const char *name);
int is_full_pointer_function(const var_t *func); int is_full_pointer_function(const var_t *func);
void write_full_pointer_init(FILE *file, int indent, const var_t *func, int is_server); void write_full_pointer_init(FILE *file, int indent, const var_t *func, int is_server);
void write_full_pointer_free(FILE *file, int indent, const var_t *func); void write_full_pointer_free(FILE *file, int indent, const var_t *func);
unsigned char get_pointer_fc(const type_t *type);
unsigned char get_struct_fc(const type_t *type);