diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-02-06 16:57:06 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-02-06 16:57:06 +0000 |
commit | afabfb5519fa6b6839f75d064bcb87b135f4f168 (patch) | |
tree | 5b70e76ed99662eb223a4212db4a62edcb97f52a | |
parent | a16154fafd66b55d0ec58516ab163ebcad867c7a (diff) | |
download | ATCD-afabfb5519fa6b6839f75d064bcb87b135f4f168.tar.gz |
got to build with Sun C++ 4.1
-rw-r--r-- | ace/IOStream.cpp | 2 | ||||
-rw-r--r-- | ace/IOStream.h | 66 |
2 files changed, 59 insertions, 9 deletions
diff --git a/ace/IOStream.cpp b/ace/IOStream.cpp index 947bbc76bcd..0673b895cf2 100644 --- a/ace/IOStream.cpp +++ b/ace/IOStream.cpp @@ -421,7 +421,9 @@ ACE_Streambuf<STREAM>::ACE_Streambuf (STREAM *peer, int io_mode) // Linebuffered is similar to unbuffered. Again, I don't have any // need for this and I don't see the advantage. I believe this // would have to be supported by underflow/overflow to be effective. +#if !defined (ACE_LACKS_LINEBUFFERED_IOSTREAMS) this->linebuffered (0); +#endif /* ! ACE_LACKS_LINEBUFFERED_IOSTREAMS */ // The get area is where the iostrem will get data from. This is // our read buffer. There are three pointers which describe the diff --git a/ace/IOStream.h b/ace/IOStream.h index 5570f3370a4..9541d7addbf 100644 --- a/ace/IOStream.h +++ b/ace/IOStream.h @@ -1,4 +1,3 @@ - /* -*- C++ -*- */ // $Id$ @@ -192,9 +191,57 @@ private: if (opfx ()) iostream::operator<< (v); osfx (); return *this; \ } +// These typedefs are provided by G++ (on some systems?) without the +// trailing '_'. Since we can't count on 'em, I've defined them to +// what GNU wants here. +// +typedef ios& (*__manip_)(ios&); +typedef istream& (*__imanip_)(istream&); +typedef ostream& (*__omanip_)(ostream&); + +// Trying to do something like is shown below instead of using the +// __*manip typedefs causes Linux do segfault when "<<endl" is done. +// +// virtual MT& operator<<(ios& (*func)(ios&)) { (*func)(*this); return *this; } + // These are necessary in case somebody wants to derive from us and // override one of these with a custom approach. +#if defined (ACE_LACKS_SIGNED_CHAR) +#define ACE_OPERATORG_SET(MT) \ + ACE_OPERATORG(MT,short &); \ + ACE_OPERATORG(MT,u_short &); \ + ACE_OPERATORG(MT,int &); \ + ACE_OPERATORG(MT,u_int &); \ + ACE_OPERATORG(MT,long &); \ + ACE_OPERATORG(MT,u_long &); \ + ACE_OPERATORG(MT,float &); \ + ACE_OPERATORG(MT,double &); \ + ACE_OPERATORG(MT,long double &); \ + ACE_OPERATORG(MT,char &) \ + ACE_OPERATORG(MT,u_char &); \ + ACE_OPERATORG(MT,char *) \ + ACE_OPERATORG(MT,u_char *); \ + virtual MT& operator>>(__omanip_ func) { (*func)(*this); return *this; } \ + virtual MT& operator>>(__manip_ func) { (*func)(*this); return *this; } + +#define ACE_OPERATORP_SET(MT) \ + ACE_OPERATORP(MT,short); \ + ACE_OPERATORP(MT,u_short); \ + ACE_OPERATORP(MT,int); \ + ACE_OPERATORP(MT,u_int); \ + ACE_OPERATORP(MT,long); \ + ACE_OPERATORP(MT,u_long); \ + ACE_OPERATORP(MT,float); \ + ACE_OPERATORP(MT,double); \ + ACE_OPERATORP(MT,char); \ + ACE_OPERATORP(MT,u_char); \ + ACE_OPERATORP(MT,const char *); \ + ACE_OPERATORP(MT,const u_char *); \ + ACE_OPERATORP(MT,const void *); \ + virtual MT& operator<<(__omanip_ func) { (*func)(*this); return *this; } \ + virtual MT& operator<<(__manip_ func) { (*func)(*this); return *this; } +#else #define ACE_OPERATORG_SET(MT) \ ACE_OPERATORG(MT,short &); \ ACE_OPERATORG(MT,u_short &); \ @@ -211,8 +258,8 @@ private: ACE_OPERATORG(MT,char *) \ ACE_OPERATORG(MT,u_char *); \ ACE_OPERATORG(MT,signed char *); \ - virtual MT& operator>>(ostream& (*func)(ostream&)) { (*func)(*this); return *this; } \ - virtual MT& operator>>(ios& (*func)(ios&)) { (*func)(*this); return *this; } + virtual MT& operator>>(__omanip_ func) { (*func)(*this); return *this; } \ + virtual MT& operator>>(__manip_ func) { (*func)(*this); return *this; } #define ACE_OPERATORP_SET(MT) \ ACE_OPERATORP(MT,short); \ @@ -230,8 +277,9 @@ private: ACE_OPERATORP(MT,const u_char *); \ ACE_OPERATORP(MT,const signed char *); \ ACE_OPERATORP(MT,const void *); \ - virtual MT& operator<<(istream& (*func)(istream&)) { (*func)(*this); return *this; } \ - virtual MT& operator<<(ios& (*func)(ios&)) { (*func)(*this); return *this; } + virtual MT& operator<<(__omanip_ func) { (*func)(*this); return *this; } \ + virtual MT& operator<<(__manip_ func) { (*func)(*this); return *this; } +#endif /* ACE_LACKS_SIGNED_CHAR */ template <class STREAM> class ACE_IOStream : public iostream, public STREAM @@ -308,11 +356,11 @@ public: // be inserted after every put operation so that my transmitted // "fields" are always separated. - virtual int ipfx (int need = 0) { iostream::ipfx(need); } - virtual int ipfx0(void) { iostream::ipfx0(); } // Optimized ipfx(0) - virtual int ipfx1(void) { iostream::ipfx1(); } // Optimized ipfx(1) + virtual int ipfx (int need = 0) { return(iostream::ipfx(need)); } + virtual int ipfx0(void) { return(iostream::ipfx0()); } // Optimized ipfx(0) + virtual int ipfx1(void) { return(iostream::ipfx1()); } // Optimized ipfx(1) virtual void isfx (void) { iostream::isfx(); } - virtual int opfx (void) { iostream::opfx(); } + virtual int opfx (void) { return(iostream::opfx()); } virtual void osfx (void) { iostream::osfx(); } protected: |