On Jun 24, 11:48=A0am, Tricky <Trickyh...@[EMAIL PROTECTED]
> wrote:
> Can I do what I asked, I suspect not, so Im thinking along the lines:
>
You suspect correctly, you can not have an unconstrained vector of any
type as a record element.
>
> Basically, I want to be able to give the record name a constant string
> when it is delcared like:
>
> CONSTANT my_record : my_record_type :=3D ( name =3D> "Betty Swollocks",
> --length only 15, complains unless I pad to 20 chars.
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
.......)=
>
> Or am I just going to have to pad the name with whitespace to make it
> up to name'length?
A cleaner way than simply typing in the extra whitespace is to define
a function that pads on the appropriate spaces and put that in the
same package where 'my_type' is defined.
function Padder(s: string) return string is
variable s0: string(1 to s'length) :=3D s;
variable RetVal: string(my_record_type.name'range);
begin
RetVal :=3D (others =3D> ' ');
RetVal(s0'range) :=3D s0;
=2E..
end function Padder;
That way you can initialize constants like this...
CONSTANT my_record : my_record_type :=3D ( name =3D> Padder("Betty
Swollocks"),...
KJ


|