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