Next: Modules for the Basic Displayable Lisp Objects, Previous: Basic Lisp Modules, Up: A Summary of the Various SXEmacs Modules [Contents][Index]
buffer.c buffer.h bufslots.h
buffer.c implements the buffer Lisp object type. This includes functions that create and destroy buffers; retrieve buffers by name or by other properties; manipulate lists of buffers (remember that buffers are permanent objects and stored in various ordered lists); retrieve or change buffer properties; etc. It also contains the definitions of all the built-in buffer-local variables (which can be viewed as buffer properties). It does not contain code to manipulate buffer-local variables (that’s in symbols.c, described above); or code to manipulate the text in a buffer.
buffer.h defines the structures associated with a buffer and the various
macros for retrieving text from a buffer and special buffer positions
(e.g. point
, the default location for text insertion). It also
contains macros for working with buffer positions and converting between
their representations as character offsets and as byte offsets (under
MULE, they are different, because characters can be multi-byte). It is
one of the largest header files.
bufslots.h defines the fields in the buffer structure that correspond to the built-in buffer-local variables. It is its own header file because it is included many times in buffer.c, as a way of iterating over all the built-in buffer-local variables.
insdel.c insdel.h
insdel.c contains low-level functions for inserting and deleting text in a buffer, keeping track of changed regions for use by redisplay, and calling any before-change and after-change functions that may have been registered for the buffer. It also contains the actual functions that convert between byte offsets and character offsets.
insdel.h contains associated headers.
marker.c
This module implements the marker Lisp object type, which conceptually is a pointer to a text position in a buffer that moves around as text is inserted and deleted, so as to remain in the same relative position. This module doesn’t actually move the markers around – that’s handled in insdel.c. This module just creates them and implements the primitives for working with them. As markers are simple objects, this does not entail much.
Note that the standard arithmetic primitives (e.g. +
) accept
markers in place of integers and automatically substitute the value of
marker-position
for the marker, i.e. an integer describing the
current buffer position of the marker.
extents.c extents.h
This module implements the extent Lisp object type, which is like a marker that works over a range of text rather than a single position. Extents are also much more complex and powerful than markers and have a more efficient (and more algorithmically complex) implementation. The implementation is described in detail in comments in extents.c.
The code in extents.c works closely with insdel.c so that
extents are properly moved around as text is inserted and deleted.
There is also code in extents.c that provides information needed
by the redisplay mechanism for efficient operation. (Remember that
extents can have display properties that affect [sometimes drastically,
as in the invisible
property] the display of the text they
cover.)
editfns.c
editfns.c contains the standard Lisp primitives for working with
a buffer’s text, and calls the low-level functions in insdel.c.
It also contains primitives for working with point
(the default
buffer insertion location).
editfns.c also contains functions for retrieving various characteristics from the external environment: the current time, the process ID of the running SXEmacs process, the name of the user who ran this SXEmacs process, etc. It’s not clear why this code is in editfns.c.
callint.c cmds.c commands.h
These modules implement the basic interactive commands, i.e. user-callable functions. Commands, as opposed to other functions, have special ways of getting their parameters interactively (by querying the user), as opposed to having them passed in a normal function invocation. Many commands are not really meant to be called from other Lisp functions, because they modify global state in a way that’s often undesired as part of other Lisp functions.
callint.c implements the mechanism for querying the user for parameters and calling interactive commands. The bulk of this module is code that parses the interactive spec that is supplied with an interactive command.
cmds.c implements the basic, most commonly used editing commands: commands to move around the current buffer and insert and delete characters. These commands are implemented using the Lisp primitives defined in editfns.c.
commands.h contains associated structure definitions and prototypes.
regex.c regex.h search.c
search.c implements the Lisp primitives for searching for text in a buffer, and some of the low-level algorithms for doing this. In particular, the fast fixed-string Boyer-Moore search algorithm is implemented in search.c. The low-level algorithms for doing regular-expression searching, however, are implemented in regex.c and regex.h. These two modules are largely independent of SXEmacs, and are similar to (and based upon) the regular-expression routines used in grep and other GNU utilities.
doprnt.c
doprnt.c implements formatted-string processing, similar to
printf()
command in C.
undo.c
This module implements the undo mechanism for tracking buffer changes. Most of this could be implemented in Lisp.