comparison src/lstream.c @ 793:e38acbeb1cae

[xemacs-hg @ 2002-03-29 04:46:17 by ben] lots o' fixes etc/ChangeLog: New file. Separated out all entries for etc/ into their own ChangeLog. Includes entries for the following files: etc/BABYL, etc/BETA, etc/CHARSETS, etc/DISTRIB, etc/Emacs.ad, etc/FTP, etc/GNUS-NEWS, etc/GOATS, etc/HELLO, etc/INSTALL, etc/MACHINES, etc/MAILINGLISTS, etc/MSDOS, etc/MYTHOLOGY, etc/NEWS, etc/OXYMORONS, etc/PACKAGES, etc/README, etc/TUTORIAL, etc/TUTORIAL.de, etc/TUTORIAL.ja, etc/TUTORIAL.ko, etc/TUTORIAL.se, etc/aliases.ksh, etc/altrasoft-logo.xpm, etc/check_cygwin_setup.sh, etc/custom/example-themes/europe-theme.el, etc/custom/example-themes/ex-custom-file, etc/custom/example-themes/example-theme.el, etc/e/eterm.ti, etc/edt-user.doc, etc/enriched.doc, etc/etags.1, etc/gnuserv.1, etc/gnuserv.README, etc/package-index.LATEST.gpg, etc/package-index.LATEST.pgp, etc/photos/jan.png, etc/recycle.xpm, etc/refcard.tex, etc/sample.Xdefaults, etc/sample.emacs, etc/sgml/CATALOG, etc/sgml/HTML32.dtd, etc/skk/SKK.tut.E, etc/smilies/Face_ase.xbm, etc/smilies/Face_ase2.xbm, etc/smilies/Face_ase3.xbm, etc/smilies/Face_smile.xbm, etc/smilies/Face_weep.xbm, etc/sounds, etc/toolbar, etc/toolbar/workshop-cap-up.xpm, etc/xemacs-ja.1, etc/xemacs.1, etc/yow.lines, etc\BETA, etc\NEWS, etc\README, etc\TUTORIAL, etc\TUTORIAL.de, etc\check_cygwin_setup.sh, etc\sample.init.el, etc\unicode\README, etc\unicode\mule-ucs\*, etc\unicode\other\* unicode/unicode-consortium/8859-16.TXT: New file. mule/english.el: Define this charset now, since a bug was fixed that formerly prevented it. mule/ethio-util.el: Fix compile errors involving Unicode `characters', which should be integers. Makefile.in.in: Always include gui.c, to fix compile error when TTY-only. EmacsFrame.c, abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, bytecode.h, callint.c, callproc.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.c, console-msw.h, console-tty.c, console-x.c, console-x.h, console.c, console.h, data.c, database.c, device-gtk.c, device-msw.c, device-x.c, device.c, device.h, dialog-msw.c, doc.c, doprnt.c, dumper.c, dynarr.c, editfns.c, eldap.c, eldap.h, elhash.c, elhash.h, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, events.h, extents.c, extents.h, faces.c, faces.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, free-hook.c, general-slots.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gtk-xemacs.c, gui-msw.c, gui-x.c, gui-x.h, gui.c, gui.h, gutter.c, gutter.h, indent.c, input-method-xlib.c, insdel.c, keymap.c, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-canna.c, mule-ccl.c, mule-charset.c, mule-wnnfns.c, native-gtk-toolbar.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, opaque.c, opaque.h, postgresql.c, postgresql.h, print.c, process-unix.c, process.c, process.h, rangetab.c, rangetab.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, search.c, select-gtk.c, select-x.c, sound.c, specifier.c, specifier.h, strftime.c, symbols.c, symeval.h, syntax.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, toolbar.h, tooltalk.c, tooltalk.h, ui-gtk.c, ui-gtk.h, undo.c, vm-limit.c, window.c, window.h: Eliminate XSETFOO. Replace all usages with wrap_foo(). Make symbol->name a Lisp_Object, not Lisp_String *. Eliminate nearly all uses of Lisp_String * in favor of Lisp_Object, and correct macros so most of them favor Lisp_Object. Create new error-behavior ERROR_ME_DEBUG_WARN -- output warnings, but at level `debug' (usually ignored). Use it when instantiating specifiers, so problems can be debugged. Move log-warning-minimum-level into C so that we can optimize ERROR_ME_DEBUG_WARN. Fix warning levels consistent with new definitions. Add default_ and parent fields to char table; not yet implemented. New fun Dynarr_verify(); use for further error checking on Dynarrs. Rearrange code at top of lisp.h in conjunction with dynarr changes. Fix eifree(). Use Eistrings in various places (format_event_object(), where_is_to_char(), and callers thereof) to avoid fixed-size strings buffers. New fun write_eistring(). Reindent and fix GPM code to follow standards. Set default MS Windows font to Lucida Console (same size as Courier New but less interline spacing, so more lines fit). Increase default frame size on Windows to 50 lines. (If that's too big for the workspace, the frame will be shrunk as necessary.) Fix problem with text files with no newlines (). (Change `convert-eol' coding system to use `nil' for autodetect, consistent with make-coding-system.) Correct compile warnings in vm-limit.c. Fix handling of reverse-direction charsets to avoid errors when opening (e.g.) mule-ucs/lisp/reldata/uiso8859-6.el. Recode some object printing methods to use write_fmt_string() instead of a fixed buffer and sprintf. Turn on display of png comments as warnings (level `info'), now that they're unobtrusive. Revamped the sound documentation. Fixed bug in redisplay w.r.t. hscroll/truncation/continuation glyphs causing jumping up and down of the lines, since they're bigger than the line size. (It was seen most obviously when there's a horizontal scroll bar, e.g. do C-h a glyph or something like that.) The problem was that the glyph-contrib-p setting on glyphs was ignored even if it was set properly, which it wasn't until now.
author ben
date Fri, 29 Mar 2002 04:49:13 +0000
parents 026c5bf9c134
children a5954632b187
comparison
equal deleted inserted replaced
792:4e83fdb13eb9 793:e38acbeb1cae
245 245
246 void 246 void
247 Lstream_delete (Lstream *lstr) 247 Lstream_delete (Lstream *lstr)
248 { 248 {
249 int i; 249 int i;
250 Lisp_Object val; 250 Lisp_Object val = wrap_lstream (lstr);
251 251
252 XSETLSTREAM (val, lstr);
253 for (i = 0; i < lstream_type_count; i++) 252 for (i = 0; i < lstream_type_count; i++)
254 { 253 {
255 if (lstream_types[i] == lstr->imp) 254 if (lstream_types[i] == lstr->imp)
256 { 255 {
257 free_managed_lcrecord (Vlstream_free_list[i], val); 256 free_managed_lcrecord (Vlstream_free_list[i], val);
859 DEFINE_LSTREAM_IMPLEMENTATION ("stdio", stdio); 858 DEFINE_LSTREAM_IMPLEMENTATION ("stdio", stdio);
860 859
861 static Lisp_Object 860 static Lisp_Object
862 make_stdio_stream_1 (FILE *stream, int flags, const char *mode) 861 make_stdio_stream_1 (FILE *stream, int flags, const char *mode)
863 { 862 {
864 Lisp_Object obj;
865 Lstream *lstr = Lstream_new (lstream_stdio, mode); 863 Lstream *lstr = Lstream_new (lstream_stdio, mode);
866 struct stdio_stream *str = STDIO_STREAM_DATA (lstr); 864 struct stdio_stream *str = STDIO_STREAM_DATA (lstr);
867 str->file = stream; 865 str->file = stream;
868 str->closing = flags & LSTR_CLOSING; 866 str->closing = flags & LSTR_CLOSING;
869 lstr->flags |= LSTREAM_FL_CLOSE_AT_DISKSAVE; 867 lstr->flags |= LSTREAM_FL_CLOSE_AT_DISKSAVE;
870 XSETLSTREAM (obj, lstr); 868 return wrap_lstream (lstr);
871 return obj;
872 } 869 }
873 870
874 Lisp_Object 871 Lisp_Object
875 make_stdio_input_stream (FILE *stream, int flags) 872 make_stdio_input_stream (FILE *stream, int flags)
876 { 873 {
996 ignored when writing); -1 for unlimited. */ 993 ignored when writing); -1 for unlimited. */
997 static Lisp_Object 994 static Lisp_Object
998 make_filedesc_stream_1 (int filedesc, int offset, int count, int flags, 995 make_filedesc_stream_1 (int filedesc, int offset, int count, int flags,
999 const char *mode) 996 const char *mode)
1000 { 997 {
1001 Lisp_Object obj;
1002 Lstream *lstr = Lstream_new (lstream_filedesc, mode); 998 Lstream *lstr = Lstream_new (lstream_filedesc, mode);
1003 struct filedesc_stream *fstr = FILEDESC_STREAM_DATA (lstr); 999 struct filedesc_stream *fstr = FILEDESC_STREAM_DATA (lstr);
1004 fstr->fd = filedesc; 1000 fstr->fd = filedesc;
1005 fstr->closing = !!(flags & LSTR_CLOSING); 1001 fstr->closing = !!(flags & LSTR_CLOSING);
1006 fstr->allow_quit = !!(flags & LSTR_ALLOW_QUIT); 1002 fstr->allow_quit = !!(flags & LSTR_ALLOW_QUIT);
1013 if (count < 0) 1009 if (count < 0)
1014 fstr->end_pos = -1; 1010 fstr->end_pos = -1;
1015 else 1011 else
1016 fstr->end_pos = fstr->starting_pos + count; 1012 fstr->end_pos = fstr->starting_pos + count;
1017 lstr->flags |= LSTREAM_FL_CLOSE_AT_DISKSAVE; 1013 lstr->flags |= LSTREAM_FL_CLOSE_AT_DISKSAVE;
1018 XSETLSTREAM (obj, lstr); 1014 return wrap_lstream (lstr);
1019 return obj;
1020 } 1015 }
1021 1016
1022 Lisp_Object 1017 Lisp_Object
1023 make_filedesc_input_stream (int filedesc, int offset, int count, int flags) 1018 make_filedesc_input_stream (int filedesc, int offset, int count, int flags)
1024 { 1019 {
1268 1263
1269 Lisp_Object 1264 Lisp_Object
1270 make_lisp_string_input_stream (Lisp_Object string, Bytecount offset, 1265 make_lisp_string_input_stream (Lisp_Object string, Bytecount offset,
1271 Bytecount len) 1266 Bytecount len)
1272 { 1267 {
1273 Lisp_Object obj;
1274 Lstream *lstr; 1268 Lstream *lstr;
1275 struct lisp_string_stream *str; 1269 struct lisp_string_stream *str;
1276 1270
1277 CHECK_STRING (string); 1271 CHECK_STRING (string);
1278 if (len < 0) 1272 if (len < 0)
1285 str = LISP_STRING_STREAM_DATA (lstr); 1279 str = LISP_STRING_STREAM_DATA (lstr);
1286 str->offset = offset; 1280 str->offset = offset;
1287 str->end = offset + len; 1281 str->end = offset + len;
1288 str->init_offset = offset; 1282 str->init_offset = offset;
1289 str->obj = string; 1283 str->obj = string;
1290 XSETLSTREAM (obj, lstr); 1284 return wrap_lstream (lstr);
1291 return obj;
1292 } 1285 }
1293 1286
1294 static Bytecount 1287 static Bytecount
1295 lisp_string_reader (Lstream *stream, unsigned char *data, 1288 lisp_string_reader (Lstream *stream, unsigned char *data,
1296 Bytecount size) 1289 Bytecount size)
1358 DEFINE_LSTREAM_IMPLEMENTATION ("fixed-buffer", fixed_buffer); 1351 DEFINE_LSTREAM_IMPLEMENTATION ("fixed-buffer", fixed_buffer);
1359 1352
1360 Lisp_Object 1353 Lisp_Object
1361 make_fixed_buffer_input_stream (const void *buf, Bytecount size) 1354 make_fixed_buffer_input_stream (const void *buf, Bytecount size)
1362 { 1355 {
1363 Lisp_Object obj;
1364 Lstream *lstr = Lstream_new (lstream_fixed_buffer, "r"); 1356 Lstream *lstr = Lstream_new (lstream_fixed_buffer, "r");
1365 struct fixed_buffer_stream *str = FIXED_BUFFER_STREAM_DATA (lstr); 1357 struct fixed_buffer_stream *str = FIXED_BUFFER_STREAM_DATA (lstr);
1366 str->inbuf = (const unsigned char *) buf; 1358 str->inbuf = (const unsigned char *) buf;
1367 str->size = size; 1359 str->size = size;
1368 XSETLSTREAM (obj, lstr); 1360 return wrap_lstream (lstr);
1369 return obj;
1370 } 1361 }
1371 1362
1372 Lisp_Object 1363 Lisp_Object
1373 make_fixed_buffer_output_stream (void *buf, Bytecount size) 1364 make_fixed_buffer_output_stream (void *buf, Bytecount size)
1374 { 1365 {
1375 Lisp_Object obj;
1376 Lstream *lstr = Lstream_new (lstream_fixed_buffer, "w"); 1366 Lstream *lstr = Lstream_new (lstream_fixed_buffer, "w");
1377 struct fixed_buffer_stream *str = FIXED_BUFFER_STREAM_DATA (lstr); 1367 struct fixed_buffer_stream *str = FIXED_BUFFER_STREAM_DATA (lstr);
1378 str->outbuf = (unsigned char *) buf; 1368 str->outbuf = (unsigned char *) buf;
1379 str->size = size; 1369 str->size = size;
1380 XSETLSTREAM (obj, lstr); 1370 return wrap_lstream (lstr);
1381 return obj;
1382 } 1371 }
1383 1372
1384 static Bytecount 1373 static Bytecount
1385 fixed_buffer_reader (Lstream *stream, unsigned char *data, 1374 fixed_buffer_reader (Lstream *stream, unsigned char *data,
1386 Bytecount size) 1375 Bytecount size)
1447 DEFINE_LSTREAM_IMPLEMENTATION ("resizing-buffer", resizing_buffer); 1436 DEFINE_LSTREAM_IMPLEMENTATION ("resizing-buffer", resizing_buffer);
1448 1437
1449 Lisp_Object 1438 Lisp_Object
1450 make_resizing_buffer_output_stream (void) 1439 make_resizing_buffer_output_stream (void)
1451 { 1440 {
1452 Lisp_Object obj; 1441 return wrap_lstream (Lstream_new (lstream_resizing_buffer, "w"));
1453 XSETLSTREAM (obj, Lstream_new (lstream_resizing_buffer, "w"));
1454 return obj;
1455 } 1442 }
1456 1443
1457 static Bytecount 1444 static Bytecount
1458 resizing_buffer_writer (Lstream *stream, const unsigned char *data, 1445 resizing_buffer_writer (Lstream *stream, const unsigned char *data,
1459 Bytecount size) 1446 Bytecount size)
1515 DEFINE_LSTREAM_IMPLEMENTATION ("dynarr", dynarr); 1502 DEFINE_LSTREAM_IMPLEMENTATION ("dynarr", dynarr);
1516 1503
1517 Lisp_Object 1504 Lisp_Object
1518 make_dynarr_output_stream (unsigned_char_dynarr *dyn) 1505 make_dynarr_output_stream (unsigned_char_dynarr *dyn)
1519 { 1506 {
1520 Lisp_Object obj; 1507 Lisp_Object obj = wrap_lstream (Lstream_new (lstream_dynarr, "w"));
1521 XSETLSTREAM (obj, Lstream_new (lstream_dynarr, "w")); 1508
1522 DYNARR_STREAM_DATA (XLSTREAM (obj))->dyn = dyn; 1509 DYNARR_STREAM_DATA (XLSTREAM (obj))->dyn = dyn;
1523 return obj; 1510 return obj;
1524 } 1511 }
1525 1512
1526 static Bytecount 1513 static Bytecount
1567 1554
1568 static Lisp_Object 1555 static Lisp_Object
1569 make_lisp_buffer_stream_1 (struct buffer *buf, Charbpos start, Charbpos end, 1556 make_lisp_buffer_stream_1 (struct buffer *buf, Charbpos start, Charbpos end,
1570 int flags, const char *mode) 1557 int flags, const char *mode)
1571 { 1558 {
1572 Lisp_Object obj;
1573 Lstream *lstr; 1559 Lstream *lstr;
1574 struct lisp_buffer_stream *str; 1560 struct lisp_buffer_stream *str;
1575 Charbpos bmin, bmax; 1561 Charbpos bmin, bmax;
1576 int reading = !strcmp (mode, "r"); 1562 int reading = !strcmp (mode, "r");
1577 1563
1605 1591
1606 lstr = Lstream_new (lstream_lisp_buffer, mode); 1592 lstr = Lstream_new (lstream_lisp_buffer, mode);
1607 str = LISP_BUFFER_STREAM_DATA (lstr); 1593 str = LISP_BUFFER_STREAM_DATA (lstr);
1608 { 1594 {
1609 Lisp_Object marker; 1595 Lisp_Object marker;
1610 Lisp_Object buffer; 1596 Lisp_Object buffer = wrap_buffer (buf);
1611 1597
1612 XSETBUFFER (buffer, buf);
1613 marker = Fmake_marker (); 1598 marker = Fmake_marker ();
1614 Fset_marker (marker, make_int (start), buffer); 1599 Fset_marker (marker, make_int (start), buffer);
1615 str->start = marker; 1600 str->start = marker;
1616 marker = Fmake_marker (); 1601 marker = Fmake_marker ();
1617 Fset_marker (marker, make_int (start), buffer); 1602 Fset_marker (marker, make_int (start), buffer);
1625 else 1610 else
1626 str->end = Qnil; 1611 str->end = Qnil;
1627 str->buffer = buffer; 1612 str->buffer = buffer;
1628 } 1613 }
1629 str->flags = flags; 1614 str->flags = flags;
1630 XSETLSTREAM (obj, lstr); 1615 return wrap_lstream (lstr);
1631 return obj;
1632 } 1616 }
1633 1617
1634 Lisp_Object 1618 Lisp_Object
1635 make_lisp_buffer_input_stream (struct buffer *buf, Charbpos start, Charbpos end, 1619 make_lisp_buffer_input_stream (struct buffer *buf, Charbpos start, Charbpos end,
1636 int flags) 1620 int flags)