/* Caching facts about regions of the buffer, for optimization.
- Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1995
- Free Software Foundation, Inc.
+ Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1995, 2002, 2003, 2004,
+ 2005 Free Software Foundation, Inc.
This file is part of GNU Emacs.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
#include <config.h>
+#include <stdio.h>
+
#include "lisp.h"
#include "buffer.h"
#include "region-cache.h"
-#include <stdio.h>
-
\f
/* Data structures. */
struct region_cache *
new_region_cache ()
{
- struct region_cache *c
+ struct region_cache *c
= (struct region_cache *) xmalloc (sizeof (struct region_cache));
c->gap_start = 0;
c->beg_unchanged = 0;
c->end_unchanged = 0;
- c->buffer_beg = 1;
- c->buffer_end = 1;
+ c->buffer_beg = BEG;
+ c->buffer_end = BEG;
/* Insert the boundary for the buffer start. */
c->cache_len++;
c->cache_len -= len;
}
-
+
\f
/* Set the value for a region. */
both the locations of real characters in the buffer. */
if (start == end)
return;
-
+
{
/* We need to make sure that there are no boundaries in the area
between start to end; the whole area will have the same value,
so those boundaries will not be necessary.
-
+
Let start_ix be the cache index of the boundary governing the
first character of start..end, and let end_ix be the cache
index of the earliest boundary after the last character in
start_ix++;
}
}
-
+
/* This is equivalent to letting end_ix float (like a buffer
marker does) with the insertions and deletions we may have
done. */
}
-/* Clean out any cache entries applying to the modified region, and
+/* Clean out any cache entries applying to the modified region, and
make the positions of the remaining entries accurate again.
After calling this function, the mess described in the comment in
(which will give the modified region the same size in the cache
as it has in the buffer), and then invalidate the modified
region. */
- if (c->buffer_beg + c->beg_unchanged
+ if (c->buffer_beg + c->beg_unchanged
== c->buffer_end - c->end_unchanged)
{
/* Move the gap so that all the boundaries in the unchanged head
/* Interface: using the cache. */
/* Return true if the text immediately after POS in BUF is known, for
- the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest
+ the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest
position after POS where the knownness changes. */
int
region_cache_forward (buf, c, pos, next)
fprintf (stderr, "%d : %d\n", pos, BOUNDARY_VALUE (c, i));
}
}
+
+/* arch-tag: 98c29f3f-2ca2-4e3a-92f0-f2249200a17d
+ (do not change this comment) */