Monash University > CSSE > CSE1303 > Part A> Pracs > Prac A4

CSE1303 Computer Science
Semester 2, 2003
Part A
Prac A4 : Linked Lists

This prac covers material from lectures A07, A09 and Tutorial A4.

Project

To write a simple version of ed, a line-oriented text editor.

Background

The editor ed was one of the first editors written for UNIX. In this prac we will use a Linked List to implement our simple version of ed. ed is very similar to, and in fact is the predecessor of vi and vim.

To find out more about ed, either read the man page (by typing: man ed at a linux prompt), or the book "Software Tools", by Brian Kernighan and P.J. Plauger. The manpage is also available on the web: http://olympus.het.brown.edu/cgi-bin/man2html?ed+1.

The courseware notes for the subject CSE1402 also discuss vi/vim in some depth, these are available at: http://www.csse.monash.edu.au/courseware/cse1402/.

To implement a simple text editor, the idea is as follows;

Suppose a file contains the following lines:

Then the addresses of copies of these lines would be stored in a Linked List, so that:

Knowing the starting address of each line allows you to manipulate the individual strings/lines (delete words/add words/substitute words). It also allows you to change the order of whole lines easily by manipulating the linked list. You can search for words or lines, you can duplicate lines, etc, which are all things that a text editor needs to be able to do.


Preparation (3 marks if completed before class)

The marks for Preparation will be awarded only if the preparation is complete before the start of the class.


Question 1: (3 marks)


Question 2: (2 marks)


Question 3: (2 marks)


Advanced Questions: (2 marks)


[ Top | Home ]

Last modified: Thursday 26 June 2003 14:42:12