comp.lang.ada
 help / color / mirror / Atom feed
* Eeeks, Sorry
@ 1998-09-22  0:00 Richmond Frost
  0 siblings, 0 replies; only message in thread
From: Richmond Frost @ 1998-09-22  0:00 UTC (permalink / raw)


Sorry for the 'bad' post. Thanks for the email (to those who kindly
pointed out my errors in newsreader protocol and in the Ada83 post I made
(Technobabble).

here is the corrected post.  It's just a novice (me) attempting to play
with pointers for learning purposes. I'm not asking for help on this one.
It's just an example GNAT using an unconstrained array type and heap
allocation.

the output is:

test_pkg
test_pkg 
test_pkg
test_pkg
test_pkg
 
here is the code (if anyone cares) :


---- This is the top level calling routine
--File: my_main_3.adb
----
with user_pkg_3; use user_pkg_3;
procedure my_main_3 is
begin
  my_user;
end my_main_3;

----
--File: user_pkg_3.ads
----
with test_pkg_3; use test_pkg_3;

package user_pkg_3 is
   This : Object;
   procedure my_user;
end user_pkg_3;

----
--File: user_pkg_3.adb
----
with test_pkg_3; use test_pkg_3;
package body user_pkg_3 is
procedure my_user is
begin

  This.XYZ(1) := new xyz_array'((1..5 => 0));
  my_range (This);
end my_user;
end user_pkg_3;


----
--File: test_pkg_3.ads
----
package test_pkg_3 is
 type xyz_array is array (integer range <>) of integer;   -- this is it
 type xyz_array_pointer is access all xyz_array;
 type xyz_array_pointer_array is array (1..100) of xyz_array_pointer;
 type Object is
     record
        XYZ : xyz_array_pointer_array;    
        abc : integer;
     end record;

procedure my_range (This : in Object); 
end test_pkg_3;


----
-File: test_pkg_3.adb
----
with Text_IO; use Text_IO;
package body test_pkg_3 is

procedure my_range (This : in Object) is
begin 
         for I in This.XYZ(1)'RANGE
        loop
          put_line ("test_pkg");
        end loop;
end my_range;
end test_pkg_3;




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-09-22  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-22  0:00 Eeeks, Sorry Richmond Frost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox