comparison src/lstream.c @ 867:804517e16990

[xemacs-hg @ 2002-06-05 09:54:39 by ben] Textual renaming: text/char names abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization. [a] distinguish between "charptr" when it refers to operations on the pointer itself and when it refers to operations on text; and [b] use consistent naming for everything referring to internal format, i.e. Itext == text in internal format Ibyte == a byte in such text Ichar == a char as represented in internal character format thus e.g. set_charptr_emchar -> set_itext_ichar The pre and post tags on either side of this change are: pre-internal-format-textual-renaming post-internal-format-textual-renaming See the Internals Manual for details of exactly how this was done, how to handle the change in your workspace, etc.
author ben
date Wed, 05 Jun 2002 09:58:45 +0000
parents 1e4e42de23d5
children c925bacdda60
comparison
equal deleted inserted replaced
866:613552a02607 867:804517e16990
311 if (!byte_ascii_p (*dataend)) 311 if (!byte_ascii_p (*dataend))
312 { 312 {
313 /* Go back to the beginning of the last (and possibly partial) 313 /* Go back to the beginning of the last (and possibly partial)
314 character, and bump forward to see if the character is 314 character, and bump forward to see if the character is
315 complete. */ 315 complete. */
316 VALIDATE_CHARPTR_BACKWARD (dataend); 316 VALIDATE_IBYTEPTR_BACKWARD (dataend);
317 if (dataend + rep_bytes_by_first_byte (*dataend) != data + size) 317 if (dataend + rep_bytes_by_first_byte (*dataend) != data + size)
318 /* If not, chop the size down to ignore the last char 318 /* If not, chop the size down to ignore the last char
319 and stash it away for next time. */ 319 and stash it away for next time. */
320 size = dataend - data; 320 size = dataend - data;
321 /* If we don't even have one character to write, then just 321 /* If we don't even have one character to write, then just
672 !override_no_partial_chars) 672 !override_no_partial_chars)
673 { 673 {
674 /* It's quite possible for us to get passed an incomplete 674 /* It's quite possible for us to get passed an incomplete
675 character at the end. We need to spit back that 675 character at the end. We need to spit back that
676 incomplete character. */ 676 incomplete character. */
677 Bytecount newoff = validate_intbyte_string_backward (p, off); 677 Bytecount newoff = validate_ibyte_string_backward (p, off);
678 if (newoff < off) 678 if (newoff < off)
679 { 679 {
680 Lstream_unread (lstr, p + newoff, off - newoff); 680 Lstream_unread (lstr, p + newoff, off - newoff);
681 off = newoff; 681 off = newoff;
682 } 682 }
982 982
983 struct filedesc_stream 983 struct filedesc_stream
984 { 984 {
985 int fd; 985 int fd;
986 int pty_max_bytes; 986 int pty_max_bytes;
987 Intbyte eof_char; 987 Ibyte eof_char;
988 int starting_pos; 988 int starting_pos;
989 int current_pos; 989 int current_pos;
990 int end_pos; 990 int end_pos;
991 int chars_sans_newline; 991 int chars_sans_newline;
992 unsigned int closing :1; 992 unsigned int closing :1;
1180 /* The need_newline flag is necessary because otherwise when the 1180 /* The need_newline flag is necessary because otherwise when the
1181 first byte is a newline, we'd get stuck never writing anything 1181 first byte is a newline, we'd get stuck never writing anything
1182 in pty-flushing mode. */ 1182 in pty-flushing mode. */
1183 if (need_newline) 1183 if (need_newline)
1184 { 1184 {
1185 Intbyte nl = '\n'; 1185 Ibyte nl = '\n';
1186 Bytecount retval2 = str->allow_quit ? 1186 Bytecount retval2 = str->allow_quit ?
1187 write_allowing_quit (str->fd, &nl, 1) : 1187 write_allowing_quit (str->fd, &nl, 1) :
1188 retry_write (str->fd, &nl, 1); 1188 retry_write (str->fd, &nl, 1);
1189 1189
1190 if (retval2 > 0) 1190 if (retval2 > 0)
1263 return str->blocking_error_p; 1263 return str->blocking_error_p;
1264 } 1264 }
1265 1265
1266 void 1266 void
1267 filedesc_stream_set_pty_flushing (Lstream *stream, int pty_max_bytes, 1267 filedesc_stream_set_pty_flushing (Lstream *stream, int pty_max_bytes,
1268 Intbyte eof_char) 1268 Ibyte eof_char)
1269 { 1269 {
1270 struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream); 1270 struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream);
1271 str->pty_max_bytes = pty_max_bytes; 1271 str->pty_max_bytes = pty_max_bytes;
1272 str->eof_char = eof_char; 1272 str->eof_char = eof_char;
1273 str->pty_flushing = 1; 1273 str->pty_flushing = 1;
1321 Bytecount size) 1321 Bytecount size)
1322 { 1322 {
1323 struct lisp_string_stream *str = LISP_STRING_STREAM_DATA (stream); 1323 struct lisp_string_stream *str = LISP_STRING_STREAM_DATA (stream);
1324 /* Don't lose if the string shrank past us ... */ 1324 /* Don't lose if the string shrank past us ... */
1325 Bytecount offset = min (str->offset, XSTRING_LENGTH (str->obj)); 1325 Bytecount offset = min (str->offset, XSTRING_LENGTH (str->obj));
1326 Intbyte *strstart = XSTRING_DATA (str->obj); 1326 Ibyte *strstart = XSTRING_DATA (str->obj);
1327 Intbyte *start = strstart + offset; 1327 Ibyte *start = strstart + offset;
1328 1328
1329 /* ... or if someone changed the string and we ended up in the 1329 /* ... or if someone changed the string and we ended up in the
1330 middle of a character. */ 1330 middle of a character. */
1331 /* Being in the middle of a character is `normal' unless 1331 /* Being in the middle of a character is `normal' unless
1332 LSTREAM_NO_PARTIAL_CHARS - mrb */ 1332 LSTREAM_NO_PARTIAL_CHARS - mrb */
1333 if (stream->flags & LSTREAM_FL_NO_PARTIAL_CHARS) 1333 if (stream->flags & LSTREAM_FL_NO_PARTIAL_CHARS)
1334 VALIDATE_CHARPTR_BACKWARD (start); 1334 VALIDATE_IBYTEPTR_BACKWARD (start);
1335 offset = start - strstart; 1335 offset = start - strstart;
1336 size = min (size, (Bytecount) (str->end - offset)); 1336 size = min (size, (Bytecount) (str->end - offset));
1337 memcpy (data, start, size); 1337 memcpy (data, start, size);
1338 str->offset = offset + size; 1338 str->offset = offset + size;
1339 return size; 1339 return size;
1349 /* Don't lose if the string shrank past us ... */ 1349 /* Don't lose if the string shrank past us ... */
1350 pos = min (pos, XSTRING_LENGTH (str->obj)); 1350 pos = min (pos, XSTRING_LENGTH (str->obj));
1351 /* ... or if someone changed the string and we ended up in the 1351 /* ... or if someone changed the string and we ended up in the
1352 middle of a character. */ 1352 middle of a character. */
1353 { 1353 {
1354 Intbyte *strstart = XSTRING_DATA (str->obj); 1354 Ibyte *strstart = XSTRING_DATA (str->obj);
1355 Intbyte *start = strstart + pos; 1355 Ibyte *start = strstart + pos;
1356 VALIDATE_CHARPTR_BACKWARD (start); 1356 VALIDATE_IBYTEPTR_BACKWARD (start);
1357 pos = start - strstart; 1357 pos = start - strstart;
1358 } 1358 }
1359 str->offset = pos; 1359 str->offset = pos;
1360 return 0; 1360 return 0;
1361 } 1361 }
1519 1519
1520 /*********** write to an unsigned-char dynarr ***********/ 1520 /*********** write to an unsigned-char dynarr ***********/
1521 1521
1522 /* Note: If you have a dynarr whose type is not unsigned_char_dynarr 1522 /* Note: If you have a dynarr whose type is not unsigned_char_dynarr
1523 but which is really just an unsigned_char_dynarr (e.g. its type 1523 but which is really just an unsigned_char_dynarr (e.g. its type
1524 is Intbyte or Extbyte), just cast to unsigned_char_dynarr. */ 1524 is Ibyte or Extbyte), just cast to unsigned_char_dynarr. */
1525 1525
1526 #define DYNARR_STREAM_DATA(stream) \ 1526 #define DYNARR_STREAM_DATA(stream) \
1527 LSTREAM_TYPE_DATA (stream, dynarr) 1527 LSTREAM_TYPE_DATA (stream, dynarr)
1528 1528
1529 struct dynarr_stream 1529 struct dynarr_stream
1662 Lstream_set_character_mode (XLSTREAM (lstr)); 1662 Lstream_set_character_mode (XLSTREAM (lstr));
1663 return lstr; 1663 return lstr;
1664 } 1664 }
1665 1665
1666 static Bytecount 1666 static Bytecount
1667 lisp_buffer_reader (Lstream *stream, Intbyte *data, Bytecount size) 1667 lisp_buffer_reader (Lstream *stream, Ibyte *data, Bytecount size)
1668 { 1668 {
1669 struct lisp_buffer_stream *str = LISP_BUFFER_STREAM_DATA (stream); 1669 struct lisp_buffer_stream *str = LISP_BUFFER_STREAM_DATA (stream);
1670 Bytebpos start; 1670 Bytebpos start;
1671 Bytebpos end; 1671 Bytebpos end;
1672 struct buffer *buf = XBUFFER (str->buffer); 1672 struct buffer *buf = XBUFFER (str->buffer);
1690 end = start + src_used; 1690 end = start + src_used;
1691 1691
1692 if (EQ (buf->selective_display, Qt) && str->flags & LSTR_SELECTIVE) 1692 if (EQ (buf->selective_display, Qt) && str->flags & LSTR_SELECTIVE)
1693 { 1693 {
1694 /* What a kludge. What a kludge. What a kludge. */ 1694 /* What a kludge. What a kludge. What a kludge. */
1695 Intbyte *p; 1695 Ibyte *p;
1696 for (p = data; p < data + src_used; p++) 1696 for (p = data; p < data + src_used; p++)
1697 if (*p == '\r') 1697 if (*p == '\r')
1698 *p = '\n'; 1698 *p = '\n';
1699 } 1699 }
1700 1700
1701 set_byte_marker_position (str->start, end); 1701 set_byte_marker_position (str->start, end);
1702 return size; 1702 return size;
1703 } 1703 }
1704 1704
1705 static Bytecount 1705 static Bytecount
1706 lisp_buffer_writer (Lstream *stream, const Intbyte *data, 1706 lisp_buffer_writer (Lstream *stream, const Ibyte *data,
1707 Bytecount size) 1707 Bytecount size)
1708 { 1708 {
1709 struct lisp_buffer_stream *str = LISP_BUFFER_STREAM_DATA (stream); 1709 struct lisp_buffer_stream *str = LISP_BUFFER_STREAM_DATA (stream);
1710 Charbpos pos; 1710 Charbpos pos;
1711 struct buffer *buf = XBUFFER (str->buffer); 1711 struct buffer *buf = XBUFFER (str->buffer);