NYU Ada-ed System Reference Card
==============================================================================

File naming conventions:

     All source Ada program files end in ".a" or "_b.a" or "_s.a"

          main.a               <-- a file with one procedure in it
          complex_s.a          <-- package specification
          complex_b.a          <-- package body

Each file can only have ONE program unit.  A program unit is either

     1.  one subprogram  (either a function or a procedure)
     2.  one package     (either a package specification or a body, not both)
     3.  one task        (both a specification and a body)
     4.  one task type specification
     5.  one task body

Put the following line into your .cshrc file:

     setenv ADALIB thislib

This makes it unnecessary to include a cumbersome library parameter on each
statement.

adacomp -- Compiler

     adacomp -n main.a          <-- New library, start all over
     adacomp main.a             <-- Library exists, add modules to it

adabind -- Binder (linker)

     adabind                    <-- if the default is a MAIN procedure
     adabind -m converttemp     <-- give explicit name of main procedure if
                                    different from "MAIN"

adaexec -- Execute a bound program

     adaexec                    <-- if there is only one MAIN procedure in the
                                    library
     adaexec -m converttemp     <-- give explicit name of main procedure if
                                    different from "MAIN"
     adaexec -r 10 -m mainprogr <-- If you want to use round-robin time-slicing
                                    with your tasks

adalib -- Find out what modules are currently in the library

The name of the current library is either explicitly given as the option -l
or in the environment variable ADALIB.  This is set as shown above.
You may have any number of "thislib" directories, each one in a different
source directory.

debugging:  There is only a weak form of execution time tracing available.

     adacomp -a main.a          <-- add the debugging code during compile
     adabind                    <-- bind as usual
     adaexec -ta -m mainprog    <-- -t is the debug trace option, a means show
                                    line numbers, c is calls to subroutines.
     adaexec -tac -m mainprog   <-- You may combine them.

The following is almost always put into a source file:

    +----------------------------------
    | with text_io; use text_io;
    |
    | procedure dosomething is
    | begin
    |      ...
    | end dosomething;
    +----------------------------------
                
To use ints and floats in I/O:

     package io_integer is new integer_io(integer);
     use io_integer;

and/or

        package io_float is new float_io(float);
        use io_float;

These go INSIDE the main procedure, or inside the package.

Declaring a package inside another package or a procedure.  If it is in a file
by itself, then the specification must be put into its own separate file than
the body.

          package xxx is            -- specification
          end xxx;                  -- specification
          package body xxx is       -- body

              globa : integer;          .
                                        .
              procedure main is         .
                  x : integer;
              begin
                  x := 5;
              end main;
          begin
               -- initialization code for package xxx
          end xxx;                  -- body


How to make a task type:

        task type worker;
            ---
        blob : worker;        <-- blob is a new task of type worker
    
        task body worker is
              ...
        end worker;