  			Introduction

	This is the final report for my Software Engineering project.  My
project involved making several improvements and enhancements to xspread,
a public domain X Windows based spreadsheet program.  I worked on this
project alone.
	Because xspread has existed since 1982 and is a very powerful
program with such a large number of commands, this report will only
discuss those aspects of xspread that pertain to the changes I have made
to it.  The information given by the man command is of a general enough
nature that no revisions need to be done to it, so I have done nothing to
the man information.  A complete documentation on this version of xspread
is found in spring94/doc/xspread.tex.  It has been reedited to reflect
all changes I have made to xspread, although my name does not appear in
it since my changes are not that substantial.
	The following is a reminder of my initial contract, followed by
instructions on how to test all of the changes I have made, with a final
section briefly describing how I implemented the changes.


			INITIAL CONTRACT

My original contract specified 8 tasks to complete.  That includes:
	1.  Ability to remember the whole pathname after starting
	2.  Ability to save graph definitions upon terminating a session
	3.  Improve user friendliness of graph error function
	4.  Improve user interface of graphic option selection
	5.  Correct text appearance after inserting ' " ' into a cell
	6.  Correct cursor movement when editing a cell
	7.  Coordination between docs and toggle key functions
	8.  Select ranges with the mouse.
During my progress report presentation, Dr. Davida asked that I also show
the default directory as well as the default path whenever
reading/printing a file and to allow the user to create a sample graph
with a sample data set that will not affect the previous graph
definitions.  


		How to Reproduce the Modifications

	This section describes how to observe the modifications I have made
to xspread exactly as was shown in the demonstration.  To start my
version of xspread, type /usr/proj/se/xspread/spring94/xspread.
	First is a demonstration of xspread's new ability to remember the
whole pathname for all file commands as well as it's display of the
default path name (and file name when appropriate).  Type /fd to call up
the directory command.  Notice how the default directory (the user's home
directory if not set previously) appears on the input line automatically,
so the user always knows what it is.  Change it to
/usr/proj/se/xspread/spring94 and press <enter>.  Now type /f followed by
g, p, w, t, m, or c to see that the whole pathname has been remembered
for all file commands (not just Merge and Combine).  Press <esc><esc>
after verifying this.
	Now type /fg to enter the Get command.  After 
"/usr/proj/se/xspread/spring94/  type ex1 followed by <enter> to get an
example file.  For extra robustness, if the user deleted the whole
pathname and only entered the local path name, the search for this file
would begin from the present working directory.  Also, if you change the
pathname on the input line, let's say by entering  /usr/st/ms/dc/ex1
(this file exists, try it) during the Get command, successive calls to
the Get, Put, Write and Table commands will use the new pathname as
default, although the Merge, Combine and Directory commands continue to
use the directory as set by the Directory command.  In a sense, this
makes the Directory command almost unnecessary, a feature sure to be
enjoyed by the user.
	After getting ex1, you may now verify the new ability to save graph
definitions.  Type /gv to view the saved graph.  Click on the upper left
hand corner when done viewing the graph.  Had ex1 not have had any graph
definitions in it, it could still have been retrieved.
	Next is a demonstration of the sample graph capabilities.  If still
in the graph menu, type s for Sample.  This produces a menu similar to
the previous, except now it is apparent from the help menu below that
these graph options are for creating a sample graph.  Here is a simple
sample graph recipe:
	t   b
	x  a  <enter>  6  <enter>  10  <enter>
	a  b  <enter>  6  <enter>  10  <enter>
	v
After viewing this sample graph, return to the main menu and view the
previous graph to verify it's continued existence:
	<esc>  g  v
	Next is a demonstration of improved user friendliness of the graph
error commands.  Return to the File menu and get ex2 from the spring94
directory.  Type /gtb to set the graph type to bar.  Now purposely make
the x range too small:
	x  a  <enter>  1  <enter>  1  <enter>
Trying to view this graph (v) brings up this error message:  "Not enough
valid x values" which is true.  So increase the x range:
	x  a  <enter>  1  <enter>  11  <enter>
Now trying to view this graph brings up a different error message:  "x
values must be strings".  Before it would continue to say there weren't
enough valid x values, a very poor error message.  This change concerns
graphs of type line, bar, stack bar and pie.
	Now for a demonstration of the improved user interface for the
graph/option/format menu.  Type <esc> until the menu bar is cleared, then
/gof.  At this point, you will see the menu
	Graph   A   B   C   D   E   F
Entering any one of these submenus allows changing the line format for
the entire graph or just a specified range, as is always explained by the
help menu underneath the currently highlighted command.  Previously,
after entering any one of these 7 submenus, the user would be confronted
with identical menus and identical help menus, all indicating format
changing options for the entire graph.  This could be very confusing to a
new user.  I have made all submenus to now clearly indicate the exact
range which will be affected by the format change.  You may enter any of
these submenus to investigate this.
	If you change the format on a range 2 or more times in a row, you
may notice that you have to press <esc> 3 times instead of 1 to exit the
options/format menu.  This is an inherited defect in xspread.  Because it
is so trivial and would require so much extra code to eliminate, I
suggest leaving it as is.
	As mentioned in the fall92/TODO file, junk characters appear in the
highlighted cell when entering text after a ".  After pressing <enter>,
the correct characters would  get inserted into the cell as typed, but in
the mean time the user may be annoyed.  To show that this is no longer a
problem, move the cursor to a blank cell (use the arrow key).  Press
<esc> until the menu line is blank.  Now type " followed by a string of
text.  While doing this, notice that the highlighted cell remains blank. 
Press <enter> and the correct text will appear in the cell.  To change
the contents of a cell, repeat the above procedure, this time typing in a
different string.  Again notice that the contents of the cell remain
frozen until the return key is pressed.
	While you were typing text, you should have also observed that the
cursor was always 1 step ahead of the last character typed.  Even when
backspacing, the cursor will always be exactly 1 space ahead of the last
character.  In earlier versions of xspread, the cursor would sometimes
remain stationary, although the characters would still appear in their
correct position and the correct text would still get entered into the
cell.  Hence this is a cosmetic improvement.
	It was in my contract to improve the coordination between the way
the toggle functions work and their documentation.  The actual problem
was that the cell highlighting toggle did not work correctly.  Instead of
disabling cell highlighting, it would cause the cell to leave an
inconsistent trail across the screen, a certainly undesirable effect. 
Because cell highlighting is such a seldom used feature anyways (and I
was short of time) I removed this as an option.  To prove this, type
<cntrl>tc and you will get an "invalid command" response.


			Programming Methods

	In this section I will briefly describe how I accomplished my
modifications.  I would first like to point out the great amount of time
and effort I put into this project.  There are over 20,000 lines of C
code, and I have read most of it.  I have also added many comments to
certain sections (some files were well documented, others were not), and
not 1 global variable was added to the already abundant list of global
variables.  The last command (or see spring94/last_xspread) will show
that I have been logged on to the xspread account for 368 hours since
March 15.
	Ability to remember the whole pathname was achieved through the use
of using preexisting global variables and creating some functions that
would figure 
out what the whole pathname should be (see get_default_dir and
get_default_path, cmds.c).  Once this was figured out, the result would
be printed on the input line for the user to see and modify.  Although
this sounds trivial, it took a tremendous amount of time due to xspread's
insistence on it's unique mallocing methods for global variables and the
need for all text on the input line to appear in a certain format in
order to be successfully parsed by the yacc generated gram.y and gram.c
files.
	The ability to save graph definitions was done by making a call to
a function (graphic_write_defn, graphic_main.c) during the print routine
which prints all graph definitions to a file.  A check is made to see if
all definitions are of default value, eliminating the need to save them. 
They are saved in such a way that a person reading the saved file will
understand and can modify them manually.  If any graph definitions have
been saved, their presence will be detected when reading in a file by the
capital G (Graph Definitions: ) which appears at the beginning of a line. 
A call is then made to a function (graphic_read_defn) which reads them
in.
	To create the Sample graph command, I store all graph variables
into temporary variables, allow the user to do what they want to them,
and upon exiting transfer the original values back to their original
graph variables.
	Improving the user friendliness of the graph error functions
involved changes to the various plot_xxx.c files.  A check would be made
on the number of valid x values.  If there weren't enough valid x values,
but the range indicated there should be, then another check is made on
the nature of those x values, printing out an appropriate error message
after determining the problem.  If some of the x values are not valid but
others are, the graph can still be viewed.
	To improve the user interface of the graphic/options/format
submenus, I had to create an entire new function with all of the specific
help menus defined 
statically.  I believe the original creator of this submenu purposely
left out a more individualistic series of help menus because of the
number of lines required to do this (130).  But the more user friendly
result is definitely worth the extra code.
	To keep junk characters from appearing in the cell during text
insertion, the cell is frozen while in edit mode.  Typing a " sets the
mode to edit, and an if statement keeps the cell from changing then.
	The cell highlighting toggle was commented out from a switch
statement.  I spent a couple days trying to correct it, but was running
short on time.  I have mentioned it in the TODO file as a future
improvement, although I don't think anyone ever uses this command.
	The ability to select ranges with a mouse is a feature that I was
unable to actualize.  The problem is not so much the mouse commands.  I
was able to actually put different ranges on the input line with the
mouse.  The problem is that all input must be parsed by the yacc files
gram.y and gram.c, so after pressing <enter> the program would crash.  I
did not have enough time to learn yacc adequately to handle the
complexities of achieving this modification.
	In addition to the above improvements, I also made some changes
which I believe will make the program more portable.  According to Dr.
Leonard Sitongia from the High Altitude Observatory, xspread does not
compile on Solaris 2.3.  From the transcript of the compiling error
messages which he sent me, I was able to make some changes in the
matrix.c file that should solve the problem.  This involves an oddity in
the way Solaris 2.3 treats spaces in function prototypes and definition
declarations.
	There are several files that should be deleted after inspecting my
work, assuming that my version of xspread will be considered superior to
the previous version.  These are ex1and ex2 in the spring94 directory and
final_rpt, prog_rpt, and last_xspread found in the spring/doc directory. 
They were left to make grading my work easier, but will be of no concern
to the general user.

