Machine Problem 4, due November 12

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. 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 Assignment:

Rewrite your Sierpinski gasket code to use the object oriented interface to the display screen provided by screen.h. The only conceptually difficult part of this involves making sure that all subroutines have access to the screen when they need it. One way to do this is to pass the screen handle as a parameter to everything. This is clumsy, cluttering up all of your code with extra parameter passing, so it is discouraged.

Another option is to use a global variable, a COMMON block, to hold the screen pointer. This is what you should do. Call your common SCRPTR.

Note that display.h, screen.h and screen.o are all in the Hawk library, so you can use the header files and link to the object file without need to make copies of these files. A demonstration program using them is available.

Submission and Grading:

As usual, submit your source code using Icon. If the code executes perfectly and displays the simple version of the gasket on the screen for several different window sizes, this will be worth half credit. The other half of the score depends on the clarity and cleanliness of your code, including appropriate commentary and readable formatting.