comp.lang.ada
 help / color / mirror / Atom feed
* need help........
@ 1994-11-15  1:10 Basri Basri
  0 siblings, 0 replies; 8+ messages in thread
From: Basri Basri @ 1994-11-15  1:10 UTC (permalink / raw)


Hi, I'm new to ADA. Does anybody know any ftp site that provides an 
ADA compiler for PC ? If there is no such site, where can I buy it?
Thanks a lot...

Please reply to : suharjot@cs.wisc.edu, don't reply to this account.
Thanks a lot.

-Supri Suharjoto.




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

* Need help
@ 1996-11-19  0:00 Antonio Casimiro Costa
  0 siblings, 0 replies; 8+ messages in thread
From: Antonio Casimiro Costa @ 1996-11-19  0:00 UTC (permalink / raw)



Hello

I don't now if this is the right place to post this message, so
if not please excuse me.

I using gnat3.05 in a linux machine and in the program I'm doing
I need to do non-blocking operations on the standard input. The
problem is that I don't know how to do it.

I would like to have a couple of functions that let me test for
the presence of a new readable character in the input and read it
without
echoing.

I would be very appreciated if someone could help me, or tell me
where can I find the information I need.

Thank you in advance

Antonio
-- 
----------------------------------------------------
Antonio Casimiro Costa
Departamento de Informatica, FCUL
e-mail: casim@di.fc.ul.pt




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

* Need Help..
@ 1997-10-26  0:00 sho
  1997-11-01  0:00 ` Matthew Heaney
  0 siblings, 1 reply; 8+ messages in thread
From: sho @ 1997-10-26  0:00 UTC (permalink / raw)



Dear Programmers,

I have encountered a difficult task in programming with Ada,the task of
this program is to get user input for an exression such as:
(X+y)/(a+b)
then it will check for any errors,when there is no error.The program
should ask the user for an input to define X,y,a,b then evaluate the
values.It might seems simple but for me it isnt:(,If any of you have
done the same program or anything similar to that or even some bits that
will give me a clue on how to do it.Please email me or write on the
board.I would like to thank you for your time and consideration:)


Sho




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

* Re: Need Help..
  1997-10-26  0:00 Need Help sho
@ 1997-11-01  0:00 ` Matthew Heaney
  0 siblings, 0 replies; 8+ messages in thread
From: Matthew Heaney @ 1997-11-01  0:00 UTC (permalink / raw)



In article <345346AB.77C4@upnaway.com>, sho@upnaway.com wrote:


>I have encountered a difficult task in programming with Ada,the task of
>this program is to get user input for an exression such as:
>(X+y)/(a+b)
>then it will check for any errors,when there is no error.The program
>should ask the user for an input to define X,y,a,b then evaluate the
>values.It might seems simple but for me it isnt:(,If any of you have
>done the same program or anything similar to that or even some bits that
>will give me a clue on how to do it.Please email me or write on the
>board.I would like to thank you for your time and consideration:)

procedure P is

   procedure Get
      (Prompt : in String;
       Value    : out Integer) is
   begin
      Main:
      loop
         Ada.Text_IO.Put ("Enter " & Prompt & ": ");

         begin
            Ada.Integer_Text_IO.Get (Value);

            exit Main;

         exception
            when Ada.Text_IO.Data_Error => 
               Ada.Text_IO.Skip_Line;
               Ada.Text_IO.Put ("Bad value; try again: ");

         end;

      end loop Main;
   end Get;

   X, Y, A, B : Integer;
begin

   Get ("X", X);
   Get ("Y", Y);
   Get ("A", A);
   Get ("B", B);

   <eval expr using X, Y, A, B>

exception
   when Ada.Text_IO.End_Error =>
      null;

end;

Will that do what you want?

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




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

* Re: Need help...
  1998-01-12  0:00 Need help Scott Barrish
@ 1998-01-11  0:00 ` Matthew Heaney
  0 siblings, 0 replies; 8+ messages in thread
From: Matthew Heaney @ 1998-01-11  0:00 UTC (permalink / raw)



In article <69bvak$14d@bgtnsc01.worldnet.att.net>, "Scott Barrish"
<TeufelHunde@worldnet.att.net> wrote:

Is there anway to instantiate a queue of stacks?  I know it might not have
>any value in real programming situations, but I just want to see if it can
>be done.  If you would like to help with this problem, I would be more than
>happy to e-mail my packages and code files.

Yes, you can.  Consider these parial declarations

generic
   type Queue_Item is private;
   with function "=" (L, R : Queue_Item) return Boolean is <>;
package Queues is

   type Root_Queue is tagged null record;
...
end Queue;

generic
   type Stack_Item is private;
   with function "=" (L, R : Stack_Item) return Boolean is <>;
package Stacks is 
   
   type Root_Stack is tagged null record;
...
end Stacks;

Assume an instantiation of stacks with on type Integer

with Stacks;
package Integer_Stacks is 
   new Stacks (Integer);


with Integer_Stacks, Stacks.Bounded_G;
package Integer_Stacks.Bounded is 
   new Integer_Stacks.Bounded_G;

(I think that's the syntax.)


Now you can instantiate your queue with your bounded integer stack:

with package Queues, Integer_Stacks.Bounded;
package Integer_Stack_Queues is 
   new Queues (Integer_Stacks.Bounded.Bounded_Stack);


with Integer_Stack_Queues, Queues.Bounded_G;
package Integer_Stack_Queues.Bounded is
   new Queues.Bounded_G;

(I think that's the syntax.)


Now you have a bounded queue of bounded stacks.

Be careful, though.  This is all by-copy.  If you get the front item
(stack) of the queue, you're getting a copy of what's in the queue.  As in

declare
   The_Queue : Integer_Stack_Queues.Bounded.Bounded_Queue;
   The_Stack : Integer_Stacks.Bounded.Bounded_Stack;
begin
   <populate queue>

   The_Stack := Front (The_Queue);

   Push (10, On => The_Stack);
end;

Be careful, because even though you pushed the item 10 on the integer
stack, it's only a copy of the stack at the front of the queue.  If you
were to get the front item of the queue again, that stack doesn't have the
value 10 on its top.

The question you need to ask is, do you want a copy, or do you want to get
a pointer to what's on the queue?  If the latter, then if you push an item
on the stack, it will show up on top of the stack at the front of the
queue.  To do this, you need to instantiate the queue with a pointer to
stack.  When you put a stack in the queue, you're really putting a
poointer-to-stack on the queue.  Something like

with Integer_Stacks;
package Integer_Stack_Types is

   type Integer_Stack_Class_Access_All is
      access all Integer_Stack.Root_Stack'Class;

end;

with Integer_Stack_Types, Queues;
package Integer_Stack_Queues is
   new Queues (Integer_Stack_Types.Integer_Stack_Class_Access_All);

with Integer_Stack_Queues, Queues.Bounded_G;
package Integer_Stack_Queues.Bounded is 
   new Integer_Stack_Queues.Bounded_G;

Now you have a bounded queue of pointers to integer stacks.  As written,
it's a pointer to any kind of stack in the class of integer stack types, so
it's actually a heterogeneous queue of stacks.  Pretty cool, huh?  This is
the kind of thing Chris Sparks was asking about a couple of days ago.

With this formulation, when you ask for the front item of the queue, you're
getting a pointer to the stack at the front.  So any changes you make to
the state of the stack will be reflected in the queue too.

If you have any more questions about this issue, feel free to email me
privately.

Hope that helps,
Matt

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




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

* Need help...
@ 1998-01-12  0:00 Scott Barrish
  1998-01-11  0:00 ` Matthew Heaney
  0 siblings, 1 reply; 8+ messages in thread
From: Scott Barrish @ 1998-01-12  0:00 UTC (permalink / raw)



Ada Professionals:

Is there anway to instantiate a queue of stacks?  I know it might not have
any value in real programming situations, but I just want to see if it can
be done.  If you would like to help with this problem, I would be more than
happy to e-mail my packages and code files.

Sincerely,

Scott B.




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

* need help
@ 1998-10-14  0:00 mostoc
  1998-10-15  0:00 ` Pascal Obry
  0 siblings, 1 reply; 8+ messages in thread
From: mostoc @ 1998-10-14  0:00 UTC (permalink / raw)


I am looking for a text based email that can be installed through a dos
window.  Can anybody help me?

Chad Moston






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

* Re: need help
  1998-10-14  0:00 need help mostoc
@ 1998-10-15  0:00 ` Pascal Obry
  0 siblings, 0 replies; 8+ messages in thread
From: Pascal Obry @ 1998-10-15  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 296 bytes --]

mostoc a �crit dans le message <702ut0$1ta$1@nitrogen.mankato.msus.edu>...
>I am looking for a text based email that can be installed through a dos
>window.  Can anybody help me?
>

Yes ! Just develop it in Ada. What kind of response do you expect from
comp.lang.ada :-)

>Chad Moston
>
>






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

end of thread, other threads:[~1998-10-15  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-19  0:00 Need help Antonio Casimiro Costa
  -- strict thread matches above, loose matches on Subject: below --
1998-10-14  0:00 need help mostoc
1998-10-15  0:00 ` Pascal Obry
1998-01-12  0:00 Need help Scott Barrish
1998-01-11  0:00 ` Matthew Heaney
1997-10-26  0:00 Need Help sho
1997-11-01  0:00 ` Matthew Heaney
1994-11-15  1:10 need help Basri Basri

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