comp.lang.ada
 help / color / mirror / Atom feed
From: johnherro@aol.com
Subject: Re: Ada 83 versions of Ada 95 packages
Date: 1996/12/24
Date: 1996-12-24T00:00:00+00:00	[thread overview]
Message-ID: <19961224155500.KAA09943@ladder01.news.aol.com> (raw)
In-Reply-To: 9612232029.AA09783@most


"W. Wesley Groleau (Wes)" <wwgrol@PSESERV3.FW.HAC.COM> writes:
>I recently had to implement in Ada 83 some
>capabilities that are part of the Ada 95 standard
>libraries...  Is anyone else doing anything similar?

To a *very small extent* I did something similar by writing a very small
package in Ada 83, which I am happy to contribute to the public domain:
----------
package Ada83_Strings_Unbounded is
   type Unbounded_String(Length : Integer := 0) is private;
   function "+"(Right : in String) return Unbounded_String;
   function "+"(Right : in Unbounded_String) return String;
   function "&"(Left, Right : in Unbounded_String) return
Unbounded_String;
private
   type Unbounded_String(Length : Integer := 0) is
      record
         Text : String(1 .. Length);
      end record;
end Ada83_Strings_Unbounded;

package body Ada83_Strings_Unbounded is
   function "+"(Right : in String) return Unbounded_String is
      Ans : Unbounded_String(Right'Length);
   begin
      Ans.Text := Right;
      return Ans;
   end "+";

   function "+"(Right : in Unbounded_String) return String is
   begin
      return Right.Text;
   end "+";

   function "&"(Left, Right : in Unbounded_String) return Unbounded_String
is
   begin
      return +((+Left) & (+Right));
   end "&";
end Ada83_Strings_Unbounded;
----------
Admittedly this package is very small, but to take slices and do other
functions, you can easily convert from Unbounded_String to String first. 
E.g., if U is an Unbounded_String, you can write "+"(U)(1 .. 3) to take a
slice.  I find this package very useful, and hope others will, too.

- John Herro
Software Innovations Technology
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor




  reply	other threads:[~1996-12-24  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-23  0:00 Ada 83 versions of Ada 95 packages W. Wesley Groleau (Wes)
1996-12-24  0:00 ` johnherro [this message]
1996-12-24  0:00   ` Robert Dewar
1996-12-24  0:00     ` johnherro
1996-12-24  0:00       ` Robert Dewar
1996-12-24  0:00       ` Norman H. Cohen
1996-12-25  0:00         ` johnherro
1996-12-26  0:00   ` Keith Thompson
replies disabled

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