JMU
Programming Assignment 4


1 Summary

zmedia has decided that, while they like the zplayer you wrote for PA3, it needs some additional functionality. Specifically, they want the user to be able to get information about the current bookz and they want the system to have two "windows".

2 Documents

zmedia has provided you with the following use case descriptions and statemachine diagram for the new version of zplayer.

They have also provided you with the following.

3 A Collection of infoz

zmedia has provided you with a group of .infoz files that correspond to the "adventure" bookz they provided earlier.

You must uncompress it (using gzip) and extract the individual files (using tar) before using it, but you must not change any of the individual file names or the contents of the files.

4 Additional Specifications/Constraints

In addition to conforming to the documents provided by zmedia (and all related course policies), your code must satisfy the following additional specifications/constraints.
  1. A user must be able to read a bookz, without any interaction, using the bookz_player program exactly as they did for PA1.
  2. The zplayer (i.e., the interactive program) must use the bookz_player program (NOT just the bookz_lib library).
  3. After the bookz has been read and the user presses b, both the zplayer process and the bookz_player process must have been terminated.
  4. The .infoz file associated with the current .bookz file must be read at most once (per session).
  5. Your parent process(es) must not create any orphan processes.

5 Submission

The .zip file you submit must be named pa4.zip.

In addition to the source code and makefile, the .zip file must contain four screenshots of the output from ps. Specifically, it must contain: one (named before.png) that shows the current processes before you run zplayer, one (named ready.png) that shows the current processes when zplayer is in the Ready state, one (named playing.png) that shows the current processes when zplayer is in the Playing state, and one (named after.png) that shows the current processes after zplayer has terminated.

You must not submit any data files.

6 Help and Hints

You may find the following hints helpful.

6.1 Processes

The system needs to be able to display the content (in the MT) "at the same time" as it displays information about the content (in the IT). To accomplish this you must use two processes.

Since you must use the bookz_player program and not the bookz_lib, the zplayer must exec the bookz_player.

6.2 Terminals

When you execute zplayer, you must have two active terminals. The first (i.e., terminal 0) will be the IT and the other (i.e., terminal 1) will be the MT.

Note that you will not be able to do this easily on stu (since stu does not support windowing you must login twice to have two terminals active at the same time). Hence, you will want to work on your computer or a lab computer.

6.3 Events and Characters

The UML statemachine diagram uses generic event names rather than the specific char values that you are using. As you know from the previous assignment, there is a correspondence between the two. You were told which char values to use in some cases and were allowed to choose the char values in other cases. For this assignment, there is only one new correspondence -- the get_info event corresponds to the char literal '?'.

Your code should treat the user-generated events (like the old load and go, and the new get_info) similarly. If it isn't then you are probably doing something wrong. In particular, you should not need to prompt for any of these events/key-presses in the individual states, that should all be handled in the zplayer.

6.4 Taking Screenshots

On most Linux systems, you can take a screenshot of the active window by pressing Alt+PrtScr.

6.5 Testing

During system testing, remember to include all of the following tests.
  1. All 11 possible transitions.
  2. Situations in which there is no .infoz file corresponding to the .bookz file. (There are several variants of this -- while in the Ready state for the first time, while in the Ready state for the n th time, and while in the Playing state.)

When testing, it will probably be convenient to create files that contain the characters you would normally enter using the keyboard and then redirect standard input (so that you don't have to keep typing the same think over and over).

Copyright 2017