a value of that type; use that instead of setting VALUE_REPEATED.
* value.h (struct value): Remove fields repetitions and repeated.
(VALUE_REPEATED, VALUE_REPETITIONS): Removed, no longer used.
* c-valprint.c, ch-valprint.c, eval.c, printcmd.c, valops.c,
value.h, values.c: Simplify, since now VALUE_REPEATED is never used.
* valprint.c (value_print_array_elemen): Removed never-used function.
+Thu Oct 5 17:28:09 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * values.c allocate_repeat_value): Allocate an array type, and
+ a value of that type; use that instead of setting VALUE_REPEATED.
+ * value.h (struct value): Remove fields repetitions and repeated.
+ (VALUE_REPEATED, VALUE_REPETITIONS): Removed, no longer used.
+ * c-valprint.c, ch-valprint.c, eval.c, printcmd.c, valops.c,
+ value.h, values.c: Simplify, since now VALUE_REPEATED is never used.
+ * valprint.c (value_print_array_elemen): Removed never-used function.
+
Thu Oct 5 15:14:36 1995 Per Bothner <bothner@kalessin.cygnus.com>
* parse.c (write_dollar_variable): New function.
int format;
enum val_prettyprint pretty;
{
- /* A "repeated" value really contains several values in a row.
- They are made by the @ operator.
- Print such values as if they were arrays. */
+ struct type *type = VALUE_TYPE (val);
- if (VALUE_REPEATED (val))
+ /* If it is a pointer, indicate what it points to.
+
+ Print type also if it is a reference.
+
+ C++: if it is a member pointer, we will take care
+ of that when we print it. */
+ if (TYPE_CODE (type) == TYPE_CODE_PTR ||
+ TYPE_CODE (type) == TYPE_CODE_REF)
{
- register unsigned int n = VALUE_REPETITIONS (val);
- register unsigned int typelen = TYPE_LENGTH (VALUE_TYPE (val));
- fprintf_filtered (stream, "{");
- /* Print arrays of characters using string syntax. */
- if (typelen == 1 && TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_INT
- && format == 0)
- LA_PRINT_STRING (stream, VALUE_CONTENTS (val), n, 0);
- else
+ /* Hack: remove (char *) for char strings. Their
+ type is indicated by the quoted string anyway. */
+ if (TYPE_CODE (type) == TYPE_CODE_PTR &&
+ TYPE_NAME (type) == NULL &&
+ TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL &&
+ STREQ (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char"))
{
- value_print_array_elements (val, stream, format, pretty);
+ /* Print nothing */
}
- fprintf_filtered (stream, "}");
- return (n * typelen);
- }
- else
- {
- struct type *type = VALUE_TYPE (val);
-
- /* If it is a pointer, indicate what it points to.
-
- Print type also if it is a reference.
-
- C++: if it is a member pointer, we will take care
- of that when we print it. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR ||
- TYPE_CODE (type) == TYPE_CODE_REF)
+ else
{
- /* Hack: remove (char *) for char strings. Their
- type is indicated by the quoted string anyway. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR &&
- TYPE_NAME (type) == NULL &&
- TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL &&
- STREQ (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char"))
- {
- /* Print nothing */
- }
- else
- {
- fprintf_filtered (stream, "(");
- type_print (type, "", stream, -1);
- fprintf_filtered (stream, ") ");
- }
+ fprintf_filtered (stream, "(");
+ type_print (type, "", stream, -1);
+ fprintf_filtered (stream, ") ");
}
- return (val_print (type, VALUE_CONTENTS (val),
- VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
}
+ return (val_print (type, VALUE_CONTENTS (val),
+ VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
}
int format;
enum val_prettyprint pretty;
{
- /* A "repeated" value really contains several values in a row.
- They are made by the @ operator.
- Print such values as if they were arrays. */
+ struct type *type = VALUE_TYPE (val);
- if (VALUE_REPEATED (val))
- {
- register unsigned int n = VALUE_REPETITIONS (val);
- register unsigned int typelen = TYPE_LENGTH (VALUE_TYPE (val));
- fprintf_filtered (stream, "[");
- /* Print arrays of characters using string syntax. */
- if (typelen == 1 && TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_INT
- && format == 0)
- LA_PRINT_STRING (stream, VALUE_CONTENTS (val), n, 0);
- else
- {
- value_print_array_elements (val, stream, format, pretty);
- }
- fprintf_filtered (stream, "]");
- return (n * typelen);
- }
- else
- {
- struct type *type = VALUE_TYPE (val);
+ /* If it is a pointer, indicate what it points to.
- /* If it is a pointer, indicate what it points to.
+ Print type also if it is a reference.
- Print type also if it is a reference.
-
- C++: if it is a member pointer, we will take care
- of that when we print it. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR ||
- TYPE_CODE (type) == TYPE_CODE_REF)
+ C++: if it is a member pointer, we will take care
+ of that when we print it. */
+ if (TYPE_CODE (type) == TYPE_CODE_PTR ||
+ TYPE_CODE (type) == TYPE_CODE_REF)
+ {
+ char *valaddr = VALUE_CONTENTS (val);
+ CORE_ADDR addr = unpack_pointer (type, valaddr);
+ if (TYPE_CODE (type) != TYPE_CODE_PTR || addr != 0)
{
- char *valaddr = VALUE_CONTENTS (val);
- CORE_ADDR addr = unpack_pointer (type, valaddr);
- if (TYPE_CODE (type) != TYPE_CODE_PTR || addr != 0)
+ int i;
+ char *name = TYPE_NAME (type);
+ if (name)
+ fputs_filtered (name, stream);
+ else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
+ fputs_filtered ("PTR", stream);
+ else
{
- int i;
- char *name = TYPE_NAME (type);
- if (name)
- fputs_filtered (name, stream);
- else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
- fputs_filtered ("PTR", stream);
- else
- {
- fprintf_filtered (stream, "(");
- type_print (type, "", stream, -1);
- fprintf_filtered (stream, ")");
- }
fprintf_filtered (stream, "(");
- i = val_print (type, valaddr, VALUE_ADDRESS (val),
- stream, format, 1, 0, pretty);
+ type_print (type, "", stream, -1);
fprintf_filtered (stream, ")");
- return i;
}
+ fprintf_filtered (stream, "(");
+ i = val_print (type, valaddr, VALUE_ADDRESS (val),
+ stream, format, 1, 0, pretty);
+ fprintf_filtered (stream, ")");
+ return i;
}
- return (val_print (type, VALUE_CONTENTS (val),
- VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
}
+ return (val_print (type, VALUE_CONTENTS (val),
+ VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
}
VALUE_OFFSET (val) = 0;
VALUE_BITPOS (val) = 0;
VALUE_BITSIZE (val) = 0;
- VALUE_REPEATED (val) = 0;
- VALUE_REPETITIONS (val) = 0;
VALUE_REGNO (val) = -1;
VALUE_LAZY (val) = 0;
VALUE_OPTIMIZED_OUT (val) = 0;
struct type *type;
int count;
{
- register value_ptr val;
-
- val =
- (value_ptr) xmalloc (sizeof (struct value) + TYPE_LENGTH (type) * count);
- VALUE_NEXT (val) = all_values;
- all_values = val;
- VALUE_TYPE (val) = type;
- VALUE_LVAL (val) = not_lval;
- VALUE_ADDRESS (val) = 0;
- VALUE_FRAME (val) = 0;
- VALUE_OFFSET (val) = 0;
- VALUE_BITPOS (val) = 0;
- VALUE_BITSIZE (val) = 0;
- VALUE_REPEATED (val) = 1;
- VALUE_REPETITIONS (val) = count;
- VALUE_REGNO (val) = -1;
- VALUE_LAZY (val) = 0;
- VALUE_OPTIMIZED_OUT (val) = 0;
- return val;
+ struct type *element_type = type;
+ int low_bound = current_language->string_lower_bound; /* ??? */
+ /* FIXME-type-allocation: need a way to free this type when we are
+ done with it. */
+ struct type *range_type
+ = create_range_type ((struct type *) NULL, builtin_type_int,
+ low_bound, count + low_bound - 1);
+ /* FIXME-type-allocation: need a way to free this type when we are
+ done with it. */
+ return allocate_value (create_array_type ((struct type *) NULL,
+ type, range_type));
}
/* Return a mark in the value chain. All values allocated after the
value_copy (arg)
value_ptr arg;
{
- register value_ptr val;
register struct type *type = VALUE_TYPE (arg);
- if (VALUE_REPEATED (arg))
- val = allocate_repeat_value (type, VALUE_REPETITIONS (arg));
- else
- val = allocate_value (type);
+ register value_ptr val = allocate_value (type);
VALUE_LVAL (val) = VALUE_LVAL (arg);
VALUE_ADDRESS (val) = VALUE_ADDRESS (arg);
VALUE_OFFSET (val) = VALUE_OFFSET (arg);
if (!VALUE_LAZY (val))
{
memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS_RAW (arg),
- TYPE_LENGTH (VALUE_TYPE (arg))
- * (VALUE_REPEATED (arg) ? VALUE_REPETITIONS (arg) : 1));
+ TYPE_LENGTH (VALUE_TYPE (arg)));
}
return val;
}
/* Take care of preliminaries. */
if (TYPE_VPTR_FIELDNO (type) < 0)
fill_in_vptr_fieldno (type);
- if (TYPE_VPTR_FIELDNO (type) < 0 || VALUE_REPEATED (arg))
+ if (TYPE_VPTR_FIELDNO (type) < 0)
return 0;
return value_headof (arg, 0, type);