widl: Add abi_prefix parameter to format_namespace.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
495f24ebb8
commit
13592f0cdb
|
@ -132,7 +132,7 @@ static void write_guid(FILE *f, const char *guid_prefix, const char *name, const
|
|||
|
||||
static void write_uuid_decl(FILE *f, type_t *type, const UUID *uuid)
|
||||
{
|
||||
char *name = format_namespace(type->namespace, "", "::", type->name);
|
||||
char *name = format_namespace(type->namespace, "", "::", type->name, use_abi_namespace ? "ABI" : NULL);
|
||||
fprintf(f, "#ifdef __CRT_UUID_DECL\n");
|
||||
fprintf(f, "__CRT_UUID_DECL(%s, 0x%08x, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x,"
|
||||
"0x%02x,0x%02x,0x%02x,0x%02x,0x%02x)\n",
|
||||
|
|
|
@ -1922,7 +1922,7 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
|
|||
if (is_global_namespace(namespace))
|
||||
type->c_name = name;
|
||||
else
|
||||
type->c_name = format_namespace(namespace, "__x_", "_C", name);
|
||||
type->c_name = format_namespace(namespace, "__x_", "_C", name, use_abi_namespace ? "ABI" : NULL);
|
||||
nt->type = type;
|
||||
nt->t = t;
|
||||
nt->next = namespace->type_hash[hash];
|
||||
|
|
|
@ -89,38 +89,38 @@ const char *type_get_name(const type_t *type, enum name_type name_type)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static char *append_namespace(char *ptr, struct namespace *namespace, const char *separator)
|
||||
static char *append_namespace(char *ptr, struct namespace *namespace, const char *separator, const char *abi_prefix)
|
||||
{
|
||||
if(is_global_namespace(namespace)) {
|
||||
if(!use_abi_namespace)
|
||||
return ptr;
|
||||
strcpy(ptr, "ABI");
|
||||
if(!abi_prefix) return ptr;
|
||||
strcpy(ptr, abi_prefix);
|
||||
strcat(ptr, separator);
|
||||
return ptr + strlen(ptr);
|
||||
}
|
||||
|
||||
ptr = append_namespace(ptr, namespace->parent, separator);
|
||||
ptr = append_namespace(ptr, namespace->parent, separator, abi_prefix);
|
||||
strcpy(ptr, namespace->name);
|
||||
strcat(ptr, separator);
|
||||
return ptr + strlen(ptr);
|
||||
}
|
||||
|
||||
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix)
|
||||
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix,
|
||||
const char *abi_prefix)
|
||||
{
|
||||
unsigned len = strlen(prefix) + strlen(suffix);
|
||||
unsigned sep_len = strlen(separator);
|
||||
struct namespace *iter;
|
||||
char *ret, *ptr;
|
||||
|
||||
if(use_abi_namespace && !is_global_namespace(namespace))
|
||||
len += 3 /* strlen("ABI") */ + sep_len;
|
||||
if(abi_prefix)
|
||||
len += strlen(abi_prefix) + sep_len;
|
||||
|
||||
for(iter = namespace; !is_global_namespace(iter); iter = iter->parent)
|
||||
len += strlen(iter->name) + sep_len;
|
||||
|
||||
ret = xmalloc(len+1);
|
||||
strcpy(ret, prefix);
|
||||
ptr = append_namespace(ret + strlen(ret), namespace, separator);
|
||||
ptr = append_namespace(ret + strlen(ret), namespace, separator, abi_prefix);
|
||||
strcpy(ptr, suffix);
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -613,7 +613,8 @@ var_list_t *append_var(var_list_t *list, var_t *var);
|
|||
|
||||
void init_loc_info(loc_info_t *);
|
||||
|
||||
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix);
|
||||
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix,
|
||||
const char *abi_prefix);
|
||||
|
||||
static inline enum type_type type_get_type_detect_alias(const type_t *type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue