]>
Commit | Line | Data |
---|---|---|
6599da04 JM |
1 | /* Defs for interface to demanglers. |
2 | Copyright 1992, 1995, 1996 Free Software Foundation, Inc. | |
3 | ||
4 | This program is free software; you can redistribute it and/or modify | |
5 | it under the terms of the GNU General Public License as published by | |
6 | the Free Software Foundation; either version 2, or (at your option) | |
7 | any later version. | |
8 | ||
9 | This program is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
15 | along with this program; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place - Suite 330, | |
17 | Boston, MA 02111-1307, USA. */ | |
18 | ||
19 | ||
20 | #if !defined (DEMANGLE_H) | |
21 | #define DEMANGLE_H | |
22 | ||
6599da04 | 23 | #include <ansidecl.h> |
6599da04 JM |
24 | |
25 | /* Options passed to cplus_demangle (in 2nd parameter). */ | |
26 | ||
69afa80d AS |
27 | #define DMGL_NO_OPTS 0 /* For readability... */ |
28 | #define DMGL_PARAMS (1 << 0) /* Include function args */ | |
29 | #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ | |
30 | #define DMGL_JAVA (1 << 2) /* Demangle as Java rather than C++. */ | |
31 | ||
32 | #define DMGL_AUTO (1 << 8) | |
33 | #define DMGL_GNU (1 << 9) | |
34 | #define DMGL_LUCID (1 << 10) | |
35 | #define DMGL_ARM (1 << 11) | |
36 | #define DMGL_HP (1 << 12) /* For the HP aCC compiler; | |
37 | same as ARM except for | |
38 | template arguments, etc. */ | |
39 | #define DMGL_EDG (1 << 13) | |
40 | #define DMGL_GNU_NEW_ABI (1 << 14) | |
7ecdd10b | 41 | #define DMGL_GNAT (1 << 15) |
63684e63 | 42 | |
6599da04 | 43 | /* If none of these are set, use 'current_demangling_style' as the default. */ |
7ecdd10b | 44 | #define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_NEW_ABI|DMGL_JAVA|DMGL_GNAT) |
6599da04 JM |
45 | |
46 | /* Enumeration of possible demangling styles. | |
47 | ||
48 | Lucid and ARM styles are still kept logically distinct, even though | |
49 | they now both behave identically. The resulting style is actual the | |
50 | union of both. I.E. either style recognizes both "__pt__" and "__rf__" | |
51 | for operator "->", even though the first is lucid style and the second | |
52 | is ARM style. (FIXME?) */ | |
53 | ||
54 | extern enum demangling_styles | |
55 | { | |
56 | unknown_demangling = 0, | |
57 | auto_demangling = DMGL_AUTO, | |
58 | gnu_demangling = DMGL_GNU, | |
59 | lucid_demangling = DMGL_LUCID, | |
63684e63 EZ |
60 | arm_demangling = DMGL_ARM, |
61 | hp_demangling = DMGL_HP, | |
69afa80d | 62 | edg_demangling = DMGL_EDG, |
7ecdd10b KB |
63 | gnu_new_abi_demangling = DMGL_GNU_NEW_ABI, |
64 | java_demangling = DMGL_JAVA, | |
65 | gnat_demangling = DMGL_GNAT | |
6599da04 JM |
66 | } current_demangling_style; |
67 | ||
68 | /* Define string names for the various demangling styles. */ | |
69 | ||
69afa80d AS |
70 | #define AUTO_DEMANGLING_STYLE_STRING "auto" |
71 | #define GNU_DEMANGLING_STYLE_STRING "gnu" | |
72 | #define LUCID_DEMANGLING_STYLE_STRING "lucid" | |
73 | #define ARM_DEMANGLING_STYLE_STRING "arm" | |
74 | #define HP_DEMANGLING_STYLE_STRING "hp" | |
75 | #define EDG_DEMANGLING_STYLE_STRING "edg" | |
76 | #define GNU_NEW_ABI_DEMANGLING_STYLE_STRING "gnu-new-abi" | |
7ecdd10b KB |
77 | #define JAVA_DEMANGLING_STYLE_STRING "java" |
78 | #define GNAT_DEMANGLING_STYLE_STRING "gnat" | |
6599da04 JM |
79 | |
80 | /* Some macros to test what demangling style is active. */ | |
81 | ||
82 | #define CURRENT_DEMANGLING_STYLE current_demangling_style | |
83 | #define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO) | |
84 | #define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU) | |
85 | #define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID) | |
63684e63 EZ |
86 | #define ARM_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM) |
87 | #define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP) | |
88 | #define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG) | |
69afa80d | 89 | #define GNU_NEW_ABI_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_NEW_ABI) |
7ecdd10b KB |
90 | #define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA) |
91 | #define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT) | |
6599da04 | 92 | |
24eaa47a KB |
93 | /* Provide information about the available demangle styles. This code is |
94 | pulled from gdb into libiberty because it is useful to binutils also. */ | |
95 | ||
96 | extern struct demangler_engine | |
97 | { | |
a85a47fb | 98 | const char *demangling_style_name; |
24eaa47a | 99 | enum demangling_styles demangling_style; |
a85a47fb | 100 | const char *demangling_style_doc; |
24eaa47a KB |
101 | } libiberty_demanglers[]; |
102 | ||
6599da04 JM |
103 | extern char * |
104 | cplus_demangle PARAMS ((const char *mangled, int options)); | |
105 | ||
106 | extern int | |
107 | cplus_demangle_opname PARAMS ((const char *opname, char *result, int options)); | |
108 | ||
109 | extern const char * | |
110 | cplus_mangle_opname PARAMS ((const char *opname, int options)); | |
111 | ||
112 | /* Note: This sets global state. FIXME if you care about multi-threading. */ | |
113 | ||
114 | extern void | |
115 | set_cplus_marker_for_demangling PARAMS ((int ch)); | |
116 | ||
24eaa47a KB |
117 | extern enum demangling_styles |
118 | cplus_demangle_set_style PARAMS ((enum demangling_styles style)); | |
119 | ||
120 | extern enum demangling_styles | |
121 | cplus_demangle_name_to_style PARAMS ((const char *name)); | |
69afa80d AS |
122 | |
123 | /* New-ABI demangling entry point, defined in cp-demangle.c. */ | |
124 | extern char* | |
125 | cplus_demangle_new_abi PARAMS ((const char* mangled)); | |
126 | ||
6599da04 | 127 | #endif /* DEMANGLE_H */ |