comp.lang.ada
 help / color / mirror / Atom feed
* attributes in generic procedure
@ 1999-11-21  0:00 daelen
  1999-11-21  0:00 ` Matthew Heaney
  1999-11-25  0:00 ` Nick Roberts
  0 siblings, 2 replies; 6+ messages in thread
From: daelen @ 1999-11-21  0:00 UTC (permalink / raw)


I would like to create a generic procedure as shown below which will only be
used for scalar types. Does anybody have a hint how to accomplish this?

generic
   type A_Type is private;
procedure Update (Par : in out A_Type; Value : String);
procedure Update (Par : in out A_Type; Value : String) is
begin
   if Value = "+" then
      if Par = A_Type'Last then
         Par := A_Type'First;
      else
         Par := A_Type'Succ (Par);
      end if;
   elsif Value = "++" then
      Par := A_Type'Last;
   elsif Value = "-" then
      if Par = A_Type'First then
         Par := A_Type'Last;
      else
         Par := A_Type'Pred (Par);
      end if;
   elsif Value = "--" then
      Par := A_Type'First;
   elsif Value /= "" then
      Par := A_Type'Value (Value);
   end if;
end Update;


Sent via Deja.com http://www.deja.com/
Before you buy.




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

end of thread, other threads:[~1999-12-03  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-21  0:00 attributes in generic procedure daelen
1999-11-21  0:00 ` Matthew Heaney
1999-11-25  0:00 ` Nick Roberts
1999-11-29  0:00   ` Niklas Holsti
1999-11-29  0:00     ` Robert Dewar
1999-12-03  0:00       ` Nick Roberts

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