comp.lang.ada
 help / color / mirror / Atom feed
* Re : Simple call of Procedure with Ada.float_text_IO.Get
@ 2015-11-02 12:33 comicfanzine
  2015-11-02 13:03 ` Jacob Sparre Andersen
  0 siblings, 1 reply; 18+ messages in thread
From: comicfanzine @ 2015-11-02 12:33 UTC (permalink / raw)


Hi , i have a code with a procedure call and i got the following errors , i understand them but i don't know how to fixe them :

log_in.adb:28:17: no candidate interpretations match the actuals:
log_in.adb:28:17: missing argument for parameter "From" in call to "get" declared at identification.ads:8
log_in.adb:28:17: missing argument for parameter "Password" in call to "get" declared at identification.ads:7

I have 3 files (packagefile.adb , packagefile.ads and the mainprogram(log_in) :

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

Procedure log_in is

   Procedure check_password is 

   Password : Identification.Password_Value;
   
   begin

   Identification.Get (Password => Password);
   
if Password = "admin" then
      Ada.Text_IO.Put_Line (Item => "Welcome, Administrator.");
   end if;
   
end check_password;

   virgules :  Identification.virgules_Value ;
   
begin

   check_password;
   -- Here i want the procedure check_password be executed before log_in , for the arguments given to  Ada.float_text_IO.Get 
   
  Identification.Get (virgules => virgules);
    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;  

package body identification is

procedure Get (Password : out Password_Value ) is

procedure Get 
     (From : in Password_Value;
      Item : out virgules_Value;
      Last : out Positive_package_declaration_need);  is

begin
      Ada.float_text_IO.get(Item => virgules); Skip_line  ; 
end Get;
begin
Ada.Text_IO.Put (Item => "Hello, User. What's your name? ");

      Get_Name : declare
         Name : constant String := Ada.Text_IO.Get_Line;
      begin 
         if Name /= "fanzine" then
            Ada.Text_IO.Put_Line (Item => "You're not Administrator.");
	    procedure Get 
     (From : in Password_Value;
      Item : out virgules_Value;
      Last : out Positive_package_declaration_need);
         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;
=====================
package identification is

   subtype Password_Value is String (1..5);
   subtype virgules_Value is Float ; 
   subtype Positive_package_declaration_need is Positive ;
   
   procedure Get (Password : out Password_Value);
    procedure Get 
     (From : in Password_Value;
      Item : out virgules_Value;
      Last : out Positive_package_declaration_need);
-- "Last" is in the declaration in Ada.float_text_IO.Get , i don't know if i can , not use it and if it silll going to work after that .
end identification;


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Jacob Sparre Andersen @ 2015-11-02 13:03 UTC (permalink / raw)


comicfanzine@gmail.com writes:

> Hi , i have a code with a procedure call and i got the following
> errors , i understand them but i don't know how to fixe them :
>
> log_in.adb:28:17: no candidate interpretations match the actuals:
> log_in.adb:28:17: missing argument for parameter "From" in call to "get" declared at identification.ads:8
> log_in.adb:28:17: missing argument for parameter "Password" in call to "get" declared at identification.ads:7

You say that you understand the error messages.  What do they mean?

Greetings,

Jacob

PS: Please format your code nicely - and mark the position the error
    message refers to - before posting it.
PPS: Which textbook (or other sources) are you using to learn Ada?  I
     think it might be useful, if you tried to work through the
     exercises in <http://www.dwheeler.com/lovelace/> before continuing
     your own Ada project.
-- 
"Any man who can drive safely while kissing a pretty girl
 is simply not giving the kiss the attention it deserves."

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-02 13:03 ` Jacob Sparre Andersen
@ 2015-11-02 14:46   ` comicfanzine
  2015-11-02 17:23     ` Jacob Sparre Andersen
  0 siblings, 1 reply; 18+ messages in thread
From: comicfanzine @ 2015-11-02 14:46 UTC (permalink / raw)


Le lundi 2 novembre 2015 14:03:39 UTC+1, Jacob Sparre Andersen a écrit :
> You say that you understand the error messages.  What do they mean?
They mean that i don't use the "Procedure Get" right , i understand but i don't know how to fix it . 

> PS: Please format your code nicely - and mark the position the error
>     message refers to - before posting it.
Here is the code whith errors included , the presentation is better if you copy-paste it into your text-editor:
============
with Ada.Text_IO;
with Identification;

  --  File  : log_in.adb  

Procedure log_in is

   Procedure check_password is 

   Password : Identification.Password_Value;
   
   begin

   Identification.Get (Password => Password);
   
if Password = "admin" then
      Ada.Text_IO.Put_Line (Item => "Welcome, Administrator.");
   end if;
   
end check_password;

   virgules :  Identification.virgules_Value ;
   
begin

   check_password;
   -- Here i want the procedure check_password be executed before log_in , for the arguments given to  Ada.float_text_IO.Get 
   
  Identification.Get (virgules => virgules);
  -- error : missing argument for parameter "From" in call to "get" declared at identification.ads:8
  -- error : missing argument for parameter "Password" in call to "get" declared at identification.ads:7
  
    if virgules'Valid then 
        Ada.Text_IO.Put_Line("A float number was not asked") ;
end if;			end log_in;

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

    --  File  :  identification.adb
    
package body identification is

procedure Get (Password : out Password_Value ) is

procedure Get 
     (From : in Password_Value;
      Item : out virgules_Value;
      Last : out Positive_package_declaration_need);  is

begin
      Ada.float_text_IO.get(Item => virgules); Skip_line  ; 
end Get;
begin
Ada.Text_IO.Put (Item => "Hello, User. What's your name? ");

      Get_Name : declare
         Name : constant String := Ada.Text_IO.Get_Line;
      begin 
         if Name /= "fanzine" then
            Ada.Text_IO.Put_Line (Item => "You're not Administrator.");
	    procedure Get 
     (From : in Password_Value;
      Item : out virgules_Value;
      Last : out Positive_package_declaration_need);
         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 ; 
   subtype Positive_package_declaration_need is Positive ;
   
   procedure Get (Password : out Password_Value);
    procedure Get 
     (From : in Password_Value;
      Item : out virgules_Value;
      Last : out Positive_package_declaration_need);
-- "Last" is in the declaration in Ada.float_text_IO.Get , i don't know if i can , not use it and if it silll going to work after that .
end identification;
===================

> PPS: Which textbook (or other sources) are you using to learn Ada?  I
>      think it might be useful, if you tried to work through the
>      exercises in <http://www.dwheeler.com/lovelace/> before continuing
>      your own Ada project.
Thanks , i learn with many textbooks , but right now , i'm trying to use the fonctions in Ada.text_io(like Ada.float_text_IO.Get) right .

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-02 14:46   ` comicfanzine
@ 2015-11-02 17:23     ` Jacob Sparre Andersen
  2015-11-02 21:51       ` comicfanzine
  0 siblings, 1 reply; 18+ messages in thread
From: Jacob Sparre Andersen @ 2015-11-02 17:23 UTC (permalink / raw)


comicfanzine@gmail.com writes:

> Le lundi 2 novembre 2015 14:03:39 UTC+1, Jacob Sparre Andersen a écrit :
>> You say that you understand the error messages.  What do they mean?
> They mean that i don't use the "Procedure Get" right , i understand
> but i don't know how to fix it . 

They say so much more than that.

First: The error messages point out that there are two procedures which
       match the name Identification.Get, one declared on line 7 and one
       declare on line 8 in the specification of the package
       Identification.

Second: They point out that if you want to call the one declared on line
        7, the formal parameter Password is missing, and that if you
        want to call the one declared on line 8, the formal parameter
        From is missing.

> Here is the code whith errors included , the presentation is better if
> you copy-paste it into your text-editor:

I don't want to copy-paste your source text to an editor.  I want you to
format it properly (standard indentation for example), so it is easy to
read.

>> PPS: Which textbook (or other sources) are you using to learn Ada?  I
>>      think it might be useful, if you tried to work through the exercises
>>      in <http://www.dwheeler.com/lovelace/> before continuing your own Ada
>>      project.

> Thanks , i learn with many textbooks , but right now , i'm trying to
> use the fonctions in Ada.text_io(like Ada.float_text_IO.Get) right .

But it appears that you haven't learnt enough Ada to use them yet.

Greetings,

Jacob
-- 
»A corollary of Murphy's law is that duplicate information
 eventually becomes different information.  Putting both in
 the same file may slow down the process, but it will not
 prevent it.«                                 -- Wes Groleau


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-02 17:23     ` Jacob Sparre Andersen
@ 2015-11-02 21:51       ` comicfanzine
  2015-11-02 23:02         ` AdaMagica
  2015-11-03  6:44         ` Randy Brukardt
  0 siblings, 2 replies; 18+ messages in thread
From: comicfanzine @ 2015-11-02 21:51 UTC (permalink / raw)


Le lundi 2 novembre 2015 18:23:30 UTC+1, Jacob Sparre Andersen a écrit : 
> They say so much more than that.
> 
> First: The error messages point out that there are two procedures which
>        match the name Identification.Get, one declared on line 7 and one
>        declare on line 8 in the specification of the package
>        Identification.
> 
> Second: They point out that if you want to call the one declared on line
>         7, the formal parameter Password is missing, and that if you
>         want to call the one declared on line 8, the formal parameter
>         From is missing.

Yes , but i still don't know how to fix them . It will be simple if you explain me how to fix those errors instead of just explain the errors , by a code .

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-02 21:51       ` comicfanzine
@ 2015-11-02 23:02         ` AdaMagica
  2015-11-03 11:42           ` comicfanzine
                             ` (2 more replies)
  2015-11-03  6:44         ` Randy Brukardt
  1 sibling, 3 replies; 18+ messages in thread
From: AdaMagica @ 2015-11-02 23:02 UTC (permalink / raw)


Am Montag, 2. November 2015 22:51:29 UTC+1 schrieb comicf...@gmail.com:
> Yes , but i still don't know how to fix them . It will be simple if you explain me how to fix those errors instead of just explain the errors , by a code .

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-02 21:51       ` comicfanzine
  2015-11-02 23:02         ` AdaMagica
@ 2015-11-03  6:44         ` Randy Brukardt
  1 sibling, 0 replies; 18+ messages in thread
From: Randy Brukardt @ 2015-11-03  6:44 UTC (permalink / raw)


<comicfanzine@gmail.com> wrote in message 
news:590d628d-41d5-454e-ae4d-a3c72e0ac698@googlegroups.com...
...
> Yes , but i still don't know how to fix them . It will be simple if you 
> explain me how
> to fix those errors instead of just explain the errors , by a code .

One learns how to use a tool by understanding how it works, not by getting 
someone else to give you the answers. What happens the next time you have a 
similar problem?? When you start using Ada for a real project, do you think 
that your boss would be happy if you need someone else to show you the 
solution??

                            Randy.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-02 23:02         ` AdaMagica
@ 2015-11-03 11:42           ` comicfanzine
  2015-11-03 11:52           ` comicfanzine
  2015-11-03 18:40           ` comicfanzine
  2 siblings, 0 replies; 18+ messages in thread
From: comicfanzine @ 2015-11-03 11:42 UTC (permalink / raw)


Le mardi 3 novembre 2015 00:02:11 UTC+1, AdaMagica a écrit :
> Am Montag, 2. November 2015 22:51:29 UTC+1 schrieb comicf...@gmail.com:
> > Yes , but i still don't know how to fix them . It will be simple if you explain me how to fix those errors instead of just explain the errors , by a code .
> 
> 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 procedure Ada.text_io.get 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
     (Item  : out virgules_Value;
      Width : Field := 0) is

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

end Get;

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
     (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.text_io.Get Procedure .

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-02 23:02         ` AdaMagica
  2015-11-03 11:42           ` comicfanzine
@ 2015-11-03 11:52           ` comicfanzine
  2015-11-03 18:40           ` comicfanzine
  2 siblings, 0 replies; 18+ messages in thread
From: comicfanzine @ 2015-11-03 11:52 UTC (permalink / raw)


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 procedure Ada.text_io.get 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.text_io.Get Procedure . 


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-02 23:02         ` AdaMagica
  2015-11-03 11:42           ` comicfanzine
  2015-11-03 11:52           ` comicfanzine
@ 2015-11-03 18:40           ` comicfanzine
  2015-11-03 19:02             ` Jeffrey R. Carter
  2015-11-03 20:27             ` Simon Wright
  2 siblings, 2 replies; 18+ messages in thread
From: comicfanzine @ 2015-11-03 18:40 UTC (permalink / raw)


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 . 


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-03 18:40           ` comicfanzine
@ 2015-11-03 19:02             ` Jeffrey R. Carter
  2015-11-03 20:27             ` Simon Wright
  1 sibling, 0 replies; 18+ messages in thread
From: Jeffrey R. Carter @ 2015-11-03 19:02 UTC (permalink / raw)


On 11/03/2015 11:40 AM, comicfanzine@gmail.com wrote:
> 
> 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);

There is also

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

If you've read the descriptions of these procedures in the ARM (ARM A.10.9) then
you should know what each one does, and which one you want.

http://www.adaic.org/resources/add_content/standards/12rm/html/RM-A-10-9.html

You should be familiar with the standard library described in ARM Annex A if
you're going to use Ada.

-- 
Jeff Carter
"Drown in a vat of whiskey. Death, where is thy sting?"
Never Give a Sucker an Even Break
106


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-03 18:40           ` comicfanzine
  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
  1 sibling, 2 replies; 18+ messages in thread
From: Simon Wright @ 2015-11-03 20:27 UTC (permalink / raw)


comicfanzine@gmail.com writes:

> 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 :

The first one reads from standard input (the ARM doesn't explicitly say
this), and leaves standard input positioned after the last character of
the float number read.

The second one reads from the string From, and Last contains "the index
value such that From(Last) is the last character read" (not sure if
that's the last character of the number, or one past it, I'd have to
experiment).

So which do you want?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-03 20:27             ` Simon Wright
@ 2015-11-03 23:14               ` comicfanzine
  2015-11-03 23:36               ` comicfanzine
  1 sibling, 0 replies; 18+ messages in thread
From: comicfanzine @ 2015-11-03 23:14 UTC (permalink / raw)



Le mardi 3 novembre 2015 21:27:35 UTC+1, Simon Wright a écrit :
> comicfanzine@gmail.com writes:
> 
> > 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 :
> 
> The first one reads from standard input (the ARM doesn't explicitly say
> this), and leaves standard input positioned after the last character of
> the float number read.
> 
> The second one reads from the string From, and Last contains "the index
> value such that From(Last) is the last character read" (not sure if
> that's the last character of the number, or one past it, I'd have to
> experiment).
> 
> So which do you want?
The first one because i don't want procedure get to read a String , i only want it to read a float input enter by the user of the program .

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  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
  1 sibling, 1 reply; 18+ messages in thread
From: comicfanzine @ 2015-11-03 23:36 UTC (permalink / raw)


Le mardi 3 novembre 2015 21:27:35 UTC+1, Simon Wright a écrit :
> comicfanzine@gmail.com writes:
>
> > 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 :
>
> The first one reads from standard input (the ARM doesn't explicitly say
> this), and leaves standard input positioned after the last character of
> the float number read.
>
> The second one reads from the string From, and Last contains "the index
> value such that From(Last) is the last character read" (not sure if
> that's the last character of the number, or one past it, I'd have to
> experiment).
>
> So which do you want?
The first one because i don't want procedure get to read a String , i only want it to read a numeric_literal(float input) enter by the user of the program .


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  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
  0 siblings, 2 replies; 18+ messages in thread
From: Simon Wright @ 2015-11-04 10:30 UTC (permalink / raw)


comicfanzine@gmail.com writes:

>> The first one reads from standard input (the ARM doesn't explicitly say
>> this), and leaves standard input positioned after the last character of
>> the float number read.
>>
>> The second one reads from the string From, and Last contains "the index
>> value such that From(Last) is the last character read" (not sure if
>> that's the last character of the number, or one past it, I'd have to
>> experiment).
>>
>> So which do you want?

> The first one because i don't want procedure get to read a String , i
> only want it to read a numeric_literal(float input) enter by the user
> of the program .

Well then,

      F : Float;
   begin
      Get (Item => F);


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-04 10:30                 ` Simon Wright
@ 2015-11-04 12:39                   ` comicfanzine
  2015-11-04 14:37                   ` comicfanzine
  1 sibling, 0 replies; 18+ messages in thread
From: comicfanzine @ 2015-11-04 12:39 UTC (permalink / raw)


Le mercredi 4 novembre 2015 11:30:29 UTC+1, Simon Wright a écrit :
> comicfanzine@gmail.com writes:
> 
> >> The first one reads from standard input (the ARM doesn't explicitly say
> >> this), and leaves standard input positioned after the last character of
> >> the float number read.
> >>
> >> The second one reads from the string From, and Last contains "the index
> >> value such that From(Last) is the last character read" (not sure if
> >> that's the last character of the number, or one past it, I'd have to
> >> experiment).
> >>
> >> So which do you want?
> 
> > The first one because i don't want procedure get to read a String , i
> > only want it to read a numeric_literal(float input) enter by the user
> > of the program .
> 
> Well then,
> 
>       F : Float;
>    begin
>       Get (Item => F);

Ok i tried without : "Width : Field := 0" , like you.
But still it doesn't compile , see errors as comments .
Here is files with correction :

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

  --  File  : log_in.adb  

Procedure log_in is

   Password : Identification.Password_Value;
   
   begin

   Identification.Get (Password => Password);
   
if Password = "admin" then
      Ada.Text_IO.Put_Line (Item => "Welcome, Administrator.");
   end if;
    Identification.receive_float;
    -- missing argument for parameter "Item" in call to "receive_float" declared at identification.ads:10
    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 receive_float 

virgules : Float ;

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

end receive_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.");
	    receive_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;
=======================
package identification is

   subtype Password_Value is String (1..5);
   
   procedure Get (Password : out Password_Value);
   
   procedure receive_float (Item  : out virgules);
  --  "virgules" is undefined (more references follow)

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  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
  1 sibling, 1 reply; 18+ messages in thread
From: comicfanzine @ 2015-11-04 14:37 UTC (permalink / raw)


Le mercredi 4 novembre 2015 11:30:29 UTC+1, Simon Wright a écrit :
> comicfanzine@gmail.com writes:
> 
> >> The first one reads from standard input (the ARM doesn't explicitly say
> >> this), and leaves standard input positioned after the last character of
> >> the float number read.
> >>
> >> The second one reads from the string From, and Last contains "the index
> >> value such that From(Last) is the last character read" (not sure if
> >> that's the last character of the number, or one past it, I'd have to
> >> experiment).
> >>
> >> So which do you want?
> 
> > The first one because i don't want procedure get to read a String , i
> > only want it to read a numeric_literal(float input) enter by the user
> > of the program .
> 
> Well then,
> 
>       F : Float;
>    begin
>       Get (Item => F);

OK i had correct my files and i also rename the procedure "Get_float" by "receive_float" , my problem is how to declare a variable in a packagefile.ads ??

More precisely : I don't want to declare "virgules" in my "log_in" file but in my "identification.ads" file .

If you read the files you will understand :

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

  --  File  : log_in.adb  

Procedure log_in is

   Password : Identification.Password_Value;

   begin

   Identification.Get (Password => Password);
   
if Password = "admin" then
      Ada.Text_IO.Put_Line (Item => "Welcome, Administrator.");
   end if;
   Identification.receive_float(virgules);
   --  error : "virgules" is undefined (more references follow)
   --  Ok but then how to defined it into identification.ads ??
   --  I tried like this : "virgules : Float" . But it doesn't work .
    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.ads
  
package identification is

   subtype Password_Value is String (1..5);
   
   procedure Get (Password : out Password_Value);
      
   procedure receive_float (virgules : float);

end identification;
======================
with Ada.Text_IO;
with Ada.float_text_IO;

    --  File  :  identification.adb
   
package body identification is

procedure receive_float (virgules : float) is
virgules : Float ;

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

end receive_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 /= "codezero1" then
            Ada.Text_IO.Put_Line (Item => "You're not Administrator.");
            receive_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; 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
  2015-11-04 14:37                   ` comicfanzine
@ 2015-11-04 16:06                     ` Simon Wright
  0 siblings, 0 replies; 18+ messages in thread
From: Simon Wright @ 2015-11-04 16:06 UTC (permalink / raw)


comicfanzine@gmail.com writes:

> I don't want to declare "virgules" in my "log_in" file but in my
> "identification.ads" file .

So do it!

> If you read the files you will understand :

Well, I don't.

You really need to work through one of the tutorials, for example the
Lovelace tutorial you've already been pointed at.

You were also recommended to format your code nicely. At the moment it's
quite painful to look at.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-11-04 16:06 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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