#include "Demangle.h"
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
Go to the source code of this file.
Classes | |
struct | work_stuff |
struct | optable |
struct | string |
Defines | |
#define | CURRENT_DEMANGLING_STYLE work->options |
#define | CPLUS_MARKER '$' |
#define | PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI) |
#define | PRINT_ARG_TYPES (work -> options & DMGL_PARAMS) |
#define | STRING_EMPTY(str) ((str) -> b == (str) -> p) |
#define | PREPEND_BLANK(str) |
#define | APPEND_BLANK(str) |
#define | ARM_VTABLE_STRING "__vtbl__" |
#define | ARM_VTABLE_STRLEN 8 |
Functions | |
void | set_cplus_marker_for_demangling (int ch) |
static char * | mop_up (struct work_stuff *, string *, int) |
static int | demangle_template (struct work_stuff *work, const char **, string *, string *) |
static int | demangle_qualified (struct work_stuff *, const char **, string *, int, int) |
static int | demangle_class (struct work_stuff *, const char **, string *) |
static int | demangle_fund_type (struct work_stuff *, const char **, string *) |
static int | demangle_signature (struct work_stuff *, const char **, string *) |
static int | demangle_prefix (struct work_stuff *, const char **, string *) |
static int | gnu_special (struct work_stuff *, const char **, string *) |
static int | arm_special (struct work_stuff *, const char **, string *) |
static void | string_need (string *, int) |
static void | string_delete (string *) |
static void | string_init (string *) |
static void | string_clear (string *) |
static void | string_append (string *, const char *) |
static void | string_appends (string *, string *) |
static void | string_appendn (string *, const char *, int) |
static void | string_prepend (string *, const char *) |
static void | string_prependn (string *, const char *, int) |
static int | get_count (const char **, int *) |
static int | consume_count (const char **) |
static int | demangle_args (struct work_stuff *, const char **, string *) |
static int | do_type (struct work_stuff *, const char **, string *) |
static int | do_arg (struct work_stuff *, const char **, string *) |
static void | demangle_function_name (struct work_stuff *, const char **, string *, const char *) |
static void | remember_type (struct work_stuff *, const char *, int) |
static void | forget_types (struct work_stuff *) |
static void | string_prepends (string *, string *) |
static int | consume_count (char **type) const |
int | cplus_demangle_opname (char *opname, char *result, int options) |
char * | cplus_mangle_opname (char *opname, int options) |
int | cplus_match (char *mangled, char *text, int text_len) const |
char * | cplus_demangle (char *mangled, int options) const |
static int | arm_pt (struct work_stuff *work, const char *mangled, int n, const char **anchor, const char **args) |
static void | demangle_arm_pt (struct work_stuff *work, const char **mangled, int n, string *declp) |
static int | demangle_class_name (struct work_stuff *work, const char **mangled, string *declp) |
static int | get_count (char **type, int *count) const |
Variables | |
enum demangling_styles | current_demangling_style = gnu_demangling |
static char | cplus_markers [] = { CPLUS_MARKER, '.', '$', '\0' } |
#define APPEND_BLANK | ( | str | ) |
Value:
{if (!STRING_EMPTY(str)) \ string_append(str, " ");}
Definition at line 182 of file Demangle.c.
Referenced by demangle_fund_type(), and do_type().
#define ARM_VTABLE_STRING "__vtbl__" |
#define ARM_VTABLE_STRLEN 8 |
#define CPLUS_MARKER '$' |
Definition at line 53 of file Demangle.c.
#define CURRENT_DEMANGLING_STYLE work->options |
Definition at line 30 of file Demangle.c.
#define PREPEND_BLANK | ( | str | ) |
Value:
{if (!STRING_EMPTY(str)) \ string_prepend(str, " ");}
Definition at line 180 of file Demangle.c.
#define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI) |
#define PRINT_ARG_TYPES (work -> options & DMGL_PARAMS) |
static int arm_pt | ( | struct work_stuff * | work, | |
const char * | mangled, | |||
int | n, | |||
const char ** | anchor, | |||
const char ** | args | |||
) | [static] |
Definition at line 1052 of file Demangle.c.
References ARM_DEMANGLING, consume_count(), and len.
Referenced by demangle_arm_pt().
static int arm_special | ( | struct work_stuff * | , | |
const char ** | , | |||
string * | ||||
) | [static] |
Definition at line 1571 of file Demangle.c.
References ARM_VTABLE_STRING, ARM_VTABLE_STRLEN, consume_count(), n, string_append(), string_prepend(), and string_prependn().
Referenced by demangle_prefix().
static int consume_count | ( | char ** | type | ) | const [static] |
Definition at line 288 of file Demangle.c.
static int consume_count | ( | const char ** | ) | [static] |
Referenced by arm_pt(), arm_special(), demangle_args(), demangle_class_name(), demangle_prefix(), demangle_qualified(), demangle_template(), do_type(), and gnu_special().
char* cplus_demangle | ( | char * | mangled, | |
int | options | |||
) | const |
Definition at line 494 of file Demangle.c.
References AUTO_DEMANGLING, current_demangling_style, demangle_prefix(), demangle_signature(), DMGL_STYLE_MASK, GNU_DEMANGLING, gnu_special(), int, mop_up(), NULL, string_init(), and string_prepend().
int cplus_demangle_opname | ( | char * | opname, | |
char * | result, | |||
int | options | |||
) |
Definition at line 303 of file Demangle.c.
References cplus_markers, do_type(), i, int, len, NULL, work_stuff::options, out, strcat(), string_delete(), and type.
char* cplus_mangle_opname | ( | char * | opname, | |
int | options | |||
) |
int cplus_match | ( | char * | mangled, | |
char * | text, | |||
int | text_len | |||
) | const |
Definition at line 453 of file Demangle.c.
static int demangle_args | ( | struct work_stuff * | , | |
const char ** | , | |||
string * | ||||
) | [static] |
Definition at line 2331 of file Demangle.c.
References ARM_DEMANGLING, consume_count(), do_arg(), get_count(), LUCID_DEMANGLING, work_stuff::ntypes, PRINT_ARG_TYPES, string_append(), string_appends(), string_delete(), t, and work_stuff::typevec.
Referenced by demangle_signature(), and do_type().
static void demangle_arm_pt | ( | struct work_stuff * | work, | |
const char ** | mangled, | |||
int | n, | |||
string * | declp | |||
) | [static] |
Definition at line 1074 of file Demangle.c.
References arm_pt(), do_type(), string::p, p, string_append(), string_appendn(), string_appends(), string_clear(), string_delete(), and string_init().
Referenced by demangle_class_name(), and demangle_prefix().
static int demangle_class | ( | struct work_stuff * | , | |
const char ** | , | |||
string * | ||||
) | [static] |
Definition at line 1164 of file Demangle.c.
References work_stuff::constructor, demangle_class_name(), work_stuff::destructor, string_delete(), string_init(), string_prepend(), and string_prepends().
Referenced by demangle_signature().
static int demangle_class_name | ( | struct work_stuff * | work, | |
const char ** | mangled, | |||
string * | declp | |||
) | [static] |
Definition at line 1110 of file Demangle.c.
References consume_count(), demangle_arm_pt(), and n.
Referenced by demangle_class(), and demangle_fund_type().
static void demangle_function_name | ( | struct work_stuff * | , | |
const char ** | , | |||
string * | , | |||
const char * | ||||
) | [static] |
Definition at line 2459 of file Demangle.c.
References ARM_DEMANGLING, string::b, b, work_stuff::constructor, cplus_markers, work_stuff::destructor, i, if(), int, len, LUCID_DEMANGLING, NULL, out, string::p, p, string_append(), string_appendn(), string_clear(), string_need(), and type.
Referenced by demangle_prefix().
static int demangle_fund_type | ( | struct work_stuff * | , | |
const char ** | , | |||
string * | ||||
) | [static] |
Definition at line 2074 of file Demangle.c.
References APPEND_BLANK, demangle_class_name(), demangle_template(), PRINT_ANSI_QUALIFIERS, result(), and string_append().
Referenced by do_type().
static int demangle_prefix | ( | struct work_stuff * | , | |
const char ** | , | |||
string * | ||||
) | [static] |
Definition at line 1228 of file Demangle.c.
References ARM_DEMANGLING, arm_special(), work_stuff::constructor, consume_count(), cplus_markers, demangle_arm_pt(), demangle_function_name(), i, LUCID_DEMANGLING, marker, NULL, work_stuff::static_type, and string_append().
Referenced by cplus_demangle().
static int demangle_qualified | ( | struct work_stuff * | , | |
const char ** | , | |||
string * | , | |||
int | , | |||
int | ||||
) | [static] |
Definition at line 1653 of file Demangle.c.
References consume_count(), demangle_template(), work_stuff::destructor, num, p, result(), string_append(), string_appendn(), string_appends(), string_delete(), STRING_EMPTY, string_init(), and string_prepends().
Referenced by demangle_signature(), do_type(), and gnu_special().
static int demangle_signature | ( | struct work_stuff * | , | |
const char ** | , | |||
string * | ||||
) | [static] |
Definition at line 609 of file Demangle.c.
References ARM_DEMANGLING, AUTO_DEMANGLING, work_stuff::const_type, demangle_args(), demangle_class(), demangle_qualified(), demangle_template(), work_stuff::destructor, forget_types(), GNU_DEMANGLING, LUCID_DEMANGLING, NULL, PRINT_ARG_TYPES, remember_type(), work_stuff::static_type, string_append(), string_appends(), string_delete(), string_init(), string_prepend(), and string_prepends().
Referenced by cplus_demangle().
static int demangle_template | ( | struct work_stuff * | work, | |
const char ** | , | |||
string * | , | |||
string * | ||||
) | [static] |
Definition at line 820 of file Demangle.c.
References consume_count(), do_type(), get_count(), i, string::p, string_append(), string_appendn(), string_appends(), string_delete(), and val.
Referenced by demangle_fund_type(), demangle_qualified(), demangle_signature(), and gnu_special().
static int do_arg | ( | struct work_stuff * | , | |
const char ** | , | |||
string * | ||||
) | [static] |
Definition at line 2221 of file Demangle.c.
References do_type(), remember_type(), result(), and start.
Referenced by demangle_args().
static int do_type | ( | struct work_stuff * | , | |
const char ** | , | |||
string * | ||||
) | [static] |
Definition at line 1842 of file Demangle.c.
References APPEND_BLANK, consume_count(), demangle_args(), demangle_fund_type(), demangle_qualified(), get_count(), n, work_stuff::ntypes, p, PRINT_ANSI_QUALIFIERS, result(), string_append(), string_appendn(), string_appends(), string_delete(), STRING_EMPTY, string_init(), string_prepend(), string_prependn(), and work_stuff::typevec.
Referenced by cplus_demangle_opname(), demangle_arm_pt(), demangle_template(), and do_arg().
static void forget_types | ( | struct work_stuff * | ) | [static] |
Definition at line 2272 of file Demangle.c.
References free(), i, work_stuff::ntypes, NULL, and work_stuff::typevec.
Referenced by demangle_signature(), and mop_up().
static int get_count | ( | char ** | type, | |
int * | count | |||
) | const [static] |
static int get_count | ( | const char ** | , | |
int * | ||||
) | [static] |
Referenced by demangle_args(), demangle_template(), and do_type().
static int gnu_special | ( | struct work_stuff * | , | |
const char ** | , | |||
string * | ||||
) | [static] |
Definition at line 1412 of file Demangle.c.
References buf, consume_count(), cplus_demangle(), cplus_markers, demangle_qualified(), demangle_template(), work_stuff::destructor, free(), method, n, NULL, p, sprintf(), string_append(), and string_appendn().
Referenced by cplus_demangle().
static char * mop_up | ( | struct work_stuff * | , | |
string * | , | |||
int | ||||
) | [static] |
Definition at line 547 of file Demangle.c.
References b, forget_types(), free(), NULL, string_appendn(), string_delete(), and work_stuff::typevec.
Referenced by cplus_demangle().
static void remember_type | ( | struct work_stuff * | , | |
const char * | , | |||
int | ||||
) | [static] |
Definition at line 2240 of file Demangle.c.
References malloc(), work_stuff::ntypes, realloc(), work_stuff::typevec, and work_stuff::typevec_size.
Referenced by demangle_signature(), and do_arg().
void set_cplus_marker_for_demangling | ( | int | ch | ) |
static void string_append | ( | string * | , | |
const char * | ||||
) | [static] |
Definition at line 2674 of file Demangle.c.
References n, NULL, and string_need().
Referenced by arm_special(), demangle_args(), demangle_arm_pt(), demangle_function_name(), demangle_fund_type(), demangle_prefix(), demangle_qualified(), demangle_signature(), demangle_template(), do_type(), and gnu_special().
static void string_appendn | ( | string * | , | |
const char * | , | |||
int | ||||
) | [static] |
Definition at line 2703 of file Demangle.c.
References string_need().
Referenced by demangle_arm_pt(), demangle_function_name(), demangle_qualified(), demangle_template(), do_type(), gnu_special(), and mop_up().
Definition at line 2688 of file Demangle.c.
References n, and string_need().
Referenced by demangle_args(), demangle_arm_pt(), demangle_qualified(), demangle_signature(), demangle_template(), and do_type().
static void string_clear | ( | string * | ) | [static] |
Definition at line 2656 of file Demangle.c.
Referenced by demangle_arm_pt(), and demangle_function_name().
static void string_delete | ( | string * | ) | [static] |
Definition at line 2638 of file Demangle.c.
Referenced by cplus_demangle_opname(), demangle_args(), demangle_arm_pt(), demangle_class(), demangle_qualified(), demangle_signature(), demangle_template(), do_type(), and mop_up().
static void string_init | ( | string * | ) | [static] |
Definition at line 2649 of file Demangle.c.
References NULL.
Referenced by cplus_demangle(), demangle_arm_pt(), demangle_class(), demangle_qualified(), demangle_signature(), and do_type().
static void string_need | ( | string * | , | |
int | ||||
) | [static] |
Definition at line 2611 of file Demangle.c.
References malloc(), NULL, and realloc().
Referenced by demangle_function_name(), string_append(), string_appendn(), string_appends(), and string_prependn().
static void string_prepend | ( | string * | , | |
const char * | ||||
) | [static] |
Definition at line 2717 of file Demangle.c.
References NULL, and string_prependn().
Referenced by arm_special(), cplus_demangle(), demangle_class(), demangle_signature(), and do_type().
static void string_prependn | ( | string * | , | |
const char * | , | |||
int | ||||
) | [static] |
Definition at line 2738 of file Demangle.c.
References string_need().
Referenced by arm_special(), do_type(), string_prepend(), and string_prepends().
Definition at line 2728 of file Demangle.c.
References string_prependn().
Referenced by demangle_class(), demangle_qualified(), and demangle_signature().
char cplus_markers[] = { CPLUS_MARKER, '.', '$', '\0' } [static] |
Definition at line 58 of file Demangle.c.
Referenced by cplus_demangle_opname(), demangle_function_name(), demangle_prefix(), gnu_special(), and set_cplus_marker_for_demangling().
enum demangling_styles current_demangling_style = gnu_demangling |
Definition at line 56 of file Demangle.c.