⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 source.doc

📁 STEVIE文本文件编缉器的C 语言源程序
💻 DOC
字号:

		 Release Notes for STEVIE - Version 3.69

			      Source Notes

			      Tony Andrews

			 	  8/6/89


Overview
--------

	This file provides a brief description of the source code for
Stevie. The data structures are described later as well. For information
specific to porting the editor, see the file 'porting.doc'. This document
is more relevant to people who want to hack on the editor apart from doing
a simple port.

	Most of this document was written some time ago so a lot of the
discussion centers on problems related to the Atari ST environment and
compilers. Most of this can be ignored for other systems.


Cruft
-----

	Older versions of the editor used Henry Spencer's regular
expression library directly. The current version incorporates a modified
version of that same library.


Data Structures
---------------

	A brief discussion of the evolution of the data structures will
do much to clarify the code, and explain some of the strangeness you may
see.

	In the original version, the file was maintained in memory as a
simple contiguous buffer. References to positions in the file were simply
character pointers. Due to the obvious performance problems inherent in
this approach, I made the following changes.

	The file is now represented by a doubly linked list of 'line'
structures defined as follows:

struct	line {
	struct	line	*prev, *next;	/* previous and next lines */
	char	*s;			/* text for this line */
	int	size;			/* actual size of space at 's' */
	unsigned long	num;		/* line "number" */
};

The members of the line structure are:

prev	- pointer to the structure for the prior line, or NULL for the
	  first line of the file

next	- like 'prev' but points to the next line

s	- points to the contents of the line (null terminated)

size	- contains the size of the chunk of space pointed to by s. This
	  is used so we know when we can add text to a line without getting
	  more space. When we DO need more space, we always get a little
	  extra so we don't make so many calls to malloc.

num	- This is a pseudo line number that makes it easy to compare
	  positions within the file. Otherwise, we'd have to traverse
	  all the links to tell which line came first.


	Since character pointers served to mark file positions in the
original, a similar data object was needed for the new data structures.
This purpose is served by the 'lptr' structure which is defined as:

struct	lptr {
	struct	line	*linep;		/* line we're referencing */
	int	index;			/* position within that line */
};

The member 'linep' points to the 'line' structure for the line containing
the location of interest. The integer 'index' is the offset into the line
data (member 's') of the character to be referenced.

The following typedef's are more commonly used:

typedef	struct line	LINE;
typedef	struct lptr	LPTR;

Many operations that were trivial with character pointers had to be
implemented by functions to manipulate LPTR's. Most of these are in the
file 'ptrfunc.c'. There you'll find functions to increment, decrement,
and compare LPTR's.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -