annotate src/insdel.h @ 68:0b7f3b634cf2 r19-16-pre9

Import from CVS: tag r19-16-pre9
author cvs
date Mon, 13 Aug 2007 09:00:03 +0200
parents 376386a54a3c
children c5d627a313b1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Buffer insertion/deletion and gap motion for XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1985-1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 /* Mostly rewritten by Ben Wing. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #ifndef _XEMACS_INSDEL_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #define _XEMACS_INSDEL_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 /* changing a buffer's text */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 extern int begin_multiple_change (struct buffer *buf, Bufpos start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 Bufpos end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 extern void end_multiple_change (struct buffer *buf, int count);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 /* flags for functions below */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #define INSDEL_BEFORE_MARKERS 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #define INSDEL_NO_LOCKING 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 Charcount buffer_insert_string_1 (struct buffer *buf, Bufpos pos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 CONST Bufbyte *nonreloc, Lisp_Object reloc,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 Bytecount offset, Bytecount length,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 int flags);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 Charcount buffer_insert_raw_string_1 (struct buffer *buf, Bufpos pos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 CONST Bufbyte *nonreloc,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 Bytecount length, int flags);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 Charcount buffer_insert_lisp_string_1 (struct buffer *buf, Bufpos pos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 Lisp_Object str, int flags);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 Charcount buffer_insert_c_string_1 (struct buffer *buf, Bufpos pos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 CONST char *s, int flags);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 Charcount buffer_insert_emacs_char_1 (struct buffer *buf, Bufpos pos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 Emchar ch, int flags);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 Charcount buffer_insert_c_char_1 (struct buffer *buf, Bufpos pos, char c,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 int flags);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 Charcount buffer_insert_from_buffer_1 (struct buffer *buf, Bufpos pos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 struct buffer *buf2, Bufpos pos2,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 Charcount length, int flags);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 /* Macros for insertion functions that insert at point after markers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 All of these can GC. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 #define buffer_insert_string(buf, nonreloc, reloc, offset, length) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 buffer_insert_string_1 (buf, -1, nonreloc, reloc, offset, length, 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 #define buffer_insert_raw_string(buf, string, length) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 buffer_insert_raw_string_1 (buf, -1, string, length, 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 #define buffer_insert_c_string(buf, s) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 buffer_insert_c_string_1 (buf, -1, s, 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 #define buffer_insert_lisp_string(buf, str) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 buffer_insert_lisp_string_1 (buf, -1, str, 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 #define buffer_insert_c_char(buf, c) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 buffer_insert_c_char_1 (buf, -1, c, 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 #define buffer_insert_emacs_char(buf, ch) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 buffer_insert_emacs_char_1 (buf, -1, ch, 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 #define buffer_insert_from_buffer(buf, b, index, length) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 buffer_insert_from_buffer_1 (buf, -1, b, index, length, 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 extern void buffer_delete_range (struct buffer *buf, Bufpos from, Bufpos to,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 int flags);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 extern void buffer_replace_char (struct buffer *b, Bufpos pos, Emchar ch,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 int not_real_change, int force_lock_check);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 /* tracking buffer changes */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 /* Split into two parts. One part goes with a buffer's text (possibly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 shared), the other with the buffer itself. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 struct buffer_text_change_data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 /* multiple change stuff */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 int in_multiple_change;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 Bufpos mc_begin, mc_orig_end, mc_new_end;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 int mc_begin_signaled;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 struct each_buffer_change_data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 Charcount begin_unchanged, end_unchanged;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 /* redisplay needs to know if a newline was deleted so its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 incremental-redisplay algorithm will fail */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 int newline_was_deleted;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 Charcount begin_extent_unchanged, end_extent_unchanged;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 /* Number of characters at the beginning and end of the buffer that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 have not changed since the last call to buffer_reset_changes().
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 If no changes have occurred since then, both values will be -1.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 "Changed" means that the text has changed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 #define BUF_BEGIN_UNCHANGED(buf) ((buf)->changes->begin_unchanged)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 #define BUF_END_UNCHANGED(buf) ((buf)->changes->end_unchanged)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 /* Number of characters at the beginning and end of the buffer that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 have not had a covering extent change since the last call to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 buffer_reset_changes (). If no changes have occurred since then,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 both values will be -1.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 "Changed" means that the extents covering the text have changed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 #define BUF_EXTENT_BEGIN_UNCHANGED(buf) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ((buf)->changes->begin_extent_unchanged)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 #define BUF_EXTENT_END_UNCHANGED(buf) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ((buf)->changes->end_extent_unchanged)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 #define BUF_NEWLINE_WAS_DELETED(buf) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ((buf)->changes->newline_was_deleted)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 extern void buffer_extent_signal_changed_region (struct buffer *buf,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 Bufpos start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 Bufpos end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 extern void buffer_reset_changes (struct buffer *buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 /* other related functions */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 extern Memind do_marker_adjustment (Memind mpos, Memind from,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 Memind to, int amount);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 extern void fixup_internal_substring (CONST Bufbyte *nonreloc,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 Lisp_Object reloc,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 int offset, int *len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 /* In font-lock.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 extern void font_lock_maybe_update_syntactic_caches (struct buffer *buf,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 Bufpos start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 Bufpos orig_end,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 Bufpos new_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 extern void font_lock_buffer_was_killed (struct buffer *buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 extern void barf_if_buffer_read_only (struct buffer *buf, Bufpos from,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 Bufpos to);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 /* In marker.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 void init_buffer_markers (struct buffer *b);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 void uninit_buffer_markers (struct buffer *b);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 extern Lisp_Object make_string_from_buffer (struct buffer *buf, Bufpos pos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 Charcount length);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 extern void init_buffer_text (struct buffer *b, int indirect_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 extern void uninit_buffer_text (struct buffer *b, int indirect_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 #endif /* _XEMACS_INSDEL_H_ */