2004-05-27 Richard B. Kreckel Benjamin Kosnik PR libstdc++/14600 * include/ext/stdio_sync_filebuf.h (stdio_sync_filebuf::file): New. * include/ext/stdio_filebuf.h (stdio_filebuf::file): New. * config/io/basic_file_stdio.cc (__basic_file::file): New. * config/io/basic_file_stdio.h: Define. Index: config/io/basic_file_stdio.cc =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/config/io/basic_file_stdio.cc,v retrieving revision 1.31 diff -c -p -r1.31 basic_file_stdio.cc *** config/io/basic_file_stdio.cc 7 Apr 2004 03:33:31 -0000 1.31 --- config/io/basic_file_stdio.cc 28 May 2004 06:52:38 -0000 *************** namespace std *** 240,246 **** int __basic_file::fd() ! { return fileno(_M_cfile) ; } __basic_file* __basic_file::close() --- 240,250 ---- int __basic_file::fd() ! { return fileno(_M_cfile); } ! ! __c_file* ! __basic_file::file() ! { return _M_cfile; } __basic_file* __basic_file::close() Index: config/io/basic_file_stdio.h =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/config/io/basic_file_stdio.h,v retrieving revision 1.19 diff -c -p -r1.19 basic_file_stdio.h *** config/io/basic_file_stdio.h 12 Feb 2004 18:24:07 -0000 1.19 --- config/io/basic_file_stdio.h 28 May 2004 06:52:39 -0000 *************** namespace std *** 81,86 **** --- 81,89 ---- int fd(); + __c_file* + file(); + ~__basic_file(); streamsize Index: include/ext/stdio_filebuf.h =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/stdio_filebuf.h,v retrieving revision 1.17 diff -c -p -r1.17 stdio_filebuf.h *** include/ext/stdio_filebuf.h 19 May 2004 08:31:07 -0000 1.17 --- include/ext/stdio_filebuf.h 28 May 2004 06:52:39 -0000 *************** *** 1,6 **** // File descriptor layer for filebuf -*- C++ -*- ! // Copyright (C) 2002, 2003 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the --- 1,6 ---- // File descriptor layer for filebuf -*- C++ -*- ! // Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the *************** namespace __gnu_cxx *** 63,68 **** --- 63,73 ---- public: /** + * deferred initialization + */ + stdio_filebuf() : std::basic_filebuf<_CharT, _Traits>() {} + + /** * @param fd An open file descriptor. * @param mode Same meaning as in a standard filebuf. * @param size Optimal or preferred size of internal buffer, in chars. *************** namespace __gnu_cxx *** 103,110 **** * descriptor, so be careful. */ int ! fd() ! { return this->_M_file.fd(); } }; template --- 108,124 ---- * descriptor, so be careful. */ int ! fd() { return this->_M_file.fd(); } ! ! /** ! * @return The underlying FILE*. ! * ! * This function can be used to access the underlying "C" file pointer. ! * Note that there is no way for the library to track what you do ! * with the file, so be careful. ! */ ! std::__c_file* ! file() { return this->_M_file.file(); } }; template Index: include/ext/stdio_sync_filebuf.h =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/stdio_sync_filebuf.h,v retrieving revision 1.8 diff -c -p -r1.8 stdio_sync_filebuf.h *** include/ext/stdio_sync_filebuf.h 19 Mar 2004 19:31:37 -0000 1.8 --- include/ext/stdio_sync_filebuf.h 28 May 2004 06:52:39 -0000 *************** namespace __gnu_cxx *** 71,76 **** --- 71,86 ---- : _M_file(__f), _M_unget_buf(traits_type::eof()) { } + /** + * @return The underlying FILE*. + * + * This function can be used to access the underlying "C" file pointer. + * Note that there is no way for the library to track what you do + * with the file, so be careful. + */ + std::__c_file* const + file() { return this->_M_file; } + protected: int_type syncgetc();