Aggregate assignment of a complex typ. 
Author Message
 Aggregate assignment of a complex typ.

Quote:

> I have a real simple example of an aggregate
> assignment of a record type. I believe that there is something
> that I am missing on how these are down  This does not compile,
> I get the following error message.

> Too many actuals in association list.

> -----------------------------------------------------------------
> architecture dontwork  of test_text is

> CONSTANT MAX_ARRAY_VALUES : INTEGER := 2;

> TYPE structure IS ARRAY (1 to MAX_ARRAY_VALUES) OF integer;

> TYPE list_type IS
>     RECORD   list     : structure;
> END RECORD;

> SIGNAL   input_data    : list_type := (5,6);
> BEGIN

> END dontwork;

The problem is that the record "list_type" has
only ONE element. In that case the only way
to assign to such a type is using an explicit
"named association"

see LRM'93 : page 103, or
see LRM'87 : pag. 7-10.

"Aggregates containing a single element association must
always be specified using named association order to distinguish
them from parenthesized expressions."

###############################
architecture dontwork  of test_text is

CONSTANT MAX_ARRAY_VALUES : INTEGER := 2;

TYPE structure IS ARRAY (1 to MAX_ARRAY_VALUES) OF integer;

TYPE list_type IS
    RECORD   list     : structure;
END RECORD;

SIGNAL   input_data    : list_type := (list => (5,6));
--                                     ^^^^^^^^^^^^^

BEGIN

END dontwork;

Bert Molenkamp
Dept. of Computer Science
University of Twente
PO Box 217
7500 AE  Enschede
the Netherlands



Mon, 24 Feb 1997 22:17:11 GMT  
 Aggregate assignment of a complex typ.

|> I have a real simple example of an aggregate
|> assignment of a record type. I believe that there is something
|> that I am missing on how these are down  This does not compile,
|> I get the following error message.
|>
|> Too many actuals in association list.
|>
|> -----------------------------------------------------------------
|> architecture dontwork  of test_text is
|>
|> CONSTANT MAX_ARRAY_VALUES : INTEGER := 2;
|>
|> TYPE structure IS ARRAY (1 to MAX_ARRAY_VALUES) OF integer;
|>
|> TYPE list_type IS
|>     RECORD   list     : structure;
|> END RECORD;
|>
|> SIGNAL   input_data    : list_type := (5,6);
|> BEGIN
|>
|> END dontwork;
|>
|> -----------------------------------------------------------------

The problem you have is to do with aggregates containing a single element
association.  Section 7.3.2 Aggregates, Pg 104: "Aggregates containing a
single element association must always be specified using named assiciation
in order to distinguish them from parenthesized expressions."

So in the above change it to:

SIGNAL   input_data    : list_type := (list => (5,6));

and it will work.  Hope this helps.  If you do not want this then you should
have more fields in your record. The second case works because it is assignment
to a signal and not aggregates.

Regards,

Sid.

----------------------------------------------------------------
Sidhartha Mohanty,
Computer Architecture Design Lab,          Home:
805B, Rhodes Hall, Univ. of Cincinnati,    2930, Scioto St.,
Dept. of ECE.,  M.L. 30,                   Apt# 603, Cincinnati,
Cincinnati, OH 45221.                      OH, 45219-1937.
(513)556 0904(O).                          (513)556 7482(H).

----------------------------------------------------------------



Mon, 24 Feb 1997 23:35:24 GMT  
 Aggregate assignment of a complex typ.
I have a real simple example of an aggregate
assignment of a record type. I believe that there is something
that I am missing on how these are down  This does not compile,
I get the following error message.

Too many actuals in association list.

-----------------------------------------------------------------
architecture dontwork  of test_text is

CONSTANT MAX_ARRAY_VALUES : INTEGER := 2;

TYPE structure IS ARRAY (1 to MAX_ARRAY_VALUES) OF integer;

TYPE list_type IS
    RECORD   list     : structure;
END RECORD;

SIGNAL   input_data    : list_type := (5,6);
BEGIN

END dontwork;

-----------------------------------------------------------------

However the following does work.  The problem is I have more
fields I want to add to the record (in fact I want to have
a record that has another record in it.  The records compile
okay if I don't try to give an aggregate initialization.

-----------------------------------------------------------------
architecture works  of test_text is

CONSTANT MAX_ARRAY_VALUES : INTEGER := 2;

TYPE structure IS ARRAY (1 to MAX_ARRAY_VALUES) OF integer;

TYPE list_type IS
    RECORD   list     : structure;
END RECORD;

SIGNAL   input_data    : structure := (5,6);
BEGIN

END works;

Thanks for the help.

Bob



Mon, 24 Feb 1997 11:06:35 GMT  
 Aggregate assignment of a complex typ.
: I have a real simple example of an aggregate
: assignment of a record type. I believe that there is something
: that I am missing on how these are down  This does not compile,
: I get the following error message.

: Too many actuals in association list.

Try using named association in the initialization, i.e.,

SIGNAL input_data : list_type := (list => (5,6));

The LRM specifically says you must use named assoc. in this
case.  This one has come up before recently, I think.  Maybe
it should be in the FAQ.

regards,


--



Tue, 25 Feb 1997 03:17:22 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. variable assignment with target as aggregate

2. Aggregate Target assignment question

3. Aggregate assignment problem with gnat under irix

4. Need help on aggregates in variable assignments !!!

5. Aggregate assignment.

6. complex assignment in f90?

7. Invalid Operator in complex assignment

8. Kanji typ font for VW2.0

9. min/typ/max delays

10. What is bit length of (min:typ:max) ?

11. Complex integration with oscillting Exp(complex argument) factor.

12. COM-support for Variant-Typ VT_ARRAY | VT_VARIANT

 

 
Powered by phpBB® Forum Software