The George Washington University
School of Engineering and Applied Science
Department of Electrical Engineering and Computer Science
CSci 51 -- Spring 2000 -- Project #6
Due Date: start of class, Thursday, April 20, 2000

This project depends on material thru Chapter 9, and will give you a taste of how fontsare handled in today's computers. It is due on Thursday because of possible disturbances in Washington next weekend.

Project Description:

The file programs51/bigdigits.dat contains a simple font: a set of digits 0..9, each made up of X characters arranged in 12 rows of 9 positions each (the first row is blank in each case). For example, the digit 8 is represented as
  XXXXX
 XXXXXXX
XX     XX
XX     XX
 XXXXXXX  
 XXXXXXX  
XX     XX
XX     XX
XX     XX
 XXXXXXX
  XXXXX
Your task in this project is to develop a package that provides an operation to display one of these large digits at an arbitrary position on the screen. Here is the spec for this package (you can add the banner comment):
WITH Screen;
PACKAGE Big_Digits IS
  
  SUBTYPE ADigit IS Natural RANGE 0..9;

  BadPosition: EXCEPTION;

  PROCEDURE DisplayDigit (Item:   IN ADigit; 
                          Row:    IN Screen.Depth; 
                          Column: IN Screen.Width);
  -- Pre:  Digit, Row, and Column, are all defined
  -- Post: displays the given digit at the given position;
  --       raises BadPosition if the digit would go over the
  --       boundaries of the screen

END Big_Digits;
For example, a call

Big_Digits.DisplayDigit(Item => 8, Row => 10, Column => 25);

displays a large 8 whose upper-left corner (that is, the leftmost end of the blank row) is at row 10, column 25.

Discussion:

Inside the package body, you'll declare some types and objects to represent the digits:
DigitColumns: CONSTANT Positive := 9;
DigitRows   : CONSTANT Positive := 12;
SUBTYPE DigitRow IS String (1..DigitColumns); -- one row of the digit
TYPE BigDigit IS ARRAY (1..DigitRows) OF DigitRow; -- 12 rows
TYPE DigitFont IS ARRAY(0..9) OF BigDigit;
AllTheDigits: DigitFont;
DigitFile: Ada.Text_IO.File_Type;
The package body will also contain the body of DisplayDigit, and also an initialization part that will read the data file to initialize AllTheDigits, row by row for each digit. Note that you can read a row with an ordinary Ada.Text_IO.Get.

The procedure DisplayDigit just displays the digit row by row.

To implement your test plan for this project, you'll have to write your own test program that tests the behavior of the package and procedure.

The package spec (big_digits.ads) and data file (bigdigits.dat) for this project are online in the programs51 directory. Also online is a skeleton of the package body (big_digits.adb). Your tasks are to complete the package body and develop a test program.