Mercurial > hg > xemacs-beta
comparison src/lstream.c @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | 441bb1e64a06 |
children | 54cc21c15cbb |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
280 } | 280 } |
281 | 281 |
282 static void | 282 static void |
283 signal_simple_internal_error (CONST char *reason, Lisp_Object obj) | 283 signal_simple_internal_error (CONST char *reason, Lisp_Object obj) |
284 { | 284 { |
285 #ifdef DEBUG_XEMACS | |
286 abort (); | |
287 #else | |
285 signal_simple_error (reason, obj); | 288 signal_simple_error (reason, obj); |
289 #endif | |
286 } | 290 } |
287 | 291 |
288 void | 292 void |
289 Lstream_reopen (Lstream *lstr) | 293 Lstream_reopen (Lstream *lstr) |
290 { | 294 { |
684 } | 688 } |
685 | 689 |
686 static int | 690 static int |
687 Lstream_pseudo_close (Lstream *lstr) | 691 Lstream_pseudo_close (Lstream *lstr) |
688 { | 692 { |
689 int rc; | |
690 | |
691 if (!lstr->flags & LSTREAM_FL_IS_OPEN) | 693 if (!lstr->flags & LSTREAM_FL_IS_OPEN) |
692 { | 694 { |
693 Lisp_Object obj = Qnil; | 695 Lisp_Object obj = Qnil; |
694 XSETLSTREAM (obj, lstr); | 696 XSETLSTREAM (obj, lstr); |
695 signal_simple_internal_error | 697 signal_simple_internal_error |
696 ("Internal error: lstream is not open", obj); | 698 ("Internal error: lstream is not open", obj); |
697 } | 699 } |
698 | 700 |
699 /* don't check errors here -- best not to risk file descriptor loss */ | 701 /* don't check errors here -- best not to risk file descriptor loss */ |
700 rc = Lstream_flush (lstr); | 702 Lstream_flush (lstr); |
701 | 703 |
702 return rc; | 704 return 0; |
703 } | 705 } |
704 | 706 |
705 int | 707 int |
706 Lstream_close (Lstream *lstr) | 708 Lstream_close (Lstream *lstr) |
707 { | 709 { |
708 int rc = 0; | |
709 | |
710 if (lstr->flags & LSTREAM_FL_IS_OPEN) | 710 if (lstr->flags & LSTREAM_FL_IS_OPEN) |
711 { | 711 { |
712 /* don't return here on error, or file descriptor leak will result. */ | 712 /* don't return here on error, or file descriptor leak will result. */ |
713 rc = Lstream_pseudo_close (lstr); | 713 Lstream_pseudo_close (lstr); |
714 if (lstr->imp->closer) | 714 if (lstr->imp->closer) |
715 { | 715 { |
716 if ((lstr->imp->closer) (lstr) < 0) | 716 if ((lstr->imp->closer) (lstr) < 0) |
717 return -1; | 717 return -1; |
718 } | 718 } |
741 { | 741 { |
742 xfree (lstr->unget_buffer); | 742 xfree (lstr->unget_buffer); |
743 lstr->unget_buffer = 0; | 743 lstr->unget_buffer = 0; |
744 } | 744 } |
745 | 745 |
746 return rc; | 746 return 0; |
747 } | 747 } |
748 | 748 |
749 int | 749 int |
750 Lstream_fputc (Lstream *lstr, int c) | 750 Lstream_fputc (Lstream *lstr, int c) |
751 { | 751 { |
886 Bufbyte eof_char; | 886 Bufbyte eof_char; |
887 int starting_pos; | 887 int starting_pos; |
888 int current_pos; | 888 int current_pos; |
889 int end_pos; | 889 int end_pos; |
890 int chars_sans_newline; | 890 int chars_sans_newline; |
891 unsigned int closing :1; | 891 int closing :1; |
892 unsigned int allow_quit :1; | 892 int allow_quit :1; |
893 unsigned int blocked_ok :1; | 893 int blocked_ok :1; |
894 unsigned int pty_flushing :1; | 894 int pty_flushing :1; |
895 unsigned int blocking_error_p :1; | 895 int blocking_error_p :1; |
896 }; | 896 }; |
897 | 897 |
898 #define FILEDESC_STREAM_DATA(stream) LSTREAM_TYPE_DATA (stream, filedesc) | 898 #define FILEDESC_STREAM_DATA(stream) LSTREAM_TYPE_DATA (stream, filedesc) |
899 | 899 |
900 DEFINE_LSTREAM_IMPLEMENTATION ("filedesc", lstream_filedesc, | 900 DEFINE_LSTREAM_IMPLEMENTATION ("filedesc", lstream_filedesc, |