Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 81855 invoked from network); 26 Apr 2006 19:46:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Apr 2006 19:46:42 -0000 Received: (qmail 2794 invoked by uid 500); 26 Apr 2006 19:46:41 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 2778 invoked by uid 500); 26 Apr 2006 19:46:41 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 2767 invoked by uid 99); 26 Apr 2006 19:46:41 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Apr 2006 12:46:41 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 26 Apr 2006 12:46:40 -0700 Received: (qmail 81373 invoked by uid 65534); 26 Apr 2006 19:46:18 -0000 Message-ID: <20060426194618.81372.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r397279 - /incubator/stdcxx/trunk/tests/include/rw_char.h Date: Wed, 26 Apr 2006 19:46:18 -0000 To: stdcxx-commits@incubator.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: sebor Date: Wed Apr 26 12:46:16 2006 New Revision: 397279 URL: http://svn.apache.org/viewcvs?rev=397279&view=rev Log: 2006-04-26 Martin Sebor * rw_char.h (UserTraits): Added the MemFun struct and the n_calls_ array to the definition of the primary template for compatibility with the UserTraits specialization. Modified: incubator/stdcxx/trunk/tests/include/rw_char.h Modified: incubator/stdcxx/trunk/tests/include/rw_char.h URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/include/rw_char.h?rev=397279&r1=397278&r2=397279&view=diff ============================================================================== --- incubator/stdcxx/trunk/tests/include/rw_char.h (original) +++ incubator/stdcxx/trunk/tests/include/rw_char.h Wed Apr 26 12:46:16 2006 @@ -176,15 +176,128 @@ template struct UserTraits: std::char_traits { - typedef typename std::char_traits::int_type int_type; + typedef std::char_traits Base; + typedef typename Base::char_type char_type; + typedef typename Base::int_type int_type; - static int_type eof_; + struct MemFun { + enum { + assign, eq, lt, compare, length, find, copy, move, + assign2, not_eof, to_char_type, to_int_type, eq_int_type, + eof, + n_funs + }; + }; + + static _RWSTD_SIZE_T n_calls_ []; + + // avoid any dependency on the library + typedef int off_type; // std::streamoff + typedef int state_type; // std::mbstate_t + typedef std::fpos pos_type; // std::fpos + + // accesses to the char_type::f member may trigger a SIGBUS + // on some architectures (e.g., PA or SPARC) if the member + // isn't appropriately aligned - static int_type eof () { + static void + assign (char_type &dst, const char_type &src) { + ++n_calls_ [MemFun::assign]; + Base::assign (dst, src); + } + + static bool + eq (const char_type &ch1, const char_type &ch2) { + ++n_calls_ [MemFun::eq]; + return Base::eq (ch1, ch2); + } + + static bool + lt (const char_type &ch1, const char_type &ch2) { + ++n_calls_ [MemFun::lt]; + return Base::lt (ch1, ch2); + } + + static int + compare (const char_type *s1, const char_type *s2, _RWSTD_SIZE_T n) { + ++n_calls_ [MemFun::compare]; + return Base::compare (s1, s2, n); + } + + static _RWSTD_SIZE_T + length (const char_type *s) { + ++n_calls_ [MemFun::length]; + return Base::length (s); + } + + static const char_type* + find (const char_type *s, _RWSTD_SIZE_T n, const char_type &ch) { + ++n_calls_ [MemFun::find]; + return Base::find (s, n, ch); + } + + static char_type* + copy (char_type *dst, const char_type *src, _RWSTD_SIZE_T n) { + ++n_calls_ [MemFun::copy]; + return Base::copy (dst, src, n); + } + + static char_type* + move (char_type *dst, const char_type *src, _RWSTD_SIZE_T n) { + ++n_calls_ [MemFun::move]; + return Base::move (dst, src, n); + } + + static char_type* + assign (char_type *s, _RWSTD_SIZE_T n, char_type ch) { + ++n_calls_ [MemFun::assign]; + return Base::assign (s, n, ch); + } + + static int_type + not_eof (const int_type &i) { + ++n_calls_ [MemFun::not_eof]; + return eof () == i ? ~i : i; + } + + static char_type + to_char_type (const int_type &i) { + ++n_calls_ [MemFun::to_char_type]; + return Base::to_char_type (i); + } + + static int_type + to_int_type (const char_type &ch) { + ++n_calls_ [MemFun::to_int_type]; + return Base::to_int_type (ch); + } + + static bool + eq_int_type (const int_type &i1, const int_type &i2) { + ++n_calls_ [MemFun::eq_int_type]; + return Base::eq_int_type (i1, i2); + } + + static int_type + eof () { return eof_; } + + static int_type eof_; + +private: + + // not defined to detect bad assumptions made by the library + UserTraits (); + ~UserTraits (); + void operator= (UserTraits&); }; + +template +_RWSTD_SIZE_T +UserTraits::n_calls_ [UserTraits::MemFun::n_funs]; + template typename UserTraits::int_type UserTraits::eof_ = std::char_traits::eof (); @@ -193,15 +306,6 @@ _RWSTD_SPECIALIZED_CLASS struct _TEST_EXPORT UserTraits // user-defined character traits { -private: - - // not defined to detect bad assumptions made by the library - UserTraits (); - ~UserTraits (); - void operator= (UserTraits&); - -public: - struct MemFun { enum { assign, eq, lt, compare, length, find, copy, move, @@ -257,6 +361,13 @@ static bool eq_int_type (const int_type&, const int_type&); static int_type eof (); + +private: + + // not defined to detect bad assumptions made by the library + UserTraits (); + ~UserTraits (); + void operator= (UserTraits&); };