1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
4 * Authors: Martin Trapp, Christian Schaefer
21 /* Make types visible to allow most efficient access */
22 # include "entity_t.h"
26 static struct obstack mangle_obst;
29 mangle_entity (entity *ent)
36 type_id = mangle_type ((type *) ent->owner);
37 obstack_printf (&mangle_obst, "%s_%s", id_to_str(type_id), id_to_str(ent->name));
38 len = obstack_object_size (&mangle_obst);
39 cp = obstack_finish (&mangle_obst);
40 res = id_from_str(cp, len);
41 obstack_free (&mangle_obst, cp);
46 mangle_type (type *tp)
52 assert (tp->kind == k_type);
53 /* assert (tp->type_op->code == tpo_class); */
55 obstack_printf (&mangle_obst, "%s", id_to_str(tp->name));
56 len = obstack_object_size (&mangle_obst);
57 cp = obstack_finish (&mangle_obst);
58 res = id_from_str (cp, len);
59 obstack_free (&mangle_obst, cp);
63 /* Returns a new ident that represents firstscnd. */
64 ident *mangle (ident *first, ident* scnd) {
69 obstack_printf (&mangle_obst, "%s%s", id_to_str(first), id_to_str(scnd));
70 len = obstack_object_size (&mangle_obst);
71 cp = obstack_finish (&mangle_obst);
72 res = id_from_str (cp, len);
73 obstack_free (&mangle_obst, cp);
77 /* Returns a new ident that represents first_scnd. */
78 ident *mangle_u (ident *first, ident* scnd) {
83 obstack_printf (&mangle_obst, "%s_%s", id_to_str(first), id_to_str(scnd));
84 len = obstack_object_size (&mangle_obst);
85 cp = obstack_finish (&mangle_obst);
86 res = id_from_str (cp, len);
87 obstack_free (&mangle_obst, cp);
95 obstack_init (&mangle_obst);