Ada Programming
Total Page:16
File Type:pdf, Size:1020Kb
Ada Programming Ada Programming by Wikibooks contributors Augusta Ada King, Countess of Lovelace. 1 Ada Programming Table of Contents Ada Programming...................................................................................................1 1 Preface...............................................................................................................15 1.1 About Ada...................................................................................................16 1.1.1 Programming in the large....................................................................16 1.1.2 Programming in the small....................................................................17 1.1.3 The Language Reference Manual.........................................................17 1.1.4 Ada Conformity Assessment Test Suite................................................18 1.2 Programming in Ada...................................................................................18 1.2.1 Getting Started....................................................................................18 1.2.2 Language Features...............................................................................18 1.2.3 Computer Programming.......................................................................19 1.2.4 Language Summary.............................................................................19 1.2.5 Predefined Language Libraries.............................................................19 1.2.6 Other Language Libraries....................................................................20 1.3 External resources......................................................................................20 1.4 Collections..................................................................................................20 1.4.1 Printable Versions................................................................................20 1.4.2 Source Code.........................................................................................21 1.5 References..................................................................................................21 1.6 See also......................................................................................................21 1.6.1 Resources.............................................................................................21 1.6.2 Manuals and guides.............................................................................21 1.6.3 Associations.........................................................................................21 1.6.4 Free online books/course.....................................................................21 1.7 Authors and contributors............................................................................22 2 Basic..................................................................................................................22 2.1 "Hello, world!" programs.............................................................................22 2.1.1 "Hello, world!"......................................................................................22 2.1.2 "Hello, world!" with renames...............................................................23 2.1.3 "Hello, world!" with use........................................................................24 2.1.4 FAQ: Why is "Hello, world!" so big?......................................................24 2.2 Things to look out for..................................................................................25 2.2.1 Comb Format.......................................................................................25 2.3 Notes...........................................................................................................26 2.3.1 Type and subtype.................................................................................27 2.3.2 Constrained types and unconstrained types.......................................27 2.3.3 Dynamic types.....................................................................................27 2.3.4 Separation of interface........................................................................27 3 Installing............................................................................................................28 3.1 AdaMagic from SofCheck............................................................................28 3.2 AdaMulti from Green Hills Software............................................................28 3.3 DEC Ada from HP........................................................................................28 3.4 GNAT, the GNU Ada Compiler from AdaCore and the Free Software 2 Ada Programming Foundation........................................................................................................28 3.4.1 GNAT GPL Edition.................................................................................29 3.4.2 GNAT Modified GPL releases................................................................29 3.4.2.1 GNAT 3.15p...................................................................................30 3.4.2.2 GNAT Pro.......................................................................................30 3.4.2.3 GCC...............................................................................................31 3.4.3 The GNU Ada Project............................................................................31 3.4.4 GNAT for AVR microcontrollers.............................................................32 3.4.5 Prebuilt packages as part of larger distributions.................................32 3.4.5.1 AIDE (for Microsoft Windows)........................................................32 3.4.5.2 Blastwave (for Solaris on SPARC and x86)....................................33 3.4.5.3 Cygwin (for Microsoft Windows)....................................................33 3.4.5.4 Debian (GNU/Linux and GNU/kFreeBSD).......................................33 3.4.5.5 DJGPP (for MS-DOS).......................................................................34 3.4.5.6 FreeBSD.........................................................................................35 3.4.5.7 Gentoo GNU/Linux.........................................................................35 3.4.5.8 GNAT for Macintosh (for Mac OS 9 and X).....................................35 3.4.5.9 Mandriva Linux..............................................................................35 3.4.5.10 MinGW (for Microsoft Windows)..................................................36 3.4.5.11 SuSE Linux..................................................................................36 3.5 ICC from Irvine Compiler Corporation.........................................................37 3.6 Janus/Ada 83 and 95 from RR Software......................................................37 3.7 ObjectAda from Aonix.................................................................................37 3.8 Power Ada from OC Systems......................................................................37 3.9 Rational Apex from IBM Rational.................................................................38 3.10 SCORE from DDC-I....................................................................................38 3.11 XD Ada from SWEP-EDS............................................................................38 4 Building..............................................................................................................38 4.1 Building with various compilers..................................................................38 4.1.1 GNAT....................................................................................................38 4.1.1.1 GNAT command line......................................................................39 4.1.1.2 GNAT IDE.......................................................................................39 4.1.1.3 GNAT with Xcode...........................................................................39 4.1.2 Rational APEX.......................................................................................40 4.1.3 ObjectAda.............................................................................................41 4.1.4 DEC Ada for VMS..................................................................................41 4.1.4.1 DEC Ada IDE..................................................................................42 4.1.5 To be completed...................................................................................42 4.2 Compiling our Demo Source.......................................................................42 4.2.1 GNAT....................................................................................................43 4.2.2 Rational APEX.......................................................................................44 4.2.3 ObjectAda.............................................................................................44 4.2.3.1 ObjectAda commandline...............................................................44 4.3 See also......................................................................................................45 4.3.1 Wikibook...............................................................................................45 5 Control...............................................................................................................45 3 Ada Programming 5.1 Conditionals................................................................................................45