comp.lang.ada
 help / color / mirror / Atom feed
From: comicfanzine@gmail.com
Subject: Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
Date: Tue, 3 Nov 2015 10:40:05 -0800 (PST)
Date: 2015-11-03T10:40:05-08:00	[thread overview]
Message-ID: <117ec1cb-834e-4aef-8449-0aa32c05fd27@googlegroups.com> (raw)
In-Reply-To: <097ed1af-f5a3-4b91-843c-124ae349a49a@googlegroups.com>

Le mardi 3 novembre 2015 00:02:11 UTC+1, AdaMagica a écrit :
> Do you understand what parameters are?
> When you call a subprogram which has parameters, you have to supply actual data items for *each* of them.
>
> procedure P (X: Integer; Y: Float);  -- declaration
>
> P (X => 42);   -- illegal call, Y missing
> P (42, 10.0);  -- call OK, both parameters suppllied

Thank you, that exactly my problem , i want to use the Ada.float_text_IO.Get Procedure  and supply in my body package those items needed . The point is there are several of them(without File management) :

procedure Get
     (Item  : out Num;
      Width : Field := 0);

procedure Get
     (From : String;
      Item : out Num;
      Last : out Positive);


and, i don't know which one use in my program and how , i tried :

======================
with Ada.Text_IO;
with Identification;

  --  File  : log_in.adb  

Procedure log_in is

   Password : Identification.Password_Value;
   virgules :  Identification.virgules_Value ;

   begin

   Identification.Get (Password => Password);
   
if Password = "admin" then
      Ada.Text_IO.Put_Line (Item => "Welcome, Administrator.");
   end if;
   
    if virgules'Valid then
        Ada.Text_IO.Put_Line("A float number was not asked") ;
end if;                        end log_in;
=========================
with Ada.Text_IO;
with Ada.float_text_IO;

    --  File  :  identification.adb
   
package body identification is

procedure Get_float
     (Item  : out virgules_Value;
      Width : Field := 0) is

begin
      Ada.float_text_IO.get(Item => virgules);
      Ada.Text_IO.Skip_Line;

end Get_float;

procedure Get (Password : out Password_Value ) is

begin
Ada.Text_IO.Put (Item => "Hello, User. What's your name? ");

Get_Name : declare
         Name : String := Ada.Text_IO.Get_Line;
      begin
         if Name /= "fanzine" then
            Ada.Text_IO.Put_Line (Item => "You're not Administrator.");
            Get_float ;
         else
            Ada.Text_IO.Get (Item => Password);
            Ada.Text_IO.Skip_Line;
            Ada.Text_IO.New_Line;
         end if;
   end Get_Name;
            
end Get;

end identification;
====================

  --  File  : identification.ads
 
package identification is

   subtype Password_Value is String (1..5);
   subtype virgules_Value is Float ;
   
   procedure Get (Password : out Password_Value);
   
   procedure Get_float
     (Item  : out virgules_Value;
      Width : Field := 0);
     --  errors: "Field" is not visible ,and, non-visible declaration at a-textio.ads:74

end identification;
======================
Errors are :
identification.ads:13:15: "Field" is not visible
identification.ads:13:15: non-visible declaration at a-textio.ads:74

As you can see , i got those errors just because i don't know how to use the Ada.float_text_IO.Get Procedure . 


  parent reply	other threads:[~2015-11-03 18:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 12:33 Re : Simple call of Procedure with Ada.float_text_IO.Get comicfanzine
2015-11-02 13:03 ` Jacob Sparre Andersen
2015-11-02 14:46   ` comicfanzine
2015-11-02 17:23     ` Jacob Sparre Andersen
2015-11-02 21:51       ` comicfanzine
2015-11-02 23:02         ` AdaMagica
2015-11-03 11:42           ` comicfanzine
2015-11-03 11:52           ` comicfanzine
2015-11-03 18:40           ` comicfanzine [this message]
2015-11-03 19:02             ` Jeffrey R. Carter
2015-11-03 20:27             ` Simon Wright
2015-11-03 23:14               ` comicfanzine
2015-11-03 23:36               ` comicfanzine
2015-11-04 10:30                 ` Simon Wright
2015-11-04 12:39                   ` comicfanzine
2015-11-04 14:37                   ` comicfanzine
2015-11-04 16:06                     ` Simon Wright
2015-11-03  6:44         ` Randy Brukardt
replies disabled

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