fixed bash/dash/sh issue (Ubuntu)
[zpugcc/jano.git] / toolchain / binutils / libiberty / cp-demangle.h
blobd3c57ce37664dfc87458fe4edc089d858c624da1
1 /* Internal demangler interface for g++ V3 ABI.
2 Copyright (C) 2003, 2004 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor <ian@wasabisystems.com>.
5 This file is part of the libiberty library, which is part of GCC.
7 This file is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 In addition to the permissions in the GNU General Public License, the
13 Free Software Foundation gives you unlimited permission to link the
14 compiled version of this file into combinations with other programs,
15 and to distribute those combinations without any restriction coming
16 from the use of this file. (The General Public License restrictions
17 do apply in other respects; for example, they cover modification of
18 the file, and distribution when not linked into a combined
19 executable.)
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 /* This file provides some definitions shared by cp-demangle.c and
32 cp-demint.c. It should not be included by any other files. */
34 /* Information we keep for operators. */
36 struct demangle_operator_info
38 /* Mangled name. */
39 const char *code;
40 /* Real name. */
41 const char *name;
42 /* Length of real name. */
43 int len;
44 /* Number of arguments. */
45 int args;
48 /* How to print the value of a builtin type. */
50 enum d_builtin_type_print
52 /* Print as (type)val. */
53 D_PRINT_DEFAULT,
54 /* Print as integer. */
55 D_PRINT_INT,
56 /* Print as long, with trailing `l'. */
57 D_PRINT_LONG,
58 /* Print as bool. */
59 D_PRINT_BOOL,
60 /* Print in usual way, but here to detect void. */
61 D_PRINT_VOID
64 /* Information we keep for a builtin type. */
66 struct demangle_builtin_type_info
68 /* Type name. */
69 const char *name;
70 /* Length of type name. */
71 int len;
72 /* Type name when using Java. */
73 const char *java_name;
74 /* Length of java name. */
75 int java_len;
76 /* How to print a value of this type. */
77 enum d_builtin_type_print print;
80 /* The information structure we pass around. */
82 struct d_info
84 /* The string we are demangling. */
85 const char *s;
86 /* The end of the string we are demangling. */
87 const char *send;
88 /* The options passed to the demangler. */
89 int options;
90 /* The next character in the string to consider. */
91 const char *n;
92 /* The array of components. */
93 struct demangle_component *comps;
94 /* The index of the next available component. */
95 int next_comp;
96 /* The number of available component structures. */
97 int num_comps;
98 /* The array of substitutions. */
99 struct demangle_component **subs;
100 /* The index of the next substitution. */
101 int next_sub;
102 /* The number of available entries in the subs array. */
103 int num_subs;
104 /* The number of substitutions which we actually made from the subs
105 array, plus the number of template parameter references we
106 saw. */
107 int did_subs;
108 /* The last name we saw, for constructors and destructors. */
109 struct demangle_component *last_name;
110 /* A running total of the length of large expansions from the
111 mangled name to the demangled name, such as standard
112 substitutions and builtin types. */
113 int expansion;
116 #define d_peek_char(di) (*((di)->n))
117 #define d_peek_next_char(di) ((di)->n[1])
118 #define d_advance(di, i) ((di)->n += (i))
119 #define d_next_char(di) (*((di)->n++))
120 #define d_str(di) ((di)->n)
122 /* Functions and arrays in cp-demangle.c which are referenced by
123 functions in cp-demint.c. */
125 extern const struct demangle_operator_info cplus_demangle_operators[];
127 #define D_BUILTIN_TYPE_COUNT (26)
129 extern const struct demangle_builtin_type_info
130 cplus_demangle_builtin_types[D_BUILTIN_TYPE_COUNT];
132 extern struct demangle_component *
133 cplus_demangle_mangled_name PARAMS ((struct d_info *, int));
135 extern struct demangle_component *
136 cplus_demangle_type PARAMS ((struct d_info *));
138 extern void
139 cplus_demangle_init_info PARAMS ((const char *, int, size_t, struct d_info *));