		   Vedit - Consistency Assertions

Whenever a command is not in process, the following assertions should always
hold:

1. The buffer is a doubly linked list of chunks:
   a. if chunk p->next==q then q->prev==p.
   b. first chunk->prev==0 and last chunk->next==0.

2. headmark is at the beginning:
   1. headmark.chunk->prev==0.
   2. headmark.cp == headmark.chunk->text.

3. endmark is at the end:
   1. endmark.chunk->next==0.
   2. endmark.cp == endmark.chunk->text + endmark.chunk->length.

4. length in range:
   1. for any chunk, chunk->length <= CHUNKSIZE.
   2. if chunk->length==0 then chunk->next==0.  -- the only place you can
      have an empty chunk is at the end.

5. mark consistency: for any mark m on the Marklist,
   1. m.chunk->text <= m.cp <= m.chunk->text + m.chunk->length
   2. if m.cp == m.chunk->text + m.chunk->length then m.chunk is the last
	chunk in the buffer.  (Otherwise this mark should be at the
	beginning of the following chunk.)
   3. m.chunk is reachable from headmark.chunk by a chain of zero or more
	chunk->next pointers.

6. linerecords attachment:
   1. linerecords form a doubly linked list, in the sense of #1 above.
   2. for every chunk in the buffer, chunk->line points to a linerecord
	in the linerecord list, and is never 0.
   3. for any chunk, chunk->next->line == chunk->line, or comes after it
	in the linerecord list.
   4. headmark.chunk->line is the first linerecord. (->prev == 0)
   5. headmark.chunk->line->chunk == headmark.chunk.

7. linerecord meaning:
   1. The first linerecord->cp == headmark.cp, and every other linerec->cp
   	points to the character following a \n, and for every \n there
	is a linerecord->cp pointing to the character after it.  This
	is also true for a \n which is the last character in the buffer -
	then the last linerecord->cp == endmark.cp.
   2. if line->cp == line->chunk->text then line->chunk->line == line.
   3. In any chunk where (7.2) does not hold,
	chunk->line->chunk == chunk->prev, and 
	chunk->line->next->chunk == chunk.

