+/****s* entity/entity
+ *
+ * NAME
+ * entity - An abstract data type to represent program entites.
+ * NOTE
+ *
+ * ATTRIBUTES
+ * owner A compound type this entity is a part of.
+ * type The type of this entity.
+ * name The string that represents this entity in the source program.
+ * allocation A flag saying whether the entity is dynamically or statically
+ * allocated (values: dynamic_allocated, static_allocated,
+ * automatic_allocated).
+ * visibility A flag indicating the visibility of this entity (values: local,
+ * external_visible, external_allocated)
+ * variability A flag indicating the variability of this entity (values:
+ * uninitialized, initalized, part_constant, constant)
+ * volatility @@@
+ * offset The offset of the entity within the compound object. Only set
+ * if the owner in the state "layout_fixed".
+ * overwrites A list of entities overwritten by this entity. This list is only
+ * existent if the owner of this entity is a class. The members in
+ * this list must be entities of super classes.
+ * overwrittenby A list of entities that overwrite this entity. This list is only
+ * existent if the owner of this entity is a class. The members in
+ * this list must be entities of sub classes.
+ * link A void* to associate some additional information with the entity.
+ * irg If the entity is a method this is the ir graph that represents the
+ * code of the method.
+ * peculiarity The peculiarity of the entity. If the entity is a method this
+ * indicates whether the entity represents
+ * a real method or whether it only exists to describe an interface.
+ * In that case there nowhere exists code for this entity and this entity
+ * is never dynamically used in the code.
+ * Values: description, existent. Default: existent.
+ * visited visited flag. Master flag is type_visited.
+ *
+ * These fields can only be accessed via access functions.
+ *
+ * SEE ALSO
+ * type
+ * SOURCE
+ */
+
+/* to resolve recursion between entity.h and type.h */
+#ifndef _ENTITY_TYPEDEF_
+#define _ENTITY_TYPEDEF_
+typedef struct entity entity;
+#endif
+
+
+/* Creates a new entity.
+ Automatically inserts the entity as a member of owner.
+ Entity is automatic_allocated and uninitialize except if the type
+ is type_method, then it is static_allocated and constant. The constant
+ value is a pointer to the method.
+ Visibility is local, offset -1, and it is not volatile. */
+entity *new_entity (type *owner, ident *name, type *tp);
+entity *new_d_entity (type *owner, ident *name, type *tp, dbg_info *db);
+/* Copies the entity if the new_owner is different from the
+ owner of the old entity. Else returns the old entity.
+ Automatically inserts the new entity as a member of owner. */
+entity *copy_entity_own (entity *old, type *new_owner);
+/* Copies the entity if the new_name is different from the
+ name of the old entity. Else returns the old entity.
+ Automatically inserts the new entity as a member of owner.
+ The mangled name ld_name is set to NULL. */
+entity *copy_entity_name (entity *old, ident *new_name);
+/* Frees the entity. The owner will still contain the pointer to this
+ entity, as well as all other references! */
+void free_entity (entity *ent);
+
+/** manipulate fields of entity **/
+const char *get_entity_name (entity *ent);
+ident *get_entity_ident (entity *ent);
+
+/* returns the mangled name of the entity. If the mangled name is
+ set it returns the existing name. Else it generates a name
+ with mangle_entity() and remembers this new name internally. */
+ident *get_entity_ld_ident (entity *ent);
+void set_entity_ld_ident (entity *ent, ident *ld_ident);
+const char *get_entity_ld_name (entity *end);
+
+type *get_entity_owner (entity *ent);
+/* Sets the owner field in entity to owner. Don't forget to add
+ ent to owner!! */
+void set_entity_owner (entity *ent, type *owner);
+INLINE void assert_legal_owner_of_ent(type *owner);
+
+type *get_entity_type (entity *ent);
+void set_entity_type (entity *ent, type *tp);
+
+typedef enum {
+ automatic_allocated, /* The entity is allocated during runtime, implicitly
+ as component of a compound type. This is the default. */
+ parameter_allocated, /* The entity is a parameter. It is also automatic allocated.
+ We distinguish the allocation of paramters from the allocation
+ of local variables as their placement depends on the calling
+ conventions. */
+ dynamic_allocated, /* The entity is allocated during runtime, explicitly
+ by an Alloc node. */
+ static_allocated /* The entity is allocated statically. We can use a
+ SymConst(?) as address of the entity. */
+} ent_allocation;
+
+ent_allocation get_entity_allocation (entity *ent);
+void set_entity_allocation (entity *ent, ent_allocation al);
+
+/* This enumeration flags the visibility of entities. This is necessary
+ for partial compilation. */
+typedef enum {
+ local, /* The entity is only visible locally. This is the default. */
+ external_visible, /* The entity is visible to other external program parts, but
+ it is defined here. It may not be optimized away. The entity must
+ be static_allocated. */
+ external_allocated /* The entity is defined and allocated externally. This compilation
+ must not allocate memory for this entity. The entity must
+ be static_allocated. This can also be an external defined
+ method. */
+} ent_visibility;