-/* TYPE_OFFSET (btype) = offset; */
- if (via_public)
- TYPE_FLAGS (btype) |= TYPE_FLAG_VIA_PUBLIC;
- if (via_virtual)
- TYPE_FLAGS (btype) |= TYPE_FLAG_VIA_VIRTUAL;
- /* New type is permanent if type pointed to is permanent. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- TYPE_FLAGS (btype) |= TYPE_FLAG_PERM;
-
- /* In practice, this is never used. */
- TYPE_LENGTH (btype) = 1;
- TYPE_CODE (btype) = TYPE_CODE_STRUCT;
-
- return btype;
-}
-#endif
-
-/* Given a type TYPE, return a type of functions that return that type.
- May need to construct such a type if this is the first use. */
-
-struct type *
-lookup_function_type (type)
- struct type *type;
-{
- register struct type *ptype = TYPE_FUNCTION_TYPE (type);
- if (ptype) return ptype;
-
- /* This is the first time anyone wanted a function returning a TYPE. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- ptype = (struct type *) xmalloc (sizeof (struct type));
- else
- ptype = (struct type *) obstack_alloc (symbol_obstack,
- sizeof (struct type));
-
- bzero (ptype, sizeof (struct type));
- TYPE_TARGET_TYPE (ptype) = type;
- TYPE_FUNCTION_TYPE (type) = ptype;
- /* New type is permanent if type returned is permanent. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- TYPE_FLAGS (ptype) |= TYPE_FLAG_PERM;
- TYPE_LENGTH (ptype) = 1;
- TYPE_CODE (ptype) = TYPE_CODE_FUNC;
- TYPE_NFIELDS (ptype) = 0;
- return ptype;
-}
-\f
-/* Create an array type. Elements will be of type TYPE, and there will
- be NUM of them.
-
- Eventually this should be extended to take two more arguments which
- specify the bounds of the array and the type of the index.
- It should also be changed to be a "lookup" function, with the
- appropriate data structures added to the type field.
- Then read array type should call here. */
-
-struct type *
-create_array_type (element_type, number)
- struct type *element_type;
- int number;
-{
- struct type *result_type = (struct type *)
- obstack_alloc (symbol_obstack, sizeof (struct type));
- struct type *range_type;
-
- bzero (result_type, sizeof (struct type));
-
- TYPE_CODE (result_type) = TYPE_CODE_ARRAY;
- TYPE_TARGET_TYPE (result_type) = element_type;
- TYPE_LENGTH (result_type) = number * TYPE_LENGTH (element_type);
- TYPE_NFIELDS (result_type) = 1;
- TYPE_FIELDS (result_type) =
- (struct field *) obstack_alloc (symbol_obstack, sizeof (struct field));
-
- {
- /* Create range type. */
- range_type = (struct type *) obstack_alloc (symbol_obstack,
- sizeof (struct type));
- TYPE_CODE (range_type) = TYPE_CODE_RANGE;
- TYPE_TARGET_TYPE (range_type) = builtin_type_int; /* FIXME */
-
- /* This should never be needed. */
- TYPE_LENGTH (range_type) = sizeof (int);
-
- TYPE_NFIELDS (range_type) = 2;
- TYPE_FIELDS (range_type) =
- (struct field *) obstack_alloc (symbol_obstack,
- 2 * sizeof (struct field));
- TYPE_FIELD_BITPOS (range_type, 0) = 0; /* FIXME */
- TYPE_FIELD_BITPOS (range_type, 1) = number-1; /* FIXME */
- TYPE_FIELD_TYPE (range_type, 0) = builtin_type_int; /* FIXME */
- TYPE_FIELD_TYPE (range_type, 1) = builtin_type_int; /* FIXME */
- }
- TYPE_FIELD_TYPE(result_type,0)=range_type;
- TYPE_VPTR_FIELDNO (result_type) = -1;
-
- return result_type;
-}
-
-\f
-/* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE. */
-
-void
-smash_to_member_type (type, domain, to_type)
- struct type *type, *domain, *to_type;
-{
- bzero (type, sizeof (struct type));
- TYPE_TARGET_TYPE (type) = to_type;
- TYPE_DOMAIN_TYPE (type) = domain;
-
- /* In practice, this is never needed. */
- TYPE_LENGTH (type) = 1;
- TYPE_CODE (type) = TYPE_CODE_MEMBER;
-
- TYPE_MAIN_VARIANT (type) = lookup_member_type (domain, to_type);
-}
-
-/* Smash TYPE to be a type of method of DOMAIN with type TO_TYPE. */
-
-void
-smash_to_method_type (type, domain, to_type, args)
- struct type *type, *domain, *to_type, **args;
-{
- bzero (type, sizeof (struct type));
- TYPE_TARGET_TYPE (type) = to_type;
- TYPE_DOMAIN_TYPE (type) = domain;
- TYPE_ARG_TYPES (type) = args;
-
- /* In practice, this is never needed. */
- TYPE_LENGTH (type) = 1;
- TYPE_CODE (type) = TYPE_CODE_METHOD;
-
- TYPE_MAIN_VARIANT (type) = lookup_method_type (domain, to_type, args);
-}
-\f
-/* Find which partial symtab on the partial_symtab_list contains
- PC. Return 0 if none. */
-
-struct partial_symtab *
-find_pc_psymtab (pc)
- register CORE_ADDR pc;
-{
- register struct partial_symtab *ps;
-
- for (ps = partial_symtab_list; ps; ps = ps->next)
- if (pc >= ps->textlow && pc < ps->texthigh)
- return ps;
-
- return 0;