* using a type record's components:
@ 2017-09-14 19:41 Mace Ayres
2017-09-14 19:45 ` Mace Ayres
0 siblings, 1 reply; 2+ messages in thread
From: Mace Ayres @ 2017-09-14 19:41 UTC (permalink / 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;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: using a type record's components:
2017-09-14 19:41 using a type record's components: Mace Ayres
@ 2017-09-14 19:45 ` Mace Ayres
0 siblings, 0 replies; 2+ messages in thread
From: Mace Ayres @ 2017-09-14 19:45 UTC (permalink / raw)
ignore layer_1 loop, I cut it out for brevity. That part, the loop, works OK
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-14 19:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-14 19:41 using a type record's components: Mace Ayres
2017-09-14 19:45 ` Mace Ayres
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox