Mercurial > hg > xemacs-beta
diff src/lstream.c @ 185:3d6bfa290dbd r20-3b19
Import from CVS: tag r20-3b19
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:55:28 +0200 |
parents | 8eaf7971accc |
children | e45d5e7c476e |
line wrap: on
line diff
--- a/src/lstream.c Mon Aug 13 09:54:24 2007 +0200 +++ b/src/lstream.c Mon Aug 13 09:55:28 2007 +0200 @@ -72,7 +72,7 @@ it is very efficient. The C argument is only evaluated once but the STREAM argument is evaluated more than once. Returns 0 on success, -1 on error. - + int Lstream_getc (Lstream *stream) Read one byte from the stream. This is a macro and so it is very efficient. The STREAM argument is evaluated more @@ -92,7 +92,7 @@ int Lstream_fputc (Lstream *stream, int c) int Lstream_fgetc (Lstream *stream) void Lstream_fungetc (Lstream *stream, int c) - Function equivalents of the above macros. + Function equivalents of the above macros. int Lstream_read (Lstream *stream, void *data, int size) Read SIZE bytes of DATA from the stream. Return the number of @@ -110,6 +110,11 @@ same bytes back. Note that this will be the case even if there is other pending unread data. +int Lstream_delete (Lstream *stream) + Frees all memory associated with the stream is freed. Calling + this is not strictly necessary, but it is much more efficient + than having the Lstream be garbage-collected. + int Lstream_close (Lstream *stream) Close the stream. All data will be flushed out. @@ -429,7 +434,7 @@ static int Lstream_write_1 (Lstream *lstr, CONST void *data, int size) { - CONST unsigned char *p = data; + CONST unsigned char *p = (CONST unsigned char *) data; int off = 0; if (! (lstr->flags & LSTREAM_FL_IS_OPEN)) { @@ -500,7 +505,7 @@ Lstream_write (Lstream *lstr, CONST void *data, int size) { int i; - CONST unsigned char *p = data; + CONST unsigned char *p = (CONST unsigned char *) data; assert (size >= 0); if (size == 0) @@ -539,7 +544,7 @@ signal_simple_internal_error ("Internal error: lstream has no reader", obj); } - + return (lstr->imp->reader) (lstr, buffer, size); } @@ -562,7 +567,7 @@ lstr->in_buffer_current = max (0, size_gotten); lstr->in_buffer_ind = 0; return size_gotten < 0 ? -1 : size_gotten; -} +} int Lstream_read (Lstream *lstr, void *data, int size) @@ -672,7 +677,7 @@ lstr->byte_count = 0; return (lstr->imp->rewinder) (lstr); } - + int Lstream_seekable_p (Lstream *lstr) { @@ -974,7 +979,7 @@ { struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream); int retval; - int need_newline = 0; + int need_newline = 0; /* This function would be simple if it were not for the blasted PTY max-bytes stuff. Why the hell can't they just have written @@ -1182,7 +1187,7 @@ XSETLSTREAM (obj, lstr); return obj; } - + static int lisp_string_reader (Lstream *stream, unsigned char *data, int size) { @@ -1264,7 +1269,7 @@ XSETLSTREAM (obj, lstr); return obj; } - + Lisp_Object make_fixed_buffer_output_stream (unsigned char *buf, int size) { @@ -1351,7 +1356,7 @@ XSETLSTREAM (obj, Lstream_new (lstream_resizing_buffer, "w")); return obj; } - + static int resizing_buffer_writer (Lstream *stream, CONST unsigned char *data, int size) { @@ -1413,7 +1418,7 @@ DYNARR_STREAM_DATA (XLSTREAM (obj))->dyn = dyn; return obj; } - + static int dynarr_writer (Lstream *stream, CONST unsigned char *data, int size) { @@ -1469,7 +1474,7 @@ /* Make sure the luser didn't pass "w" in. */ if (!strcmp (mode, "w")) abort (); - + if (flags & LSTR_IGNORE_ACCESSIBLE) { bmin = BUF_BEG (buf); @@ -1562,7 +1567,7 @@ end = bytind_clip_to_bounds (BI_BUF_BEGV (buf), end, BI_BUF_ZV (buf)); } - + size = min (size, end - start); end = start + size; /* We cannot return a partial character. */