comparison src/lread.c @ 20566:0877f6e6fc15

(readchar): Use marker's bytepos instead of bufpos.
author Richard M. Stallman <rms@gnu.org>
date Fri, 02 Jan 1998 21:27:40 +0000
parents e9733cb049d9
children 4bf29951648f
comparison
equal deleted inserted replaced
20565:aa9b7c5f0f62 20566:0877f6e6fc15
206 int orig_bytepos = bytepos; 206 int orig_bytepos = bytepos;
207 207
208 if (bytepos >= BUF_ZV_BYTE (inbuffer)) 208 if (bytepos >= BUF_ZV_BYTE (inbuffer))
209 return -1; 209 return -1;
210 210
211 if (XMARKER (readcharfun)->bufpos == BUF_GPT_BYTE (inbuffer))
212 XMARKER (readcharfun)->bufpos += BUF_GAP_SIZE (inbuffer);
213
214 if (! NILP (inbuffer->enable_multibyte_characters)) 211 if (! NILP (inbuffer->enable_multibyte_characters))
215 INC_POS (bytepos); 212 INC_POS (bytepos);
216 else 213 else
217 bytepos++; 214 bytepos++;
218 XMARKER (readcharfun)->bufpos += bytepos - orig_bytepos; 215 XMARKER (readcharfun)->bytepos = bytepos;
219 XMARKER (readcharfun)->charpos++; 216 XMARKER (readcharfun)->charpos++;
220 217
221 readchar_backlog = bytepos - orig_bytepos; 218 readchar_backlog = bytepos - orig_bytepos;
222 } 219 }
223 220
224 /* Because we move ->bufpos across the gap before we advance it, 221 return *(BUF_BEG_ADDR (inbuffer) + XMARKER (readcharfun)->bytepos
225 the gap never comes between the previous character and ->bufpos. */
226 return *(BUF_BEG_ADDR (inbuffer) + XMARKER (readcharfun)->bufpos
227 - readchar_backlog--); 222 - readchar_backlog--);
228 } 223 }
229 if (EQ (readcharfun, Qget_file_char)) 224 if (EQ (readcharfun, Qget_file_char))
230 { 225 {
231 c = getc (instream); 226 c = getc (instream);