comp.lang.ada
 help / color / mirror / Atom feed
From: Mace Ayres <mace.ayres@gmail.com>
Subject: use Ada.Text_IO in main() or Package?
Date: Wed, 13 Sep 2017 22:09:20 -0700 (PDT)
Date: 2017-09-13T22:09:20-07:00	[thread overview]
Message-ID: <4776d346-325b-4685-8ff4-ddb4ff6e08e3@googlegroups.com> (raw)

I am moving code I had in main() into a package and getting errors.
In main(), I had with Ada.Text_IO and use Ada.Text_IO and all worked OK.
When moving code into a package, to be called from Main(),
     with and use clauses in Main() are not seen in Package code & adding with and use Ada-Text_IO in package throws error "with can only appear in context clause"
I get lost here.

- --------------------------
package body structures is  
   
 with Ada.Text_IO;
 use  Ada.Text_IO;

   
 PROCEDURE set_up is         --------------------------------
      
with  Ada.Text_IO; use Ada.Text_IO;   -- throws error, without it errors in put_line and other Ada.Text_IO functions..
type grid is array (1..9) of Integer;
layer_1: grid:=(1,2,3,4,5,6,7,8,9);
   
begin
New_Line(2);
   Put_Line("Hello Michael from Ada");
   Put_Line(sayhi("Hi"));  -- parameter not used in structures::say; it uses its own
   New_Line;
   for i of layer_1 loop
      Put ("Layer 1 grid one dimension has values:" );
      Put(layer_1(i),Width=>2);       -- Width :=3));
          New_Line;
   end loop;
   New_line(2);      
end set_up;  ----------------------------------------------- 
   
    


             reply	other threads:[~2017-09-14  5:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14  5:09 Mace Ayres [this message]
2017-09-14  5:12 ` use Ada.Text_IO in main() or Package? Mace Ayres
2017-09-14  6:33   ` Petter Fryklund
2017-09-14  6:51     ` Mace Ayres
2017-09-15  5:22       ` Petter Fryklund
2017-09-14  6:21 ` gautier_niouzes
2017-09-14  6:47   ` Mace Ayres
2017-09-14  7:13     ` gautier_niouzes
2017-09-14  9:37       ` Mace Ayres
2017-09-14  9:49         ` gautier_niouzes
replies disabled

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