Machine Problem 5, due December 3

Part of the homework for 22C:60, Fall 2005
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Background:

An object oriented output interface is available on-line, as defined in the files distributed with Machine Problem 4. This interface includes a generic display screen class (interface description in display.h) as well as one concrete subclass of this that offers the services of the standard display screen (interface description in screen.h). The implementation for the latter is also available (see screen.a)

The interface to a new subclass of the generic display screen class is defined in window.h distributed with this assignment. Objects of this new class, once initialized, are display screens that appear within another display screen. Given a screen S, the operation wininit(S',S,x,y,w,h) initializes the window S' to be a region of the window S with its upper left corner at coordinates x and y in S, with width and height w and h. Full interface specifications for this initializer appear in window.h.

The Assignment:

Write and test an implementation of the new window class. Your solution should suppress the display of any characters outside the window. This means that it will have to track the coordinates of each character plotted and simply not plot any characters that would be outside the window bounds. If the window bounds are greater than the dimensions of the parent screen, the parent screen may also do the display clipping.

Your solution should be in window.a. You should test your solution thoroughly. In your testing, you should verify that windows can be defined inside the pre-defined display, that windows can be defined inside other windows, and that clipping operates correctly in each context, including the case where the innermost window clips some of the display content and the outer window clips other parts of the dispplay content. There is no requirement to use any particular test code, although your Sierpinski gasket main program from MP4 is one obvious way to generate test data.

Submission and Grading:

Turn in the file window.a. We will test it, so it must conform sufficiently to the interface specification that we can assemble it and link it to our main program. Your test program is not part of this assignment. It will be part of the homework!