October 25, 2000
(Note: Any changes to this project description since the release date will be posted in this color (green) and italicized.)
This document was last modified on
The due date of this project will NOT be extended due to brief system downtimes. Plan your time carefully.
history
^d
(EOF
for cin
)
exit
These commands are explained in detail in the "Command Processing" section below.
In addition, the class must contain the "big four" (a default constructor, an assignment operator, a copy constructor, and a destructor). You may include other operations as you see necessary, but the above list MUST be included.
In addition, the class must contain the "big four" (a default constructor, an assignment operator, a copy constructor, and a destructor). You may include other operations as you see necessary, but the above list MUST be included.
isFull()
for your stack will always be
false
.
main()
, class header files, class method implementations, auxilliary functions, and auxilliary function prototypes.
Note that no suggestions for the implementations (i.e., data members) of the Stack clas has been given. Those choices are up to you.
The commands that the program must be able to process are explained below.
history
Displays the contents of the history. Each line in the history is known as an "event". A sample history is:
Runs the command at event number n (absolute access). For example, given the history above, issuing the command !1 should look like:
Runs the command n-1
events before the last (most recent) command issued (relative access). For example,
Runs the last (most recent) command. Shorthand for !-1. For example,
Finds the most recent command that matches the prefix string, displays the command, and runs it. For example,
^d
Terminates the command input process and ends the program.
exit
Also terminates the command input process and ends the program.
All of the commands must be checked for correct syntax. A command is considered syntactically correct if it appears on a line by itself (i.e., has no trailing non-whitespace characters) and matches one of the above commands. Note that it is ok for a command to contain multiple white spaces before the command or after the command. All commands, whether syntactically correct or not, should be entered into the history.
system()
Function
In order to run the history commands after they have been processed and entered into the history, you will need to use the system()
function. You will need to #include the stdlib.h header file in order to use this function. A sample program that uses the system function can be found here. See "man system" for more information on this function.
This is extra credit for your project grade. The course staff WILL NOT help
you with the extra credit portion of your grade in any way. You must come
up with the solution for this on your own. The course staff can answer general programming questions, but once a staff member determines that you're asking about the extra credit question they may decline to answer the question.
Good luck.
Extra Credit (10 points)
The command cd
is not a program but is actually a command that
is built into the shell itself. Your program will not support cd
by default. Add extra cases to your program to handle the cd
command. The sample program currently handles this command and will illustrate
the kind of error handling you should have for things like bad directory names, etc.
on the irix.gl.umbc.edu systems. Please use it to help understand how the program should behave under certain conditions before coming to your instructor. And when in doubt, make it behave like the sample program!
Note: The program is an executable file compiled for irix, so the odds are fairly high that it won't run as is on your home machine.
CC
compiler on the IRIX machines (irix1.gl.umbc.edu
or irix2.gl.umbc.edu
). If your program does not compile or does not generate the correct output, you will not receive full credit for this project.
Many systems come with a utility called "make" which helps simplify project compilation. For this class you are required to use make for each project. The way this is done is by using a "makefile" that tells the make utility what to do when compiling your program.
You may use this sample makefile for this project. You should make sure that you have a makefile named either makefile
or Makefile
and that when you type make
your program compiles to an executable called
proj3
. Failure to follow these simple directions will result in a reduced grade.
Makefile
and all files needed to build your program.
submit
. The project name for this assignment is proj3
. As an example, to submit your files, you would type:
submit
and related commands
can be found here. You should replace all of the file.x
's above with your real file names.