comparison src/lstream.c @ 263:727739f917cb r20-5b30

Import from CVS: tag r20-5b30
author cvs
date Mon, 13 Aug 2007 10:24:41 +0200
parents f955c73f5258
children c5d627a313b1
comparison
equal deleted inserted replaced
262:9d8607af9e13 263:727739f917cb
527 break; 527 break;
528 } 528 }
529 return i == 0 ? -1 : 0; 529 return i == 0 ? -1 : 0;
530 } 530 }
531 531
532 int
533 Lstream_was_blocked_p (Lstream *lstr)
534 {
535 if (lstr->imp->was_blocked_p)
536 return (lstr->imp->was_blocked_p) (lstr);
537 else
538 return 0;
539 }
540
532 static int 541 static int
533 Lstream_raw_read (Lstream *lstr, unsigned char *buffer, int size) 542 Lstream_raw_read (Lstream *lstr, unsigned char *buffer, int size)
534 { 543 {
535 if (! (lstr->flags & LSTREAM_FL_IS_OPEN)) 544 if (! (lstr->flags & LSTREAM_FL_IS_OPEN))
536 { 545 {
1168 return close (str->fd); 1177 return close (str->fd);
1169 else 1178 else
1170 return 0; 1179 return 0;
1171 } 1180 }
1172 1181
1182 static int
1183 filedesc_was_blocked_p (Lstream *stream)
1184 {
1185 struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream);
1186 return str->blocking_error_p;
1187 }
1188
1173 void 1189 void
1174 filedesc_stream_set_pty_flushing (Lstream *stream, int pty_max_bytes, 1190 filedesc_stream_set_pty_flushing (Lstream *stream, int pty_max_bytes,
1175 Bufbyte eof_char) 1191 Bufbyte eof_char)
1176 { 1192 {
1177 struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream); 1193 struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream);
1178 str->pty_max_bytes = pty_max_bytes; 1194 str->pty_max_bytes = pty_max_bytes;
1179 str->eof_char = eof_char; 1195 str->eof_char = eof_char;
1196 str->pty_flushing = 1;
1180 } 1197 }
1181 1198
1182 int 1199 int
1183 filedesc_stream_was_blocked (Lstream *stream) 1200 filedesc_stream_fd (Lstream *stream)
1184 { 1201 {
1185 struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream); 1202 struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream);
1186 return str->blocking_error_p; 1203 return str->fd;
1187 } 1204 }
1188 1205
1189 /*********** read from a Lisp string ***********/ 1206 /*********** read from a Lisp string ***********/
1190 1207
1191 #define LISP_STRING_STREAM_DATA(stream) LSTREAM_TYPE_DATA (stream, lisp_string) 1208 #define LISP_STRING_STREAM_DATA(stream) LSTREAM_TYPE_DATA (stream, lisp_string)
1705 LSTREAM_HAS_METHOD (stdio, flusher); 1722 LSTREAM_HAS_METHOD (stdio, flusher);
1706 LSTREAM_HAS_METHOD (stdio, closer); 1723 LSTREAM_HAS_METHOD (stdio, closer);
1707 1724
1708 LSTREAM_HAS_METHOD (filedesc, reader); 1725 LSTREAM_HAS_METHOD (filedesc, reader);
1709 LSTREAM_HAS_METHOD (filedesc, writer); 1726 LSTREAM_HAS_METHOD (filedesc, writer);
1727 LSTREAM_HAS_METHOD (filedesc, was_blocked_p);
1710 LSTREAM_HAS_METHOD (filedesc, rewinder); 1728 LSTREAM_HAS_METHOD (filedesc, rewinder);
1711 LSTREAM_HAS_METHOD (filedesc, seekable_p); 1729 LSTREAM_HAS_METHOD (filedesc, seekable_p);
1712 LSTREAM_HAS_METHOD (filedesc, closer); 1730 LSTREAM_HAS_METHOD (filedesc, closer);
1713 1731
1714 LSTREAM_HAS_METHOD (lisp_string, reader); 1732 LSTREAM_HAS_METHOD (lisp_string, reader);