annotate src/lstream.h @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children e7ef97881643
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Generic stream implementation -- header file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1995 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1996 Ben Wing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 /* Written by Ben Wing. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
26 #ifndef INCLUDED_lstream_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
27 #define INCLUDED_lstream_h_
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 /* definition of Lstream object */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 DECLARE_LRECORD (lstream, struct lstream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #define XLSTREAM(x) XRECORD (x, lstream, struct lstream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #define XSETLSTREAM(x, p) XSETRECORD (x, p, lstream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #define LSTREAMP(x) RECORDP (x, lstream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 /* #define CHECK_LSTREAM(x) CHECK_RECORD (x, lstream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 Lstream pointers should never escape to the Lisp level, so
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 functions should not be doing this. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #ifndef EOF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 #define EOF (-1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 typedef enum lstream_buffering
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 /* No buffering. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 LSTREAM_UNBUFFERED,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 /* Buffer until a '\n' character is reached. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 LSTREAM_LINE_BUFFERED,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 /* Buffer in standard-size (i.e. 512-byte) blocks. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 LSTREAM_BLOCK_BUFFERED,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 /* Buffer in blocks of a specified size. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 LSTREAM_BLOCKN_BUFFERED,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 /* Buffer until the stream is closed (only applies to write-only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 streams). Only one call to the stream writer will be made,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 and that is when the stream is closed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 LSTREAM_UNLIMITED
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 } Lstream_buffering;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 /* Methods defining how this stream works. Some may be undefined. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 /* We do not implement the seek/tell paradigm. I tried to do that,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 but getting the semantics right in the presence of buffering is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 extremely tricky and very error-prone and basically not worth it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 This is especially the case with complicated streams like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 decoding streams -- the seek pointer in this case can't be a single
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 integer but has to be a whole complicated structure that records
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 all of the stream's state at the time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 Rewind semantics are generally easy to implement, so we do provide
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 a rewind method. Even rewind() may not be available on a stream,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 however -- e.g. on process output. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 typedef struct lstream_implementation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
77 const char *name;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 size_t size; /* Number of additional bytes to be allocated with this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 stream. Access this data using Lstream_data(). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 /* Read some data from the stream's end and store it into DATA, which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 can hold SIZE bytes. Return the number of bytes read. A return
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 value of 0 means no bytes can be read at this time. This may
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 be because of an EOF, or because there is a granularity greater
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 than one byte that the stream imposes on the returned data, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 SIZE is less than this granularity. (This will happen frequently
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 for streams that need to return whole characters, because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 Lstream_read() calls the reader function repeatedly until it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 has the number of bytes it wants or until 0 is returned.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 The lstream functions do not treat a 0 return as EOF or do
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 anything special; however, the calling function will interpret
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 any 0 it gets back as EOF. This will normally not happen unless
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 the caller calls Lstream_read() with a very small size.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 This function can be NULL if the stream is output-only. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
95 /* The omniscient mly, blinded by the irresistible thrall of Common
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 Lisp, thinks that it is bogus that the types and implementations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 of input and output streams are the same. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 ssize_t (*reader) (Lstream *stream, unsigned char *data, size_t size);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 /* Send some data to the stream's end. Data to be sent is in DATA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 and is SIZE bytes. Return the number of bytes sent. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 function can send and return fewer bytes than is passed in; in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 that case, the function will just be called again until there is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 no data left or 0 is returned. A return value of 0 means that no
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 more data can be currently stored, but there is no error; the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 data will be squirrelled away until the writer can accept
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 data. (This is useful, e.g., of you're dealing with a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 non-blocking file descriptor and are getting EWOULDBLOCK errors.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 This function can be NULL if the stream is input-only. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
109 ssize_t (*writer) (Lstream *stream, const unsigned char *data, size_t size);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 /* Return non-zero if the last write operation on the stream resulted
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 in an attempt to block (EWOULDBLOCK). If this method does not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 exists, the implementation returns 0 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 int (*was_blocked_p) (Lstream *stream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 /* Rewind the stream. If this is NULL, the stream is not seekable. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 int (*rewinder) (Lstream *stream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 /* Indicate whether this stream is seekable -- i.e. it can be rewound.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 This method is ignored if the stream does not have a rewind
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 method. If this method is not present, the result is determined
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 by whether a rewind method is present. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 int (*seekable_p) (Lstream *stream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 /* Perform any additional operations necessary to flush the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 data in this stream. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 int (*flusher) (Lstream *stream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 /* Perform any additional operations necessary to close this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 stream down. May be NULL. This function is called when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 Lstream_close() is called or when the stream is garbage-
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 collected. When this function is called, all pending data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 in the stream will already have been written out. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 int (*closer) (Lstream *stream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 /* Mark this object for garbage collection. Same semantics as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 a standard Lisp_Object marker. This function can be NULL. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 Lisp_Object (*marker) (Lisp_Object lstream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 } Lstream_implementation;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 #define DEFINE_LSTREAM_IMPLEMENTATION(name,c_name,size) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 Lstream_implementation c_name[1] = \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 { { (name), (size) } }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 #define LSTREAM_FL_IS_OPEN 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 #define LSTREAM_FL_READ 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 #define LSTREAM_FL_WRITE 4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 #define LSTREAM_FL_NO_PARTIAL_CHARS 8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 #define LSTREAM_FL_CLOSE_AT_DISKSAVE 16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 struct lstream
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 struct lcrecord_header header;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
148 const Lstream_implementation *imp; /* methods for this stream */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 Lstream_buffering buffering; /* type of buffering in use */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 size_t buffering_size; /* number of bytes buffered */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 unsigned char *in_buffer; /* holds characters read from stream end */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 size_t in_buffer_size; /* allocated size of buffer */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 size_t in_buffer_current; /* number of characters in buffer */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 size_t in_buffer_ind; /* pointer to next character to take from buffer */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 unsigned char *out_buffer; /* holds characters to write to stream end */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 size_t out_buffer_size; /* allocated size of buffer */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 size_t out_buffer_ind; /* pointer to next buffer spot to write a character */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 /* The unget buffer is more or less a stack -- things get pushed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 onto the end and read back from the end. Lstream_read()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 basically reads backwards from the end to get stuff; Lstream_unread()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 similarly has to push the data on backwards. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 unsigned char *unget_buffer; /* holds characters pushed back onto input */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 size_t unget_buffer_size; /* allocated size of buffer */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 size_t unget_buffer_ind; /* pointer to next buffer spot to write a character */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 size_t byte_count;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 long flags; /* Align pointer for 64 bit machines (kny) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 char data[1];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 #define LSTREAM_TYPE_P(lstr, type) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 ((lstr)->imp == lstream_##type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 #ifdef ERROR_CHECK_TYPECHECK
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
178 INLINE_HEADER struct lstream *
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 error_check_lstream_type (struct lstream *stream,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
180 const Lstream_implementation *imp);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
181 INLINE_HEADER struct lstream *
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 error_check_lstream_type (struct lstream *stream,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
183 const Lstream_implementation *imp)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 assert (stream->imp == imp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 return stream;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 # define LSTREAM_TYPE_DATA(lstr, type) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 ((struct type##_stream *) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 Lstream_data (error_check_lstream_type(lstr, lstream_##type)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 # define LSTREAM_TYPE_DATA(lstr, type) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 ((struct type##_stream *) Lstream_data (lstr))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 /* Declare that lstream-type TYPE has method M; used in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 initialization routines */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 #define LSTREAM_HAS_METHOD(type, m) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 (lstream_##type->m = type##_##m)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
202 Lstream *Lstream_new (const Lstream_implementation *imp,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
203 const char *mode);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 void Lstream_reopen (Lstream *lstr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 void Lstream_set_buffering (Lstream *lstr, Lstream_buffering buffering,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 int buffering_size);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 int Lstream_flush (Lstream *lstr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 int Lstream_flush_out (Lstream *lstr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 int Lstream_fputc (Lstream *lstr, int c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 int Lstream_fgetc (Lstream *lstr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 void Lstream_fungetc (Lstream *lstr, int c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 ssize_t Lstream_read (Lstream *lstr, void *data, size_t size);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
213 ssize_t Lstream_write (Lstream *lstr, const void *data, size_t size);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 int Lstream_was_blocked_p (Lstream *lstr);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
215 void Lstream_unread (Lstream *lstr, const void *data, size_t size);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 int Lstream_rewind (Lstream *lstr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 int Lstream_seekable_p (Lstream *lstr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 int Lstream_close (Lstream *lstr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 void Lstream_delete (Lstream *lstr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 void Lstream_set_character_mode (Lstream *str);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 /* Call the function equivalent if the out buffer is full. Otherwise,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 add to the end of the out buffer and, if line buffering is called for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 and the character marks the end of a line, write out the buffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 #define Lstream_putc(stream, c) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 ((stream)->out_buffer_ind >= (stream)->out_buffer_size ? \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 Lstream_fputc (stream, c) : \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 ((stream)->out_buffer[(stream)->out_buffer_ind++] = \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 (unsigned char) (c), \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 (stream)->byte_count++, \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 (stream)->buffering == LSTREAM_LINE_BUFFERED && \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 (stream)->out_buffer[(stream)->out_buffer_ind - 1] == '\n' ? \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 Lstream_flush_out (stream) : 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 /* Retrieve from unget buffer if there are any characters there;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 else retrieve from in buffer if there's anything there;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 else call the function equivalent */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 #define Lstream_getc(stream) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 ((stream)->unget_buffer_ind > 0 ? \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 ((stream)->byte_count++, \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 (stream)->unget_buffer[--(stream)->unget_buffer_ind]) : \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 (stream)->in_buffer_ind < (stream)->in_buffer_current ? \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 ((stream)->byte_count++, \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 (stream)->in_buffer[(stream)->in_buffer_ind++]) : \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 Lstream_fgetc (stream))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 /* Add to the end if it won't overflow buffer; otherwise call the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 function equivalent */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 #define Lstream_ungetc(stream, c) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 ((stream)->unget_buffer_ind >= (stream)->unget_buffer_size ? \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 Lstream_fungetc (stream, c) : \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 (void) ((stream)->byte_count--, \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 ((stream)->unget_buffer[(stream)->unget_buffer_ind++] = \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 (unsigned char) (c))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 #define Lstream_data(stream) ((void *) ((stream)->data))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 #define Lstream_byte_count(stream) ((stream)->byte_count)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 /* working with an Lstream as a stream of Emchars */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 #ifdef MULE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 #ifndef BYTE_ASCII_P
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 #include "mule-charset.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
271 INLINE_HEADER Emchar Lstream_get_emchar (Lstream *stream);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
272 INLINE_HEADER Emchar
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 Lstream_get_emchar (Lstream *stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 int c = Lstream_getc (stream);
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
276 return (c < 0x80 /* c == EOF || BYTE_ASCII_P (c) */
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
277 ? (Emchar) c
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
278 : Lstream_get_emchar_1 (stream, c));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
281 INLINE_HEADER int Lstream_put_emchar (Lstream *stream, Emchar ch);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
282 INLINE_HEADER int
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 Lstream_put_emchar (Lstream *stream, Emchar ch)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 return CHAR_ASCII_P (ch) ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 Lstream_putc (stream, ch) :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 Lstream_fput_emchar (stream, ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
290 INLINE_HEADER void Lstream_unget_emchar (Lstream *stream, Emchar ch);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
291 INLINE_HEADER void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 Lstream_unget_emchar (Lstream *stream, Emchar ch)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 if (CHAR_ASCII_P (ch))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 Lstream_ungetc (stream, ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 Lstream_funget_emchar (stream, ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 #else /* not MULE */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 # define Lstream_get_emchar(stream) Lstream_getc (stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 # define Lstream_put_emchar(stream, ch) Lstream_putc (stream, ch)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 # define Lstream_unget_emchar(stream, ch) Lstream_ungetc (stream, ch)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 #endif /* not MULE */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 /* Lstream implementations */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 /* Flags we can pass to the filedesc and stdio streams. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 /* If set, close the descriptor or FILE * when the stream is closed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 #define LSTR_CLOSING 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 /* If set, allow quitting out of the actual I/O. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 #define LSTR_ALLOW_QUIT 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 /* If set and filedesc_stream_set_pty_flushing() has been called
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 on the stream, do not send more than pty_max_bytes on a single
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 line without flushing the data out using the eof_char. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 #define LSTR_PTY_FLUSHING 4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 /* If set, an EWOULDBLOCK error is not treated as an error but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 simply causes the write function to return 0 as the number
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 of bytes written out. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 #define LSTR_BLOCKED_OK 8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 Lisp_Object make_stdio_input_stream (FILE *stream, int flags);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 Lisp_Object make_stdio_output_stream (FILE *stream, int flags);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 Lisp_Object make_filedesc_input_stream (int filedesc, int offset, int count,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 int flags);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 Lisp_Object make_filedesc_output_stream (int filedesc, int offset, int count,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 int flags);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 void filedesc_stream_set_pty_flushing (Lstream *stream,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 int pty_max_bytes,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 Bufbyte eof_char);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 int filedesc_stream_fd (Lstream *stream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 Lisp_Object make_lisp_string_input_stream (Lisp_Object string,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 Bytecount offset,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 Bytecount len);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
343 Lisp_Object make_fixed_buffer_input_stream (const void *buf, size_t size);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
344 Lisp_Object make_fixed_buffer_output_stream (void *buf, size_t size);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
345 const unsigned char *fixed_buffer_input_stream_ptr (Lstream *stream);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 unsigned char *fixed_buffer_output_stream_ptr (Lstream *stream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 Lisp_Object make_resizing_buffer_output_stream (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 unsigned char *resizing_buffer_stream_ptr (Lstream *stream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 Lisp_Object make_dynarr_output_stream (unsigned_char_dynarr *dyn);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 #define LSTR_SELECTIVE 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 #define LSTR_IGNORE_ACCESSIBLE 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 Lisp_Object make_lisp_buffer_input_stream (struct buffer *buf, Bufpos start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 Bufpos end, int flags);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 Lisp_Object make_lisp_buffer_output_stream (struct buffer *buf, Bufpos pos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 int flags);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 Bufpos lisp_buffer_stream_startpos (Lstream *stream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
358 #endif /* INCLUDED_lstream_h_ */