SAL (Stephe's Ada Library)

Current version: 2.01

SAL is a collection of stuff I've found useful in my projects.

A large part of SAL provides a coherent set of generic abstract data types, intended to be yet another entry in the "Standard Ada Library" discussion. My goal in this part of SAL was to provide Ada packages that take full advantage of the flexibility and power of Ada generics, while at the same time making things relatively easy for the casual user. See here for more on my design philosophy.

Another large part of SAL provides math operations for kinematics and dynamics of masses in 3 dimensional space. Cartesian vectors, quaternions, orthonormal rotation matrices, moments of inertia, forces, acceleration, velocity are supported, in 3 and 6 degrees of freedom (translation and rotation). I've used this library for both robotics and satelite simulation. This portion is partially documented in spacecraft_math.pdf

Download the source in tar.gz format. Then follow the simple installation instructions.

Review the release history.

SAL is copyright 1998 - 2006, 2009 by Stephen Leake, released under the Modified Gnu Public License (the same one that covers the supported GNAT run time libraries).


Design philosophy

SAL grew out of my desire to provide abstract data types and algorithms that could work with the widest possible range of Ada types. I did not want to build a direct replacement for the C++ Standard Template Library; I wanted to see what I could accomplish by pushing the generics in Ada as far as I could.

This was started in 1997, well before the Ada 2005 standard Containers effort. The SAL design is quite different from the Containers design; I believe both packages are useful.

So far, SAL does not take advantage of any Ada 2005 features, except for 'raise .. with' and the Ada.Text_IO.Get_Line function. It probably will evolve to use more Ada 2005 features in the future.

Since Ada allows abstract data types that are polymorphic or not, and in some applications polymorphism is not desired, I provide both kinds of data types. The child package tree rooted at SAL.Gen (for generic) provides non-polymorphic data types, while the tree rooted at SAL.Poly provides polymorphic data types. However, it turns out the Poly packages are not much more useful than the Gen packages (at least in my applications), so I stopped writing Poly packages after the first few.

If the item type is indefinite, the abstract data type packages require helper functions that do allocation and deallocation. If the item type is not indefinite, providing these helper functions is a chore. The SAL.Aux packages simplify that chore.

Here's a short list of some of the data types provided by SAL.

One purpose of a coherent set of abstract data types is to provide algorithms that can be used with them. SAL has a small set of algorithm packages, rooted at SAL.Gen.Alg. The root packages take generic formal parameters that are common to all the algorithms in the tree; child packages may require additional functions (such as comparison). In one sense, it is these root algorithm packages that define a SAL container; any abstract data type that can be used with SAL.Gen.Alg is a SAL container. This contrasts with the C++ Standard Template Library approach of defining a class hierarchy, and algorithms that work with various levels in the hierarchy. SAL does not have a common root container type. Here are a couple of algorithm packages:

Ada provides a wide range of types; definite/indefinite, limited/non-limited, tagged/non-tagged, abstract/concrete. By contrast, C++ classes can only be abstract or concrete; there are no other choices. A C++ class corresponds to an Ada non-limited tagged type, either abstract or concrete. This range of Ada types complicates container packages; we want to allow the item type for container packages to be any possible Ada type. In practice, this is not possible, but it is possible to allow the item type to cover most of the possibilities.


Test code

There is complete test code for each SAL package. The intent is to provide full path coverage. Each test runs autonomously, and most produce an output file that can be compared to known good output. Some tests have been converted to use the AUnit framework, and do the comparisons in the test, rather than generating output files. This was necessary because different platforms produce slightly different results for some of the complex computations in the manipulator packages. As I've gotten used to AUnit, I like it a lot; there is a SAL.AUnit package that provides useful Check functions for writing AUnit based tests. There is a makefile that runs all the tests.

If you find a bug in SAL, let me know. If you are up to it, please try to enhance the appropriate test to pinpoint the bug.


Installation

SAL is distributed in source form only. One way for you to use it is simply to incorporate it in your Ada code just like code you write; you don't need to use my development environment.

Development tools

If you'd like to compile SAL the way I do, here is the list of tools I use, with brief installation hints.

SAL Installation instructions - download

  1. Download sal-2.01.tar.gz to a temporary directory.
  2. Extract to the directory of your choice (herinafter called "the root directory"). This will create two top-level directories in the root directory:

Installation instructions - your way

You can just compile the SAL source as if it were your code.

  1. Download as above.
  2. Delete Makerules and SAL/Build
  3. Add SAL/Source_Common to your development environment's list of source directories, and have fun!

Installation instructions - my way

  1. Download as above.
  2. Define GNAT_VERSION as an environment variable; it must have one of the values "6.2.0", "GPL-2008", "3.4.4". This is used to select the proper compiler switches.
  3. From directory SAL/Build/x86_gnu_*_release, run make. Windows, Linux, and Lynx build directories are provided. This will compile all the code and run all the tests. The object and ali files are in an objects directory; easy to ignore in a CM tool.
  4. To use the library with project files, add SAL/Build/x86_gnu_*_release to ADA_PROJECT_PATHS and add "with sal;" in your project file.

Known Bugs


History

Version 2.01 11 April 2009
Version 2.00 18 June 2006
Version 1.70 7 August 2004
Version 1.60 3 April 2004
Version 1.51 16 Nov 2003
Version 1.50 2 Sept 2003
Version 1.06 24 April 2003
Version 1.05 26 September, 2002
Version 1.04b 26 July, 2002
Version 1.04 14 June, 2002
Version 1.03 9 December, 2001
Version 1.02 17 November, 2001
Version 1.01 2 October, 2000
Significant upgrade; refined notion of "containers", added many containers and algorithms. Upgraded to GNAT 3.13p. Dropped support for ObjectAda.
Version 1.00 19 October, 1999
First release.

my home page Author : Stephen Leake Valid HTML 4.01! Created with Emacs powered by Ada Last modified: Sun Feb 17 06:21:47 EST 2013