+Thu May 13 01:14:46 1999 Marc Espie <espie@cvs.openbsd.org>
+
+ * cplus-dem.c (standard_symbol_characters): Renamed from
+ standard_symbol_alphabet. No longer modify TABLE.
+ (hp_symbol_characters): Renamed from hp_symbol_alphabet. No longer
+ modify TABLE.
+ (main): Corresponding changes. Use strchr to determine if a
+ character is valid.
+
1999-05-11 Jim Blandy <jimb@zwingli.cygnus.com>
* cplus-dem.c (main): Use table lookup to distinguish identifier
}
-/* Fill in TABLE so that TABLE[C] is true iff C (as an unsigned char)
- is a valid symbol component, in the standard assembler symbol
+/* Return the string of non-alnum characters that may occur
+ as a valid symbol component, in the standard assembler symbol
syntax. */
-void
-standard_symbol_alphabet (char *table)
-{
- int c;
- for (c = 0; c < 256; c++)
- table[c] = isalnum(c);
-
- table['_'] = 1;
- table['$'] = 1;
- table['.'] = 1;
+static const char *
+standard_symbol_characters ()
+{
+ return "_$.";
}
-/* Fill in TABLE so that TABLE[C] is true iff C (as an unsigned char)
- is a valid symbol name component in an HP object file.
+/* Return the string of non-alnum characters that may occur
+ as a valid symbol name component in an HP object file.
Note that, since HP's compiler generates object code straight from
C++ source, without going through an assembler, its mangled
non-digit character.
So have fun. */
-void
-hp_symbol_alphabet (char *table)
+static const char *
+hp_symbol_characters ()
{
- char *c;
-
- standard_symbol_alphabet (table);
-
- for (c = "<>#,*&[]:(){}"; *c; c++)
- table[(unsigned char) *c] = 1;
+ return "_$.<>#,*&[]:(){}";
}
{
char *result;
int c;
- char symbol_alphabet[256];
+ char *valid_symbols;
program_name = argv[0];
case lucid_demangling:
case arm_demangling:
case edg_demangling:
- standard_symbol_alphabet (symbol_alphabet);
+ valid_symbols = standard_symbol_characters ();
break;
case hp_demangling:
- hp_symbol_alphabet (symbol_alphabet);
+ valid_symbols = hp_symbol_characters ();
break;
default:
/* Folks should explicitly indicate the appropriate alphabet for
int i = 0;
c = getchar ();
/* Try to read a label. */
- while (c != EOF && symbol_alphabet[c])
+ while (c != EOF && (isalnum (c) || strchr (valid_symbols, c)))
{
if (i >= MBUF_SIZE-1)
break;