Writing code without having some way to easily organize sets of variables or data would be a real bother. Even if in the end you could totally do all of the shuffling of bits and allocating in memory by yourself, it’s much easier when the programming language abstracts all of that housekeeping away. In Ada you generally use a few standard types, ranging from records (equivalent to structs in C) to a series of containers like vectors and maps. As with any language, there are some subtle details about how all of these work, which is where the usage of these types in the Sarge project will act as an illustrative example.
In this project’s Ada code, a record is used for information about command line arguments (flag names, values, etc.) with these argument records stored in a vector. In addition, a map is created that links the names of these arguments, using a string as the key, to the index of the corresponding record in the vector. Finally, a second vector is used to store any text fragments that follow the list of arguments provided on the command line. This then provides a number of ways to access the record information, either sequentially in the arguments vector, or by argument (flag) name via the map.
Continue reading “Programming Ada: Records And Containers For Organized Code”




It stood at the back of the container, with a row of four telephones in front of it. We particularly liked the angular “Trimphone”, the height of 1960s and 70s chic. You could dial the other phones in the network with a two digit number, and watch the exchange clicking in the background as you did so. Some of the sounds weren’t quite the same as the full-sized equivalents, with the various tones being replaced by vibrating reeds.

