NOTE: This assignment, like the other projects in this class, is due at a particular time, listed above. This means that if you are even a minute late, you lose 20%. If you are worried about potentially being late, turn in your project ahead of time. Do this by submitting it electronically before it is due and giving the hard copy to me during office hours or by sliding it under my office door before it is due. Do not send assignments to my personal email address. Do not leave hard copies in my departmental mail box or attempt to give them to departmental staff (who cannot and will not accept them).
In your previous assignment, you took the first step toward the development
of a graphical PDF browser by linking together a PDF to image conversion tool
with a web browser. However, gbPDF Version 1.0
lacked some
functionality we might want in a graphical PDF browser, such as browsing
through zipped files of PDFs.
In this assignment, you will take the second step toward the development of a graphical PDF browser. This is only the second step, since you have not yet learned in this class about mechanisms for passing the input and output of processes to one another (although you will!), and you are not assigned the job of creating a nice GUI front end for your PDF browser. Still, it will let you gain experience with the basic mechanisms for dealing with files, directories, and permissions.
You are to create a program called gbPDF2
that behaves as follows:
gbPDF2
by handing it one or more files
with the extension .pdf or .PDF, it will behave almost exactly as described
for the original gbPDF
described in Project 2. The one
exception to this is that gbPDF2
will not exit as soon the web
browser is launched. Instead, gbPDF
will wait for the web
browser to exit, then gbPDF
will delete all .png files it
created, then gbPDF2
itself will exit. If there are any
problems deleting the .png files, gbPDF2
should notify the user
of that fact and exit with exit code 4. Otherwise, gbPDF2
should exit with exit code 0.gbPDF2
by handing it one or more
directory names, gbPDF2
will recursively read through each named
directory and its subdirectories searching for files that have the .pdf or
.PDF extension. If there are any problems reading through a directory or its
subdirectories, gbPDF2
should notify the user of that fact and
exit with exit code 5. Otherwise, gbPDF2
should treat these
files as it would PDF files given on the command line. (That is, create
two sets of .png files, full sized and thumbnails, …).gbPDF2
by handing it one or more
filenames with the extension .zip, .tar, or .tgz, gbPDF2
will
behave as described below.
For each "package file" given (with the extension .zip, .tar, or .tgz)
gbPDF2
will do the following:
gbPDF2
should notify the
user of that fact and exit with exit code 6. Otherwise, gbPDF should
proceed to Step 2.gbPDF2
should notify the user of that fact and exit with exit
code 7. Otherwise, gbPDF should proceed to Step 3.gbPDF2
should notify the user of that
fact and exit with exit code 5. Otherwise gbPDF2
should treat
these files as it would PDF files given on the command line. (That is,
create two sets of .png files, full sized and thumbnails, …).gbPDF2
has deleted all .png files it created (see
Step I, above), gbPDF2
will delete all files and directories
it created by unpacking files. If there are any problems deleting these
files and directories, gbPDF2
should notify the user of that
fact and exit with exit code 8. Otherwise, gbPDF2
should exit
with exit code 0.gbPDF2
with filenames with any other
extension or none at all and/or with any other command line argument(s),
gbPDF2
should print a usage message to the terminal and exit
with exit code -1. Note that the rules on extensions mentioned here apply
only to file names, not to directory names.You will turn in both a hard copy and an electronic copy of your assignment. Electronic copies must be submitted to the appropriate drop box in D2L for the course. Do not send them to my email address.
Both the hard copy and the electronic copy will contain a cover sheet
documenting group membership and contributions (see below), all source code
you created for gbPDF2
, and a write-up of 1/2 to 1 page (roughly
80 characters per line, 50 lines per page) explaining the data structures and
algorithms used in your code. This page limitation does not include figures
used in your explanations, which are encouraged and may take up any amount of
space. (The explanations do not remove the requirement that your code be well
commented.)
The electronic copy will also contain an executable for
gbPDF2
which should be called gbPDF2
.
Your source code should be well structured and well commented. It should conform to good coding standards (e.g., no memory leaks).
You may write your program from scratch or may start from programs for which the source code is freely available on the web or through other sources (such as friends or student organizations). If you do not start from scratch, you must give a complete and accurate accounting of where all of your code came from and indicate which parts are original or changed, and which you got from which other source. Failure to give credit where credit is due is academic fraud and will be dealt with accordingly.
As noted in the syllabus, you are required to work on this programming assignment in a group of at least two people. It is your responsibility to find other group members and work with them. The group should turn in only one (1) hard copy and one (1) electronic copy of the assignment. Both the electronic and hard copies should contain the names and student ID numbers of all group members. If your group composition changes during the course of working on this assignment (for example, a group of five splits into a group of two and a separate group of three), this must be clearly indicated on your cover sheet (see below), including the names and student ID numbers of everyone involved and details of when the change occurred and who accomplished what before and after the change.
Each group member is required to contribute equally to each project, as far as is possible. Your cover sheet must thoroughly document which group members were involved in each part of the project. For example, if you have three functions in your program and one function was written by group member one, the second was written by group member two, and the third was written jointly and equally by group members three and four, your cover sheet must clearly indicate this division of labor.
Note that all personally identifying information (names, student ID numbers, 4x4s, etc.) must only be included on the cover sheet and nowhere else in the project materials.
For determining which files and directories were created by gbPDF2
, you may use time stamps and assume that files or directories created after gbPDF2
was invoked and in subdirectories of the directories on which gbPDF2
was invoked were created by gbPDF2
. Note that this is not a good assumption to make in general and is only allowed in this project because you have not yet learned sufficient IPC to do this in a better way.