SINGLE
CHARACTER FUNCTIONS
These functions act on a single character that represents a node in the List.
int
Insert(char ch, int xcord, int ycord)
Inserts
the character, ch, at the location in the linked list specified by the
screen co-ordinates, xcord & ycord, passed as
arguments. Characters to the right of the inserted character will be moved by
one position to the right.
void
Replace(char ch, int xcord, int ycord)
Replaces
the character, ch, at the location in the linked list specified by the
screen co-ordinates, xcord & ycord, passed as
arguments.
NOTE:
The above two functions are invoked depending upon the status of the INSERT key.
void
Remove(int xcord, int ycord)
Deletes
the character at the location in the linked list specified by the screen
co-ordinates, xcord & ycord, passed as arguments.
NOTE:
The above functions, on invocation, update the variable Chars in the
HeadNode of the current List.
SINGLE
LINE FUNCTIONS
These functions act on the group of Nodes constituting a line in the List.
int
InsertLine(int xcord, int ycord)
This
will insert a line at the specified location, xcord & ycord, and
hence a new List in the data structure. It is to be noted that if this function
is invoked with the cursor being at a non-terminal position will place the
characters on the right of the cursor in the newly created List.
void
RemoveLine(int ycord)
This
will delete a complete line and hence a List in the data structure specifed by
the ycord.
void
AppendLine(int ycord)
This
will append the line specified by the ycord, to the line preceding it in
the List.
NOTE:
The above functions, on invocation, update the variable Lines.
These functions perform the specified I/O operations on the file.
int
SaveFile(char *filename)
This function will write the contents of the List on the file specified by the filename. If a file with the filename already exists, then it is overwritten.
int
LoadFile(char *filename)
This function will the load the contents of the file specified by the filename into the List.
void
DeleteList(void)
This
function acts as an explicit destructor for the List. Whenever a new file is to
be opened, the present file contents stored in the List are flushed and Head
is made to point to NULL. Also, Chars & Lines are
updated.
SCREEN
MANIPULATION FUNCTION
This function will update the screen contents.
void
DispLine(int ycord, char *str)
This
function will return the line contents at the specified ycord, in str
to the calling function.
These functions will return values indicating the status of the List.
int
ReturnChars(int ycord)
This
function will return the number of characters present in the line specified by ycord.
int
ReturnLines(void)
This function will return the number of lines present in the List.
int
ReturnWords(int ycord)
This
function will return the number of words in the line specified by ycord.
These
functions are used to perform search operations.
int
FindWord(char *str , int *xcord , int *ycord)
This function searches for a particular string specified by str, and if found, moves the screen cursor to the end of the matched string.
int
FindReplaceWord(char *str , char *repstr, int *xcord, int *ycord)
This
function searches for a particular string specified by str, and if found,
replaces this str with the replace string, repstr.
These functions are used to perform basic editing operations.
void
Cut(List *Temp, int x1, int y1, int x2, int y2)
This
function cuts the List from the co-ordinates (x1, y1) to (x2,
y2) and places it in a temporary list, Temp. The character after (x2,
y2) is appended to the character preceding (x1, y1).
int
Copy(List *Temp, int x1 , int y1,
int x2, int y2)
This
function copies the List from the co-ordinates (x1, y1) to (x2,
y2) and places it in a temporary list, Temp.
int
Paste(List *Temp, int x1 , int y1,
int x2, int y2)
This
function inserts into the List, the characters from the co-ordinates (x1,
y1) to (x2, y2) from the temporary list, Temp.
NOTE:
These functions preserve the format of the file. For e.g. if the copied portion
of the file extends over multiple lines, then during the paste operation the
inserted portion will contain line breaks at the same positions as in the copied
portion.
ZAP works