1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
4 * Authors: Martin Trapp, Christian Schaefer
18 /* Make types visible to allow most efficient access */
19 # include "entity_t.h"
23 static struct obstack mangle_obst;
26 mangle_entity (entity *ent)
33 type_id = mangle_type ((type *) ent->owner);
34 obstack_grow(&mangle_obst, get_id_str(type_id), get_id_strlen(type_id));
35 obstack_1grow(&mangle_obst,'_');
36 obstack_grow(&mangle_obst,get_id_str(ent->name),get_id_strlen(ent->name));
37 len = obstack_object_size (&mangle_obst);
38 cp = obstack_finish (&mangle_obst);
39 res = id_from_str(cp, len);
40 obstack_free (&mangle_obst, cp);
45 mangle_type (type *tp)
47 assert (tp->kind == k_type);
51 /* Returns a new ident that represents firstscnd. */
52 ident *mangle (ident *first, ident* scnd) {
57 obstack_grow(&mangle_obst, get_id_str(first), get_id_strlen(first));
58 obstack_grow(&mangle_obst, get_id_str(scnd), get_id_strlen(scnd));
59 len = obstack_object_size (&mangle_obst);
60 cp = obstack_finish (&mangle_obst);
61 res = id_from_str (cp, len);
62 obstack_free (&mangle_obst, cp);
66 /* Returns a new ident that represents first_scnd. */
67 ident *mangle_u (ident *first, ident* scnd) {
72 obstack_grow(&mangle_obst, get_id_str(first), get_id_strlen(first));
73 obstack_1grow(&mangle_obst,'_');
74 obstack_grow(&mangle_obst,get_id_str(scnd),get_id_strlen(scnd));
75 len = obstack_object_size (&mangle_obst);
76 cp = obstack_finish (&mangle_obst);
77 res = id_from_str (cp, len);
78 obstack_free (&mangle_obst, cp);
86 obstack_init(&mangle_obst);