1 Introduction


  Table of Contents Next Chapter-->  

[Rewrite & Expand] Ada 95 is arguably the most powerful development language available for Linux, with features comparable to Java and execution speeds similar to, and sometimes exceeding, C. gnat, the main [perhaps only'check at HBAP?--KB] Ada 95 compiler for Linux, is also absolutely free. This makes a combination that's hard for Linux programmers to ignore.

1.1 A Brief History of Linux

The Linux operating system that was created as a hobby by a young student, Linus Torvalds, at the University of Helsinki in Finland. Linus, interested in the UNIX clone operating system Minix, wanted to create an expanded version of Minix with more capabilities. He began his work in 1991 when he released version 0.02 and invited programmers to participate in his project. Version 1.0 was released in 1994. The latest version is 2.4 and development continues.

Linux uses GNU General Public License (GPL) and its source code is freely available to everyone. Linux distributions, CD-ROMs with the Linux kernel and various other software ready for installation, do not have to be free, but the Linux source code must remain available. Making source code available is known as 'open source'.

The word "Linux" is properly pronounced using a Swedish accent, making it difficult to pronounce in North America. It is most often pronounced with a short "i" and with the first syllable stressed, as in LIH-nicks, but it is sometimes pronounced LYE-nicks (the anglicized "Linus' UNIX") or LEE-nucks.

Strickly speaking, Linux refers to the operating system kernel that starts and manages other programs and provides access to system resources. The various open source shells, compilers, standard libraries and commands are a part of another project called GNU. The GNU project was started by the Free Software Foundation (FSF) as an an attempt to create a free version of UNIX. The main Linux C compiler, gcc, is a part of the GNU project.

There is also a GNU kernel project, but this has been largely superseded by the Linux kernel.

X Windows is also not strictly a part of Linux. Xfree86, the free version of X Windows, was adapted to the Linux operating system.

1.2 1995: The Year of Ada and Gnat

In 1974, the US Department of Defense realized it was spending too much on software. They wanted a new computer language that could handle all of their needs, from controlling the hardware in a missile guidance system to doing artificial intelligence. In 1983, they created the language Ada (now known as Ada 83), a heavily modified version of the Pascal language. "Ada", a proper name, refers to Countess Ada Lovelace (1815-1852), considered by some to be the world's first programmer.

The original Ada had several shortcomings in the areas of software engineering: Ada programs tended to be big and awkward to maintain over time. In 1990, ANSI began a project to revise Ada, to include object oriented features, hierarchical program libraries, support for other languages, and add-ons for specialized applications like systems programming, real-time systems, distributed information (client/server) systems and scientific programming. The updated language is known as Ada 95.

GNAT is a GPL Ada compiler, available for Linux, Windows NT, and many other platforms. It was originally created at New York University. GNAT is owned by Ada Core Technologies (ACT, http://www.gnat.com): although gnat is free, companies who want support can purchase it for a fee. The Linux version of GNAT supports the entire Ada 95 standard, including all optional features. It includes many extensions, like cross-compiling and support for the C++ language. ACT also provides GLADE, a free RPC-based TCP/IP networking implementation Ada 95's distributed systems annex.

The GNAT manual describes their compiler as "an industrial-quality Ada 95 compiler, integrated into the GCC retargetable compiler system. GNAT is a complete compiler, validated on several platforms, that includes support for all the Ada 95 annexes specified in the Ada Reference manual. Because of its integration into the GCC system, GNAT is available on a large number of hardware/operating system platforms, and can be used as a cross-compiler from any of its targets to any other one. Because of the common code-generator technology of GCC, GNAT has excellent support for multi-language programming: Ada, C, C++, Fortran, etc.

GNAT also represents a substantial improvement in Ada compilation technology. It's [sic] open-system philosophy stands in contrast with the opaque approach of older Ada compilers. There are no hidden and complex central libraries whose use requires a totally new set of commands, and no rigid development environments that often force needless recompilations. While preserving all of Ada's safety, GNAT's source-based model provides the flexibility and efficiency typically encountered in C development environments. Furthermore, GNAT's flexibility greatly facilitates its integration within third-party development environments and CASE tools. A number of standard editors, debuggers, profilers, memory analyzers, test coverage or configuration-management tools, etc. can be used with GNAT, which coexists comfortably with familiar programming tools (unlike older Ada compilation systems)."
Fun Fact: When Gnat 3.11p was released, Robert Dewar said that Linux would never be a billion dollar platform and deserved no special consideration by ACT. By the time Gnat 3.12p was released just over a year later, the Red Hat company was worth more than 18 billion dollars, or 40% of the server market. The first platform supported by Gnat 3.12p was Linux.

1.3 Why Use Ada?

C and C++ represent the de facto standard for Linux programming. After all, the kernel itself is written in C. However, C++ is not suitable for all kinds of projects because different computer languages have different strengths and weaknesses. Ada was designed for team development and embedded systems, leading to advantages over C in development time and debugging. An in-depth 1995 study by Stephen F. Zeigler (http://www.adaic.com/docs/reports/cada/cada_art.html) showed that development in Ada costs about half that of C++. It also suggests that Ada produces "almost 90% fewer bugs for the final customer".

GNAT was developed closely with gcc, the native C compiler for Linux. Unlike some compilers that translate a program into C and then feed the C program into gcc, gcc has built-in support for the Ada language. Like g++, the GNU C++ compiler, gnat works with gcc, allowing it to produce fast, quality executables without any intermediate steps.

This integration gives a lot of flexibility to programmers who want or need to support multiple languages. GNAT has an extensive set of features for trading variables and function calls between Ada and C/C++. It can import C/C++ items into Ada, export Ada items to C/C++. You can also link Ada functions indirectly into Java, using Java's ability to import C++ functions.

GNAT comes with over 140 standard libraries. These include numeric and string libraries, file operations, hash tables and sorts. If you would rather work directly with Linux C libraries, a variety of "binding" libraries exist, available for download from the Public Ada Library or The Home of the Brave Ada Programmers. These include bindings for POSIX (that is, the Linux kernel), X Windows, Motif, TCL and WWW CGI applications. The Ada Linux Team prepackage many bindings for use with their version of the Gnat compiler.

More and more Linux libraries feature Ada bindings, including ncurses (a standard text screen drawing library) and GTK (the Gimp Toolkit, a graphics package).

Although gnat is distributed under the GPL license, gnat and its libraries may be used in commercial applications.

The GtkAda mailing list is at http://gtkada.eu.org.

The Gnat mailing list is at http://www.diax.ch/users/gdm/gnatlist.htm.

The Gnat Glade chat mailing list is at glade-chat@act-europe.fr.

1.4 Why Ada and Linux?

Ada provides a number of important features for Linux programmers:

1.5 Linux Ada Resources

There are a variety of resouces on the Internet for Linux Ada development.

One important resource is the comp.lang.ada newsgroup, which is frequented by many Ada celebrities, including Robert Dewar of Ada Core Technologies and Tucker Taft, the principle designer of Ada 95. If you have questions about the inner workings of Ada 95, this is the place to go.

Ada Linux Team (ALT) is a group of programmers dedicated to Linux programming specifically using Ada. This site is located at www.gnuada.org/alt.html . They provide the latest versions of software and libraries for Linux, including bug fixes for Gnat, prepackaged and ready for installation.

The GNU Ada site, www.gnuada.org, is a site for all things related to Gnat, not only Linux Gnat development.

The Ada Source Code Treasury at www.adapower.com provides examples of both Linux and Windows Ada applications. Included are examples of sockets, MD5 encryption and packages to work with Windows servers from a Linux computer.It also has a free, unsupported binding to Motif  by Itermetric/Avestar.

If you are looking for general algorithms and source code examples, PAL (the Public Ada Library), is a large source code repository located at www.monmouth.edu/faculty/conn/webproj/ppt2/ . It includes thousdands of source code examples, bindings, compilers and the official Ada 95 documentation.

The Ada Software Engineering Library has over 1 Gig of files. It's available at http://unicoi.kennesaw.edu/ase/index.htm.

The Home for Brave Ada Programmers at www.adahome.com provides a lot of general reference material and bindings.

The Ada Information Clearinghouse (AIC) at www.adaic.com contains statistics, studies and other general information.

http://www.skinner.demon.co.uk/aidan/programming/libra has a tool called Libra (Library of Reusable Ada Code) for many common data structures such as lists, queues, and Internet sockets such as HTTP and POP3.

http://www.ainslie-software.com has a tool called AdaJNI (Java Native Interface) that lets you call java methods from Ada 95.  

  Table of Contents Next Chapter-->