7, September

 

If you want to compile your Ada program from  the command line:

compile: gcc -c –g Example1.adb

                                                *.adb, Ada body

link and bind: gnatmake -g Example1.adb

            performs:   gnatbind -x exampl1.ali

                                                *.ali, implementation

                                gnatlink -x example1.ali -g

 

To run a file while at the command line, type the name of the file.

 

- Regarding usefulStuff.ads  which is an Ada  specification

·        three enumerated type defintions

o       mySuit, myRank, Player

·        one record definition (allows bundling of heterogeneous types)

o       card

·        one array of cards

o       deck

 

  • three instantiations to allow direct reading and writing of enumerated types
    • one is needed for each type so have:  suit_io, rank_io, player_io

 

  • illustration of requirements for instantiation for enumerated type :
    • PACKAGE  idntifier IS NEW ada.text_io.enumeration_io .(newTypename)

 

  • generic package, ada.text_io.enumeration_io
    • contains code that needs a parameter to be used
    • myRank, mySuit, Player are the user-defined enuerated types which are parameters in the instantiations in this example

 

 

WRITING CODE

-         when writing code, use existing code as a model

 

-         when compile errors occur you will get a pointer to a section an paragraph in the  Language Reference Manual which should help you find your error – make use of it

 

- compile frequently (almost after every new line of code)

 

- use code examples on the webpage (https;//users.cs.jmu.edu/adamses/), and copy relevant models as reference

 

- formal parameters in Ada subprograms must be named types

- use fully qualified references to the related packages and programs