Author: sebor
Date: Fri Oct 14 13:20:28 2005
New Revision: 321205
URL: http://svn.apache.org/viewcvs?rev=321205&view=rev
Log:
2005-10-14 Martin Sebor <[EMAIL PROTECTED]>
* _config.h: Introduced the _RWSTD_EDG_ECCP macro to unambiguously
identify the vanilla EDG eccp front end demo and to distinguish it
from compilers such as Compaq C++, Intel C++, or SGI MIPSpro that
use the front-end and (sometimes) also #define __EDG__.
Removed the hardcoded _RWSTD_CRLF_CONVENTION macro (superseded
by the new _RWSTD_NEWLINE_... set of autoconfigured macros).
* fstream (_C_crlf_extern_count): Replaced the _RWSTD_CRLF_CONVENTION
macro with the new _RWSTD_NEWLINE_... set of macros. Replaced a loop
with the potentially more efficient call to traits::find().
(_C_crlf_intern_count): Same.
Modified:
incubator/stdcxx/trunk/include/fstream
incubator/stdcxx/trunk/include/rw/_config.h
Modified: incubator/stdcxx/trunk/include/fstream
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/include/fstream?rev=321205&r1=321204&r2=321205&view=diff
==============================================================================
--- incubator/stdcxx/trunk/include/fstream (original)
+++ incubator/stdcxx/trunk/include/fstream Fri Oct 14 13:20:28 2005
@@ -3,7 +3,7 @@
*
* fstream -- declarations of the C++ Standard Library file stream classes
*
- * $Id: //stdlib/dev/include/fstream#39 $
+ * $Id$
*
***************************************************************************
*
@@ -286,20 +286,24 @@
off_type __n = 0;
-#ifdef _RWSTD_CRLF_CONVENTION
+#if defined (_RWSTD_NEWLINE_CR_LF) || defined (_RWSTD_NEWLINE_LF_CR)
+ // compute the number of newline characters in the external representation
if (!(this->_C_state & ios_base::binary)) {
- while (__start != __finish)
- if (char_traits<char>::eq ('\n', *__start++))
- ++__n;
+ typedef char_traits<char> _CTraits;
+
+ while ((__start = _CTraits::find (__start, __finish - __start, '\n')))
{
+ ++__start;
+ ++__n;
+ }
}
-#else // if !defined (_RWSTD_CRLF_CONVENTION)
+#else // if !defined (_RWSTD_NEWLINE_CR_LF) || ...
_RWSTD_UNUSED (__start);
_RWSTD_UNUSED (__finish);
-#endif // _RWSTD_CRLF_CONVENTION
+#endif // _RWSTD_NEWLINE_CR_LF
return __n;
}
@@ -315,21 +319,25 @@
off_type __n = 0;
-#ifdef _RWSTD_CRLF_CONVENTION
+#if defined (_RWSTD_NEWLINE_CR_LF) || defined (_RWSTD_NEWLINE_LF_CR)
+ // compute the number of newline characters in the internal representation
if (!(this->_C_state & ios_base::binary)) {
- const char_type __eol = _USE_FACET (ctype<char_type>,
- this->getloc ()).widen ('\n');
- while (__start != __finish)
- if (traits_type::eq (__eol, *__start++))
- ++__n;
+ const char_type __nl =
+ _USE_FACET (ctype<char_type>, this->getloc ()).widen ('\n');
+
+ while ((__start = _Traits::find (__start, __finish - __start, __nl))) {
+ ++__start;
+ ++__n;
+ }
}
-#else // if !defined (_RWSTD_CRLF_CONVENTION)
+
+#else // if !defined (_RWSTD_NEWLINE_CR_LF) || ...
_RWSTD_UNUSED (__start);
_RWSTD_UNUSED (__finish);
-#endif // _RWSTD_CRLF_CONVENTION
+#endif // _RWSTD_NEWLINE_CR_LF
return __n;
}
Modified: incubator/stdcxx/trunk/include/rw/_config.h
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/include/rw/_config.h?rev=321205&r1=321204&r2=321205&view=diff
==============================================================================
--- incubator/stdcxx/trunk/include/rw/_config.h (original)
+++ incubator/stdcxx/trunk/include/rw/_config.h Fri Oct 14 13:20:28 2005
@@ -267,7 +267,7 @@
#endif // __DECCXX
-/*** EDG eccp ********************************************************/
+/*** EDG eccp (this is the vanilla EDG front end) **********************/
// NOTE: the __EDG__ macro is #defined by most edg-based compilers
@@ -276,6 +276,11 @@
&& !defined (__INTEL_COMPILER) \
&& !defined (_SGI_COMPILER_VERSION)
+ // identify the EDG eccp standalone front-end in order to help avoid
+ // confusing it with compilers such as Compaq C++, Intel C++, or SGI
+ // MIPSpro, that use the front-end and (sometimes) #define __EDG__
+# define _RWSTD_EDG_ECCP
+
# if defined (_RWSTD_REENTRANT) && !defined (_RWSTD_POSIX_THREADS)
# define _RWSTD_POSIX_THREADS
# endif // (_RWSTD_REENTRANT) && !(_RWSTD_POSIX_THREADS)
@@ -902,14 +907,6 @@
#endif // NO_COLLAPSE_TEMPLATE_STATICS || NO_STATIC_TEMPLATE_MEMBER_INIT
/********************** Environment *********************************/
-
-// Most (but not all) non-unix systems convert new line to carriage
-// return + line feed on output:
-
-#if defined (__OS2__) || defined (_WIN32) || defined (_WIN64)
-# define _RWSTD_CRLF_CONVENTION
-#endif
-
// define wherever atomic instructions are provided
// affects the size of string reference (i.e., is binary incompatible)