mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 06:21:15 +00:00
msvcrt: Rename modifier into qualifier.
That's how they are defined in C/C++ standard. Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
This commit is contained in:
parent
854eb9990f
commit
56b973cdb9
|
@ -33,8 +33,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
||||||
* - back-port this new code into tools/winedump/msmangle.c
|
* - back-port this new code into tools/winedump/msmangle.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* How data types modifiers are stored:
|
/* How data types qualifiers are stored:
|
||||||
* M (in the following definitions) is defined for
|
* M (in the following definitions) is defined for
|
||||||
* 'A', 'B', 'C' and 'D' as follows
|
* 'A', 'B', 'C' and 'D' as follows
|
||||||
* {<A>}: ""
|
* {<A>}: ""
|
||||||
* {<B>}: "const "
|
* {<B>}: "const "
|
||||||
|
@ -407,7 +407,7 @@ static char* get_args(struct parsed_symbol* sym, struct array* pmt_ref, BOOL z_t
|
||||||
return args_str;
|
return args_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void append_extended_modifier(struct parsed_symbol *sym, const char **where, const char *str)
|
static void append_extended_qualifier(struct parsed_symbol *sym, const char **where, const char *str)
|
||||||
{
|
{
|
||||||
if (!(sym->flags & UNDNAME_NO_MS_KEYWORDS))
|
if (!(sym->flags & UNDNAME_NO_MS_KEYWORDS))
|
||||||
{
|
{
|
||||||
|
@ -417,7 +417,7 @@ static void append_extended_modifier(struct parsed_symbol *sym, const char **whe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_extended_modifier(struct parsed_symbol *sym, struct datatype_t *xdt)
|
static void get_extended_qualifier(struct parsed_symbol *sym, struct datatype_t *xdt)
|
||||||
{
|
{
|
||||||
xdt->left = xdt->right = NULL;
|
xdt->left = xdt->right = NULL;
|
||||||
xdt->flags = 0;
|
xdt->flags = 0;
|
||||||
|
@ -425,9 +425,9 @@ static void get_extended_modifier(struct parsed_symbol *sym, struct datatype_t *
|
||||||
{
|
{
|
||||||
switch (*sym->current)
|
switch (*sym->current)
|
||||||
{
|
{
|
||||||
case 'E': append_extended_modifier(sym, &xdt->right, "__ptr64"); break;
|
case 'E': append_extended_qualifier(sym, &xdt->right, "__ptr64"); break;
|
||||||
case 'F': append_extended_modifier(sym, &xdt->left, "__unaligned"); break;
|
case 'F': append_extended_qualifier(sym, &xdt->left, "__unaligned"); break;
|
||||||
case 'I': append_extended_modifier(sym, &xdt->right, "__restrict"); break;
|
case 'I': append_extended_qualifier(sym, &xdt->right, "__restrict"); break;
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
sym->current++;
|
sym->current++;
|
||||||
|
@ -435,29 +435,29 @@ static void get_extended_modifier(struct parsed_symbol *sym, struct datatype_t *
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* get_modifier
|
* get_qualifier
|
||||||
* Parses the type modifier. Always returns static strings.
|
* Parses the type qualifier. Always returns static strings.
|
||||||
*/
|
*/
|
||||||
static BOOL get_modifier(struct parsed_symbol *sym, struct datatype_t *xdt, const char** pclass)
|
static BOOL get_qualifier(struct parsed_symbol *sym, struct datatype_t *xdt, const char** pclass)
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
const char* mod;
|
const char* qualif;
|
||||||
|
|
||||||
get_extended_modifier(sym, xdt);
|
get_extended_qualifier(sym, xdt);
|
||||||
switch (ch = *sym->current++)
|
switch (ch = *sym->current++)
|
||||||
{
|
{
|
||||||
case 'A': mod = NULL; break;
|
case 'A': qualif = NULL; break;
|
||||||
case 'B': mod = "const"; break;
|
case 'B': qualif = "const"; break;
|
||||||
case 'C': mod = "volatile"; break;
|
case 'C': qualif = "volatile"; break;
|
||||||
case 'D': mod = "const volatile"; break;
|
case 'D': qualif = "const volatile"; break;
|
||||||
case 'Q': mod = NULL; break;
|
case 'Q': qualif = NULL; break;
|
||||||
case 'R': mod = "const"; break;
|
case 'R': qualif = "const"; break;
|
||||||
case 'S': mod = "volatile"; break;
|
case 'S': qualif = "volatile"; break;
|
||||||
case 'T': mod = "const volatile"; break;
|
case 'T': qualif = "const volatile"; break;
|
||||||
default: return FALSE;
|
default: return FALSE;
|
||||||
}
|
}
|
||||||
if (mod)
|
if (qualif)
|
||||||
xdt->left = xdt->left ? str_printf(sym, "%s %s", mod, xdt->left) : mod;
|
xdt->left = xdt->left ? str_printf(sym, "%s %s", qualif, xdt->left) : qualif;
|
||||||
if (ch >= 'Q' && ch <= 'T') /* pointer to member, fetch class */
|
if (ch >= 'Q' && ch <= 'T') /* pointer to member, fetch class */
|
||||||
{
|
{
|
||||||
const char* class = get_class_name(sym);
|
const char* class = get_class_name(sym);
|
||||||
|
@ -473,48 +473,48 @@ static BOOL get_modifier(struct parsed_symbol *sym, struct datatype_t *xdt, cons
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL get_modified_type(struct datatype_t *ct, struct parsed_symbol* sym,
|
static BOOL get_qualified_type(struct datatype_t *ct, struct parsed_symbol* sym,
|
||||||
struct array *pmt_ref, char modif, enum datatype_flags flags)
|
struct array *pmt_ref, char qualif, enum datatype_flags flags)
|
||||||
{
|
{
|
||||||
struct datatype_t xdt1;
|
struct datatype_t xdt1;
|
||||||
struct datatype_t xdt2;
|
struct datatype_t xdt2;
|
||||||
const char* ref;
|
const char* ref;
|
||||||
const char* str_modif;
|
const char* str_qualif;
|
||||||
const char* class;
|
const char* class;
|
||||||
|
|
||||||
get_extended_modifier(sym, &xdt1);
|
get_extended_qualifier(sym, &xdt1);
|
||||||
|
|
||||||
switch (modif)
|
switch (qualif)
|
||||||
{
|
{
|
||||||
case 'A': ref = " &"; str_modif = NULL; break;
|
case 'A': ref = " &"; str_qualif = NULL; break;
|
||||||
case 'B': ref = " &"; str_modif = " volatile"; break;
|
case 'B': ref = " &"; str_qualif = " volatile"; break;
|
||||||
case 'P': ref = " *"; str_modif = NULL; break;
|
case 'P': ref = " *"; str_qualif = NULL; break;
|
||||||
case 'Q': ref = " *"; str_modif = " const"; break;
|
case 'Q': ref = " *"; str_qualif = " const"; break;
|
||||||
case 'R': ref = " *"; str_modif = " volatile"; break;
|
case 'R': ref = " *"; str_qualif = " volatile"; break;
|
||||||
case 'S': ref = " *"; str_modif = " const volatile"; break;
|
case 'S': ref = " *"; str_qualif = " const volatile"; break;
|
||||||
case '?': ref = NULL; str_modif = NULL; break;
|
case '?': ref = NULL; str_qualif = NULL; break;
|
||||||
case '$': ref = " &&"; str_modif = NULL; break;
|
case '$': ref = " &&"; str_qualif = NULL; break;
|
||||||
default: return FALSE;
|
default: return FALSE;
|
||||||
}
|
}
|
||||||
ct->right = NULL;
|
ct->right = NULL;
|
||||||
ct->flags = 0;
|
ct->flags = 0;
|
||||||
|
|
||||||
if (get_modifier(sym, &xdt2, &class))
|
if (get_qualifier(sym, &xdt2, &class))
|
||||||
{
|
{
|
||||||
unsigned mark = sym->stack.num;
|
unsigned mark = sym->stack.num;
|
||||||
struct datatype_t sub_ct;
|
struct datatype_t sub_ct;
|
||||||
|
|
||||||
if (ref || str_modif || xdt1.left || xdt1.right)
|
if (ref || str_qualif || xdt1.left || xdt1.right)
|
||||||
{
|
{
|
||||||
if (class)
|
if (class)
|
||||||
ct->left = str_printf(sym, "%s%s%s%s::%s%s%s",
|
ct->left = str_printf(sym, "%s%s%s%s::%s%s%s",
|
||||||
xdt1.left ? " " : NULL, xdt1.left,
|
xdt1.left ? " " : NULL, xdt1.left,
|
||||||
class ? " " : NULL, class, ref ? ref + 1 : NULL,
|
class ? " " : NULL, class, ref ? ref + 1 : NULL,
|
||||||
xdt1.right ? " " : NULL, xdt1.right, str_modif);
|
xdt1.right ? " " : NULL, xdt1.right, str_qualif);
|
||||||
else
|
else
|
||||||
ct->left = str_printf(sym, "%s%s%s%s%s%s",
|
ct->left = str_printf(sym, "%s%s%s%s%s%s",
|
||||||
xdt1.left ? " " : NULL, xdt1.left, ref,
|
xdt1.left ? " " : NULL, xdt1.left, ref,
|
||||||
xdt1.right ? " " : NULL, xdt1.right, str_modif);
|
xdt1.right ? " " : NULL, xdt1.right, str_qualif);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ct->left = NULL;
|
ct->left = NULL;
|
||||||
|
@ -543,14 +543,14 @@ static BOOL get_modified_type(struct datatype_t *ct, struct parsed_symbol* sym,
|
||||||
ct->left++;
|
ct->left++;
|
||||||
ct->left = str_printf(sym, "%s%s%s%s%s", sub_ct.left, xdt2.left ? " " : NULL,
|
ct->left = str_printf(sym, "%s%s%s%s%s", sub_ct.left, xdt2.left ? " " : NULL,
|
||||||
xdt2.left, ct->left,
|
xdt2.left, ct->left,
|
||||||
((xdt2.left || str_modif) && (flags & WS_AFTER_QUAL_IF)) ? " " : NULL);
|
((xdt2.left || str_qualif) && (flags & WS_AFTER_QUAL_IF)) ? " " : NULL);
|
||||||
if (sub_ct.right) ct->right = str_printf(sym, "%s%s", ct->right, sub_ct.right);
|
if (sub_ct.right) ct->right = str_printf(sym, "%s%s", ct->right, sub_ct.right);
|
||||||
sym->stack.num = mark;
|
sym->stack.num = mark;
|
||||||
}
|
}
|
||||||
else if (ref || str_modif || xdt1.left || xdt1.right)
|
else if (ref || str_qualif || xdt1.left || xdt1.right)
|
||||||
ct->left = str_printf(sym, "%s%s%s%s%s%s",
|
ct->left = str_printf(sym, "%s%s%s%s%s%s",
|
||||||
xdt1.left ? " " : NULL, xdt1.left, ref,
|
xdt1.left ? " " : NULL, xdt1.left, ref,
|
||||||
xdt1.right ? " " : NULL, xdt1.right, str_modif);
|
xdt1.right ? " " : NULL, xdt1.right, str_qualif);
|
||||||
else
|
else
|
||||||
ct->left = NULL;
|
ct->left = NULL;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -926,17 +926,17 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!get_modified_type(ct, sym, pmt_ref, '?', flags)) goto done;
|
if (!get_qualified_type(ct, sym, pmt_ref, '?', flags)) goto done;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'A': /* reference */
|
case 'A': /* reference */
|
||||||
case 'B': /* volatile reference */
|
case 'B': /* volatile reference */
|
||||||
if (!get_modified_type(ct, sym, pmt_ref, dt, flags)) goto done;
|
if (!get_qualified_type(ct, sym, pmt_ref, dt, flags)) goto done;
|
||||||
break;
|
break;
|
||||||
case 'Q': /* const pointer */
|
case 'Q': /* const pointer */
|
||||||
case 'R': /* volatile pointer */
|
case 'R': /* volatile pointer */
|
||||||
case 'S': /* const volatile pointer */
|
case 'S': /* const volatile pointer */
|
||||||
if (!get_modified_type(ct, sym, pmt_ref, (flags & IN_ARGS) ? dt : 'P', flags)) goto done;
|
if (!get_qualified_type(ct, sym, pmt_ref, (flags & IN_ARGS) ? dt : 'P', flags)) goto done;
|
||||||
break;
|
break;
|
||||||
case 'P': /* Pointer */
|
case 'P': /* Pointer */
|
||||||
if (isdigit(*sym->current))
|
if (isdigit(*sym->current))
|
||||||
|
@ -955,7 +955,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
|
||||||
|
|
||||||
if (!(class = get_class_name(sym)))
|
if (!(class = get_class_name(sym)))
|
||||||
goto done;
|
goto done;
|
||||||
if (!get_modifier(sym, &xdt, NULL))
|
if (!get_qualifier(sym, &xdt, NULL))
|
||||||
goto done;
|
goto done;
|
||||||
if (!get_function_signature(sym, pmt_ref, &fs))
|
if (!get_function_signature(sym, pmt_ref, &fs))
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -984,7 +984,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
|
||||||
}
|
}
|
||||||
else goto done;
|
else goto done;
|
||||||
}
|
}
|
||||||
else if (!get_modified_type(ct, sym, pmt_ref, 'P', flags)) goto done;
|
else if (!get_qualified_type(ct, sym, pmt_ref, 'P', flags)) goto done;
|
||||||
break;
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
if (*sym->current == '4')
|
if (*sym->current == '4')
|
||||||
|
@ -1101,14 +1101,14 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
|
||||||
struct datatype_t xdt;
|
struct datatype_t xdt;
|
||||||
|
|
||||||
sym->current++;
|
sym->current++;
|
||||||
if (!get_modifier(sym, &xdt, NULL)) goto done;
|
if (!get_qualifier(sym, &xdt, NULL)) goto done;
|
||||||
if (!demangle_datatype(sym, ct, pmt_ref, flags)) goto done;
|
if (!demangle_datatype(sym, ct, pmt_ref, flags)) goto done;
|
||||||
ct->left = str_printf(sym, "%s %s", ct->left, xdt.left);
|
ct->left = str_printf(sym, "%s %s", ct->left, xdt.left);
|
||||||
}
|
}
|
||||||
else if (*sym->current == 'Q')
|
else if (*sym->current == 'Q')
|
||||||
{
|
{
|
||||||
sym->current++;
|
sym->current++;
|
||||||
if (!get_modified_type(ct, sym, pmt_ref, '$', flags)) goto done;
|
if (!get_qualified_type(ct, sym, pmt_ref, '$', flags)) goto done;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1184,7 +1184,7 @@ static BOOL handle_data(struct parsed_symbol* sym)
|
||||||
str_array_init(&pmt);
|
str_array_init(&pmt);
|
||||||
|
|
||||||
if (!demangle_datatype(sym, &ct, &pmt, 0)) goto done;
|
if (!demangle_datatype(sym, &ct, &pmt, 0)) goto done;
|
||||||
if (!get_modifier(sym, &xdt, &class)) goto done; /* class doesn't seem to be displayed */
|
if (!get_qualifier(sym, &xdt, &class)) goto done; /* class doesn't seem to be displayed */
|
||||||
if (xdt.left && xdt.right) xdt.left = str_printf(sym, "%s %s", xdt.left, xdt.right);
|
if (xdt.left && xdt.right) xdt.left = str_printf(sym, "%s %s", xdt.left, xdt.right);
|
||||||
else if (!xdt.left) xdt.left = xdt.right;
|
else if (!xdt.left) xdt.left = xdt.right;
|
||||||
sym->stack.num = mark;
|
sym->stack.num = mark;
|
||||||
|
@ -1193,7 +1193,7 @@ static BOOL handle_data(struct parsed_symbol* sym)
|
||||||
case '6' : /* compiler generated static */
|
case '6' : /* compiler generated static */
|
||||||
case '7' : /* compiler generated static */
|
case '7' : /* compiler generated static */
|
||||||
ct.left = ct.right = NULL;
|
ct.left = ct.right = NULL;
|
||||||
if (!get_modifier(sym, &xdt, NULL)) goto done;
|
if (!get_qualifier(sym, &xdt, NULL)) goto done;
|
||||||
if (*sym->current != '@')
|
if (*sym->current != '@')
|
||||||
{
|
{
|
||||||
char* cls = NULL;
|
char* cls = NULL;
|
||||||
|
@ -1362,8 +1362,8 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op)
|
||||||
(accmem <= 'X' && (accmem - 'A') % 8 != 2 && (accmem - 'A') % 8 != 3)))
|
(accmem <= 'X' && (accmem - 'A') % 8 != 2 && (accmem - 'A') % 8 != 3)))
|
||||||
{
|
{
|
||||||
/* Implicit 'this' pointer */
|
/* Implicit 'this' pointer */
|
||||||
/* If there is an implicit this pointer, const modifier follows */
|
/* If there is an implicit this pointer, const qualifier follows */
|
||||||
if (!get_modifier(sym, &xdt, NULL)) goto done;
|
if (!get_qualifier(sym, &xdt, NULL)) goto done;
|
||||||
if (xdt.left || xdt.right) xdt.left = str_printf(sym, "%s %s", xdt.left, xdt.right);
|
if (xdt.left || xdt.right) xdt.left = str_printf(sym, "%s %s", xdt.left, xdt.right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue