From: Mace Ayres <mace.ayres@gmail.com>
Subject: using a type record's components:
Date: Thu, 14 Sep 2017 12:41:49 -0700 (PDT)
Date: 2017-09-14T12:41:49-07:00 [thread overview]
Message-ID: <3f2fad3a-22e9-412d-b97f-a7c455fd7a7b@googlegroups.com> (raw)
1) In a package specification I have defined a record type ( i had errors in putting it in the body)
Is that wrong, should the record info be both in package specification and body, like everything else?
2) record type is:
package structures is -- specification
function sayhi(strin : in String) return String;
function report_self(layer,numb: in Integer) return String;
procedure set_up;
type a_cell is
record
numb: integer range 1..100;
row: integer range 1..10;
col: integer range 1..10;
layer: integer range 1..10;
valu: integer range 0..9;
fixd: BOOLEAN ;
end record;
end structures;
-------
in package body -- separate file
..
..
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
type cell is new a_cell;
type layer is array(1..100) of cell;
layer_0 : layer;
begin
...
for i of layer_1 loop
....
New_Line;
layer_0(i).numb := i;
..
Put (layer_0.cell.numb, Width =>2);
Put( " Cell x has numb value ");
--Put (layer_0(i).numb) ;
New_Line;
end loop;
I can't access the record type 'cell's component '.numb" which i tried to assign the value of the loop index i.
I do have a record cell function to report on itself, a stub. Do I a function like this to get to the record's numb value?
-- this is just a stub for now
FUNCTION report_self(layer,numb: in Integer) return STRING is
--cell_status: STRING (1..100) ;
begin
--cell_status := "";
New_Line(2);
return ("Layer , row y column z has value of 0 and is not fixed");
end report_self;
next reply other threads:[~2017-09-14 19:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-14 19:41 Mace Ayres [this message]
2017-09-14 19:45 ` using a type record's components: Mace Ayres
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox