Bug Summary

File:stlport/unxlngi6.pro/misc/build/STLport-4.5/src/../stlport/stl/_istream.c
Location:line 851, column 9
Description:Value stored to '__done' is never read

Annotated Source Code

1/*
2 * Copyright (c) 1999
3 * Silicon Graphics Computer Systems, Inc.
4 *
5 * Copyright (c) 1999
6 * Boris Fomitchev
7 *
8 * This material is provided "as is", with absolutely no warranty expressed
9 * or implied. Any use is at your own risk.
10 *
11 * Permission to use or copy this software for any purpose is hereby granted
12 * without fee, provided the above notices are retained on all copies.
13 * Permission to modify the code and to distribute modified code is granted,
14 * provided the above notices are retained, and a notice that the code was
15 * modified is included with the above copyright notice.
16 *
17 */
18#ifndef _STLP_ISTREAM_C
19#define _STLP_ISTREAM_C
20
21# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION1)
22
23#ifndef _STLP_LIMITS_H
24# include <stl/_limits.h>
25#endif
26
27#ifndef _STLP_INTERNAL_NUM_GET_H
28# include <stl/_num_get.h>
29#endif
30
31# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
32// no wchar_t is supported for this mode
33# define __BIS_int_type__ int
34# define __BIS_pos_type__ streampos
35# define __BIS_off_type__ streamoff
36# else
37# define __BIS_int_type__ _STLP_TYPENAME_ON_RETURN_TYPEtypename basic_istream<_CharT, _Traits>::int_type
38# define __BIS_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPEtypename basic_istream<_CharT, _Traits>::pos_type
39# define __BIS_off_type__ _STLP_TYPENAME_ON_RETURN_TYPEtypename basic_istream<_CharT, _Traits>::off_type
40# endif
41
42_STLP_BEGIN_NAMESPACEnamespace _STL {
43
44//----------------------------------------------------------------------
45// Function object structs used by some member functions.
46
47template <class _Traits>
48struct _Is_not_wspace {
49 typedef typename _Traits::char_type argument_type;
50 typedef bool result_type;
51
52 const ctype<argument_type>* _M_ctype;
53
54 _Is_not_wspace(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
55 bool operator()(argument_type __c) const
56 { return !_M_ctype->is(ctype_base::space, __c); }
57};
58
59template <class _Traits>
60struct _Is_wspace_null {
61 typedef typename _Traits::char_type argument_type;
62 typedef bool result_type;
63
64 const ctype<argument_type>* _M_ctype;
65
66 _Is_wspace_null(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
67 bool operator()(argument_type __c) const {
68 return _Traits::eq(__c, argument_type()) ||
69 _M_ctype->is(ctype_base::space, __c);
70 }
71};
72
73template <class _Traits>
74struct _Scan_for_wspace {
75 typedef typename _Traits::char_type char_type;
76 typedef char_type* first_argument_type;
77 typedef char_type* second_argument_type;
78 typedef char_type* result_type;
79
80 const ctype<char_type>* _M_ctype;
81
82 _Scan_for_wspace(const ctype<char_type>* __ctype) : _M_ctype(__ctype) {}
83 const char_type*
84 operator()(const char_type* __first, const char_type* __last) const {
85 return _M_ctype->scan_is(ctype_base::space, __first, __last);
86 }
87};
88
89template <class _Traits>
90struct _Scan_wspace_null {
91 typedef typename _Traits::char_type char_type;
92 typedef char_type* first_argument_type;
93 typedef char_type* second_argument_type;
94 typedef char_type* result_type;
95
96 const ctype<char_type>* _M_ctype;
97
98 _Scan_wspace_null(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
99 const char_type*
100 operator()(const char_type* __first, const char_type* __last) const {
101 __last = find_if(__first, __last,
102 _Eq_char_bound<_Traits>(char_type()));
103 return _M_ctype->scan_is(ctype_base::space, __first, __last);
104 }
105};
106
107template <class _Traits>
108struct _Scan_for_not_wspace {
109 typedef typename _Traits::char_type char_type;
110 typedef char_type* first_argument_type;
111 typedef char_type* second_argument_type;
112 typedef char_type* result_type;
113
114 const ctype<char_type>* _M_ctype;
115
116 _Scan_for_not_wspace(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
117 const char_type*
118 operator()(const char_type* __first, const char_type* __last) const {
119 return _M_ctype->scan_not(ctype_base::space, __first, __last);
120 }
121};
122
123template <class _Traits>
124struct _Scan_for_char_val
125{
126 typedef typename _Traits::char_type char_type;
127 typedef char_type* first_argument_type;
128 typedef char_type* second_argument_type;
129 typedef char_type* result_type;
130
131 char_type _M_val;
132
133 _Scan_for_char_val(char_type __value) : _M_val(__value) {}
134
135 const char_type*
136 operator()(const char_type* __first, const char_type* __last) const {
137 return find_if(__first, __last, _Eq_char_bound<_Traits>(_M_val));
138 }
139};
140
141template <class _Traits>
142struct _Scan_for_int_val
143{
144 typedef typename _Traits::char_type char_type;
145 typedef typename _Traits::int_type int_type;
146 typedef char_type* first_argument_type;
147 typedef char_type* second_argument_type;
148 typedef char_type* result_type;
149
150 int_type _M_val;
151
152 _Scan_for_int_val(int_type __value) : _M_val(__value) {}
153
154 const char_type*
155 operator()(const char_type* __first, const char_type* __last) const {
156 return find_if(__first, __last,
157 _Eq_int_bound<_Traits>(_M_val));
158 }
159};
160
161// Helper function: try to push back a character to a streambuf,
162// return true if the pushback succeeded. Does not throw.
163
164template <class _CharT, class _Traits>
165bool _STLP_CALL
166__pushback(basic_streambuf<_CharT, _Traits>* __buf, _CharT __c)
167{
168 bool ret;
169 _STLP_TRYtry {
170 const typename _Traits::int_type __eof = _Traits::eof();
171 ret = !_Traits::eq_int_type(__buf->sputbackc(__c), __eof);
172 }
173 _STLP_CATCH_ALLcatch(...) {
174 ret = false;
175 }
176 return ret;
177}
178
179template <class _CharT, class _Traits>
180basic_istream<_CharT, _Traits>& _STLP_CALL
181ws(basic_istream<_CharT, _Traits>& __is)
182{
183 typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
184 _Sentry __sentry(__is, _No_Skip_WS()); // Don't skip whitespace.
185 if (__sentry)
186 __is._M_skip_whitespace(false);
187 return __is;
188}
189
190// Helper functions for istream<>::sentry constructor.
191template <class _CharT, class _Traits>
192bool
193_M_init_skip(basic_istream<_CharT, _Traits>& __is) {
194 if (__is.good()) {
195 if (__is.tie())
196 __is.tie()->flush();
197
198 __is._M_skip_whitespace(true);
199 }
200
201 if (!__is.good()) {
202 __is.setstate(ios_base::failbit);
203 return false;
204 } else
205 return true;
206}
207
208template <class _CharT, class _Traits>
209bool
210_M_init_noskip(basic_istream<_CharT, _Traits>& __is){
211 if (__is.good()) {
212 if (__is.tie())
213 __is.tie()->flush();
214
215 if (!__is.rdbuf())
216 __is.setstate(ios_base::badbit);
217 }
218 else
219 __is.setstate(ios_base::failbit);
220 return __is.good();
221}
222
223//----------------------------------------------------------------------
224// Definitions of basic_istream<>'s noninline member functions.
225
226// Helper function for formatted input of numbers.
227template <class _CharT, class _Traits, class _Number>
228ios_base::iostate _STLP_CALL
229_M_get_num(basic_istream<_CharT, _Traits>& __that, _Number& __val)
230{
231 typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
232 ios_base::iostate __err = 0;
233 _Sentry __sentry( __that ); // Skip whitespace.
234 if (__sentry) {
235 typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > _Num_get;
236 _STLP_TRYtry {
237 ((const _Num_get&)use_facet<_Num_get>(__that.getloc())).get(istreambuf_iterator<_CharT, _Traits>(__that.rdbuf()),
238 0, __that, __err, __val);
239 }
240 _STLP_CATCH_ALLcatch(...) {
241 __that._M_handle_exception(ios_base::badbit);
242 }
243 if (__err) __that.setstate(__err);
244 }
245 return __err;
246}
247
248
249// Unformatted input
250
251template <class _CharT, class _Traits>
252__BIS_int_type__
253basic_istream<_CharT, _Traits>::peek()
254{
255 typename _Traits::int_type __tmp = _Traits::eof();
256
257 this->_M_gcount = 0;
258 sentry __sentry(*this, _No_Skip_WS());
259
260 if (__sentry) {
261 _STLP_TRYtry {
262 __tmp = this->rdbuf()->sgetc();
263 }
264 _STLP_CATCH_ALLcatch(...) {
265 this->_M_handle_exception(ios_base::badbit);
266 }
267 if (this->_S_eof(__tmp))
268 this->setstate(ios_base::eofbit);
269 }
270
271 return __tmp;
272}
273
274
275template <class _CharT, class _Traits>
276__BIS_int_type__
277basic_istream<_CharT, _Traits>::get()
278{
279 typename _Traits::int_type __tmp = _Traits::eof();
280 sentry __sentry(*this, _No_Skip_WS());
281 this->_M_gcount = 0;
282
283 if (__sentry) {
284 _STLP_TRYtry {
285 __tmp = this->rdbuf()->sbumpc();
286 }
287 _STLP_CATCH_ALLcatch(...) {
288 this->_M_handle_exception(ios_base::badbit);
289 }
290
291 if (!this->_S_eof(__tmp))
292 this->_M_gcount = 1;
293 }
294
295 if (_M_gcount == 0)
296 this->setstate(ios_base::eofbit | ios_base::failbit);
297
298 return __tmp;
299}
300
301template <class _CharT, class _Traits>
302basic_istream<_CharT, _Traits>&
303basic_istream<_CharT, _Traits>::get(_CharT& __c)
304{
305 sentry __sentry(*this, _No_Skip_WS());
306 this->_M_gcount = 0;
307
308 if (__sentry) {
309 typename _Traits::int_type __tmp = _Traits::eof();
310 _STLP_TRYtry {
311 __tmp = this->rdbuf()->sbumpc();
312 }
313 _STLP_CATCH_ALLcatch(...) {
314 this->_M_handle_exception(ios_base::badbit);
315 }
316
317 if (!this->_S_eof(__tmp)) {
318 this->_M_gcount = 1;
319 __c = _Traits::to_char_type(__tmp);
320 }
321 }
322
323 if (this->_M_gcount == 0)
324 this->setstate(ios_base::eofbit | ios_base::failbit);
325
326 return *this;
327}
328
329
330
331// Read characters and discard them. The standard specifies a single
332// function with two arguments, each with a default. We instead use
333// three overloded functions, because it's possible to implement the
334// first two more efficiently than the fully general third version.
335template <class _CharT, class _Traits>
336basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore()
337{
338 sentry __sentry(*this, _No_Skip_WS());
339 this->_M_gcount = 0;
340
341 if (__sentry) {
342 int_type __c;
343 _STLP_TRYtry {
344 __c = this->rdbuf()->sbumpc();
345 }
346 _STLP_CATCH_ALLcatch(...) {
347 this->_M_handle_exception(ios_base::badbit);
348 return *this;
349 }
350
351 if (!this->_S_eof(__c))
352 this->_M_gcount = 1;
353 else
354 this->setstate(ios_base::eofbit);
355 }
356
357 return *this;
358}
359
360// Putback
361
362template <class _CharT, class _Traits>
363basic_istream<_CharT, _Traits>&
364basic_istream<_CharT, _Traits>::putback(_CharT __c) {
365 this->_M_gcount = 0;
366 sentry __sentry(*this, _No_Skip_WS());
367
368 if (__sentry) {
369 typename _Traits::int_type __tmp = _Traits::eof();
370 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
371// if (!__buf || this->_S_eof(__buf->sputbackc(__c)))
372 if (__buf) {
373 _STLP_TRYtry {
374 __tmp = __buf->sputbackc(__c);
375 }
376 _STLP_CATCH_ALLcatch(...) {
377 this->_M_handle_exception(ios_base::badbit);
378 }
379 }
380 if (this->_S_eof(__tmp))
381 this->setstate(ios_base::badbit);
382 }
383 else
384 this->setstate(ios_base::failbit);
385
386 return *this;
387}
388
389template <class _CharT, class _Traits>
390basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() {
391 this->_M_gcount = 0;
392
393 sentry __sentry(*this, _No_Skip_WS());
394
395 if (__sentry) {
396 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
397 // if (!__buf || _Traits::eq_int_type(__buf->sungetc(), _Traits::eof()))
398 if (__buf) {
399 _STLP_TRYtry {
400 _CharT __tmp;
401 __tmp = __buf->sungetc();
402 if (this->_S_eof(__tmp))
403 this->setstate(ios_base::badbit);
404 }
405 _STLP_CATCH_ALLcatch(...) {
406 this->_M_handle_exception(ios_base::badbit);
407 }
408 } else
409 this->setstate(ios_base::badbit);
410 }
411 else
412 this->setstate(ios_base::failbit);
413
414 return *this;
415}
416
417// Positioning and buffer control.
418
419template <class _CharT, class _Traits>
420int basic_istream<_CharT, _Traits>::sync() {
421 sentry __sentry(*this, _No_Skip_WS());
422
423 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
424 if (__buf) {
425 if (__buf->pubsync() == -1) {
426 this->setstate(ios_base::badbit);
427 return -1;
428 }
429 else
430 return 0;
431 }
432 else
433 return -1;
434}
435
436template <class _CharT, class _Traits>
437__BIS_pos_type__
438basic_istream<_CharT, _Traits>::tellg() {
439 // sentry __sentry(*this, _No_Skip_WS());
440 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
441 return (__buf && !this->fail()) ? __buf->pubseekoff(0, ios_base::cur, ios_base::in)
442 : pos_type(-1);
443}
444
445template <class _CharT, class _Traits>
446basic_istream<_CharT, _Traits>&
447basic_istream<_CharT, _Traits>::seekg(pos_type __pos) {
448 sentry __sentry(*this, _No_Skip_WS());
449
450 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
451 if (!this->fail() && __buf)
452 __buf->pubseekpos(__pos, ios_base::in);
453 return *this;
454}
455
456template <class _CharT, class _Traits>
457basic_istream<_CharT, _Traits>&
458basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
459{
460 sentry __sentry(*this, _No_Skip_WS());
461
462 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
463 if (!this->fail() && __buf)
464 __buf->pubseekoff(__off, __dir, ios_base::in);
465 return *this;
466}
467
468// Formatted input of characters and character arrays.
469
470template <class _CharT, class _Traits>
471void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT& __c)
472{
473// typename _Traits::int_type __tmp = _Traits::eof();
474
475 sentry __sentry(*this); // Skip whitespace.
476
477 if (__sentry) {
478 typename _Traits::int_type __tmp = _Traits::eof();
479
480 _STLP_TRYtry {
481 __tmp = this->rdbuf()->sbumpc();
482 }
483 _STLP_CATCH_ALLcatch(...) {
484 this->_M_handle_exception(ios_base::badbit);
485 return;
486 }
487
488 if (!this->_S_eof(__tmp))
489 __c = _Traits::to_char_type(__tmp);
490 else
491 this->setstate(ios_base::eofbit | ios_base::failbit);
492 }
493}
494
495
496//---------------------------------------------------------------------------
497// istream's helper functions.
498
499// A generic function for unbuffered input. We stop when we reach EOF,
500// or when we have extracted _Num characters, or when the function object
501// __is_delim return true. In the last case, it extracts the character
502// for which __is_delim is true, if and only if __extract_delim is true.
503// It appends a null character to the end of the string; this means that
504// it may store up to _Num + 1 characters.
505//
506// __is_getline governs two corner cases: reading _Num characters without
507// encountering delim or eof (in which case failbit is set if __is_getline
508// is true); and reading _Num characters where the _Num+1'st character is
509// eof (in which case eofbit is set if __is_getline is true).
510//
511// It is assumed that __is_delim never throws.
512//
513// Return value is the number of characters extracted, including the
514// delimiter if it is extracted. Note that the number of characaters
515// extracted isn't necessarily the same as the number stored.
516
517template < class _CharT, class _Traits, class _Is_Delim>
518streamsize _STLP_CALL
519_M_read_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
520 streamsize _Num, _CharT* __s,
521 _Is_Delim __is_delim,
522 bool __extract_delim, bool __append_null,
523 bool __is_getline)
524{
525 streamsize __n = 0;
526 ios_base::iostate __status = 0;
527
528 typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
529 // The operations that can potentially throw are sbumpc, snextc, and sgetc.
530 _STLP_TRYtry {
531 int_type __c = __buf->sgetc();
532 while (true) {
533 if (__that->_S_eof(__c)) {
534 if (__n < _Num || __is_getline)
535 __status |= ios_base::eofbit;
536 break;
537 }
538
539 else if (__is_delim(__c)) {
540 if (__extract_delim) { // Extract and discard current character.
541 __buf->sbumpc();
542 ++__n;
543 }
544 break;
545 }
546
547 else if (__n == _Num) {
548 if (__is_getline)
549 __status |= ios_base::failbit;
550 break;
551 }
552
553 *__s++ = _Traits::to_char_type(__c);
554 ++__n;
555 __c = __buf->snextc();
556 }
557 }
558 _STLP_CATCH_ALLcatch(...) {
559 __that->_M_handle_exception(ios_base::badbit);
560 *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT)_CharT();
561 return __n;
562 }
563
564 if (__append_null)
565 *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT)_CharT();
566 if (__status)
567 __that->setstate(__status); // This might throw.
568 return __n;
569}
570
571// Much like _M_read_unbuffered, but with one additional function object:
572// __scan_delim(first, last) returns the first pointer p in [first, last)
573// such that __is_delim(p) is true.
574
575template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
576streamsize _STLP_CALL
577_M_read_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
578 streamsize _Num, _CharT* __s,
579 _Is_Delim __is_delim, _Scan_Delim __scan_delim,
580 bool __extract_delim, bool __append_null,
581 bool __is_getline)
582{
583 streamsize __n = 0;
584 ios_base::iostate __status = 0;
585 bool __done = false;
586
587 _STLP_TRYtry {
588 while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
589 const _CharT* __first = __buf->_M_gptr();
590 const _CharT* __last = __buf->_M_egptr();
591 ptrdiff_t __request = _Num - __n;
592
593 const _CharT* __p = __scan_delim(__first, __last);
594 ptrdiff_t __chunk = (min) (ptrdiff_t(__p - __first), __request);
595 _Traits::copy(__s, __first, __chunk);
596 __s += __chunk;
597 __n += __chunk;
598 __buf->_M_gbump((int)__chunk);
599
600 // We terminated by finding delim.
601 if (__p != __last && __p - __first <= __request) {
602 if (__extract_delim) {
603 __n += 1;
604 __buf->_M_gbump(1);
605 }
606 __done = true;
607 }
608
609 // We terminated by reading all the characters we were asked for.
610 else if(__n == _Num) {
611
612 // Find out if we have reached eof. This matters for getline.
613 if (__is_getline) {
614 if (__chunk == __last - __first) {
615 if (__that->_S_eof(__buf->sgetc()))
616 __status |= ios_base::eofbit;
617 }
618 else
619 __status |= ios_base::failbit;
620 }
621 __done = true;
622 }
623
624 // The buffer contained fewer than _Num - __n characters. Either we're
625 // at eof, or we should refill the buffer and try again.
626 else {
627 if (__that->_S_eof(__buf->sgetc())) {
628 __status |= ios_base::eofbit;
629 __done = true;
630 }
631 }
632 } // Close the while loop.
633 }
634 _STLP_CATCH_ALLcatch(...) {
635 __that->_M_handle_exception(ios_base::badbit);
636 __done = true;
637 }
638
639 if (__done) {
640 if (__append_null)
641 *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT)_CharT();
642 if (__status != 0)
643 __that->setstate(__status); // This might throw.
644 return __n;
645 }
646
647 // If execution has reached this point, then we have an empty buffer but
648 // we have not reached eof. What that means is that the streambuf has
649 // decided to switch from buffered to unbuffered input. We switch to
650 // to _M_read_unbuffered.
651
652 return __n + _M_read_unbuffered(__that, __buf, _Num - __n, __s, __is_delim,
653 __extract_delim,__append_null,__is_getline);
654}
655
656
657
658
659template <class _CharT, class _Traits>
660basic_istream<_CharT, _Traits>&
661basic_istream<_CharT, _Traits>::get(_CharT* __s, streamsize __n,
662 _CharT __delim) {
663 sentry __sentry(*this, _No_Skip_WS());
664 this->_M_gcount = 0;
665
666 if (__sentry) {
667 if (__n > 0) {
668 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
669
670 if (__buf->egptr() != __buf->gptr())
671 this->_M_gcount =
672 _M_read_buffered(this, __buf, __n - 1, __s,
673 _Eq_char_bound<_Traits>(__delim),
674 _Scan_for_char_val<_Traits>(__delim),
675 false, true, false);
676 else
677 this->_M_gcount =
678 _M_read_unbuffered(this, __buf, __n - 1, __s,
679 _Eq_char_bound<_Traits>(__delim),
680 false, true, false);
681 }
682 }
683
684 if (this->_M_gcount == 0)
685 this->setstate(ios_base::failbit);
686
687 return *this;
688}
689
690// Getline is essentially identical to get, except that it extracts
691// the delimiter.
692template <class _CharT, class _Traits>
693basic_istream<_CharT, _Traits>&
694basic_istream<_CharT, _Traits>::getline(_CharT* __s, streamsize __n,
695 _CharT __delim) {
696 sentry __sentry(*this, _No_Skip_WS());
697 this->_M_gcount = 0;
698
699 if (__sentry) {
700 if (__n > 0) {
701 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
702 this->_M_gcount = __buf->egptr() != __buf->gptr()
703 ? _M_read_buffered(this, __buf, __n - 1, __s,
704 _Eq_char_bound<_Traits>(__delim),
705 _Scan_for_char_val<_Traits>(__delim),
706 true, true, true)
707 : _M_read_unbuffered(this, __buf, __n - 1, __s,
708 _Eq_char_bound<_Traits>(__delim),
709 true, true, true);
710 }
711 }
712
713 if (this->_M_gcount == 0)
714 this->setstate(ios_base::failbit);
715
716 return *this;
717}
718
719// Read n characters. We don't look for any delimiter, and we don't
720// put in a terminating null character.
721template <class _CharT, class _Traits>
722basic_istream<_CharT, _Traits>&
723basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
724{
725 sentry __sentry(*this, _No_Skip_WS());
726 this->_M_gcount = 0;
727
728 if (__sentry && !this->eof()) {
729 basic_streambuf<_CharT, _Traits>*__buf = this->rdbuf();
730 if (__buf->gptr() != __buf->egptr())
731 _M_gcount
732 = _M_read_buffered(this, __buf, __n, __s,
733 _Constant_unary_fun<bool, int_type>(false),
734 _Project2nd<const _CharT*, const _CharT*>(),
735 false, false, false);
736 else
737 _M_gcount
738 = _M_read_unbuffered(this, __buf, __n, __s,
739 _Constant_unary_fun<bool, int_type>(false),
740 false, false, false);
741 }
742 else
743 this->setstate(ios_base::failbit);
744
745 if (this->eof())
746 this->setstate(ios_base::eofbit | ios_base::failbit);
747
748 return *this;
749}
750
751
752// Read n or fewer characters. We don't look for any delimiter, and
753// we don't put in a terminating null character.
754template <class _CharT, class _Traits>
755streamsize
756basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __nmax)
757{
758 sentry __sentry(*this, _No_Skip_WS());
759 this->_M_gcount = 0;
760
761 if (__sentry && !this->eof() && __nmax >= 0) {
762
763 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
764 streamsize __avail = __buf->in_avail();
765
766 // fbp : isn't full-blown setstate required here ?
767 if (__avail == -1)
768 this->_M_setstate_nothrow(ios_base::eofbit);
769
770 else if (__avail != 0) {
771
772 if (__buf->gptr() != __buf->egptr())
773 _M_gcount
774 = _M_read_buffered(this, __buf, (min) (__avail, __nmax), __s,
775 _Constant_unary_fun<bool, int_type>(false),
776 _Project2nd<const _CharT*, const _CharT*>(),
777 false, false, false);
778 else
779 _M_gcount
780 = _M_read_unbuffered(this, __buf, (min) (__avail, __nmax), __s,
781 _Constant_unary_fun<bool, int_type>(false),
782 false, false, false);
783 }
784 }
785 else {
786 // fbp : changed so that failbit is set only there, to pass Dietmar's test
787 if (this->eof())
788 this->setstate(ios_base::eofbit | ios_base::failbit);
789 else
790 this->setstate(ios_base::failbit);
791 }
792
793 // if (this->eof())
794 // this->setstate(ios_base::eofbit | ios_base::failbit);
795
796 return _M_gcount;
797}
798
799template <class _CharT, class _Traits>
800void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT* __s)
801{
802 sentry __sentry(*this); // Skip whitespace.
803
804 if (__sentry) {
805 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
806 streamsize __nmax = this->width() > 0
807 ? this->width() - 1
808 : (numeric_limits<streamsize>::max)() / sizeof(_CharT) - 1;
809
810 streamsize __n = __buf->gptr() != __buf->egptr()
811 ? _M_read_buffered(this, __buf, __nmax, __s,
812 _Is_wspace_null<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
813 _Scan_wspace_null<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
814 false, true, false)
815 : _M_read_unbuffered(this, __buf, __nmax, __s,
816 _Is_wspace_null<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
817 false, true, false);
818 if (__n == 0)
819 this->setstate(ios_base::failbit);
820 }
821 this->width(0);
822}
823
824// A generic unbuffered function for ignoring characters. We stop
825// when we reach EOF, or when the function object __is_delim returns
826// true. In the last case, it extracts the character for which
827// __is_delim is true, if and only if __extract_delim is true.
828
829template < class _CharT, class _Traits, class _Is_Delim>
830void _STLP_CALL
831_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
832 basic_streambuf<_CharT, _Traits>* __buf,
833 _Is_Delim __is_delim,
834 bool __extract_delim, bool __set_failbit)
835{
836 bool __done = false;
837 ios_base::iostate __status = 0;
838 typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
839
840 _STLP_TRYtry {
841 while (!__done) {
842 int_type __c = __buf->sbumpc();
843
844 if (__that->_S_eof(__c)) {
845 __done = true;
846 __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
847 : ios_base::eofbit;
848 }
849
850 else if (__is_delim(__c)) {
851 __done = true;
Value stored to '__done' is never read
852 if (!__extract_delim)
853 if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
854 __status |= ios_base::failbit;
855 }
856 }
857 }
858 _STLP_CATCH_ALLcatch(...) {
859 __that->_M_handle_exception(ios_base::badbit);
860 }
861
862 __that->setstate(__status);
863}
864
865// A generic buffered function for ignoring characters. Much like
866// _M_ignore_unbuffered, but with one additional function object:
867// __scan_delim(first, last) returns the first pointer p in [first,
868// last) such that __is_delim(p) is true.
869
870template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
871void _STLP_CALL
872_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
873 basic_streambuf<_CharT, _Traits>* __buf,
874 _Is_Delim __is_delim, _Scan_Delim __scan_delim,
875 bool __extract_delim, bool __set_failbit)
876{
877 bool __at_eof = false;
878 bool __found_delim = false;
879
880 _STLP_TRYtry {
881 while (__buf->_M_egptr() != __buf->_M_gptr() && !__at_eof && !__found_delim) {
882 const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
883 __buf->_M_gbump((int)(__p - __buf->_M_gptr()));
884
885 if (__p != __buf->_M_egptr()) { // We found delim, so we're done.
886 if (__extract_delim)
887 __buf->_M_gbump(1);
888 __found_delim = true;
889 }
890
891 else // No delim. Try to refil the buffer.
892 __at_eof = __that->_S_eof(__buf->sgetc());
893 } // Close the while loop.
894 }
895 _STLP_CATCH_ALLcatch(...) {
896 __that->_M_handle_exception(ios_base::badbit);
897 return;
898 }
899
900 if (__at_eof) {
901 __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
902 : ios_base::eofbit);
903 return;
904 }
905 if (__found_delim)
906 return;
907
908 // If execution has reached this point, then we have an empty buffer but
909 // we have not reached eof. What that means is that the streambuf has
910 // decided to switch from a buffered to an unbuffered mode. We switch
911 // to _M_ignore_unbuffered.
912 _M_ignore_unbuffered(__that, __buf, __is_delim, __extract_delim, __set_failbit);
913}
914
915// Overloaded versions of _M_ignore_unbuffered and _M_ignore_unbuffered
916// with an explicit count _Num. Return value is the number of
917// characters extracted.
918//
919// The function object __max_chars takes two arguments, _Num and __n
920// (the latter being the number of characters we have already read),
921// and returns the maximum number of characters to read from the buffer.
922// We parameterize _M_ignore_buffered so that we can use it for both
923// bounded and unbounded input; for the former the function object should
924// be minus<>, and for the latter it should return a constant maximum value.
925
926template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim>
927streamsize _STLP_CALL
928_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
929 basic_streambuf<_CharT, _Traits>* __buf,
930 streamsize _Num, _Max_Chars __max_chars,
931 _Is_Delim __is_delim,
932 bool __extract_delim, bool __set_failbit)
933{
934 streamsize __n = 0;
935 ios_base::iostate __status = 0;
936 typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
937
938 _STLP_TRYtry {
939 while (__max_chars(_Num, __n) > 0) {
940 int_type __c = __buf->sbumpc();
941
942 if (__that->_S_eof(__c)) {
943 __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
944 : ios_base::eofbit;
945 break;
946 }
947
948 else if (__is_delim(__c)) {
949 if (__extract_delim)
950 ++__n;
951 else if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
952 __status |= ios_base::failbit;
953
954 break;
955 }
956 // fbp : added counter increment to pass Dietmar's test
957 ++__n;
958 }
959 }
960 _STLP_CATCH_ALLcatch(...) {
961 __that->_M_handle_exception(ios_base::badbit);
962 }
963
964 if (__status)
965 __that->setstate(__status); // This might throw.
966 return __n;
967}
968
969template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim, class _Scan_Delim>
970streamsize _STLP_CALL
971_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
972 basic_streambuf<_CharT, _Traits>* __buf,
973 streamsize _Num,
974 _Max_Chars __max_chars,
975 _Is_Delim __is_delim, _Scan_Delim __scan_delim,
976 bool __extract_delim, bool __set_failbit)
977{
978 streamsize __n = 0;
979 bool __at_eof = false;
980 bool __done = false;
981
982 _STLP_TRYtry {
983 while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
984 ptrdiff_t __avail = __buf->_M_egptr() - __buf->_M_gptr();
985 streamsize __m = __max_chars(_Num, __n);
986
987 if (__avail >= __m) { // We have more characters than we need.
988 const _CharT* __last = __buf->_M_gptr() + __m;
989 const _CharT* __p = __scan_delim(__buf->_M_gptr(), __last);
990 ptrdiff_t __chunk = __p - __buf->_M_gptr();
991 __n += __chunk;
992 __buf->_M_gbump((int)__chunk);
993
994 if (__extract_delim && __p != __last) {
995 __n += 1;
996 __buf->_M_gbump(1);
997 }
998
999 __done = true;
1000 }
1001
1002 else {
1003 const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
1004 ptrdiff_t __chunk = __p - __buf->_M_gptr();
1005 __n += __chunk;
1006 __buf->_M_gbump((int)__chunk);
1007
1008 if (__p != __buf->_M_egptr()) { // We found delim.
1009 if (__extract_delim) {
1010 __n += 1;
1011 __buf->_M_gbump(1);
1012 }
1013
1014 __done = true;
1015 }
1016
1017 // We didn't find delim. Try to refill the buffer.
1018 else if (__that->_S_eof(__buf->sgetc())) {
1019 __done = true;
1020 __at_eof = true;
1021 }
1022 }
1023 } // Close the while loop.
1024 }
1025 _STLP_CATCH_ALLcatch(...) {
1026 __that->_M_handle_exception(ios_base::badbit);
1027 return __n;
1028 }
1029
1030 if (__at_eof)
1031 __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
1032 : ios_base::eofbit);
1033
1034 if (__done)
1035 return __n;
1036
1037 // If execution has reached this point, then we have an empty buffer but
1038 // we have not reached eof. What that means is that the streambuf has
1039 // decided to switch from buffered to unbuffered input. We switch to
1040 // to _M_ignore_unbuffered.
1041
1042 return __n + _M_ignore_unbuffered( __that, __buf, _Num, __max_chars,
1043 __is_delim, __extract_delim, __set_failbit);
1044}
1045
1046
1047template <class _CharT, class _Traits>
1048basic_istream<_CharT, _Traits>&
1049basic_istream<_CharT, _Traits>::ignore(streamsize __n)
1050{
1051 sentry __sentry(*this, _No_Skip_WS());
1052 this->_M_gcount = 0;
1053
1054 if (__sentry) {
1055 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
1056 typedef _Constant_unary_fun<bool, int_type> _Const_bool;
1057 typedef _Constant_binary_fun<streamsize, streamsize, streamsize>
1058 _Const_streamsize;
1059 const streamsize __maxss = (numeric_limits<streamsize>::max)();
1060
1061 if (__n == (numeric_limits<int>::max)()) {
1062 if (__buf->gptr() != __buf->egptr())
1063 _M_gcount
1064 = _M_ignore_buffered(this, __buf,
1065 __maxss, _Const_streamsize(__maxss),
1066 _Const_bool(false),
1067 _Project2nd<const _CharT*, const _CharT*>(),
1068 false, false);
1069 else
1070 _M_gcount = _M_ignore_unbuffered(this, __buf,
1071 __maxss, _Const_streamsize(__maxss),
1072 _Const_bool(false), false, false);
1073 }
1074 else {
1075 if (__buf->gptr() != __buf->egptr())
1076 _M_gcount
1077 = _M_ignore_buffered(this, __buf,
1078 __n, minus<streamsize>(),
1079 _Const_bool(false),
1080 _Project2nd<const _CharT*, const _CharT*>(),
1081 false, false);
1082 else
1083 _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
1084 _Const_bool(false), false, false);
1085 }
1086 }
1087
1088 return *this;
1089}
1090
1091template <class _CharT, class _Traits>
1092basic_istream<_CharT, _Traits>&
1093basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __delim)
1094{
1095 sentry __sentry(*this, _No_Skip_WS());
1096 this->_M_gcount = 0;
1097
1098 if (__sentry) {
1099 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
1100 typedef _Constant_unary_fun<bool, int_type> _Const_bool;
1101 typedef _Constant_binary_fun<streamsize, streamsize, streamsize>
1102 _Const_streamsize;
1103 const streamsize __maxss = (numeric_limits<streamsize>::max)();
1104
1105 if (__n == (numeric_limits<int>::max)()) {
1106 if (__buf->gptr() != __buf->egptr())
1107 _M_gcount = _M_ignore_buffered(this, __buf,
1108 __maxss, _Const_streamsize(__maxss),
1109 _Eq_int_bound<_Traits>(__delim),
1110 _Scan_for_int_val<_Traits>(__delim),
1111 true, false);
1112 else
1113 _M_gcount = _M_ignore_unbuffered(this, __buf,
1114 __maxss, _Const_streamsize(__maxss),
1115 _Eq_int_bound<_Traits>(__delim),
1116 true, false);
1117 }
1118 else {
1119 if (__buf->gptr() != __buf->egptr())
1120 _M_gcount = _M_ignore_buffered(this, __buf,
1121 __n, minus<streamsize>(),
1122 _Eq_int_bound<_Traits>(
1123 __delim),
1124 _Scan_for_int_val<_Traits>(__delim),
1125 true, false);
1126 else
1127 _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
1128 _Eq_int_bound<_Traits>(__delim),
1129 true, false);
1130 }
1131 }
1132
1133 return *this;
1134}
1135
1136// This member function does not construct a sentry object, because
1137// it is called from sentry's constructor.
1138template <class _CharT, class _Traits>
1139void basic_istream<_CharT, _Traits>::_M_skip_whitespace(bool __set_failbit)
1140{
1141 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
1142 if (!__buf)
1143 this->setstate(ios_base::badbit);
1144 else if (__buf->gptr() != __buf->egptr())
1145 _M_ignore_buffered(this, __buf,
1146 _Is_not_wspace<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
1147 _Scan_for_not_wspace<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
1148 false, __set_failbit);
1149 else
1150 _M_ignore_unbuffered(this, __buf,
1151 _Is_not_wspace<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
1152 false, __set_failbit);
1153}
1154
1155
1156// This is a very simple loop that reads characters from __src and puts
1157// them into __dest. It looks complicated because of the (standard-
1158// mandated) exception handling policy.
1159//
1160// We stop when we get an exception, when we fail to insert into the
1161// output streambuf, or when __is_delim is true.
1162
1163template < class _CharT, class _Traits, class _Is_Delim>
1164streamsize _STLP_CALL
1165_M_copy_unbuffered( basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
1166 basic_streambuf<_CharT, _Traits>* __dest,
1167 _Is_Delim __is_delim,
1168 bool __extract_delim, bool __rethrow)
1169{
1170 streamsize __extracted = 0;
1171 ios_base::iostate __status = 0;
1172 typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
1173 int_type __c;
1174
1175 _STLP_TRYtry {
1176
1177 while (true) {
1178
1179 // Get a character. If there's an exception, catch and (maybe) rethrow it.
1180 __c = __src->sbumpc();
1181
1182 // If we failed to get a character, then quit.
1183 if (__that->_S_eof(__c)) {
1184 __status |= ios_base::eofbit;
1185 break;
1186 }
1187 // If it's the delimiter, then quit.
1188 else if (__is_delim(__c)) {
1189 if (!__extract_delim && !__pushback(__src, _Traits::to_char_type(__c)))
1190 __status |= ios_base::failbit;
1191 break;
1192 }
1193
1194 else {
1195
1196 // Try to put the character in the output streambuf.
1197 bool __failed = false;
1198 _STLP_TRYtry {
1199 if (!__that->_S_eof(__dest->sputc(__c)))
1200 ++__extracted;
1201 else
1202 __failed = true;
1203 }
1204 _STLP_CATCH_ALLcatch(...) {
1205 __failed = true;
1206 }
1207
1208 // If we failed to put the character in the output streambuf, then
1209 // try to push it back to the input streambuf.
1210 if (__failed && !__pushback(__src, _Traits::to_char_type(__c)))
1211 __status |= ios_base::failbit;
1212
1213 // fbp : avoiding infinite loop in io-27-6-1-2-3.exp
1214 if (__failed)
1215 break;
1216 }
1217
1218 } /* while (true) */
1219
1220 }
1221 // fbp : this try/catch moved here in reasonable assumption
1222 // __is_delim never throw (__pushback is guaranteed not to)
1223 _STLP_CATCH_ALLcatch(...) {
1224 // See 27.6.1.2.3, paragraph 13.
1225 if (__rethrow && __extracted == 0)
1226 __that->_M_handle_exception(ios_base::failbit);
1227 }
1228 __that->setstate(__status);
1229 return __extracted;
1230}
1231
1232// Buffered copying from one streambuf to another. We copy the characters
1233// in chunks, rather than one at a time. We still have to worry about all
1234// of the error conditions we checked in _M_copy_unbuffered, plus one more:
1235// the streambuf might decide to switch from a buffered to an unbuffered mode.
1236
1237template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
1238streamsize _STLP_CALL
1239_M_copy_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
1240 basic_streambuf<_CharT, _Traits>* __dest,
1241 _Scan_Delim __scan_delim, _Is_Delim __is_delim,
1242 bool __extract_delim, bool __rethrow)
1243{
1244 streamsize __extracted = 0;
1245 ios_base::iostate __status = 0;
1246 typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
1247 int_type __c = _Traits::eof();
1248 _CharT* __first = __src->_M_gptr();
1249 ptrdiff_t __avail = __src->_M_egptr() - __first;
1250 // fbp : introduced to move catch/try blocks out of the loop
1251 bool __do_handle_exceptions;
1252
1253 _STLP_TRYtry {
1254 while (true) {
1255 __do_handle_exceptions = false ;
1256 const _CharT* __last = __scan_delim(__first, __src->_M_egptr());
1257
1258 // Try to copy the entire input buffer to the output buffer.
1259 streamsize __n = __dest->sputn(__first, __extract_delim && __last != __src->_M_egptr()
1260 ? (__last - __first) + 1
1261 : (__last - __first));
1262 __src->_M_gbump((int)__n);
1263 __extracted += __n;
1264
1265 // from this on, catch() will call _M_handle_exceptions()
1266 __do_handle_exceptions = true;
1267
1268 if (__n < __avail) // We found the delimiter, or else failed to
1269 break; // copy some characters.
1270
1271 __c = __src->sgetc();
1272
1273 // Three possibilities: we succeeded in refilling the buffer, or
1274 // we got EOF, or the streambuf has switched to unbuffered mode.
1275 __first = __src->_M_gptr();
1276 __avail = __src->_M_egptr() - __first;
1277
1278 if (__avail > 0)
1279 {} // dwa 1/16/00 -- suppress a Metrowerks warning
1280 else if (__that->_S_eof(__c)) {
1281 __status |= ios_base::eofbit;
1282 break;
1283 }
1284 else
1285 return __extracted + _M_copy_unbuffered(__that, __src, __dest, __is_delim,
1286 __extract_delim, __rethrow);
1287 } /* while */
1288 }
1289
1290 _STLP_CATCH_ALLcatch(...) {
1291 // See 27.6.1.2.3, paragraph 13.
1292 if (__rethrow && __do_handle_exceptions && __extracted == 0)
1293 __that->_M_handle_exception(ios_base::failbit);
1294 }
1295
1296 if (__status)
1297 __that->setstate(__status); // This might throw.
1298 return __extracted;
1299}
1300
1301
1302
1303template <class _CharT, class _Traits>
1304basic_istream<_CharT, _Traits>&
1305basic_istream<_CharT, _Traits>
1306 ::get(basic_streambuf<_CharT, _Traits>& __dest, _CharT __delim)
1307{
1308 sentry __sentry(*this, _No_Skip_WS());
1309 this->_M_gcount = 0;
1310
1311 if (__sentry) {
1312 basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
1313
1314 if (__src)
1315 this->_M_gcount = __src->egptr() != __src->gptr()
1316 ? _M_copy_buffered(this, __src, &__dest,
1317 _Scan_for_char_val<_Traits>(__delim),
1318 _Eq_char_bound<_Traits>(__delim),
1319 false, false)
1320 : _M_copy_unbuffered(this, __src, &__dest,
1321 _Eq_char_bound<_Traits>(__delim),
1322 false, false);
1323 }
1324
1325 if (this->_M_gcount == 0)
1326 this->setstate(ios_base::failbit);
1327
1328 return *this;
1329}
1330
1331// Copying characters into a streambuf.
1332template <class _CharT, class _Traits>
1333basic_istream<_CharT, _Traits>&
1334basic_istream<_CharT, _Traits>
1335 ::operator>>(basic_streambuf<_CharT, _Traits>* __dest)
1336{
1337 streamsize __n = 0;
1338 typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
1339 _Sentry __sentry(*this);
1340 if (__sentry) {
1341 basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
1342 if (__src && __dest)
1343 __n = __src->egptr() != __src->gptr()
1344 ? _M_copy_buffered(this, __src, __dest,
1345 _Project2nd<const _CharT*, const _CharT*>(),
1346 _Constant_unary_fun<bool, int_type>(false),
1347 false, true)
1348 : _M_copy_unbuffered(this, __src, __dest,
1349 _Constant_unary_fun<bool, int_type>(false),
1350 false, true);
1351 }
1352
1353 if (__n == 0)
1354 this->setstate(ios_base::failbit);
1355
1356 return *this;
1357}
1358
1359// ----------------------------------------------------------------
1360// basic_iostream<> class
1361// ----------------------------------------------------------------
1362
1363template <class _CharT, class _Traits>
1364basic_iostream<_CharT, _Traits>
1365 ::basic_iostream(basic_streambuf<_CharT, _Traits>* __buf)
1366 : basic_ios<_CharT, _Traits>(),
1367 basic_istream<_CharT, _Traits>(__buf),
1368 basic_ostream<_CharT, _Traits>(__buf)
1369{
1370 this->init(__buf);
1371}
1372
1373template <class _CharT, class _Traits>
1374basic_iostream<_CharT, _Traits>::~basic_iostream()
1375{}
1376
1377_STLP_END_NAMESPACE}
1378
1379# undef __BIS_int_type__
1380# undef __BIS_pos_type__
1381# undef __BIS_off_type__
1382
1383# endif /* defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) */
1384
1385#endif /* _STLP_ISTREAM_C */