comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthewjheaney@earthlink.net>
Subject: Re: Hash table
Date: Sat, 13 Aug 2005 23:58:43 GMT
Date: 2005-08-13T23:58:43+00:00	[thread overview]
Message-ID: <ur7cx4cen.fsf@earthlink.net> (raw)
In-Reply-To: m3k6iq4qfq.fsf@rr.trudgett

David Trudgett <wpower@zeta.org.au.nospamplease>  writes:

> I'm looking for a Free Software Ada95 container library, or in
> particular, a hash table (or associative list).

Ada 2005 will have both sets and maps.  You're asking specifically for a
hashed version, but keep in mind that an ordered container (having an
identical interface, but different time complexity) might satisfy your
needs just as well.

The hashed containers are:

ada.containers.hashed_sets
ada.containers.indefinite_hashed_sets
ada.containers.hashed_maps
ada.containers.indefinite_hashed_maps

The ordered forms are:

ada.containers.ordered_sets
ada.containers.indefinite_ordered_sets
ada.containers.ordered_maps
ada.containers.indefinite_ordered_maps


> I noticed that Ada 2005 may include a standard Ada.Containers library,
> but is there a working prototype of this available now?

Yes, there's a public reference implementation available here:

http://charles.tigris.org/

Follow the links to the CVS repository, to the ai302 subdirectory.  The
names use gnat run-time syntax, so you're looking for:

a-cohama.ad[sb]
a-cihama.ad[sb]
a-cohase.ad[sb]
a-cihase.ad[sb]

Note that these will only compile with an Ada 2005 compiler.  If you're
using the latest version of gnat, use the -gnat05 switch to compile them.

If you don't have an Ada 2005 compiler, then you can modify the sources
to your liking.  That will mean replacing an anonymous access subprogram
parameters with something else, typically a generic operation that
passes the subprogram as a generic formal.  For example, the procedure:

procedure Iterate
  (Container : in Map;
   Process   : not null access procedure (Position : Cursor));

should be re-written as:

generic
   with procedure Process (Position : Cursor);
procedure Generic_Iteration (Container : in Map);

(Note that replacing the anonymous access subprogram parameters with
named access parameters is probably not what you want, because of the
accessibility rules.  Hence the generic declaration above.)


> A bit of searching found the ASL (Ada Structured Library --
> http://sourceforge.net/projects/adasl), which hasn't had a new release
> since 2001 (which means it must be perfect ;-)). Should I use ASL, and
> if I do, will it be completely different from the proposed
> Ada.Containers standard?

I would try to use a reference implementation of the standard library,
modified as necessary to run under pure Ada 95.  I can help you make the
necessary modifications.

In general, we prefer that users use the standard library now, since
that helps us find bugs in the design of the library (early adopters
have been extremely helpful here), and in the actual implementation of
the library.


> I'm using Gnat (3.15p) on Debian Linux.

Do you have access to gcc 4.x?  The standard container library is
already bundled with the gcc 4 release.

-Matt



  parent reply	other threads:[~2005-08-13 23:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-13  0:43 Hash table David Trudgett
2005-08-13  9:23 ` Frank
2005-08-13 13:52 ` Ludovic Brenta
2005-08-14  0:23   ` David Trudgett
2005-08-14 22:42     ` Martin Dowie
2005-08-15  6:51       ` Martin Dowie
2005-08-15 15:47         ` Matthew Heaney
2005-08-16  7:33           ` Martin Dowie
2005-08-13 23:58 ` Matthew Heaney [this message]
2005-08-14  1:30   ` David Trudgett
replies disabled

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