first commit
This commit is contained in:
29
extern/stdcxx/4.2.1/include/loc/_codecvt.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_codecvt.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_codecvt.c
|
||||
*
|
||||
* $Id: _codecvt.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_codecvt.cc>
|
||||
41
extern/stdcxx/4.2.1/include/loc/_codecvt.cc
vendored
Normal file
41
extern/stdcxx/4.2.1/include/loc/_codecvt.cc
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _codecvt .cc - definition of std::codecvt members
|
||||
*
|
||||
* $Id: _codecvt.cc 597181 2007-11-21 18:59:19Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_CODECVT_PRIMARY
|
||||
|
||||
template <class _InternT, class _ExternT, class _StateT>
|
||||
_RW::__rw_facet_id codecvt<_InternT, _ExternT, _StateT>::id;
|
||||
|
||||
#endif // _RWSTD_NO_EXT_CODECVT_PRIMARY
|
||||
|
||||
|
||||
} // namespace std
|
||||
457
extern/stdcxx/4.2.1/include/loc/_codecvt.h
vendored
Normal file
457
extern/stdcxx/4.2.1/include/loc/_codecvt.h
vendored
Normal file
@@ -0,0 +1,457 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _codecvt.h - Definitions of the code conversion facets
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _codecvt.h 597181 2007-11-21 18:59:19Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2007 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_CODECVT_H_INCLUDED
|
||||
#define _RWSTD_LOC_CODECVT_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
#include <loc/_facet.h>
|
||||
#include <rw/_mbstate.h> // for _RWSTD_MBSTATE_T
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
struct __rw_ctype_t;
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
// 22.2.1.5 - Template class codecvt
|
||||
|
||||
struct codecvt_base
|
||||
{
|
||||
enum result { ok, partial, error, noconv };
|
||||
};
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <class _InternT, class _ExternT, class _StateT>
|
||||
class codecvt;
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_CODECVT_PRIMARY
|
||||
|
||||
_EXPORT
|
||||
template <class _InternT, class _ExternT, class _StateT>
|
||||
class codecvt: public _RW::__rw_facet,
|
||||
public codecvt_base
|
||||
{
|
||||
public:
|
||||
typedef _InternT intern_type;
|
||||
typedef _ExternT extern_type;
|
||||
typedef _StateT state_type;
|
||||
|
||||
protected:
|
||||
|
||||
// extension: where reasonable, the default behavior of the primary
|
||||
// template is the same as that of codecvt<char, char, mbstate_t> if
|
||||
// sizeof (intern_type) == sizeof (extern_type) to allow iostream
|
||||
// instantiations on signed char or unsigned char to have somewhat
|
||||
// meaningful behavior
|
||||
|
||||
virtual result
|
||||
do_out (state_type&,
|
||||
const intern_type*, const intern_type*, const intern_type*&,
|
||||
extern_type*, extern_type*, extern_type*&) const {
|
||||
return sizeof (intern_type) == sizeof (extern_type) ? noconv : error;
|
||||
}
|
||||
|
||||
virtual result
|
||||
do_in (state_type&,
|
||||
const extern_type*, const extern_type*, const extern_type*&,
|
||||
intern_type*, intern_type*, intern_type*&) const {
|
||||
return sizeof (intern_type) == sizeof (extern_type) ? noconv : error;
|
||||
}
|
||||
|
||||
virtual result
|
||||
do_unshift (state_type&, extern_type*, extern_type*, extern_type*&) const {
|
||||
return sizeof (intern_type) == sizeof (extern_type) ? noconv : error;
|
||||
}
|
||||
|
||||
virtual int do_encoding () const _THROWS (()) {
|
||||
return -1; // unknown, possibly state dependent
|
||||
}
|
||||
|
||||
virtual bool do_always_noconv () const _THROWS (()) {
|
||||
return sizeof (intern_type) == sizeof (extern_type);
|
||||
}
|
||||
|
||||
virtual int do_max_length () const _THROWS (()) {
|
||||
return _RWSTD_INT_MAX;
|
||||
}
|
||||
|
||||
virtual int
|
||||
do_length (state_type&,
|
||||
const extern_type*, const extern_type*, _RWSTD_SIZE_T) const {
|
||||
return _RWSTD_INT_MAX;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT codecvt (_RWSTD_SIZE_T __ref = 0): _RW::__rw_facet (__ref) { }
|
||||
|
||||
// 22,2,1,5,1, p1
|
||||
result out (state_type& __state,
|
||||
const intern_type* __from, const intern_type* __from_end,
|
||||
const intern_type*& __from_next,
|
||||
extern_type* __to, extern_type* __to_limit,
|
||||
extern_type*& __to_next) const {
|
||||
return do_out(__state,__from,__from_end,__from_next,
|
||||
__to,__to_limit,__to_next);
|
||||
}
|
||||
|
||||
// 22,2,1,5,1, p2
|
||||
result unshift (state_type& __state, extern_type* __to,
|
||||
extern_type* __to_limit, extern_type*& __to_next) const {
|
||||
return do_unshift (__state,__to,__to_limit,__to_next);
|
||||
}
|
||||
|
||||
// 22,2,1,5,1, p3
|
||||
result in (state_type& __state, const extern_type* __from,
|
||||
const extern_type* __from_end, const extern_type*& __from_next,
|
||||
intern_type* __to, intern_type* __to_limit,
|
||||
intern_type*& __to_next) const {
|
||||
return do_in (__state,__from,__from_end,__from_next,
|
||||
__to,__to_limit,__to_next);
|
||||
}
|
||||
|
||||
// 22,2,1,5,1, p5
|
||||
bool always_noconv () const _THROWS (()) {
|
||||
return do_always_noconv();
|
||||
}
|
||||
|
||||
// 22,2,1,5,1, p4
|
||||
int encoding () const _THROWS (()) {
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
// 22,2,1,5,1, p6, lwg issue 75
|
||||
int length (state_type& __state, const extern_type* __from,
|
||||
const extern_type* __end, _RWSTD_SIZE_T __maxlen) const {
|
||||
return do_length (__state, __from, __end, __maxlen);
|
||||
}
|
||||
|
||||
// 22,2,1,5,1, p7
|
||||
int max_length() const _THROWS (()) {
|
||||
return do_max_length();
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
};
|
||||
|
||||
#endif // _RWSTD_NO_EXT_CODECVT_PRIMARY
|
||||
|
||||
|
||||
// 22.2.1.5, p3 - performs no conversion
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class _RWSTD_EXPORT codecvt<char, char, _RWSTD_MBSTATE_T>
|
||||
: public _RW::__rw_facet,
|
||||
public codecvt_base
|
||||
{
|
||||
public:
|
||||
|
||||
typedef char extern_type;
|
||||
typedef char intern_type;
|
||||
typedef _RWSTD_MBSTATE_T state_type;
|
||||
|
||||
_EXPLICIT codecvt (_RWSTD_SIZE_T = 0);
|
||||
|
||||
virtual ~codecvt ();
|
||||
|
||||
result out (state_type &__state,
|
||||
const intern_type *__from, const intern_type* __from_end,
|
||||
const intern_type *&__from_next,
|
||||
extern_type* __to, extern_type* __to_limit,
|
||||
extern_type *&__to_next) const {
|
||||
return do_out (__state, __from, __from_end, __from_next,
|
||||
__to, __to_limit, __to_next);
|
||||
}
|
||||
|
||||
result unshift (state_type &__state,
|
||||
extern_type *__to, extern_type *__to_limit,
|
||||
extern_type*& __to_next) const {
|
||||
return do_unshift (__state, __to, __to_limit, __to_next);
|
||||
}
|
||||
|
||||
result in (state_type &__state,
|
||||
const extern_type *__from, const extern_type *__from_end,
|
||||
const extern_type *&__from_next,
|
||||
intern_type *__to, intern_type *__to_limit,
|
||||
intern_type *&__to_next) const {
|
||||
return do_in (__state, __from, __from_end, __from_next,
|
||||
__to, __to_limit, __to_next);
|
||||
}
|
||||
|
||||
int encoding () const _THROWS (()) {
|
||||
return do_encoding ();
|
||||
}
|
||||
|
||||
bool always_noconv () const _THROWS (());
|
||||
|
||||
// signature follows lwg issue 75
|
||||
int length (state_type &__state, const extern_type *__from,
|
||||
const extern_type *__end, _RWSTD_SIZE_T __maxlen) const {
|
||||
return do_length (__state, __from, __end, __maxlen);
|
||||
}
|
||||
|
||||
int max_length () const _THROWS (()) {
|
||||
return do_max_length ();
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
virtual result
|
||||
do_out (state_type&,
|
||||
const intern_type*, const intern_type*, const intern_type*&,
|
||||
extern_type*, extern_type*, extern_type*&) const;
|
||||
|
||||
virtual result
|
||||
do_in (state_type&,
|
||||
const extern_type*, const extern_type*, const extern_type*&,
|
||||
intern_type*, intern_type*, intern_type*&) const;
|
||||
|
||||
// 22.2.1.5.2, p5 - stores no characters
|
||||
virtual result
|
||||
do_unshift (state_type&,
|
||||
extern_type*, extern_type*, extern_type*&) const;
|
||||
|
||||
virtual int do_encoding () const _THROWS (());
|
||||
|
||||
virtual bool do_always_noconv () const _THROWS (());
|
||||
|
||||
// signature follows lwg issue 75
|
||||
virtual int
|
||||
do_length (state_type&,
|
||||
const extern_type*, const extern_type*, _RWSTD_SIZE_T) const;
|
||||
|
||||
virtual int do_max_length () const _THROWS (());
|
||||
|
||||
private:
|
||||
|
||||
int _C_always_noconv; // cached value
|
||||
};
|
||||
|
||||
|
||||
inline bool
|
||||
codecvt<char, char, _RWSTD_MBSTATE_T>::
|
||||
always_noconv () const _THROWS (())
|
||||
{
|
||||
// optimize away repeated calls to the virtual function
|
||||
if (_C_always_noconv < 0) {
|
||||
|
||||
// typedef works around an HP aCC x.38 bug (PR #25832)
|
||||
typedef codecvt<char, char, _RWSTD_MBSTATE_T> _CodeCvt;
|
||||
|
||||
_CodeCvt *__self = _RWSTD_CONST_CAST (_CodeCvt*, this);
|
||||
|
||||
__self->_C_always_noconv = do_always_noconv ();
|
||||
}
|
||||
|
||||
return 1 == _C_always_noconv;
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
// 22.2.1.5, p3 - converts between wide and narrow characters
|
||||
// of the native character set (i.e., widens and narrows)
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class _RWSTD_EXPORT codecvt<wchar_t, char, _RWSTD_MBSTATE_T>
|
||||
: public _RW::__rw_facet,
|
||||
public codecvt_base
|
||||
{
|
||||
public:
|
||||
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef _RWSTD_MBSTATE_T state_type;
|
||||
|
||||
protected:
|
||||
|
||||
virtual result
|
||||
do_out (state_type&, const intern_type*, const intern_type*,
|
||||
const intern_type*&,
|
||||
extern_type*, extern_type*, extern_type*&) const;
|
||||
|
||||
virtual result
|
||||
do_in (state_type&,
|
||||
const extern_type*, const extern_type*, const extern_type*&,
|
||||
intern_type*, intern_type*, intern_type*&) const;
|
||||
|
||||
// 22.2.1.5.2, p5 - stores no characters
|
||||
virtual result
|
||||
do_unshift (state_type&, extern_type*, extern_type*, extern_type*&) const;
|
||||
|
||||
virtual bool do_always_noconv () const _THROWS (());
|
||||
|
||||
virtual int do_encoding () const _THROWS (());
|
||||
|
||||
// signature follows lwg issue 75
|
||||
virtual int
|
||||
do_length (state_type&,
|
||||
const extern_type*, const extern_type*, _RWSTD_SIZE_T) const;
|
||||
|
||||
virtual int do_max_length () const _THROWS (());
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT codecvt (_RWSTD_SIZE_T = 0);
|
||||
|
||||
result out (state_type& __state,
|
||||
const intern_type *__from, const intern_type *__from_end,
|
||||
const intern_type *&__from_next,
|
||||
extern_type *__to, extern_type* __to_limit,
|
||||
extern_type *& __to_next) const {
|
||||
return do_out (__state, __from, __from_end, __from_next, __to,
|
||||
__to_limit, __to_next);
|
||||
}
|
||||
|
||||
result unshift (state_type &__state,
|
||||
extern_type *__to, extern_type *__to_limit,
|
||||
extern_type *&__to_next) const {
|
||||
return do_unshift (__state, __to, __to_limit, __to_next);
|
||||
}
|
||||
|
||||
result in (state_type& __state,
|
||||
const extern_type *__from, const extern_type *__from_end,
|
||||
const extern_type *&__from_next,
|
||||
intern_type *__to, intern_type *__to_limit,
|
||||
intern_type *&__to_next) const {
|
||||
return do_in (__state, __from, __from_end, __from_next,
|
||||
__to, __to_limit, __to_next);
|
||||
}
|
||||
|
||||
int encoding () const _THROWS (()) {
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
bool always_noconv () const _THROWS (()) {
|
||||
return do_always_noconv ();
|
||||
}
|
||||
|
||||
// signature follows lwg issue 75
|
||||
int length (state_type &__state,
|
||||
const extern_type *__from, const extern_type *__end,
|
||||
_RWSTD_SIZE_T __maxlen) const {
|
||||
return do_length (__state, __from, __end, __maxlen);
|
||||
}
|
||||
|
||||
int max_length () const _THROWS (()) {
|
||||
return do_max_length ();
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
};
|
||||
|
||||
|
||||
#endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
|
||||
// 22.2.1.6
|
||||
template <class _InternT, class _ExternT, class _StateT>
|
||||
class codecvt_byname: public codecvt<_InternT, _ExternT, _StateT>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
|
||||
public:
|
||||
|
||||
typedef _InternT intern_type;
|
||||
typedef _ExternT extern_type;
|
||||
typedef _StateT state_type;
|
||||
|
||||
_EXPLICIT codecvt_byname (const char *__name, _RWSTD_SIZE_T __ref = 0)
|
||||
: codecvt <_InternT, _ExternT, _StateT> (__ref) {
|
||||
this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class _RWSTD_EXPORT codecvt_byname<wchar_t, char, _RWSTD_MBSTATE_T>
|
||||
: public codecvt<wchar_t, char, _RWSTD_MBSTATE_T>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
|
||||
unsigned _C_flags;
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT codecvt_byname (const char*, _RWSTD_SIZE_T = 0);
|
||||
|
||||
protected:
|
||||
|
||||
virtual codecvt_base::result
|
||||
do_out (state_type&,
|
||||
const intern_type*, const intern_type*, const intern_type*&,
|
||||
extern_type*, extern_type*, extern_type*&) const;
|
||||
|
||||
virtual codecvt_base::result
|
||||
do_in (state_type&,
|
||||
const extern_type*, const extern_type*, const extern_type*&,
|
||||
intern_type*, intern_type*, intern_type*&) const;
|
||||
|
||||
|
||||
virtual codecvt_base::result
|
||||
do_unshift (state_type&,
|
||||
extern_type*, extern_type*, extern_type*&) const;
|
||||
|
||||
virtual int do_encoding () const _THROWS (());
|
||||
|
||||
// signature follows lwg issue 75
|
||||
virtual int
|
||||
do_length (state_type&, const extern_type*, const extern_type*,
|
||||
_RWSTD_SIZE_T) const;
|
||||
|
||||
virtual int do_max_length () const _THROWS (());
|
||||
};
|
||||
|
||||
|
||||
#endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE (_CODECVT)
|
||||
# include <loc/_codecvt.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE (_CODECVT)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_CODECVT_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_collate.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_collate.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_collate.c
|
||||
*
|
||||
* $Id: _collate.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_collate.cc>
|
||||
40
extern/stdcxx/4.2.1/include/loc/_collate.cc
vendored
Normal file
40
extern/stdcxx/4.2.1/include/loc/_collate.cc
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _collate .cc - definition of std::collate members
|
||||
*
|
||||
* $Id: _collate.cc 597181 2007-11-21 18:59:19Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_COLLATE_PRIMARY
|
||||
|
||||
template <class _CharT>
|
||||
_RW::__rw_facet_id collate<_CharT>::id;
|
||||
|
||||
#endif // _RWSTD_NO_EXT_COLLATE_PRIMARY
|
||||
|
||||
} // namespace std
|
||||
265
extern/stdcxx/4.2.1/include/loc/_collate.h
vendored
Normal file
265
extern/stdcxx/4.2.1/include/loc/_collate.h
vendored
Normal file
@@ -0,0 +1,265 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _collate.h - definition of the std::collate class templates
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _collate.h 597181 2007-11-21 18:59:19Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_COLLATE_H_INCLUDED
|
||||
#define _RWSTD_LOC_COLLATE_H_INCLUDED
|
||||
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <loc/_facet.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT>
|
||||
class collate;
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_COLLATE_PRIMARY
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT>
|
||||
class collate: public _RW::__rw_facet
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<char_type, char_traits<char_type>,
|
||||
allocator<char_type> >
|
||||
string_type;
|
||||
|
||||
_EXPLICIT collate (_RWSTD_SIZE_T __refs = 0)
|
||||
: _RW::__rw_facet (__refs) { }
|
||||
|
||||
int
|
||||
compare (const char_type* __low1, const char_type* __high1,
|
||||
const char_type* __low2, const char_type* __high2) const {
|
||||
return do_compare (__low1, __high1, __low2, __high2);
|
||||
}
|
||||
|
||||
string_type
|
||||
transform (const char_type* __low, const char_type* __high) const {
|
||||
return do_transform (__low, __high);
|
||||
}
|
||||
|
||||
long
|
||||
hash (const char_type* __low, const char_type* __high) const {
|
||||
return do_hash (__low, __high);
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
// protected virtual members are not defined
|
||||
virtual int
|
||||
do_compare (const char_type*, const char_type*,
|
||||
const char_type*, const char_type*) const;
|
||||
|
||||
virtual string_type
|
||||
do_transform (const char_type*, const char_type*) const;
|
||||
|
||||
virtual long
|
||||
do_hash (const char_type*, const char_type*) const;
|
||||
};
|
||||
|
||||
#endif // _RWSTD_NO_EXT_COLLATE_PRIMARY
|
||||
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class _RWSTD_EXPORT collate<char>: public _RW::__rw_facet
|
||||
{
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef basic_string<char_type, char_traits<char_type>,
|
||||
allocator<char_type> >
|
||||
string_type;
|
||||
|
||||
_EXPLICIT collate (_RWSTD_SIZE_T __refs = 0)
|
||||
: _RW::__rw_facet (__refs) { }
|
||||
|
||||
int
|
||||
compare (const char_type* __low1, const char_type* __high1,
|
||||
const char_type* __low2, const char_type* __high2) const {
|
||||
return do_compare (__low1, __high1, __low2, __high2);
|
||||
}
|
||||
|
||||
string_type
|
||||
transform (const char_type* __low, const char_type* __high) const {
|
||||
return do_transform (__low, __high);
|
||||
}
|
||||
|
||||
long
|
||||
hash (const char_type* __low, const char_type* __high) const {
|
||||
return do_hash (__low, __high);
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
virtual int
|
||||
do_compare (const char_type*, const char_type*,
|
||||
const char_type*, const char_type*) const;
|
||||
|
||||
virtual string_type
|
||||
do_transform (const char_type*, const char_type*) const;
|
||||
|
||||
virtual long
|
||||
do_hash (const char_type*, const char_type*) const;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class _RWSTD_EXPORT collate<wchar_t>: public _RW::__rw_facet
|
||||
{
|
||||
public:
|
||||
typedef wchar_t char_type;
|
||||
typedef basic_string<char_type, char_traits<char_type>,
|
||||
allocator<char_type> >
|
||||
string_type;
|
||||
|
||||
_EXPLICIT collate (_RWSTD_SIZE_T __refs = 0)
|
||||
: _RW::__rw_facet (__refs) { }
|
||||
|
||||
int
|
||||
compare (const char_type* __low1, const char_type* __high1,
|
||||
const char_type* __low2, const char_type* __high2) const {
|
||||
return do_compare (__low1, __high1, __low2, __high2);
|
||||
}
|
||||
|
||||
string_type
|
||||
transform (const char_type* __low, const char_type* __high) const {
|
||||
return do_transform (__low, __high);
|
||||
}
|
||||
|
||||
long
|
||||
hash (const char_type* __low, const char_type* __high) const {
|
||||
return do_hash (__low, __high);
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
virtual int
|
||||
do_compare (const char_type*, const char_type*,
|
||||
const char_type*, const char_type*) const;
|
||||
|
||||
virtual string_type
|
||||
do_transform (const char_type*, const char_type*) const;
|
||||
|
||||
virtual long
|
||||
do_hash (const char_type*, const char_type*) const;
|
||||
};
|
||||
|
||||
#endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
class collate_byname: public collate<_CharT>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT collate_byname (const char *__name, _RWSTD_SIZE_T __ref = 0)
|
||||
: collate<_CharT>(__ref) {
|
||||
this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class _RWSTD_EXPORT collate_byname<char>: public collate<char>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
public:
|
||||
|
||||
_EXPLICIT collate_byname (const char* __name, _RWSTD_SIZE_T __ref = 0)
|
||||
: collate<char_type>(__ref){
|
||||
this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual int
|
||||
do_compare (const char_type*, const char_type*,
|
||||
const char_type*, const char_type*) const;
|
||||
|
||||
virtual string_type
|
||||
do_transform (const char_type*, const char_type*) const;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class _RWSTD_EXPORT collate_byname<wchar_t>: public collate<wchar_t>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
public:
|
||||
|
||||
_EXPLICIT collate_byname (const char* __name, _RWSTD_SIZE_T __ref = 0)
|
||||
: collate<char_type>(__ref){
|
||||
this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual int
|
||||
do_compare (const char_type*, const char_type*,
|
||||
const char_type*, const char_type*) const;
|
||||
|
||||
virtual string_type
|
||||
do_transform (const char_type*, const char_type*) const;
|
||||
};
|
||||
|
||||
#endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE (_COLLATE)
|
||||
# include <loc/_collate.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE (_COLLATE)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_COLLATE_H_INCLUDED
|
||||
142
extern/stdcxx/4.2.1/include/loc/_convenience.h
vendored
Normal file
142
extern/stdcxx/4.2.1/include/loc/_convenience.h
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _convenience.h - definitions of locale convenience interfaces
|
||||
* as described in [lib.locale.convenience]
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _convenience.h 597438 2007-11-22 15:44:53Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_CONVENIENCE_H_INCLUDED
|
||||
#define _RWSTD_LOC_CONVENIENCE_H_INCLUDED
|
||||
|
||||
|
||||
#include <loc/_ctype.h>
|
||||
#include <loc/_locale.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
// convenience interfaces: is*(char)
|
||||
// names parenthesized to avoid clashing with masking macros
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline bool (isspace)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return _RWSTD_USE_FACET (ctype<_CharT>, __loc).is (ctype_base::space, __c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline bool (isprint)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return _RWSTD_USE_FACET (ctype<_CharT>, __loc).is (ctype_base::print, __c);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
inline bool (iscntrl)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return _RWSTD_USE_FACET (ctype<_CharT>, __loc).is(ctype_base::cntrl, __c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline bool (isupper)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return _RWSTD_USE_FACET (ctype<_CharT>, __loc).is (ctype_base::upper, __c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline bool (islower)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return _RWSTD_USE_FACET (ctype<_CharT>, __loc).is (ctype_base::lower, __c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline bool (isalpha)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return _RWSTD_USE_FACET (ctype<_CharT>, __loc).is (ctype_base::alpha, __c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline bool (isdigit)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return _RWSTD_USE_FACET (ctype<_CharT>, __loc).is (ctype_base::digit, __c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline bool (ispunct)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return _RWSTD_USE_FACET (ctype<_CharT>, __loc).is(ctype_base::punct, __c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline bool (isxdigit)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return _RWSTD_USE_FACET (ctype<_CharT>, __loc).is (ctype_base::xdigit,
|
||||
__c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline bool (isalnum)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return _RWSTD_USE_FACET (ctype<_CharT>, __loc).is (ctype_base::alnum, __c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline bool (isgraph)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return _RWSTD_USE_FACET (ctype<_CharT>, __loc).is (ctype_base::graph, __c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline _CharT (toupper)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return (_RWSTD_USE_FACET (ctype<_CharT>, __loc).toupper) (__c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline _CharT (tolower)(_CharT __c, const locale &__loc)
|
||||
{
|
||||
return (_RWSTD_USE_FACET (ctype<_CharT>, __loc).tolower) (__c);
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_CONVENIENCE_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_ctype.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_ctype.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_ctype.c
|
||||
*
|
||||
* $Id: _ctype.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_ctype.cc>
|
||||
148
extern/stdcxx/4.2.1/include/loc/_ctype.cc
vendored
Normal file
148
extern/stdcxx/4.2.1/include/loc/_ctype.cc
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _ctype .cc - definition of std::ctype members
|
||||
*
|
||||
* $Id: _ctype.cc 597181 2007-11-21 18:59:19Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_CTYPE_PRIMARY
|
||||
|
||||
template <class _CharT>
|
||||
_RW::__rw_facet_id ctype<_CharT>::id;
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
/* virtual */ const _TYPENAME ctype<_CharT>::char_type*
|
||||
ctype<_CharT>::
|
||||
do_is (const char_type *__lo, const char_type *__hi, mask *__m) const
|
||||
{
|
||||
_RWSTD_ASSERT (__lo <= __hi);
|
||||
_RWSTD_ASSERT (!__lo || __m);
|
||||
|
||||
for (; __lo < __hi; ++__lo, ++__m)
|
||||
*__m = mask ();
|
||||
|
||||
return __hi;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
/* virtual */ const _TYPENAME ctype<_CharT>::char_type*
|
||||
ctype<_CharT>::
|
||||
do_scan_is (mask __m, const char_type *__lo, const char_type *__hi) const
|
||||
{
|
||||
_RWSTD_ASSERT (__lo <= __hi);
|
||||
|
||||
for (; __lo < __hi; ++__lo) {
|
||||
if (is (__m, *__lo))
|
||||
return __lo;
|
||||
}
|
||||
|
||||
return __hi;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
/* virtual */ const _TYPENAME ctype<_CharT>::char_type*
|
||||
ctype<_CharT>::
|
||||
do_scan_not (mask __m, const char_type *__lo, const char_type *__hi) const
|
||||
{
|
||||
_RWSTD_ASSERT (__lo <= __hi);
|
||||
|
||||
for (; __lo < __hi; ++__lo) {
|
||||
if (!is (__m, *__lo))
|
||||
return __lo;
|
||||
}
|
||||
|
||||
return __hi;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
/* virtual */ const _TYPENAME ctype<_CharT>::char_type*
|
||||
ctype<_CharT>::
|
||||
do_toupper (char_type *__lo, const char_type *__hi) const
|
||||
{
|
||||
_RWSTD_ASSERT (__lo <= __hi);
|
||||
|
||||
for (; __lo < __hi; ++__lo) {
|
||||
*__lo = (toupper)(*__lo);
|
||||
}
|
||||
|
||||
return __hi;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
/* virtual */ const _TYPENAME ctype<_CharT>::char_type*
|
||||
ctype<_CharT>::
|
||||
do_tolower (char_type *__lo, const char_type *__hi) const
|
||||
{
|
||||
_RWSTD_ASSERT (__lo <= __hi);
|
||||
|
||||
for (; __lo < __hi; ++__lo) {
|
||||
*__lo = (tolower)(*__lo);
|
||||
}
|
||||
|
||||
return __hi;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
/* virtual */ const char*
|
||||
ctype<_CharT>::
|
||||
do_widen (const char *__lo, const char *__hi, char_type *__dest) const
|
||||
{
|
||||
_RWSTD_ASSERT (__lo <= __hi);
|
||||
|
||||
for (; __lo < __hi; ++__lo, ++__dest)
|
||||
*__dest = widen (*__lo);
|
||||
|
||||
return __hi;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
/* virtual */ const _TYPENAME ctype<_CharT>::char_type*
|
||||
ctype<_CharT>::
|
||||
do_narrow (const char_type *__lo, const char_type *__hi,
|
||||
char __dfault, char *__dest) const
|
||||
{
|
||||
_RWSTD_ASSERT (__lo <= __hi);
|
||||
_RWSTD_ASSERT (!__lo || __dest);
|
||||
|
||||
for (; __lo < __hi; ++__lo, ++__dest)
|
||||
*__dest = narrow (*__lo, __dfault);
|
||||
|
||||
return __hi;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_EXT_CTYPE_PRIMARY
|
||||
|
||||
|
||||
} // namespace std
|
||||
655
extern/stdcxx/4.2.1/include/loc/_ctype.h
vendored
Normal file
655
extern/stdcxx/4.2.1/include/loc/_ctype.h
vendored
Normal file
@@ -0,0 +1,655 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _ctype.h
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _ctype.h 649680 2008-04-18 20:18:52Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 2001-2005 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_CTYPE_H_INCLUDED
|
||||
#define _RWSTD_LOC_CTYPE_H_INCLUDED
|
||||
|
||||
|
||||
#include <loc/_facet.h>
|
||||
#include <rw/_bitmask.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
struct __rw_ctype_t;
|
||||
|
||||
enum __rw_ctype_mask {
|
||||
__rw_none = 0,
|
||||
__rw_space = 0x0001,
|
||||
__rw_print = 0x0002,
|
||||
__rw_cntrl = 0x0004,
|
||||
__rw_upper = 0x0008,
|
||||
__rw_lower = 0x0010,
|
||||
__rw_alpha = 0x0020,
|
||||
__rw_digit = 0x0040,
|
||||
__rw_punct = 0x0080,
|
||||
__rw_xdigit = 0x0100,
|
||||
__rw_alnum = __rw_alpha | __rw_digit,
|
||||
__rw_graph = 0x0200,
|
||||
__rw_all = 0x03ff
|
||||
};
|
||||
|
||||
_RWSTD_DEFINE_BITMASK_OPERATORS (__rw_ctype_mask);
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
struct _RWSTD_CLASS_EXPORT locale;
|
||||
|
||||
// 22.2.1
|
||||
struct _RWSTD_EXPORT ctype_base
|
||||
{
|
||||
// 22.2.1, p1 - mask is a bitmask type (see 17.3.3.1.2)
|
||||
typedef _RWSTD_BITMASK_ENUM (_RW::__rw_ctype_mask) mask;
|
||||
|
||||
_RWSTD_STATIC_CONST (mask, space = _RW::__rw_space);
|
||||
_RWSTD_STATIC_CONST (mask, print = _RW::__rw_print);
|
||||
_RWSTD_STATIC_CONST (mask, cntrl = _RW::__rw_cntrl);
|
||||
_RWSTD_STATIC_CONST (mask, upper = _RW::__rw_upper);
|
||||
_RWSTD_STATIC_CONST (mask, lower = _RW::__rw_lower);
|
||||
_RWSTD_STATIC_CONST (mask, alpha = _RW::__rw_alpha);
|
||||
_RWSTD_STATIC_CONST (mask, digit = _RW::__rw_digit);
|
||||
_RWSTD_STATIC_CONST (mask, punct = _RW::__rw_punct);
|
||||
_RWSTD_STATIC_CONST (mask, xdigit = _RW::__rw_xdigit);
|
||||
_RWSTD_STATIC_CONST (mask, alnum = _RW::__rw_alnum);
|
||||
_RWSTD_STATIC_CONST (mask, graph = _RW::__rw_graph);
|
||||
};
|
||||
|
||||
|
||||
// 22.2.1.1
|
||||
_EXPORT
|
||||
template <class _CharT>
|
||||
class ctype;
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_CTYPE_PRIMARY
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT>
|
||||
class ctype: public _RW::__rw_facet, public ctype_base
|
||||
{
|
||||
public:
|
||||
|
||||
typedef _CharT char_type;
|
||||
|
||||
_EXPLICIT ctype (_RWSTD_SIZE_T __ref = 0)
|
||||
: _RW::__rw_facet (__ref) { }
|
||||
|
||||
|
||||
// 22.2.1.1.1, p1
|
||||
bool is (mask __m, char_type __c) const {
|
||||
return do_is ( __m, __c);
|
||||
}
|
||||
|
||||
const char_type*
|
||||
is (const char_type* __lo, const char_type *__hi, mask *__vec) const {
|
||||
return do_is (__lo, __hi, __vec);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p2
|
||||
const char_type*
|
||||
scan_is (mask __m, const char_type *__lo, const char_type *__hi) const {
|
||||
return do_scan_is ( __m, __lo, __hi);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p3
|
||||
const char_type*
|
||||
scan_not (mask __m, const char_type *__lo, const char_type *__hi) const {
|
||||
return do_scan_not ( __m, __lo, __hi);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p4
|
||||
char_type (toupper)(char_type __c) const {
|
||||
return do_toupper (__c);
|
||||
}
|
||||
|
||||
const char_type* (toupper)(char_type *__lo, const char_type *__hi) const {
|
||||
return do_toupper (__lo, __hi);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p5
|
||||
char_type (tolower)(char_type __c) const {
|
||||
return do_tolower (__c);
|
||||
}
|
||||
|
||||
const char_type* (tolower)(char_type *__lo, const char_type *__hi) const {
|
||||
return do_tolower (__lo, __hi);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p6
|
||||
char_type widen (char __c) const {
|
||||
return do_widen (__c);
|
||||
}
|
||||
|
||||
const char*
|
||||
widen (const char *__lo, const char *__hi, char_type *__to) const {
|
||||
return do_widen (__lo, __hi, __to);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p7
|
||||
char narrow (char_type __c, char __dfault) const {
|
||||
return do_narrow (__c, __dfault);
|
||||
}
|
||||
|
||||
const char_type*
|
||||
narrow (const char_type *__lo, const char_type *__hi,
|
||||
char __dfault, char *__to) const {
|
||||
return do_narrow (__lo, __hi, __dfault, __to);
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
// 22.2.1.1.2, p1
|
||||
virtual bool do_is (mask, char_type) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual const char_type*
|
||||
do_is (const char_type*, const char_type*, mask*) const;
|
||||
|
||||
// 22.2.1.1.2, p3
|
||||
virtual const char_type*
|
||||
do_scan_is (mask, const char_type*, const char_type*) const;
|
||||
|
||||
// 22.2.1.1.2, p5
|
||||
virtual const char_type*
|
||||
do_scan_not (mask, const char_type*, const char_type*) const;
|
||||
|
||||
// 22.2.1.1.2, p7
|
||||
virtual char_type do_toupper (char_type __c) const {
|
||||
return __c;
|
||||
}
|
||||
|
||||
virtual const char_type*
|
||||
do_toupper (char_type*, const char_type*) const;
|
||||
|
||||
// 22.2.1.1.2, p9
|
||||
virtual char_type do_tolower (char_type __c) const {
|
||||
return __c;
|
||||
}
|
||||
|
||||
virtual const char_type*
|
||||
do_tolower (char_type*, const char_type*) const;
|
||||
|
||||
// 22.2.1.1.2, p11
|
||||
virtual char_type do_widen (char) const {
|
||||
return char_type ();
|
||||
}
|
||||
|
||||
virtual const char*
|
||||
do_widen (const char*, const char*, char_type*) const;
|
||||
|
||||
// 22.2.1.1.2, p13
|
||||
virtual char do_narrow (char_type, char __dfault) const {
|
||||
return __dfault;
|
||||
}
|
||||
|
||||
virtual const char_type*
|
||||
do_narrow (const char_type*, const char_type*, char, char*) const;
|
||||
};
|
||||
|
||||
#endif // _RWSTD_NO_EXT_CTYPE_PRIMARY
|
||||
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class _RWSTD_EXPORT ctype<char>: public _RW::__rw_facet, public ctype_base
|
||||
{
|
||||
typedef unsigned char _UChar;
|
||||
|
||||
public:
|
||||
|
||||
typedef char char_type;
|
||||
|
||||
bool is (mask __m, char_type __c) const {
|
||||
#if _RWSTD_UCHAR_MAX <= 255
|
||||
return (_C_mask_tab [_UChar (__c)] & __m) != 0;
|
||||
#else
|
||||
return __c < table_size && (_C_mask_tab [_UChar (__c)] & __m) != 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
_RWSTD_STATIC_CONST (_RWSTD_SIZE_T, table_size = 256);
|
||||
|
||||
_EXPLICIT ctype (const mask* = 0, bool = false, _RWSTD_SIZE_T = 0);
|
||||
|
||||
const char_type* is (const char_type*, const char_type*, mask*) const;
|
||||
|
||||
const char_type* scan_is (mask, const char_type*, const char_type*) const;
|
||||
|
||||
const char_type* scan_not (mask, const char_type*, const char_type*) const;
|
||||
|
||||
char_type (toupper)(char_type __c) const {
|
||||
return do_toupper (__c);
|
||||
}
|
||||
|
||||
char_type (tolower)(char_type __c) const {
|
||||
return do_tolower (__c);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p6
|
||||
char_type widen (char) const;
|
||||
|
||||
char narrow (char_type, char) const;
|
||||
|
||||
const char_type* (toupper)(char_type *__lo, const char_type *__hi) const {
|
||||
return do_toupper (__lo, __hi);
|
||||
}
|
||||
|
||||
const char_type* (tolower)(char_type *__lo, const char_type *__hi) const {
|
||||
return do_tolower (__lo, __hi);
|
||||
}
|
||||
|
||||
const char_type*
|
||||
widen (const char *__lo, const char *__hi, char_type *__to) const {
|
||||
return do_widen (__lo, __hi, __to);
|
||||
}
|
||||
|
||||
const char_type*
|
||||
narrow (const char_type *__lo, const char_type *__hi,
|
||||
char_type __dfault, char_type *__to) const {
|
||||
return do_narrow (__lo, __hi, __dfault, __to);
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
const mask* table () const _THROWS (()) {
|
||||
return _C_mask_tab;
|
||||
}
|
||||
|
||||
static const mask* classic_table () _THROWS (());
|
||||
|
||||
virtual ~ctype ();
|
||||
|
||||
virtual const char_type*
|
||||
do_toupper (char_type*, const char_type*) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_tolower (char_type*, const char_type*) const;
|
||||
|
||||
virtual char_type do_toupper (char_type) const;
|
||||
|
||||
virtual char_type do_tolower (char_type) const;
|
||||
|
||||
virtual char_type do_widen (char) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_widen (const char_type*, const char_type*, char_type*) const;
|
||||
|
||||
virtual char_type do_narrow (char_type, char_type) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_narrow (const char_type*, const char_type*, char_type, char_type*)const;
|
||||
|
||||
protected:
|
||||
|
||||
const mask *_C_mask_tab; // mask for each character
|
||||
unsigned char *_C_upper_tab; // uppercase version of each character
|
||||
unsigned char *_C_lower_tab; // lowercase version of each character
|
||||
char _C_narrow_tab [256]; // cached results of do_narrow()
|
||||
char _C_wide_tab [256]; // cached results of do_widen()
|
||||
int _C_delete_it; // delete tables above?
|
||||
};
|
||||
|
||||
|
||||
inline ctype<char>::char_type
|
||||
ctype<char>::narrow (char_type __c, char __dfault) const
|
||||
{
|
||||
const _RWSTD_SIZE_T __inx = _RWSTD_STATIC_CAST (unsigned char, __c);
|
||||
|
||||
// optimize away all but the first call to the virtual do_widen()
|
||||
|
||||
if (
|
||||
|
||||
#if _RWSTD_CHAR_BIT > 8
|
||||
|
||||
__inx < sizeof _C_narrow_tab / sizeof *_C_narrow_tab &&
|
||||
|
||||
#endif // _RWSTD_CHAR_BIT > 8
|
||||
|
||||
_C_narrow_tab [__inx])
|
||||
return _C_narrow_tab [__inx];
|
||||
|
||||
// template argument provided to work around an HP aCC bug (PR #27087)
|
||||
ctype<char>* const __self = _RWSTD_CONST_CAST (ctype<char>*, this);
|
||||
|
||||
__c = do_narrow (__c, __dfault);
|
||||
|
||||
if (__c != __dfault)
|
||||
__self->_C_narrow_tab [__inx] = __c;
|
||||
|
||||
return __c;
|
||||
}
|
||||
|
||||
|
||||
inline ctype<char>::char_type
|
||||
ctype<char>::widen (char __ch) const
|
||||
{
|
||||
const _RWSTD_SIZE_T __inx = _RWSTD_STATIC_CAST (unsigned char, __ch);
|
||||
|
||||
// optimize away all but the first call to the virtual do_widen()
|
||||
|
||||
#if _RWSTD_CHAR_BIT <= 8
|
||||
const bool __fits = true;
|
||||
#else
|
||||
const bool __fits = __inx < sizeof _C_wide_tab / sizeof *_C_wide_tab;
|
||||
#endif
|
||||
|
||||
if (__fits) {
|
||||
if (_C_wide_tab [__inx])
|
||||
return _C_wide_tab [__inx];
|
||||
|
||||
// template argument provided to work around an HP aCC bug (PR #27087)
|
||||
ctype<char>* const __self = _RWSTD_CONST_CAST (ctype<char>*, this);
|
||||
|
||||
return __self->_C_wide_tab [__inx] = do_widen (__ch);
|
||||
}
|
||||
else
|
||||
return do_widen (__ch);
|
||||
}
|
||||
|
||||
|
||||
// 22.2.1.2
|
||||
template <class _CharT>
|
||||
class ctype_byname: public ctype<_CharT>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT ctype_byname (const char *__name, _RWSTD_SIZE_T __ref = 0)
|
||||
: ctype<_CharT>(__ref) {
|
||||
this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class _RWSTD_EXPORT ctype_byname<char>: public ctype<char>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT ctype_byname (const char*, _RWSTD_SIZE_T = 0);
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class _RWSTD_EXPORT ctype<wchar_t>: public _RW::__rw_facet, public ctype_base
|
||||
{
|
||||
typedef unsigned char _UChar;
|
||||
|
||||
enum { _C_tab_size = 256 };
|
||||
|
||||
public:
|
||||
|
||||
typedef wchar_t char_type;
|
||||
|
||||
_EXPLICIT ctype (_RWSTD_SIZE_T = 0);
|
||||
|
||||
// 22.2.1.1.1, p1
|
||||
bool is (mask __m, char_type __c) const {
|
||||
return do_is ( __m, __c);
|
||||
}
|
||||
|
||||
const char_type*
|
||||
is (const char_type *__lo, const char_type *__hi, mask *__vec) const {
|
||||
return do_is (__lo, __hi, __vec);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p2
|
||||
const char_type*
|
||||
scan_is (mask __m, const char_type *__lo, const char_type *__hi) const {
|
||||
return do_scan_is ( __m, __lo, __hi);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p3
|
||||
const char_type*
|
||||
scan_not (mask __m, const char_type *__lo, const char_type *__hi) const {
|
||||
return do_scan_not ( __m, __lo, __hi);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p4
|
||||
char_type (toupper)(char_type __c) const {
|
||||
return do_toupper (__c);
|
||||
}
|
||||
|
||||
const char_type* (toupper)(char_type *__lo, const char_type *__hi) const {
|
||||
return do_toupper (__lo, __hi);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p5
|
||||
char_type (tolower)(char_type __c) const {
|
||||
return do_tolower (__c);
|
||||
}
|
||||
|
||||
const char_type* (tolower)(char_type *__lo, const char_type *__hi) const {
|
||||
return do_tolower (__lo, __hi);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p6
|
||||
char_type widen (char) const;
|
||||
|
||||
const char*
|
||||
widen (const char* __lo, const char *__hi, char_type *__to) const {
|
||||
return do_widen (__lo, __hi, __to);
|
||||
}
|
||||
|
||||
// 22.2.1.1.1, p7
|
||||
char narrow (char_type, char) const;
|
||||
|
||||
const char_type*
|
||||
narrow (const char_type *__lo, const char_type *__hi,
|
||||
char __dfault, char *__to) const {
|
||||
return do_narrow (__lo, __hi, __dfault, __to);
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~ctype ();
|
||||
|
||||
// 22.2.1.1.2, p1
|
||||
virtual bool do_is (mask, char_type) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_is (const char_type*, const char_type*, mask*) const;
|
||||
|
||||
// 22.2.1.1.2, p7
|
||||
virtual char_type do_toupper (char_type) const;
|
||||
|
||||
// 22.2.1.1.2, p9
|
||||
virtual char_type do_tolower (char_type) const;
|
||||
|
||||
// 22.2.1.1.2, p11
|
||||
virtual char_type do_widen (char) const;
|
||||
|
||||
virtual const char*
|
||||
do_widen (const char*, const char*, char_type*) const;
|
||||
|
||||
// 22.2.1.1.2, p13
|
||||
virtual char
|
||||
do_narrow (char_type, char) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_toupper (char_type*, const char_type*) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_tolower (char_type*, const char_type*) const;
|
||||
|
||||
// 22.2.1.1.2, p3
|
||||
virtual const char_type*
|
||||
do_scan_is (mask, const char_type*, const char_type*) const;
|
||||
|
||||
// 22.2.1.1.2, p5
|
||||
virtual const char_type*
|
||||
do_scan_not (mask, const char_type*, const char_type*) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_narrow (const char_type*, const char_type*, char, char*) const;
|
||||
|
||||
private:
|
||||
|
||||
friend class ctype_byname<wchar_t>;
|
||||
|
||||
const mask *_C_mask_tab; // mask for each character
|
||||
unsigned char *_C_upper_tab; // uppercase version of each character
|
||||
unsigned char *_C_lower_tab; // lowercase version of each character
|
||||
char _C_narrow_tab [256]; // cached results of do_narrow()
|
||||
char_type _C_wide_tab [256]; // cached results of do_widen()
|
||||
int _C_delete_it; // delete tables above?
|
||||
};
|
||||
|
||||
|
||||
inline char
|
||||
ctype<wchar_t>::narrow (char_type __c, char __dfault) const
|
||||
{
|
||||
const _RWSTD_SIZE_T __inx = _RWSTD_STATIC_CAST (_RWSTD_UWCHAR_INT_T, __c);
|
||||
|
||||
// optimize away all but the first call to the virtual do_widen()
|
||||
if ( __inx < sizeof _C_narrow_tab / sizeof *_C_narrow_tab
|
||||
&& _C_narrow_tab [__inx])
|
||||
return _C_narrow_tab [__inx];
|
||||
|
||||
// template argument provided to work around an HP aCC bug (PR #27087)
|
||||
ctype<wchar_t>* const __self = _RWSTD_CONST_CAST (ctype<wchar_t>*, this);
|
||||
|
||||
const char __ch = do_narrow (__c, __dfault);
|
||||
|
||||
if (__inx < sizeof _C_narrow_tab / sizeof *_C_narrow_tab && __ch != __dfault)
|
||||
__self->_C_narrow_tab [__inx] = __ch;
|
||||
|
||||
return __ch;
|
||||
}
|
||||
|
||||
|
||||
inline ctype<wchar_t>::char_type
|
||||
ctype<wchar_t>::widen (char __ch) const
|
||||
{
|
||||
const _RWSTD_SIZE_T __inx = _RWSTD_STATIC_CAST (unsigned char, __ch);
|
||||
|
||||
// optimize away all but the first call to the virtual do_widen()
|
||||
|
||||
#if _RWSTD_CHAR_BIT <= 8
|
||||
const bool __fits = true;
|
||||
#else
|
||||
const bool __fits = __inx < sizeof _C_wide_tab / sizeof *_C_wide_tab;
|
||||
#endif
|
||||
|
||||
if (__fits) {
|
||||
if (_C_wide_tab [__inx])
|
||||
return _C_wide_tab [__inx];
|
||||
|
||||
// template argument provided to work around an HP aCC bug (PR #27087)
|
||||
ctype<wchar_t>* const __self = _RWSTD_CONST_CAST (ctype<wchar_t>*, this);
|
||||
|
||||
return __self->_C_wide_tab [__inx] = do_widen (__ch);
|
||||
}
|
||||
else
|
||||
return do_widen (__ch);
|
||||
}
|
||||
|
||||
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class _RWSTD_EXPORT ctype_byname<wchar_t>: public ctype<wchar_t>
|
||||
{
|
||||
public:
|
||||
|
||||
_EXPLICIT ctype_byname (const char*, _RWSTD_SIZE_T = 0);
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~ctype_byname ();
|
||||
|
||||
virtual bool
|
||||
do_is (mask, char_type) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_is (const char_type*, const char_type*, mask*) const;
|
||||
|
||||
virtual char_type
|
||||
do_toupper (char_type) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_toupper (char_type*, const char_type*) const;
|
||||
|
||||
virtual char_type
|
||||
do_tolower (char_type) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_tolower (char_type*, const char_type*) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_scan_is (mask, const char_type*, const char_type*) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_scan_not (mask, const char_type*, const char_type*) const;
|
||||
|
||||
virtual char
|
||||
do_narrow(char_type, char) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_narrow (const char_type*, const char_type*, char, char*) const;
|
||||
|
||||
virtual char_type do_widen (char) const;
|
||||
|
||||
virtual const char*
|
||||
do_widen (const char*, const char*, char_type*) const;
|
||||
|
||||
private:
|
||||
|
||||
char _C_namebuf [32];
|
||||
const void *_C_cvtimpl; // codecvt database mapped by ctype facet
|
||||
_RWSTD_SIZE_T _C_cvtsize; // size of the above mapping
|
||||
};
|
||||
|
||||
#endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE (CTYPE)
|
||||
# include <loc/_ctype.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE (CTYPE)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_CTYPE_H_INCLUDED
|
||||
286
extern/stdcxx/4.2.1/include/loc/_facet.h
vendored
Normal file
286
extern/stdcxx/4.2.1/include/loc/_facet.h
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _facet.h - definition of the std::locale::facet and locale::id classes
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _facet.h 586016 2007-10-18 15:53:57Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2007 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_FACET_H_INCLUDED
|
||||
#define _RWSTD_LOC_FACET_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_mutex.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
struct _RWSTD_CLASS_EXPORT locale;
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
class _RWSTD_EXPORT __rw_locale;
|
||||
|
||||
struct __rw_access;
|
||||
|
||||
struct _RWSTD_EXPORT __rw_facet: __rw_synchronized
|
||||
{
|
||||
// the type of a "constructor" function used to create facet objects
|
||||
// of standard types by the library
|
||||
typedef __rw_facet* (_C_ctor_t)(_RWSTD_SIZE_T, const char*);
|
||||
|
||||
#if !defined (_MSC_VER) || 5 <= _RWSTD_VER_MAJOR
|
||||
|
||||
// disabled for binary compatibility with stdcxx 4.1.x for MSVC
|
||||
// (the compiler mangles access specifiers into class members)
|
||||
protected:
|
||||
|
||||
#endif // !MSVC || 5 <= stdcxx version
|
||||
|
||||
_EXPLICIT __rw_facet (_RWSTD_SIZE_T = 0);
|
||||
|
||||
virtual ~__rw_facet ();
|
||||
|
||||
public:
|
||||
|
||||
// types of standard facets; only globally managed facets (i.e.,
|
||||
// standard facets created internally) set this member, user-created
|
||||
// facet objects of any types set their type to _C_unknown
|
||||
|
||||
// NOTE: the values and order of all the enumerators below are important
|
||||
// any changes may affect the binary compatibility of the library
|
||||
|
||||
enum _C_facet_type {
|
||||
/* -1 */ _C_invalid = -1, // marked e.g., when deleted
|
||||
/* 0 */ _C_unknown = 0, // user-defined
|
||||
|
||||
// narrow character specializations
|
||||
|
||||
// classic versions // byname versions
|
||||
//
|
||||
/* id */ // <-- facet id, i.e. the value of Facet::id._C_val
|
||||
|
||||
// collate category
|
||||
/* 1 */ _C_collate, _C_collate_byname,
|
||||
// ctype category
|
||||
/* 3 */ _C_codecvt, _C_codecvt_byname,
|
||||
/* 5 */ _C_ctype, _C_ctype_byname,
|
||||
// monetary category
|
||||
/* 7 */ _C_moneypunct, _C_moneypunct_byname,
|
||||
/* 9 */ _C_moneypunct_intl, _C_moneypunct_intl_byname,
|
||||
/* 11 */ _C_money_get, _C_nonexistent_0,
|
||||
/* 13 */ _C_money_put, _C_nonexistent_1,
|
||||
// numeric category
|
||||
/* 15 */ _C_numpunct, _C_numpunct_byname,
|
||||
/* 17 */ _C_num_get, _C_nonexistent_2,
|
||||
/* 19 */ _C_num_put, _C_nonexistent_3,
|
||||
// time category
|
||||
/* 21 */ _C_time_get, _C_time_get_byname,
|
||||
/* 23 */ _C_time_put, _C_time_put_byname,
|
||||
// messages category
|
||||
/* 25 */ _C_messages, _C_messages_byname,
|
||||
|
||||
// wide character specializations
|
||||
|
||||
// classic versions // byname versions
|
||||
/* 27 */ _C_wcollate, _C_wcollate_byname,
|
||||
/* 29 */ _C_wcodecvt, _C_wcodecvt_byname,
|
||||
/* 31 */ _C_wctype, _C_wctype_byname,
|
||||
/* 33 */ _C_wmoneypunct, _C_wmoneypunct_byname,
|
||||
/* 35 */ _C_wmoneypunct_intl, _C_wmoneypunct_intl_byname,
|
||||
/* 37 */ _C_wmoney_get, _C_nonexistent_4,
|
||||
/* 39 */ _C_wmoney_put, _C_nonexistent_5,
|
||||
/* 41 */ _C_wnumpunct, _C_wnumpunct_byname,
|
||||
/* 43 */ _C_wnum_get, _C_nonexistent_6,
|
||||
/* 45 */ _C_wnum_put, _C_nonexistent_7,
|
||||
/* 47 */ _C_wtime_get, _C_wtime_get_byname,
|
||||
/* 49 */ _C_wtime_put, _C_wtime_put_byname,
|
||||
/* 51 */ _C_wmessages, _C_wmessages_byname,
|
||||
|
||||
// the value of each standard facet's id is computed
|
||||
// as (facet_type + 1) / 2; the value is stored in
|
||||
// each facet's *__rw_facet::_C_pid member
|
||||
|
||||
// the value of the first available (non-standard)
|
||||
// facet's id is computed as (_C_last_type / 2 + 1)
|
||||
|
||||
// note that this value determines the binary footprint of each facet
|
||||
// changing it affects the binary compatibility of the localization
|
||||
// library
|
||||
/* 52 */ _C_last_type = _C_wmessages_byname
|
||||
};
|
||||
|
||||
// unique fundamental type id
|
||||
enum _C_type_id {
|
||||
_C_signed = 0x100, _C_ptr = 0x200, _C_cont = 0x400,
|
||||
_C_integral = 0x800, _C_floating = 0x1000, _C_typemask = 0x00ff,
|
||||
_C_bool = 0,
|
||||
_C_char = 1 | _C_integral,
|
||||
_C_uchar = 2 | _C_integral, _C_schar = _C_uchar | _C_signed,
|
||||
_C_ushort = 3 | _C_integral, _C_short = _C_ushort | _C_signed,
|
||||
_C_uint = 4 | _C_integral, _C_int = _C_uint | _C_signed,
|
||||
_C_ulong = 5 | _C_integral, _C_long = _C_ulong | _C_signed,
|
||||
_C_ullong = 6 | _C_integral, _C_llong = _C_ullong | _C_signed,
|
||||
_C_float = 7 | _C_floating,
|
||||
_C_double = 8 | _C_floating,
|
||||
_C_ldouble = 9 | _C_floating,
|
||||
_C_void = 10, _C_pvoid = _C_void | _C_ptr,
|
||||
_C_wchar_t = 11
|
||||
};
|
||||
|
||||
enum {
|
||||
// SunOS prepends the separator charater to the beginning
|
||||
// of locale names, e.g., "/en_US/de_DE/fr_FR/..."
|
||||
_C_prepend_cat_sep = 0x01,
|
||||
|
||||
// Linux uses the names of LC_XXX constants in combined
|
||||
// locale names,
|
||||
// e.g., "LC_CYPE=en_US;LC_COLLATE=de_DE;LC_MONETARY=fr_FR..."
|
||||
_C_use_cat_names = 0x02,
|
||||
|
||||
// HP-UX, for instance, keeps even trivial locale names
|
||||
// fully expanded
|
||||
// (e.g., setlocale ("C") will return "C C C C C C")
|
||||
// and doesn't include category names in (combined or others)
|
||||
// locale names
|
||||
_C_condensed_name = 0x04,
|
||||
|
||||
// bits to determine whether and when libc locale will be
|
||||
// used as an implementation of C++ locale functionality
|
||||
//
|
||||
// libc libstd effect
|
||||
// 0 0 use own implementation, fall back on libc if that fails
|
||||
// 0 1 use own implementation only, never libc
|
||||
// 1 0 use libc implementation only, never own
|
||||
// 1 1 try libc implementation first, own if that fails
|
||||
_C_use_libc = 0x08,
|
||||
_C_use_libstd = 0x10
|
||||
};
|
||||
|
||||
// global options controlling the behavior of locale and facets
|
||||
static int _C_opts;
|
||||
|
||||
// returns a pointer to the facet's implementation data
|
||||
// if it exists, 0 otherwise
|
||||
const void* _C_data () const {
|
||||
return _C_impsize ? _C_impdata
|
||||
: _RWSTD_CONST_CAST (__rw_facet*, this)->_C_get_data ();
|
||||
}
|
||||
|
||||
const char* _C_get_name () const {
|
||||
return _C_name ? _C_name : "C";
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// set facet locale name (will allocate if bufsize is too small)
|
||||
void _C_set_name (const char*, char*, _RWSTD_SIZE_T);
|
||||
|
||||
const char *_C_name; // name of locale associated with facet
|
||||
char *_C_buf; // character buffer name may be stored in
|
||||
const void *_C_impdata; // implementation data (e.g., punct)
|
||||
_RWSTD_SIZE_T _C_impsize; // size of implementation data
|
||||
|
||||
private:
|
||||
|
||||
_C_facet_type _C_type; // facet type (see above)
|
||||
_RWSTD_SIZE_T _C_ref; // reference count (> 0)
|
||||
_RWSTD_SIZE_T *_C_pid; // pointer to the static Facet::id._C_id
|
||||
|
||||
// standard facets' id's are computed as (_C_type + 1) / 2
|
||||
// standard facet's base type is computed as 2 * Facet::id._C_id - 1
|
||||
|
||||
__rw_facet (const __rw_facet&); // not defined
|
||||
void operator= (const __rw_facet&); // not defined
|
||||
|
||||
const void* _C_get_data ();
|
||||
|
||||
static __rw_facet*
|
||||
_C_manage (__rw_facet*, _C_facet_type, const char*, _C_ctor_t*);
|
||||
|
||||
friend struct _STD::locale;
|
||||
friend class __rw_locale;
|
||||
friend struct __rw_facet_id;
|
||||
friend struct __rw_access;
|
||||
};
|
||||
|
||||
|
||||
struct _RWSTD_EXPORT __rw_facet_id
|
||||
{
|
||||
#ifdef _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
__rw_facet_id () {
|
||||
// _C_id member zero-initialized (i.e., invalidated) by the system
|
||||
// for __rw_facet_id objects with static storage duration, the only
|
||||
// ones locale ever references
|
||||
}
|
||||
|
||||
#else // if !defined (_RWSTD_NO_SPECIALIZED_FACET_ID)
|
||||
|
||||
enum _C_init_id { _C_Init };
|
||||
|
||||
__rw_facet_id (_C_init_id = _C_Init) {
|
||||
// same as above except that Facet::id is explicitly specialized
|
||||
// for all standard facet base classes in order to guarantee one
|
||||
// instance of each in a program; the definition of the explicit
|
||||
// specialization is distinguished from the declaration by the
|
||||
// presence of an initializer
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
private:
|
||||
|
||||
__rw_facet_id (const __rw_facet_id&); // not defined
|
||||
void operator= (const __rw_facet_id&); // not defined
|
||||
|
||||
// initialize id to the given value if within the valid range
|
||||
// otherwise to the next value generated by the id generator
|
||||
_RWSTD_SIZE_T _C_init () const;
|
||||
|
||||
_MUTABLE _RWSTD_SIZE_T _C_id; // unique id > 0
|
||||
|
||||
friend class __rw_locale;
|
||||
friend struct _STD::locale;
|
||||
friend struct __rw_access;
|
||||
};
|
||||
|
||||
|
||||
// does the necessary path calculations and mapping of locale databases
|
||||
const void*
|
||||
__rw_get_facet_data (int, _RWSTD_SIZE_T&, const char*, const char* = 0);
|
||||
|
||||
// its counterpart - does the database unmapping
|
||||
void __rw_release_facet_data (const void*, _RWSTD_SIZE_T);
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_FACET_H_INCLUDED
|
||||
570
extern/stdcxx/4.2.1/include/loc/_locale.h
vendored
Normal file
570
extern/stdcxx/4.2.1/include/loc/_locale.h
vendored
Normal file
@@ -0,0 +1,570 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _locale.h - definition of the std::locale class
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _locale.h 597181 2007-11-21 18:59:19Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2005 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_LOCALE_INCLUDED
|
||||
#define _RWSTD_LOC_LOCALE_INCLUDED
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <loc/_facet.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
enum __rw_locale_category {
|
||||
__rw_cat_none = 0x0100,
|
||||
__rw_cat_collate = 0x0200,
|
||||
__rw_cat_ctype = 0x0400,
|
||||
__rw_cat_monetary = 0x0800,
|
||||
__rw_cat_numeric = 0x1000,
|
||||
__rw_cat_time = 0x2000,
|
||||
__rw_cat_messages = 0x4000,
|
||||
__rw_cat_all = 0x7e00
|
||||
};
|
||||
|
||||
|
||||
class _RWSTD_EXPORT __rw_locale;
|
||||
|
||||
inline const __rw_facet*
|
||||
__rw_get_std_facet (const _STD::locale&, __rw_facet::_C_facet_type,
|
||||
__rw_facet::_C_ctor_t*);
|
||||
|
||||
inline const __rw_facet*
|
||||
__rw_get_facet_by_id (const _STD::locale&,
|
||||
const __rw_facet_id&,
|
||||
const __rw_facet*);
|
||||
|
||||
// called from has_facet and use_facet to strips top level
|
||||
// const-qualifier from the type of Facet
|
||||
template <class _Facet>
|
||||
inline const __rw_facet*
|
||||
__rw_get_facet (const _STD::locale&, const _Facet*);
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
// 22.1.2, p1
|
||||
template <class _Facet>
|
||||
inline const _Facet&
|
||||
use_facet (const locale &__loc _RWSTD_DUMMY_ARG (const _Facet* = 0))
|
||||
{
|
||||
// Facet could be a const SomeFacet; strip the const qualifier
|
||||
// and, for non-standard facets, use dynamic_cast to make sure
|
||||
// that the dynamic type of `pfacet' is the same as Facet
|
||||
const _RW::__rw_facet* const __pfacet =
|
||||
_RW::__rw_get_facet (__loc, (_Facet*)0);
|
||||
|
||||
_RWSTD_REQUIRES (__pfacet,
|
||||
(_RWSTD_ERROR_BAD_CAST,
|
||||
_RWSTD_FUNC ("use_facet (const locale&)")));
|
||||
|
||||
return *_RWSTD_STATIC_CAST (const _Facet*, __pfacet);
|
||||
}
|
||||
|
||||
|
||||
// 22.1.2, p5
|
||||
template <class _Facet>
|
||||
inline bool
|
||||
has_facet (const locale &__loc _RWSTD_DUMMY_ARG (const _Facet* = 0))
|
||||
{
|
||||
// Facet could be a const SomeFacet; strip the const qualifier
|
||||
const _RW::__rw_facet* const __pfacet =
|
||||
_RW::__rw_get_facet (__loc, (_Facet*)0);
|
||||
|
||||
return 0 != __pfacet;
|
||||
}
|
||||
|
||||
|
||||
// forward declare standard facets before referencing them below
|
||||
_EXPORT template <class _InternT, class _ExternT, class _StateT>
|
||||
class codecvt;
|
||||
|
||||
_EXPORT template <class _CharT>
|
||||
class collate;
|
||||
|
||||
_EXPORT template <class _CharT>
|
||||
class ctype;
|
||||
|
||||
_EXPORT template <class _CharT, class _Iter>
|
||||
struct money_get;
|
||||
|
||||
_EXPORT template <class _CharT, class _Iter>
|
||||
struct money_put;
|
||||
|
||||
_EXPORT template <class _CharT, bool _Intl>
|
||||
struct moneypunct;
|
||||
|
||||
_EXPORT template <class _CharT, class _Iter>
|
||||
struct num_get;
|
||||
|
||||
_EXPORT template <class _CharT, class _Iter>
|
||||
struct num_put;
|
||||
|
||||
_EXPORT template <class _CharT>
|
||||
struct numpunct;
|
||||
|
||||
_EXPORT template <class _CharT, class _Iter>
|
||||
class time_get;
|
||||
|
||||
_EXPORT template <class _CharT, class _Iter>
|
||||
struct time_put;
|
||||
|
||||
_EXPORT template <class _CharT>
|
||||
class messages;
|
||||
|
||||
|
||||
// 22.1.1
|
||||
struct _RWSTD_CLASS_EXPORT locale
|
||||
{
|
||||
// 22.1.1.1.1, p1
|
||||
typedef int category;
|
||||
|
||||
// 22.1.1.1.2
|
||||
typedef _RW::__rw_facet facet;
|
||||
|
||||
// 22.1.1.1.3
|
||||
typedef _RW::__rw_facet_id id;
|
||||
|
||||
// values (including none) must not conflict with any LC_XXX constants
|
||||
_RWSTD_STATIC_CONST (category, none = _RW::__rw_cat_none);
|
||||
_RWSTD_STATIC_CONST (category, collate = _RW::__rw_cat_collate);
|
||||
_RWSTD_STATIC_CONST (category, ctype = _RW::__rw_cat_ctype);
|
||||
_RWSTD_STATIC_CONST (category, monetary = _RW::__rw_cat_monetary);
|
||||
_RWSTD_STATIC_CONST (category, numeric = _RW::__rw_cat_numeric);
|
||||
_RWSTD_STATIC_CONST (category, time = _RW::__rw_cat_time);
|
||||
_RWSTD_STATIC_CONST (category, messages = _RW::__rw_cat_messages);
|
||||
_RWSTD_STATIC_CONST (category, all = _RW::__rw_cat_all);
|
||||
|
||||
// 22.1.1.2, p1
|
||||
_RWSTD_MEMBER_EXPORT locale () _THROWS (());
|
||||
|
||||
// 22.1.1.2, p3
|
||||
_RWSTD_MEMBER_EXPORT locale (const locale&) _THROWS (());
|
||||
|
||||
// 22.1.1.2, p6
|
||||
_RWSTD_MEMBER_EXPORT _EXPLICIT locale (const char*);
|
||||
|
||||
// 22.1.1.2, p9
|
||||
_RWSTD_MEMBER_EXPORT locale (const locale&, const char*, category);
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
// 22.1.1.2, p12
|
||||
template <class _Facet>
|
||||
locale (const locale&, _Facet*);
|
||||
|
||||
# ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
|
||||
|
||||
// 22.1.1.3, p1
|
||||
template <class _Facet>
|
||||
locale combine (const locale&) const;
|
||||
|
||||
# endif // _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
|
||||
|
||||
// 22.1.1.4, p3
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
bool operator() (const basic_string<_CharT, _Traits, _Allocator>&,
|
||||
const basic_string<_CharT, _Traits, _Allocator>&) const;
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
template <class _Facet>
|
||||
locale (const locale &__rhs, _Facet *__facet)
|
||||
: _C_body (0) {
|
||||
// initialize facet's member id to point to Facet::id
|
||||
if (__facet && !__facet->_C_pid) {
|
||||
// unusual cast (to size_t** rather than size_t*&)
|
||||
// done to work around an HP aCC 3.3x bug
|
||||
*_RWSTD_CONST_CAST (_RWSTD_SIZE_T**, &__facet->_C_pid) =
|
||||
&_Facet::id._C_id;
|
||||
}
|
||||
|
||||
// uninitialized Facet::id will be initialized by has_facet<>()
|
||||
|
||||
// prevent passing `facet' the ctor if it is installed
|
||||
// in `rhs' to potentially avoid creating a whole new body
|
||||
if ( has_facet<_Facet>(__rhs)
|
||||
&& &use_facet<_Facet>(__rhs) == __facet)
|
||||
__facet = 0;
|
||||
|
||||
*this = locale (*__rhs._C_body, __facet);
|
||||
}
|
||||
|
||||
# ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
|
||||
|
||||
template <class _Facet>
|
||||
locale combine (const locale &__rhs) const {
|
||||
// unitialized Facet::id will be initialized by has_facet<>()
|
||||
|
||||
_RWSTD_REQUIRES (has_facet<_Facet>(__rhs),
|
||||
(_RWSTD_ERROR_FACET_NOT_FOUND,
|
||||
_RWSTD_FUNC ("locale::combine (const locale&)"),
|
||||
_Facet::id._C_id, __rhs.name ().c_str ()));
|
||||
|
||||
return locale (__rhs, &use_facet<_Facet>(__rhs));
|
||||
}
|
||||
|
||||
# endif // _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
bool
|
||||
operator() (const basic_string<_CharT, _Traits, _Allocator> &__x,
|
||||
const basic_string<_CharT, _Traits, _Allocator> &__y) const {
|
||||
// qualify collate to distinguish it from locale::collate
|
||||
return use_facet<_STD::collate<_CharT> >(*this)
|
||||
.compare (__x.data (), __x.data () + __x.length (),
|
||||
__y.data (), __y.data () + __y.length ()) < 0;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
|
||||
// 22.1.1.2, p14
|
||||
_RWSTD_MEMBER_EXPORT locale (const locale&, const locale&, category);
|
||||
|
||||
// 22.1.1.2, p16
|
||||
_RWSTD_MEMBER_EXPORT ~locale() _THROWS (());
|
||||
|
||||
// 22.1.1.2, p4
|
||||
_RWSTD_MEMBER_EXPORT const locale& operator= (const locale&) _THROWS (());
|
||||
|
||||
// 22.1.1.3, p5
|
||||
_RWSTD_MEMBER_EXPORT string name () const;
|
||||
|
||||
// 22.1.1.4, p1
|
||||
_RWSTD_MEMBER_EXPORT bool operator== (const locale&) const;
|
||||
|
||||
// 22.1.1.4, p2
|
||||
_RWSTD_MEMBER_EXPORT bool operator!= (const locale &__rhs) const {
|
||||
return !(*this == __rhs);
|
||||
}
|
||||
|
||||
// 22.1.1.5, p1
|
||||
_RWSTD_MEMBER_EXPORT static locale global (const locale&);
|
||||
|
||||
// 22.1.1.5, p4
|
||||
_RWSTD_MEMBER_EXPORT static const locale& classic ();
|
||||
|
||||
private:
|
||||
|
||||
_RWSTD_MEMBER_EXPORT _EXPLICIT locale (_RW::__rw_locale &__rhs)
|
||||
_THROWS (())
|
||||
: _C_body (&__rhs) { }
|
||||
|
||||
_RWSTD_MEMBER_EXPORT locale (_RW::__rw_locale&, const facet*);
|
||||
|
||||
_RW::__rw_locale *_C_body; // reference-counted body
|
||||
|
||||
#if defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x540
|
||||
|
||||
// working around a SunPro member access control bug (see PR #25910)
|
||||
public:
|
||||
|
||||
#endif // SunPro <= 5.4
|
||||
|
||||
// (try to) retrieve a facet from a locale given an id
|
||||
// may initialize the id if it isn't initialized yet
|
||||
_RWSTD_MEMBER_EXPORT const facet*
|
||||
_C_get_facet (const id&) const;
|
||||
|
||||
_RWSTD_MEMBER_EXPORT const facet*
|
||||
_C_get_std_facet (facet::_C_facet_type, facet::_C_ctor_t*) const;
|
||||
|
||||
friend class _RW::__rw_locale;
|
||||
friend struct _RW::__rw_access;
|
||||
|
||||
// function arguments below are qualified to work around
|
||||
// a SunPro 5.5 and prior bug (PR #28626)
|
||||
friend const facet*
|
||||
_RW::__rw_get_std_facet (const _STD::locale&,
|
||||
_RW::__rw_facet::_C_facet_type,
|
||||
_RW::__rw_facet::_C_ctor_t*);
|
||||
|
||||
friend const _RW::__rw_facet*
|
||||
_RW::__rw_get_facet_by_id (const _STD::locale&,
|
||||
const _RW::__rw_facet_id&,
|
||||
const _RW::__rw_facet*);
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
inline const __rw_facet*
|
||||
__rw_get_facet_by_id (const _STD::locale &__loc,
|
||||
const __rw_facet_id &__id,
|
||||
const __rw_facet*)
|
||||
{
|
||||
// initialize Facet::id and retrieve facet if it's installed
|
||||
return __loc._C_get_facet (__id);
|
||||
}
|
||||
|
||||
|
||||
template <class _Facet>
|
||||
inline const __rw_facet*
|
||||
__rw_get_facet (const _STD::locale &__loc, const _Facet *__dummy)
|
||||
{
|
||||
// resolves either to one of the overloads of __rw_get_facet_by_id
|
||||
// defined for the set of standard facets or the overload for the base
|
||||
// locale::facet* if _Facet is not derived from any of the former
|
||||
const __rw_facet* const __pfacet =
|
||||
__rw_get_facet_by_id (__loc, _Facet::id, __dummy);
|
||||
|
||||
return _RWSTD_DYNAMIC_CAST (const _Facet*, __pfacet);
|
||||
}
|
||||
|
||||
|
||||
inline const __rw_facet*
|
||||
__rw_get_std_facet (const _STD::locale &__loc,
|
||||
__rw_facet::_C_facet_type __type,
|
||||
__rw_facet::_C_ctor_t *__ctor)
|
||||
{
|
||||
// expose an implementation detail of locale body for efficiency
|
||||
struct _Facets {
|
||||
__rw_facet *__facets [__rw_facet::_C_last_type / 2];
|
||||
};
|
||||
|
||||
const _Facets* const __pfacets =
|
||||
_RWSTD_REINTERPRET_CAST (const _Facets*, __loc._C_body);
|
||||
|
||||
_RWSTD_ASSERT (0 != __pfacets);
|
||||
|
||||
const __rw_facet *__facet = __pfacets->__facets [__type >> 1];
|
||||
|
||||
if (!__facet)
|
||||
__facet = __loc._C_get_std_facet (__type, __ctor);
|
||||
|
||||
#if !defined (__HP_aCC) || _RWSTD_HP_aCC_MINOR > 3800
|
||||
|
||||
// working around an HP aCC ICE (PR #28838)
|
||||
_RWSTD_ASSERT (0 != __facet);
|
||||
|
||||
#endif // HP aCC
|
||||
|
||||
return __facet;
|
||||
}
|
||||
|
||||
|
||||
// functions' type must be __rw_facet::_C_ctor_t
|
||||
// i.e., as if they were declared as follows:
|
||||
// __rw_facet::_C_ctor_t __rw_ct_ctype;
|
||||
// the declaration above causes a Compaq C++ 6.5 ICE (PR #30188)
|
||||
_RWSTD_EXPORT __rw_facet* __rw_ct_ctype (_RWSTD_SIZE_T, const char*);
|
||||
_RWSTD_EXPORT __rw_facet* __rw_ct_numpunct (_RWSTD_SIZE_T, const char*);
|
||||
_RWSTD_EXPORT __rw_facet* __rw_ct_num_get (_RWSTD_SIZE_T, const char*);
|
||||
_RWSTD_EXPORT __rw_facet* __rw_ct_num_put (_RWSTD_SIZE_T, const char*);
|
||||
|
||||
|
||||
#define _RWSTD_OVERLOAD_GET_FACET(F) \
|
||||
_RWSTD_EXPORT const __rw_facet* \
|
||||
__rw_get_facet_by_id (const _STD::locale&, \
|
||||
const __rw_facet_id&, const F*)
|
||||
|
||||
#define _Facet(name, T, U) _STD::name<T, U >
|
||||
|
||||
#define _InIter(T) _STD::istreambuf_iterator< T, _STD::char_traits<T > >
|
||||
#define _OutIter(T) _STD::ostreambuf_iterator< T, _STD::char_traits<T > >
|
||||
|
||||
// convenience typedefs to allow them to be used as macro arguments
|
||||
typedef _STD::codecvt<char, char, _RWSTD_MBSTATE_T> __rw_codecvt_c;
|
||||
typedef _Facet (moneypunct, char, false) __rw_mpunct_c_0;
|
||||
typedef _Facet (moneypunct, char, true) __rw_mpunct_c_1;
|
||||
typedef _Facet (money_get, char, _InIter (char)) __rw_mget_c;
|
||||
typedef _Facet (money_put, char, _OutIter (char)) __rw_mput_c;
|
||||
typedef _Facet (num_get, char, _InIter (char)) __rw_nget_c;
|
||||
typedef _Facet (num_put, char, _OutIter (char)) __rw_nput_c;
|
||||
typedef _Facet (time_get, char, _InIter (char)) __rw_tget_c;
|
||||
typedef _Facet (time_put, char, _OutIter (char)) __rw_tput_c;
|
||||
|
||||
|
||||
// inline definitions of heavily used use_facet specializations
|
||||
// for iostream efficiency
|
||||
|
||||
_RWSTD_SPECIALIZED_FUNCTION
|
||||
inline const __rw_facet*
|
||||
__rw_get_facet (const _STD::locale &__loc, const _STD::ctype<char>*)
|
||||
{
|
||||
return __rw_get_std_facet (__loc, __rw_facet::_C_ctype,
|
||||
__rw_ct_ctype);
|
||||
}
|
||||
|
||||
|
||||
_RWSTD_SPECIALIZED_FUNCTION
|
||||
inline const __rw_facet*
|
||||
__rw_get_facet (const _STD::locale &__loc, const _STD::numpunct<char>*)
|
||||
{
|
||||
return __rw_get_std_facet (__loc, __rw_facet::_C_numpunct,
|
||||
__rw_ct_numpunct);
|
||||
}
|
||||
|
||||
|
||||
_RWSTD_SPECIALIZED_FUNCTION
|
||||
inline const __rw_facet*
|
||||
__rw_get_facet (const _STD::locale &__loc, const __rw_nget_c*)
|
||||
{
|
||||
return __rw_get_std_facet (__loc, __rw_facet::_C_num_get,
|
||||
__rw_ct_num_get);
|
||||
}
|
||||
|
||||
|
||||
_RWSTD_SPECIALIZED_FUNCTION
|
||||
inline const __rw_facet*
|
||||
__rw_get_facet (const _STD::locale &__loc, const __rw_nput_c*)
|
||||
{
|
||||
return __rw_get_std_facet (__loc, __rw_facet::_C_num_put,
|
||||
__rw_ct_num_put);
|
||||
}
|
||||
|
||||
|
||||
// declarations of __rw_get_facet_by_id overloads
|
||||
_RWSTD_OVERLOAD_GET_FACET (_STD::ctype<char>);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_codecvt_c);
|
||||
_RWSTD_OVERLOAD_GET_FACET (_STD::collate<char>);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_mget_c);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_mput_c);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_mpunct_c_0);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_mpunct_c_1);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_nget_c);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_nput_c);
|
||||
_RWSTD_OVERLOAD_GET_FACET (_STD::numpunct<char>);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_tget_c);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_tput_c);
|
||||
_RWSTD_OVERLOAD_GET_FACET (_STD::messages<char>);
|
||||
|
||||
#ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
typedef _STD::codecvt<wchar_t, char, _RWSTD_MBSTATE_T> __rw_codecvt_w;
|
||||
typedef _Facet (moneypunct, wchar_t, false) __rw_mpunct_w_0;
|
||||
typedef _Facet (moneypunct, wchar_t, true) __rw_mpunct_w_1;
|
||||
typedef _Facet (money_get, wchar_t, _InIter (wchar_t)) __rw_mget_w;
|
||||
typedef _Facet (money_put, wchar_t, _OutIter (wchar_t)) __rw_mput_w;
|
||||
typedef _Facet (num_get, wchar_t, _InIter (wchar_t)) __rw_nget_w;
|
||||
typedef _Facet (num_put, wchar_t, _OutIter (wchar_t)) __rw_nput_w;
|
||||
typedef _Facet (time_get, wchar_t, _InIter (wchar_t)) __rw_tget_w;
|
||||
typedef _Facet (time_put, wchar_t, _OutIter (wchar_t)) __rw_tput_w;
|
||||
|
||||
_RWSTD_OVERLOAD_GET_FACET (_STD::ctype<wchar_t>);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_codecvt_w);
|
||||
_RWSTD_OVERLOAD_GET_FACET (_STD::collate<wchar_t>);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_mget_w);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_mput_w);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_mpunct_w_0);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_mpunct_w_1);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_nget_w);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_nput_w);
|
||||
_RWSTD_OVERLOAD_GET_FACET (_STD::numpunct<wchar_t>);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_tget_w);
|
||||
_RWSTD_OVERLOAD_GET_FACET (__rw_tput_w);
|
||||
_RWSTD_OVERLOAD_GET_FACET (_STD::messages<wchar_t>);
|
||||
|
||||
#endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
// clean up
|
||||
#undef _RWSTD_OVERLOAD_GET_FACET
|
||||
#undef _Facet
|
||||
#undef _InIter
|
||||
#undef _OutIter
|
||||
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template <class _Facet>
|
||||
inline locale::locale (const locale &__rhs, _Facet *__facet)
|
||||
: _C_body (0)
|
||||
{
|
||||
// initialize facet's member id to point to Facet::id
|
||||
if (__facet && !__facet->_C_pid) {
|
||||
// unusual cast (to size_t** rather than size_t*&)
|
||||
// done to work around an HP aCC 3.3x bug
|
||||
*_RWSTD_CONST_CAST (_RWSTD_SIZE_T**, &__facet->_C_pid) =
|
||||
&_Facet::id._C_id;
|
||||
}
|
||||
|
||||
// uninitialized Facet::id will be initialized by has_facet<>()
|
||||
|
||||
// prevent passing `facet' the ctor if it is installed in `rhs'
|
||||
// to potentially avoid creating a whole new locale body
|
||||
if (_RW::__rw_get_facet (__rhs, (_Facet*)0) == __facet)
|
||||
__facet = 0;
|
||||
|
||||
*this = locale (*__rhs._C_body, __facet);
|
||||
}
|
||||
|
||||
|
||||
# ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
|
||||
|
||||
template <class _Facet>
|
||||
inline locale locale::combine (const locale &__rhs) const
|
||||
{
|
||||
// unitialized Facet::id will be initialized by has_facet<>()
|
||||
|
||||
_RWSTD_REQUIRES (has_facet<_Facet>(__rhs),
|
||||
(_RWSTD_ERROR_FACET_NOT_FOUND,
|
||||
_RWSTD_FUNC ("locale::combine (const locale&)"),
|
||||
_Facet::id._C_id, __rhs.name ().c_str ()));
|
||||
|
||||
return locale (*this, &use_facet<_Facet>(__rhs));
|
||||
}
|
||||
|
||||
# endif // _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
|
||||
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline bool
|
||||
locale::operator() (const basic_string<_CharT, _Traits, _Allocator> &__x,
|
||||
const basic_string<_CharT, _Traits, _Allocator> &__y) const
|
||||
{
|
||||
// qualify collate to distinguish it from locale::collate
|
||||
return use_facet<_STD::collate<_CharT> >(*this)
|
||||
.compare (__x.data (), __x.data () + __x.length (),
|
||||
__y.data (), __y.data () + __y.length ()) < 0;
|
||||
}
|
||||
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_LOCALE_INCLUDED
|
||||
872
extern/stdcxx/4.2.1/include/loc/_localedef.h
vendored
Normal file
872
extern/stdcxx/4.2.1/include/loc/_localedef.h
vendored
Normal file
@@ -0,0 +1,872 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _localedef.h
|
||||
*
|
||||
* $Id: _localedef.h 648752 2008-04-16 17:01:56Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 2001-2008 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_LOCALEDEF_H_INCLUDED
|
||||
#define _RWSTD_LOC_LOCALEDEF_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
#if 6 <= _RWSTD_HP_aCC_MAJOR
|
||||
// suppress HP aCC 6 remarks
|
||||
// 4298: addition result truncated before cast to bigger sized type
|
||||
// 4299: multiply result truncated before cast to bigger sized type
|
||||
# pragma diag_suppress 4298, 4299
|
||||
#endif // aCC >= 6.0
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
// LC_CTYPE structures
|
||||
struct __rw_mask_elm
|
||||
{
|
||||
wchar_t ch; // the wide character value
|
||||
_RWSTD_UINT32_T mask; // the mask for that character
|
||||
};
|
||||
|
||||
struct __rw_upper_elm
|
||||
{
|
||||
wchar_t lower; // the lower case wide character
|
||||
wchar_t upper; // the upper case wide character that the lower maps to
|
||||
};
|
||||
|
||||
struct __rw_lower_elm
|
||||
{
|
||||
wchar_t upper; // the upper case wide character
|
||||
wchar_t lower; // the lower case wide character that the upper maps to
|
||||
};
|
||||
|
||||
|
||||
// returns a pointer to a character at the given byte offset
|
||||
// from the end of the structure
|
||||
#define _RWSTD_CHAR_ARRAY(off) \
|
||||
(_RWSTD_REINTERPRET_CAST (const char*, this + 1) + (off))
|
||||
|
||||
// returns a pointer to a wide character at the given byte offset
|
||||
// from the end of the structure
|
||||
#define _RWSTD_WCHAR_T_ARRAY(off) \
|
||||
_RWSTD_REINTERPRET_CAST (const wchar_t*, _RWSTD_CHAR_ARRAY (off))
|
||||
|
||||
#define _RWSTD_UINT_ARRAY(off) \
|
||||
_RWSTD_REINTERPRET_CAST (const _RWSTD_UINT32_T*, _RWSTD_CHAR_ARRAY (off))
|
||||
|
||||
// returns a pointer to the i-th element of an array
|
||||
// at the given byte offset from the end of the structure
|
||||
#define _RWSTD_ARRAY_ELM(T, off, i) \
|
||||
_RWSTD_REINTERPRET_CAST (const T*, \
|
||||
( _RWSTD_REINTERPRET_CAST (const char*, this + 1) \
|
||||
+ (off) + (i) * sizeof (T)))
|
||||
|
||||
|
||||
struct __rw_codecvt_t
|
||||
{
|
||||
// offsets from the end of *this
|
||||
_RWSTD_UINT32_T codeset_off;
|
||||
_RWSTD_UINT32_T charmap_off;
|
||||
_RWSTD_UINT32_T n_to_w_tab_off;
|
||||
_RWSTD_UINT32_T w_to_n_tab_off;
|
||||
_RWSTD_UINT32_T utf8_to_ext_tab_off;
|
||||
_RWSTD_UINT32_T wchar_off;
|
||||
_RWSTD_UINT32_T xliteration_off;
|
||||
_RWSTD_UINT32_T codecvt_ext_off;
|
||||
|
||||
// the size of the longest multibyte character
|
||||
_RWSTD_UINT8_T mb_cur_max;
|
||||
|
||||
// the name of the codeset and its database file
|
||||
const char* codeset_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (codeset_off);
|
||||
}
|
||||
|
||||
// the name of the character map description file
|
||||
const char* charmap_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (charmap_off);
|
||||
}
|
||||
|
||||
// pointer to the first table for wide to narrow conversions
|
||||
const _RWSTD_UINT32_T* w_to_n_tab () const {
|
||||
return _RWSTD_UINT_ARRAY (w_to_n_tab_off);
|
||||
}
|
||||
|
||||
// pointer to the first table for narrow to wide conversions
|
||||
const _RWSTD_UINT32_T* n_to_w_tab () const {
|
||||
return _RWSTD_UINT_ARRAY (n_to_w_tab_off);
|
||||
}
|
||||
|
||||
// pointer to the first table for utf8 to external conversions
|
||||
const _RWSTD_UINT32_T* utf8_to_ext_tab () const {
|
||||
return _RWSTD_UINT_ARRAY (utf8_to_ext_tab_off);
|
||||
}
|
||||
|
||||
// returns the value of the wide character at a given offset
|
||||
// obtained from one of the n_to_w_tab() tables
|
||||
wchar_t get_internal_at_offset (_RWSTD_UINT32_T off) const {
|
||||
return *(_RWSTD_ARRAY_ELM (wchar_t, wchar_off, off * 2));
|
||||
|
||||
}
|
||||
|
||||
// returns the value of the UCS character at a given offset
|
||||
wchar_t get_ucs4_at_offset (_RWSTD_UINT32_T off) const {
|
||||
return *(_RWSTD_ARRAY_ELM (wchar_t, wchar_off, off * 2 + 1));
|
||||
}
|
||||
|
||||
const void* get_ext () const {
|
||||
return _RWSTD_CHAR_ARRAY (codecvt_ext_off);
|
||||
}
|
||||
|
||||
const _RWSTD_UINT32_T* get_xliteration_tab () const {
|
||||
return _RWSTD_UINT_ARRAY (xliteration_off);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// LC_CTYPE structure
|
||||
struct __rw_ctype_t
|
||||
{
|
||||
_RWSTD_UINT32_T codeset_off; // byte offset of the codeset_name
|
||||
_RWSTD_UINT32_T charmap_off; // byte offset of the charmap name
|
||||
_RWSTD_UINT32_T wmask_s;
|
||||
_RWSTD_UINT32_T wtoupper_off; // byte offset of the wtoupper_tab
|
||||
_RWSTD_UINT32_T wtolower_off; // byte offset of the wtolower_tab
|
||||
_RWSTD_UINT32_T wmask_off; // byte offset of the wmask_tab_tab
|
||||
|
||||
// this is added to allow for future extensions
|
||||
_RWSTD_UINT32_T ctype_ext_off; // extended ctype data offset
|
||||
|
||||
_RWSTD_UINT8_T toupper_tab[256]; // the narrow char to_upper table
|
||||
_RWSTD_UINT8_T tolower_tab[256]; // the narrow char to_lower table
|
||||
_RWSTD_UINT32_T mask_tab[256]; // the narrow char mask table
|
||||
_RWSTD_UINT8_T mb_cur_max; // max number of bytes per MB character
|
||||
|
||||
_RWSTD_SIZE_T wtoupper_s () const {
|
||||
return (wtolower_off - wtoupper_off) / sizeof (__rw_upper_elm);
|
||||
}
|
||||
|
||||
_RWSTD_SIZE_T wtolower_s () const {
|
||||
return (wmask_off - wtolower_off) / sizeof (__rw_lower_elm);
|
||||
}
|
||||
|
||||
_RWSTD_SIZE_T codeset_s () const {
|
||||
return charmap_off - codeset_off;
|
||||
}
|
||||
|
||||
_RWSTD_SIZE_T charmap_s () const {
|
||||
return wtoupper_off - charmap_off;
|
||||
}
|
||||
|
||||
const char* codeset_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (codeset_off);
|
||||
}
|
||||
|
||||
const char* charmap_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (charmap_off);
|
||||
}
|
||||
|
||||
__rw_upper_elm wtoupper_tab (_RWSTD_SIZE_T idx) const {
|
||||
return *_RWSTD_ARRAY_ELM (__rw_upper_elm, wtoupper_off, idx);
|
||||
}
|
||||
|
||||
__rw_lower_elm wtolower_tab (_RWSTD_SIZE_T idx) const {
|
||||
return *_RWSTD_ARRAY_ELM (__rw_lower_elm, wtolower_off, idx);
|
||||
}
|
||||
|
||||
__rw_mask_elm wmask_tab (_RWSTD_SIZE_T idx) const {
|
||||
return *_RWSTD_ARRAY_ELM (__rw_mask_elm, wmask_off, idx);
|
||||
}
|
||||
|
||||
const void* get_ext () const {
|
||||
return _RWSTD_CHAR_ARRAY (ctype_ext_off);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// LC_COLLATE structure
|
||||
struct __rw_collate_t
|
||||
{
|
||||
_RWSTD_UINT32_T codeset_off; // byte offset of the codeset_name
|
||||
_RWSTD_UINT32_T charmap_off; // byte offset to the charmap name
|
||||
|
||||
_RWSTD_UINT32_T n_ce_tab_off;
|
||||
_RWSTD_UINT32_T w_ce_tab_off;
|
||||
|
||||
_RWSTD_UINT32_T weight_tab_off; // offset to the weight information
|
||||
|
||||
_RWSTD_UINT32_T n_char_tab_off; // offset to the first nchar table
|
||||
_RWSTD_UINT32_T n_char_off_tab_off; // offset to offset table for nchars
|
||||
_RWSTD_UINT32_T n_char_first_char_off; // offset to first character info
|
||||
|
||||
_RWSTD_UINT32_T w_char_tab_off; // offset to the first wide character table
|
||||
_RWSTD_UINT32_T w_char_off_tab_off; // offset to offset table for wchars
|
||||
_RWSTD_UINT32_T w_char_first_char_off; // offset to first character info
|
||||
|
||||
_RWSTD_UINT32_T n_ce_off_tab_off;
|
||||
_RWSTD_UINT32_T w_ce_off_tab_off;
|
||||
_RWSTD_UINT32_T n_ce_first_char_off;
|
||||
_RWSTD_UINT32_T w_ce_first_char_off;
|
||||
_RWSTD_UINT32_T n_ce_last_char_off;
|
||||
_RWSTD_UINT32_T w_ce_last_char_off;
|
||||
|
||||
_RWSTD_UINT32_T undefined_weight_idx;
|
||||
|
||||
_RWSTD_UINT32_T elm_size; // number of bytes in each coll array elem
|
||||
_RWSTD_UINT32_T num_elms; // numer of elements in coll array
|
||||
|
||||
_RWSTD_UINT32_T num_wchars; // number of wide chars in wchar mapping
|
||||
|
||||
// this is added to allow for future extensions
|
||||
_RWSTD_UINT32_T collate_ext_off; // extended collate data offset
|
||||
|
||||
_RWSTD_UINT32_T undefined_optimization;
|
||||
|
||||
_RWSTD_UINT8_T longest_weight; // the longest weight value
|
||||
_RWSTD_UINT8_T num_weights; // number of weights
|
||||
_RWSTD_UINT8_T largest_ce;
|
||||
|
||||
_RWSTD_UINT8_T weight_type[256]; // weight types (ex. forward)
|
||||
|
||||
// get the offset of a table number `tabno'
|
||||
_RWSTD_UINT32_T get_n_tab_off (_RWSTD_UINT32_T tabno) const {
|
||||
return (_RWSTD_UINT32_T)
|
||||
(sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
|
||||
(_RWSTD_SIZE_T)((const char*)this + sizeof *this
|
||||
+ n_char_off_tab_off
|
||||
+ (tabno * sizeof (_RWSTD_UINT32_T))))));
|
||||
}
|
||||
_RWSTD_UINT32_T get_n_ce_tab_off (_RWSTD_UINT32_T tabno) const {
|
||||
return (_RWSTD_UINT32_T)
|
||||
(sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
|
||||
(_RWSTD_SIZE_T)((const char*)this + sizeof *this
|
||||
+ n_ce_off_tab_off
|
||||
+ (tabno * sizeof (_RWSTD_UINT32_T))))));
|
||||
}
|
||||
|
||||
_RWSTD_UINT32_T get_w_ce_tab_off (_RWSTD_UINT32_T tabno) const {
|
||||
return (_RWSTD_UINT32_T)
|
||||
(sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
|
||||
(_RWSTD_SIZE_T)((const char*)this + sizeof *this
|
||||
+ w_ce_off_tab_off
|
||||
+ (tabno * sizeof (_RWSTD_UINT32_T))))));
|
||||
}
|
||||
|
||||
_RWSTD_UINT8_T get_first_char_in_n_tab (_RWSTD_UINT32_T tabno) const {
|
||||
return *((const _RWSTD_UINT8_T*)this + sizeof *this
|
||||
+ n_char_first_char_off + tabno);
|
||||
|
||||
}
|
||||
|
||||
_RWSTD_UINT8_T get_first_char_in_n_ce_tab (_RWSTD_UINT32_T tabno) const {
|
||||
return *((const _RWSTD_UINT8_T*)this + sizeof *this
|
||||
+ n_ce_first_char_off + tabno);
|
||||
}
|
||||
|
||||
_RWSTD_UINT8_T get_first_char_in_w_ce_tab (_RWSTD_UINT32_T tabno) const {
|
||||
return *((const _RWSTD_UINT8_T*)this + sizeof *this
|
||||
+ w_ce_first_char_off + tabno);
|
||||
}
|
||||
|
||||
_RWSTD_UINT8_T get_last_char_in_n_ce_tab (_RWSTD_UINT32_T tabno) const {
|
||||
return *((const _RWSTD_UINT8_T*)this + sizeof *this
|
||||
+ n_ce_last_char_off + tabno);
|
||||
}
|
||||
|
||||
_RWSTD_UINT8_T get_last_char_in_w_ce_tab (_RWSTD_UINT32_T tabno) const {
|
||||
return *((const _RWSTD_UINT8_T*)this + sizeof *this
|
||||
+ w_ce_last_char_off + tabno);
|
||||
}
|
||||
|
||||
const _RWSTD_UINT32_T* get_n_tab (_RWSTD_UINT32_T tabno) const {
|
||||
return (const _RWSTD_UINT32_T*)
|
||||
((_RWSTD_SIZE_T)((const char*)this + sizeof *this
|
||||
+ n_char_tab_off + get_n_tab_off (tabno)));
|
||||
|
||||
}
|
||||
const _RWSTD_UINT32_T* get_n_ce_tab (_RWSTD_UINT32_T tabno) const {
|
||||
return (const _RWSTD_UINT32_T*)
|
||||
((_RWSTD_SIZE_T)((const char*)this + sizeof *this
|
||||
+ n_ce_tab_off + get_n_ce_tab_off (tabno)));
|
||||
}
|
||||
|
||||
const _RWSTD_UINT32_T* get_w_ce_tab (_RWSTD_UINT32_T tabno) const {
|
||||
return (const _RWSTD_UINT32_T*)
|
||||
((_RWSTD_SIZE_T)((const char*)this + sizeof *this
|
||||
+ w_ce_tab_off + get_w_ce_tab_off (tabno)));
|
||||
}
|
||||
|
||||
_RWSTD_UINT32_T get_w_tab_off (_RWSTD_UINT32_T tabno) const {
|
||||
return (_RWSTD_UINT32_T)
|
||||
(sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
|
||||
(_RWSTD_SIZE_T)((const char*)this + sizeof *this
|
||||
+ w_char_off_tab_off
|
||||
+ (tabno * sizeof (_RWSTD_UINT32_T))))));
|
||||
}
|
||||
|
||||
_RWSTD_UINT8_T get_first_char_in_w_tab (_RWSTD_UINT32_T tabno) const {
|
||||
return *((const _RWSTD_UINT8_T*)this + sizeof *this
|
||||
+ w_char_first_char_off + tabno);
|
||||
|
||||
}
|
||||
|
||||
const _RWSTD_UINT32_T* get_w_tab (_RWSTD_UINT32_T tabno) const {
|
||||
return (const _RWSTD_UINT32_T*)
|
||||
((_RWSTD_SIZE_T)((const char*)this + sizeof *this
|
||||
+ w_char_tab_off + get_w_tab_off (tabno)));
|
||||
|
||||
}
|
||||
|
||||
const _RWSTD_UINT32_T* coll () const {
|
||||
return _RWSTD_UINT_ARRAY (weight_tab_off);
|
||||
}
|
||||
|
||||
const char* codeset_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (codeset_off);
|
||||
}
|
||||
|
||||
const char* charmap_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (charmap_off);
|
||||
}
|
||||
|
||||
const _RWSTD_UINT32_T* get_weight (_RWSTD_UINT32_T idx) const {
|
||||
return (const _RWSTD_UINT32_T*)((_RWSTD_SIZE_T)((const char*)coll ()
|
||||
+ elm_size * idx));
|
||||
}
|
||||
|
||||
const void* get_ext () const {
|
||||
return _RWSTD_CHAR_ARRAY (collate_ext_off);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// punct structure for monetary and numeric facets
|
||||
struct __rw_punct_t
|
||||
{
|
||||
_RWSTD_UINT32_T decimal_point_off [2]; // narrow and wide decimal_point
|
||||
_RWSTD_UINT32_T thousands_sep_off [2]; // narrow and wide thousands_sep
|
||||
_RWSTD_UINT32_T grouping_off; // grouping string
|
||||
_RWSTD_UINT32_T punct_ext_off; // offset of extended data
|
||||
|
||||
// decimal_point (0) points to a char*, decimal_point (1) to wchar_t*
|
||||
const void* decimal_point (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (decimal_point_off [wide]);
|
||||
}
|
||||
|
||||
// thousands_sep (0) points to a char*, thousands_sep (1) to wchar_t*
|
||||
const void* thousands_sep (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (thousands_sep_off [wide]);
|
||||
}
|
||||
|
||||
const void* grouping () const {
|
||||
return _RWSTD_CHAR_ARRAY (grouping_off);
|
||||
}
|
||||
|
||||
const void* get_ext () const {
|
||||
return _RWSTD_CHAR_ARRAY (punct_ext_off);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// LC_MONETARY structure
|
||||
struct __rw_mon_t
|
||||
{
|
||||
_RWSTD_UINT32_T codeset_off; // byte offset of the codeset_name
|
||||
_RWSTD_UINT32_T charmap_off; // byte offset to the charmap name
|
||||
|
||||
_RWSTD_UINT32_T curr_symbol_off [2][2]; // byte offset of curr_symbol
|
||||
_RWSTD_UINT32_T positive_sign_off [2]; // byte offset of positive_sign
|
||||
_RWSTD_UINT32_T negative_sign_off [2]; // byte offset of negative_sign
|
||||
|
||||
// this is added to allow for future extensions
|
||||
_RWSTD_UINT32_T monetary_ext_off; // extended monetary data offset
|
||||
|
||||
// monetary format pattern for positive values
|
||||
char pos_format[2][4];
|
||||
|
||||
// monetary format pattern for negative values
|
||||
char neg_format[2][4];
|
||||
|
||||
// num of frac digits to write using currency_symbol
|
||||
char frac_digits[2];
|
||||
|
||||
// 0 = currency symbol then pos value
|
||||
// 1 = pos value then currency symbol
|
||||
char p_cs_precedes[2];
|
||||
|
||||
|
||||
// separation of curr symbol and value
|
||||
// 0 - no separation
|
||||
// 1 = if the symbol and sign are adjacent, a space separates them from
|
||||
// the value; otherwise, a space separates the symbol from the value
|
||||
// 2 = if the symbol and sign are adjacent, a space separates them;
|
||||
// otherwise, a space separates the sign from the value
|
||||
char p_sep_by_space[2];
|
||||
|
||||
// 0 = currency symbol succeeds the neg value
|
||||
// 1 = currency symbol precedes the neg value
|
||||
char n_cs_precedes[2];
|
||||
|
||||
// 0 = no space seperates curr sym from neg value
|
||||
// 1 = space seperates symbol from neg value
|
||||
// 2 = space seperates symbol and sign string
|
||||
char n_sep_by_space[2];
|
||||
|
||||
// 0 = Parentheses enclose the quantity of the curr sym
|
||||
// 1 = Sign string precedes the quantity and curr sym
|
||||
// 2 = sign string succeeds the quantity and curr sym
|
||||
// 3 = sign string precedes the curr symbol
|
||||
// 4 = sign string succeeds the curr symbol
|
||||
char p_sign_posn[2];
|
||||
|
||||
// 0 = Parentheses enclose the quantity of the curr sym
|
||||
// 1 = Sign string precedes the quantity and curr sym
|
||||
// 2 = sign string succeeds the quantity and curr sym
|
||||
// 3 = sign string precedes the curr symbol
|
||||
// 4 = sign string succeeds the curr symbol
|
||||
char n_sign_posn[2];
|
||||
|
||||
const void* curr_symbol (bool intl, bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (curr_symbol_off [intl][wide]);
|
||||
}
|
||||
|
||||
const void* positive_sign (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (positive_sign_off [wide]);
|
||||
}
|
||||
|
||||
const void* negative_sign (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (negative_sign_off [wide]);
|
||||
}
|
||||
|
||||
const char* codeset_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (codeset_off);
|
||||
}
|
||||
|
||||
const char* charmap_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (charmap_off);
|
||||
}
|
||||
|
||||
const void* get_ext () const {
|
||||
return _RWSTD_CHAR_ARRAY (monetary_ext_off);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// LC_NUMERIC structure
|
||||
struct __rw_num_t
|
||||
{
|
||||
_RWSTD_UINT32_T codeset_off; // byte offset of the codeset_name
|
||||
_RWSTD_UINT32_T charmap_off; // byte offset to the charmap name
|
||||
|
||||
_RWSTD_UINT32_T truename_off [2]; // offset of narrow and wide truename
|
||||
_RWSTD_UINT32_T falsename_off [2]; // offset of narrow and wide falsename
|
||||
|
||||
_RWSTD_UINT32_T numeric_ext_off; // extended numeric data offset
|
||||
|
||||
const void* truename (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (truename_off [wide]);
|
||||
}
|
||||
|
||||
const void* falsename (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (falsename_off [wide]);
|
||||
}
|
||||
|
||||
const char* codeset_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (codeset_off);
|
||||
}
|
||||
|
||||
const char* charmap_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (charmap_off);
|
||||
}
|
||||
|
||||
const void* get_ext () const {
|
||||
return _RWSTD_CHAR_ARRAY (numeric_ext_off);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// LC_MESSAGES structure
|
||||
struct __rw_messages_t
|
||||
{
|
||||
_RWSTD_UINT32_T codeset_off;
|
||||
_RWSTD_UINT32_T charmap_off;
|
||||
|
||||
_RWSTD_UINT32_T yesexpr_off[2];
|
||||
_RWSTD_UINT32_T noexpr_off[2];
|
||||
|
||||
_RWSTD_UINT32_T messages_ext_off;
|
||||
|
||||
const void* yesexpr (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (yesexpr_off[wide]);
|
||||
}
|
||||
|
||||
const void* noexpr (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (noexpr_off[wide]);
|
||||
}
|
||||
|
||||
const char* codeset_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (codeset_off);
|
||||
}
|
||||
|
||||
const char* charmap_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (charmap_off);
|
||||
}
|
||||
|
||||
const void* get_ext () const {
|
||||
return _RWSTD_CHAR_ARRAY (messages_ext_off);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// LC_TIME structure
|
||||
struct __rw_time_t
|
||||
{
|
||||
_RWSTD_UINT32_T codeset_off; // byte offset of the codeset_name
|
||||
_RWSTD_UINT32_T charmap_off; // byte offset to the charmap name
|
||||
_RWSTD_UINT32_T num_eras; // the number of eras
|
||||
_RWSTD_UINT32_T num_alt_digits; // the number of alt_digits
|
||||
|
||||
_RWSTD_UINT32_T era_off; // bute offset of the first era
|
||||
_RWSTD_UINT32_T alt_digits_off; // byte offset to offset array
|
||||
_RWSTD_UINT32_T abday_off[2][7]; // byte offset of each abday
|
||||
_RWSTD_UINT32_T day_off[2][7]; // byte offset of each day
|
||||
_RWSTD_UINT32_T abmon_off[2][12]; // byte offset of each abmon
|
||||
_RWSTD_UINT32_T mon_off[2][12]; // byte offset of each mon
|
||||
_RWSTD_UINT32_T am_pm_off[2][2]; // byte offset of am and pm
|
||||
_RWSTD_UINT32_T d_t_fmt_off[2]; // byte offset of d_t_fmt
|
||||
_RWSTD_UINT32_T d_fmt_off[2]; // byte offset of d_fmt
|
||||
_RWSTD_UINT32_T t_fmt_off[2]; // byte offset of t_fmt
|
||||
_RWSTD_UINT32_T t_fmt_ampm_off[2]; // byte offset of t_fmt_ampm
|
||||
_RWSTD_UINT32_T era_d_t_fmt_off[2]; // byte offset of era_d_t_fmt
|
||||
_RWSTD_UINT32_T era_d_fmt_off[2]; // byte offset of era_d_fmt
|
||||
_RWSTD_UINT32_T era_t_fmt_off[2]; // byte offset of era_t_fmt
|
||||
|
||||
// this is added to allow for future extensions
|
||||
_RWSTD_UINT32_T time_ext_off; // extended time data offset
|
||||
|
||||
// %a: abbreviated weekday name [tm_wday]
|
||||
const void* abday (_RWSTD_SIZE_T idx, bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (abday_off [wide][idx]);
|
||||
}
|
||||
|
||||
// %A: full weekday name [tm_wday]
|
||||
const void* day (_RWSTD_SIZE_T idx, bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (day_off [wide][idx]);
|
||||
}
|
||||
|
||||
// %b: abbreviated month name [tm_mon]
|
||||
const void* abmon (_RWSTD_SIZE_T idx, bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (abmon_off [wide][idx]);
|
||||
}
|
||||
|
||||
// %B: full month name [tm_mon]
|
||||
const void* mon (_RWSTD_SIZE_T idx, bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (mon_off [wide][idx]);
|
||||
}
|
||||
|
||||
// %p: the locale's equivalent of the AM/PM designations
|
||||
// associated with a 12-hour clock [tm_hour]
|
||||
const void* am_pm (_RWSTD_SIZE_T idx, bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (am_pm_off [wide][idx]);
|
||||
}
|
||||
|
||||
// %c: the appropriate date and time representation
|
||||
const void* d_t_fmt (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (d_t_fmt_off[wide]);
|
||||
}
|
||||
|
||||
// %x: the appropriate date representation
|
||||
const void* d_fmt (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (d_fmt_off[wide]);
|
||||
}
|
||||
|
||||
// %X: the appropriate time representation
|
||||
const void* t_fmt (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (t_fmt_off[wide]);
|
||||
}
|
||||
|
||||
const void* t_fmt_ampm (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (t_fmt_ampm_off[wide]);
|
||||
}
|
||||
|
||||
struct era_t {
|
||||
_RWSTD_UINT32_T name_off [2]; // narrow and wide era names
|
||||
_RWSTD_UINT32_T fmt_off [2]; // narrow and wide format of the year
|
||||
|
||||
// negative offset represents direction of '-', otherwise '+'
|
||||
_RWSTD_INT32_T offset; // year closest to start_date
|
||||
|
||||
// the beginning of time is represented by INT_MIN stored in
|
||||
// year [1], and CHAR_MIN in month [1] and day [1]
|
||||
// the end of time is represented by INT_MAX stored in
|
||||
// year [1], and CHAR_MAX in month [1] and day [1]
|
||||
_RWSTD_INT32_T year [2]; // start and end year
|
||||
char month [2]; // start and end month [0..11]
|
||||
char day [2]; // start and end day [1..31]
|
||||
};
|
||||
|
||||
// era description segment
|
||||
const era_t* era (_RWSTD_SIZE_T idx) const {
|
||||
return _RWSTD_ARRAY_ELM (era_t, era_off, idx);
|
||||
}
|
||||
|
||||
// the number of era description segments
|
||||
_RWSTD_SIZE_T era_count () const {
|
||||
return num_eras;
|
||||
}
|
||||
|
||||
const void* era_name (_RWSTD_SIZE_T idx, bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (era (idx)->name_off[wide]);
|
||||
}
|
||||
|
||||
const void* era_fmt (_RWSTD_SIZE_T idx, bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (era (idx)->fmt_off[wide]);
|
||||
}
|
||||
|
||||
// %Ec: the locale's alternate date and time representation
|
||||
const void* era_d_t_fmt (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (era_d_t_fmt_off[wide]);
|
||||
}
|
||||
|
||||
// %Ex: the locale's alternative date representation
|
||||
const void* era_d_fmt (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (era_d_fmt_off[wide]);
|
||||
}
|
||||
|
||||
// %EX: the locale's alternative time representation
|
||||
const void* era_t_fmt (bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (era_t_fmt_off[wide]);
|
||||
}
|
||||
|
||||
// alternative symbols for digits, corresponding to the %O modifier
|
||||
const void* alt_digits (_RWSTD_SIZE_T idx, bool wide) const {
|
||||
return _RWSTD_CHAR_ARRAY (*_RWSTD_ARRAY_ELM
|
||||
(_RWSTD_UINT32_T, alt_digits_off,
|
||||
idx * 2 + wide));
|
||||
}
|
||||
|
||||
// number of alternative digits
|
||||
_RWSTD_UINT32_T alt_digits_count () const {
|
||||
return num_alt_digits;
|
||||
}
|
||||
|
||||
const char* codeset_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (codeset_off);
|
||||
}
|
||||
|
||||
const char* charmap_name () const {
|
||||
return _RWSTD_CHAR_ARRAY (charmap_off);
|
||||
}
|
||||
|
||||
const void* get_ext () const {
|
||||
return _RWSTD_CHAR_ARRAY (time_ext_off);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#if 6 <= _RWSTD_aCC_MAJOR
|
||||
// restore HP aCC 6 remarks suppressed above to their default state
|
||||
# pragma diag_default 4298, 4299
|
||||
#endif // aCC >= 6
|
||||
|
||||
|
||||
static inline _RWSTD_SIZE_T
|
||||
__rw_itoutf8 (_RWSTD_UINT32_T wchar, char *to)
|
||||
{
|
||||
typedef _RWSTD_UINT8_T _UChar;
|
||||
|
||||
if (wchar < 0x80U) {
|
||||
to [0] = _UChar (wchar);
|
||||
return 1U;
|
||||
}
|
||||
if (wchar < 0x800U) {
|
||||
to [0] = _UChar (0xc0U | (wchar >> 6));
|
||||
to [1] = _UChar (0x80U | (wchar & 0x3fU));
|
||||
return 2U;
|
||||
}
|
||||
if (wchar < 0x10000U) {
|
||||
to [0] = _UChar (0xe0U | (wchar >> 12));
|
||||
to [1] = _UChar (0x80U | (wchar >> 6 & 0x3fU));
|
||||
to [2] = _UChar (0x80U | (wchar & 0x3fU));
|
||||
return 3U;
|
||||
}
|
||||
if (wchar < 0x200000U) {
|
||||
to [0] = _UChar (0xf0U | (wchar >> 18));
|
||||
to [1] = _UChar (0x80U | (wchar >> 12 & 0x3fU));
|
||||
to [2] = _UChar (0x80U | (wchar >> 6 & 0x3fU));
|
||||
to [3] = _UChar (0x80U | (wchar & 0x3fU));
|
||||
return 4U;
|
||||
}
|
||||
if (wchar < 0x4000000U) {
|
||||
to [0] = _UChar (0xf8U | (wchar >> 24));
|
||||
to [1] = _UChar (0x80U | (wchar >> 18 & 0x3fU));
|
||||
to [2] = _UChar (0x80U | (wchar >> 12 & 0x3fU));
|
||||
to [3] = _UChar (0x80U | (wchar >> 6 & 0x3fU));
|
||||
to [4] = _UChar (0x80U | (wchar & 0x3fU));
|
||||
return 5U;
|
||||
}
|
||||
to [0] = _UChar (0xfcU | (wchar >> 30));
|
||||
to [1] = _UChar (0x80U | (wchar >> 24 & 0x3fU));
|
||||
to [2] = _UChar (0x80U | (wchar >> 18 & 0x3fU));
|
||||
to [3] = _UChar (0x80U | (wchar >> 12 & 0x3fU));
|
||||
to [4] = _UChar (0x80U | (wchar >> 6 & 0x3fU));
|
||||
to [5] = _UChar (0x80U | (wchar & 0x3fU));
|
||||
return 6U;
|
||||
}
|
||||
|
||||
|
||||
// converts a single UTF-8 character starting at `from' to its UCS-4
|
||||
// representation and, if successful, stores the result in `*ret'
|
||||
// returns a pointer to the beginning of the next UTF-8 character
|
||||
// or 0 on error
|
||||
// returns `from' when the sequence in the range [`from', `from_end')
|
||||
// forms an incomplete UTF-8 character
|
||||
static inline const char*
|
||||
__rw_utf8toucs4 (_RWSTD_INT32_T *ret, const char *from, const char *from_end)
|
||||
{
|
||||
_RWSTD_ASSERT (0 != ret);
|
||||
_RWSTD_ASSERT (0 != from);
|
||||
_RWSTD_ASSERT (from <= from_end);
|
||||
|
||||
typedef _RWSTD_INT32_T _Int32;
|
||||
|
||||
const _RWSTD_UINT8_T* const byte =
|
||||
_RWSTD_REINTERPRET_CAST (const _RWSTD_UINT8_T*, from);
|
||||
|
||||
if (byte [0] < 0x80U) {
|
||||
*ret = _Int32 (byte [0]);
|
||||
return from + 1;
|
||||
}
|
||||
|
||||
if (byte [0] < 0xc2U) {
|
||||
// sequences beginning with a byte in the range [0x80, 0xc2)
|
||||
// do not form a valid UTF-8 character
|
||||
return 0;
|
||||
}
|
||||
|
||||
const _RWSTD_PTRDIFF_T len = from_end - from;
|
||||
|
||||
if (byte [0] < 0xe0U) {
|
||||
if (len < 2)
|
||||
return from;
|
||||
|
||||
*ret = _Int32 ((byte [0] & 0x1fU) << 6 | byte [1] & 0x3fU);
|
||||
return from + 2;
|
||||
}
|
||||
|
||||
if (byte [0] < 0xf0U) {
|
||||
if (len < 3)
|
||||
return from;
|
||||
|
||||
*ret = _Int32 ( (byte [0] & 0x0fU) << 12
|
||||
| (byte [1] & 0x3fU) << 6
|
||||
| (byte [2] & 0x3fU));
|
||||
return from + 3;
|
||||
}
|
||||
|
||||
if (byte [0] < 0xf8U) {
|
||||
if (len < 4)
|
||||
return from;
|
||||
|
||||
*ret = _Int32 ( (byte [0] & 0x07U) << 18
|
||||
| (byte [1] & 0x3fU) << 12
|
||||
| (byte [2] & 0x3fU) << 6
|
||||
| (byte [3] & 0x3fU));
|
||||
return from + 4;
|
||||
}
|
||||
|
||||
if (byte [0] < 0xfcU) {
|
||||
if (len < 5)
|
||||
return from;
|
||||
|
||||
*ret = _Int32 ( (byte [0] & 0x03U) << 24
|
||||
| (byte [1] & 0x3fU) << 18
|
||||
| (byte [2] & 0x3fU) << 12
|
||||
| (byte [3] & 0x3fU) << 6
|
||||
| (byte [4] & 0x3fU));
|
||||
return from + 5;
|
||||
}
|
||||
|
||||
if (byte [0] < 0xfeU) {
|
||||
if (len < 6)
|
||||
return from;
|
||||
|
||||
*ret = _Int32 ( (byte [0] & 0x01U) << 30
|
||||
| (byte [1] & 0x3fU) << 24
|
||||
| (byte [2] & 0x3fU) << 18
|
||||
| (byte [3] & 0x3fU) << 12
|
||||
| (byte [4] & 0x3fU) << 6
|
||||
| (byte [5] & 0x3fU));
|
||||
return from + 6;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// looks up the offset of the wide character corresponing to the multibyte
|
||||
// character starting at `from'; returns the offset on success, UINT_MAX if
|
||||
// no such wide character exists (i.e., on conversion error), or any value
|
||||
// with bit 31 set if the the range [`from', `from_end') forms an incomplete
|
||||
// multibyte character (i.e., if it's an initial subsequence of one)
|
||||
static inline
|
||||
unsigned __rw_mbtowco (const unsigned *cvtbl,
|
||||
const char *&from,
|
||||
const char *from_end)
|
||||
{
|
||||
typedef _RWSTD_UINT8_T _UChar;
|
||||
|
||||
// `bit31' has the most significant bit set and all others clear
|
||||
const unsigned bit31 = 0x80000000U;
|
||||
|
||||
const char *next = from;
|
||||
|
||||
unsigned wc;
|
||||
|
||||
for (const unsigned *ptbl = cvtbl; (wc = ptbl [_UChar (*next)]) & bit31; ) {
|
||||
|
||||
// check if it is valid and if so, whether we have reached the
|
||||
// end of the source sequence and found an incomplete character
|
||||
// note, however, that an incomplete character does not mean
|
||||
// partial conversion
|
||||
if (wc == _RWSTD_UINT_MAX || ++next == from_end)
|
||||
return wc;
|
||||
|
||||
// use the `wc' value to compute the address of the next table
|
||||
ptbl = cvtbl + 256 * (wc & ~bit31);
|
||||
}
|
||||
|
||||
from = next + 1;
|
||||
|
||||
return wc;
|
||||
}
|
||||
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_LOCALEDEF_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_messages.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_messages.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_messages.c
|
||||
*
|
||||
* $Id: _messages.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_messages.cc>
|
||||
144
extern/stdcxx/4.2.1/include/loc/_messages.cc
vendored
Normal file
144
extern/stdcxx/4.2.1/include/loc/_messages.cc
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _messages.cc - definition of std::messages members
|
||||
*
|
||||
* $Id: _messages.cc 637130 2008-03-14 15:16:33Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2008 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_ctype.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
_RW::__rw_facet_id messages<_CharT>::id;
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
messages_base::catalog
|
||||
messages<_CharT>::
|
||||
do_open (const string& __fun, const locale&__loc) const
|
||||
{
|
||||
return _RW::__rw_cat_open (__fun, __loc);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
messages<_CharT>::
|
||||
do_close (messages_base::catalog __cat) const
|
||||
{
|
||||
_RW::__rw_cat_close (__cat);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
_TYPENAME messages<_CharT>::string_type
|
||||
messages<_CharT>::do_get (messages_base::catalog __cat,
|
||||
int __set,
|
||||
int __msgid,
|
||||
const string_type &__dfault) const
|
||||
{
|
||||
const char* const __text = _RW::__rw_get_message (__cat, __set, __msgid);
|
||||
|
||||
if (__text) {
|
||||
typedef _STD::codecvt<_CharT, char, _RWSTD_MBSTATE_T>
|
||||
_CodeCvt;
|
||||
|
||||
typedef _TYPENAME _CodeCvt::state_type state_type;
|
||||
|
||||
const _CodeCvt& __codecvt =
|
||||
_RWSTD_USE_FACET (_CodeCvt, _RW::__rw_get_locale (__cat));
|
||||
|
||||
if (sizeof (_CharT) == sizeof (char) && __codecvt.always_noconv ()) {
|
||||
// lwg issue 19: always_noconv() is only allowed to return
|
||||
// true if extern_type and intern_type are one and the same
|
||||
return _RWSTD_REINTERPRET_CAST (const _CharT*, __text);
|
||||
}
|
||||
|
||||
typedef char_traits<char> _CharTraits;
|
||||
typedef _RWSTD_SIZE_T _SizeT;
|
||||
|
||||
const _SizeT __src_len = _CharTraits::length (__text);
|
||||
const char* const __src_first = __text;
|
||||
const char* const __src_last = __text + __src_len;
|
||||
const char* __src_next = __src_first;
|
||||
|
||||
// allocate a [wide] string large enough to hold at least
|
||||
// as many internal characters as there are bytes in the
|
||||
// multibyte characater message
|
||||
string_type __result_str ((const _CharT*)0, __src_len);
|
||||
|
||||
_CharT* const __dst_first = &__result_str [0];
|
||||
_CharT* const __dst_last = __dst_first + __src_len;
|
||||
_CharT* __dst_next = __dst_first;
|
||||
|
||||
state_type __state = state_type ();
|
||||
|
||||
// avoid using const codecvt_base::result here
|
||||
// to prevent HP aCC 3.27 errors
|
||||
const int __res =
|
||||
__codecvt.in (__state, __src_first, __src_last, __src_next,
|
||||
__dst_first, __dst_last, __dst_next);
|
||||
|
||||
switch (__res) {
|
||||
case codecvt_base::ok:
|
||||
// shrink the converted string accordingly
|
||||
_RWSTD_ASSERT (__dst_first <= __dst_next);
|
||||
|
||||
__result_str.resize (_SizeT (__dst_next - __dst_first));
|
||||
return __result_str;
|
||||
|
||||
case codecvt_base::noconv:
|
||||
if (sizeof (_CharT) == sizeof (char)) {
|
||||
// lwg issue 19: in() is only allowed to return noconv
|
||||
// if extern_type and intern_type are one and the same
|
||||
return _RWSTD_REINTERPRET_CAST (const _CharT*, __text);
|
||||
}
|
||||
else {
|
||||
// should not happen - bad codecvt implementation
|
||||
|
||||
typedef ctype<_CharT> _Ctype;
|
||||
|
||||
const _Ctype& __ctp =
|
||||
_RWSTD_USE_FACET (_Ctype, _RW::__rw_get_locale (__cat));
|
||||
|
||||
for (_SizeT __i = 0; __i != __src_len; ++__i)
|
||||
__dst_first [__i] = __ctp.widen (__text [__i]);
|
||||
|
||||
return __result_str;
|
||||
}
|
||||
|
||||
case codecvt_base::partial:
|
||||
// should not happen (bad catalog?)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return __dfault;
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
171
extern/stdcxx/4.2.1/include/loc/_messages.h
vendored
Normal file
171
extern/stdcxx/4.2.1/include/loc/_messages.h
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _messages.h - definition of the std::messages class templates
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _messages.h 637130 2008-03-14 15:16:33Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2007 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_MESSAGES_H_INCLUDED
|
||||
#define _RWSTD_LOC_MESSAGES_H_INCLUDED
|
||||
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <loc/_facet.h>
|
||||
#include <loc/_codecvt.h>
|
||||
#include <loc/_locale.h>
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
int __rw_cat_open (const _STD::string&, const _STD::locale&);
|
||||
|
||||
const char* __rw_get_message (int, int, int);
|
||||
|
||||
const _STD::locale& __rw_get_locale (int);
|
||||
|
||||
void __rw_cat_close (int);
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
struct _RWSTD_EXPORT messages_base
|
||||
{
|
||||
typedef int catalog;
|
||||
};
|
||||
|
||||
|
||||
// 22.2.7.1
|
||||
_EXPORT
|
||||
template <class _CharT>
|
||||
class messages: public _RW::__rw_facet,
|
||||
public messages_base
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
|
||||
typedef basic_string<char_type, char_traits<char_type>,
|
||||
allocator<char_type> > string_type;
|
||||
|
||||
_EXPLICIT messages (_RWSTD_SIZE_T __refs = 0)
|
||||
: _RW::__rw_facet (__refs) { }
|
||||
|
||||
|
||||
catalog open (const string& __fun, const locale& __loc) const {
|
||||
return do_open (__fun, __loc);
|
||||
}
|
||||
|
||||
string_type get (catalog __c, int __set, int __msgid,
|
||||
const string_type& __df) const {
|
||||
return do_get (__c, __set, __msgid, __df);
|
||||
}
|
||||
|
||||
void close (catalog __c) const {
|
||||
do_close (__c);
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
virtual catalog do_open (const string&, const locale&) const;
|
||||
|
||||
virtual string_type do_get (catalog, int, int, const string_type&) const;
|
||||
|
||||
virtual void do_close (catalog) const;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id messages<char>::id;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id messages<wchar_t>::id;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
|
||||
// 22.2.7.2
|
||||
template <class _CharT>
|
||||
class messages_byname: public messages<_CharT>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT messages_byname (const char *__name, _RWSTD_SIZE_T __refs = 0)
|
||||
: messages<_CharT>(__refs) {
|
||||
this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_MESSAGES)
|
||||
# include <loc/_messages.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (MESSAGES)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_MESSAGES, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT messages<char>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_MESSAGES, _CHAR)
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_MESSAGES, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT messages<wchar_t>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_MESSAGES, _WCHAR_T)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_MESSAGES)
|
||||
# include <loc/_messages.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (MESSAGES)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_MESSAGES_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_money_get.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_money_get.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_money_get.c
|
||||
*
|
||||
* $Id: _money_get.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_money_get.cc>
|
||||
381
extern/stdcxx/4.2.1/include/loc/_money_get.cc
vendored
Normal file
381
extern/stdcxx/4.2.1/include/loc/_money_get.cc
vendored
Normal file
@@ -0,0 +1,381 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _money_get.cc - definition of std::money_get members
|
||||
*
|
||||
* $Id: _money_get.cc 637130 2008-03-14 15:16:33Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 2001-2008 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <streambuf>
|
||||
#include <loc/_ctype.h>
|
||||
#include <loc/_moneypunct.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
_RWSTD_EXPORT int
|
||||
__rw_get_num (void*, const char*, int, int,
|
||||
const char*, _RWSTD_SIZE_T, const char*, _RWSTD_SIZE_T);
|
||||
|
||||
_RWSTD_EXPORT int
|
||||
__rw_check_grouping (const char*, _RWSTD_SIZE_T,
|
||||
const char*, _RWSTD_SIZE_T);
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template <class _CharT, class _InputIter>
|
||||
_RW::__rw_facet_id money_get<_CharT, _InputIter>::id;
|
||||
|
||||
|
||||
template <class _CharT, class _InputIter>
|
||||
_TYPENAME money_get<_CharT, _InputIter>::iter_type
|
||||
money_get<_CharT, _InputIter>::
|
||||
_C_get (iter_type __it, iter_type __end, bool __intl, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, void *__pval, string_type *__pstr) const
|
||||
{
|
||||
typedef moneypunct<_CharT, false> _Punct0;
|
||||
typedef moneypunct<_CharT, true> _Punct1;
|
||||
|
||||
const _Punct0 &__pun = __intl ?
|
||||
_RWSTD_REINTERPRET_CAST (const _Punct0&,
|
||||
_RWSTD_USE_FACET (_Punct1,
|
||||
__flags.getloc ()))
|
||||
: _RWSTD_USE_FACET (_Punct0, __flags.getloc ());
|
||||
|
||||
// retrieve positive and negative sign, currency symbol,
|
||||
// the grouping string and the pattern format
|
||||
const string_type __ps = __pun.positive_sign ();
|
||||
const string_type __ns = __pun.negative_sign ();
|
||||
const string_type __cs = __pun.curr_symbol ();
|
||||
const string __gr = __pun.grouping ();
|
||||
const money_base::pattern __pat = __pun.neg_format ();
|
||||
|
||||
_RWSTD_IOSTATE __ebits = _RW::__rw_goodbit;
|
||||
|
||||
bool __needws = false; // whitespace required?
|
||||
bool __seendp = false; // seen decimal point in input
|
||||
|
||||
const ctype<_CharT> &__ctp =
|
||||
_RWSTD_USE_FACET (ctype<_CharT>, __flags.getloc ());
|
||||
|
||||
char __buf [304];
|
||||
char *__pcur = __buf;
|
||||
|
||||
typedef _TYPENAME string_type::traits_type _Traits;
|
||||
|
||||
char __grpbuf [sizeof __buf]; // holds sizes of discovered groups
|
||||
char *__pgrp = __grpbuf; // current group
|
||||
const char *__grpstart = 0; // the start of the last group
|
||||
const char *__grpend = 0; // the end of the last group
|
||||
|
||||
|
||||
int __sign = 0; // the sign of the result if detected (-1, 0, or +1)
|
||||
|
||||
// buffer must always start with a sign (__rw_get_num requirement)
|
||||
// use a '+' and overwrite it with a '-' if necessary
|
||||
*__pcur++ = '+';
|
||||
|
||||
const int __fl = __flags.flags ();
|
||||
|
||||
typedef _RWSTD_SIZE_T _SizeT;
|
||||
|
||||
for (_SizeT __i = 0; !__ebits && __i != sizeof __pat.field; ++__i) {
|
||||
|
||||
switch (__pat.field [__i]) {
|
||||
|
||||
case /* '\1' */ money_base::space:
|
||||
__needws = true;
|
||||
// fall through...
|
||||
|
||||
case /* '\0' */ money_base::none: {
|
||||
|
||||
// optional or even required whitespace is consumed only if
|
||||
// other characters may be required to complete the format
|
||||
if ( sizeof __pat.field == __i + 1
|
||||
|| 2 == __i && money_base::symbol == __pat.field [3]
|
||||
&& (!(__fl & _RW::__rw_showbase) || 0 == __cs.size ())
|
||||
&& !( __sign < 0 && __ns.size () > 1
|
||||
|| __sign > 0 && __ps.size () > 1)
|
||||
|| 1 == __i && money_base::value == __pat.field [0]
|
||||
&& 0 == __ns.size () && 0 == __ps.size ()
|
||||
&& (0 == __cs.size () || !(__fl & _RW::__rw_showbase)))
|
||||
break;
|
||||
|
||||
_SizeT __nc = 0;
|
||||
|
||||
while (__it != __end && __ctp.is (ctype_base::space, *__it)) {
|
||||
++__it;
|
||||
++__nc;
|
||||
}
|
||||
|
||||
if (__needws && !__nc)
|
||||
__ebits |= _RW::__rw_failbit;
|
||||
break;
|
||||
}
|
||||
|
||||
case /* '\2' */ money_base::symbol: {
|
||||
|
||||
// if optional, currency symbol is not extracted unless
|
||||
// it is consumed only if it is followed by characters
|
||||
// required to complete the pattern (see example in
|
||||
// 22.2.6.1.2, p3)
|
||||
if ( __fl & _RW::__rw_showbase
|
||||
|| __i < 2
|
||||
|| 2 == __i && (money_base::none != __pat.field [3])
|
||||
|| __sign < 0 && __ns.size () > 1
|
||||
|| __sign > 0 && __ps.size () > 1) {
|
||||
|
||||
for (_SizeT __nc = 0; __nc != __cs.size ();
|
||||
++__nc, ++__it) {
|
||||
if (__it == __end || !_Traits::eq (*__it, __cs [__nc])) {
|
||||
|
||||
// 22.2.6.1.2, p2: unless showbase is set,
|
||||
// curr_symbol is optional
|
||||
if (__nc || __fl & _RW::__rw_showbase)
|
||||
__ebits |= _RW::__rw_failbit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case /* '\3' */ money_base::sign: {
|
||||
|
||||
if (__it == __end) {
|
||||
if (__ps.size () && __ns.size ())
|
||||
__ebits |= _RW::__rw_failbit;
|
||||
else
|
||||
__sign = __ps.empty () - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
const char_type __c = *__it;
|
||||
|
||||
// 22.2.6.1.2, p3: if the first character of positive
|
||||
// and negative sign is the same, the result is positive
|
||||
|
||||
if (__ps.size () && _Traits::eq (__c, __ps [0])) {
|
||||
__sign = 1;
|
||||
++__it;
|
||||
}
|
||||
else if (__ns.size () && _Traits::eq (__c, __ns [0])) {
|
||||
__sign = -1;
|
||||
++__it;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case /* '\4' */ money_base::value: {
|
||||
|
||||
const char_type __ts =
|
||||
__gr.size () && __gr [0] && __gr [0] != _RWSTD_CHAR_MAX ?
|
||||
__pun.thousands_sep () : __ctp.widen ('0');
|
||||
|
||||
int __fd = __pun.frac_digits ();
|
||||
|
||||
for (; __it != __end; ++__it) {
|
||||
|
||||
// read and narrow a character (note that narrow() may
|
||||
// yield the same narrow char for more than one wide
|
||||
// character; e.g., there may be two sets of digits)
|
||||
const char_type __c = *__it;
|
||||
const char __ch = __ctp.narrow (__c, '\0');
|
||||
|
||||
if (__ch >= '0' && __ch <= '9') {
|
||||
if (!__seendp || __fd-- > 0)
|
||||
*__pcur++ = __ch;
|
||||
}
|
||||
else if ( !__seendp && __fd > 0
|
||||
&& _Traits::eq (__c, __pun.decimal_point ())) {
|
||||
__grpend = __pcur;
|
||||
__seendp = true;
|
||||
}
|
||||
else if (!__seendp && _Traits::eq (__c, __ts)) {
|
||||
// add the length of the current group to the array groups
|
||||
// store UCHAR_MAX if group length exceeds the size of char
|
||||
_RWSTD_PTRDIFF_T __len;
|
||||
|
||||
if (__grpstart)
|
||||
__len = __pcur - __grpstart;
|
||||
else {
|
||||
__grpstart = __pcur;
|
||||
__len = __pcur - __buf - 1;
|
||||
}
|
||||
|
||||
typedef unsigned char _UChar;
|
||||
|
||||
*__pgrp++ = char (__len < _UChar (-1) ? __len : -1);
|
||||
__grpstart = __pcur;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (__pcur - __buf > 1) {
|
||||
// append zeros to a non-empty string of digits
|
||||
// up to the number of frac_digits
|
||||
while (__fd-- > 0)
|
||||
*__pcur++ = '0';
|
||||
}
|
||||
|
||||
*__pcur = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
__ebits = _RW::__rw_failbit;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!(__ebits & _RW::__rw_failbit)) {
|
||||
|
||||
if (__buf [1]) {
|
||||
|
||||
// process the remainder of a multicharacter sign
|
||||
const _SizeT __sizes [] = {
|
||||
__ps.size () ? __ps.size () -1 : 0,
|
||||
__ns.size () ? __ns.size () -1 : 0
|
||||
};
|
||||
|
||||
const char_type* const __names [] = {
|
||||
__ps.data () + !!__sizes [0],
|
||||
__ns.data () + !!__sizes [1]
|
||||
};
|
||||
|
||||
if (__sign && (__sizes [0] || __sizes [1])) {
|
||||
|
||||
// if the first character of a multi-character sign
|
||||
// has been seen, try to extract the rest of the sign
|
||||
|
||||
_SizeT __inx = 0;
|
||||
|
||||
int __errtmp = 1; // no duplicates allowed
|
||||
|
||||
__it = _RW::__rw_match_name (__it, __end, __names, __sizes,
|
||||
sizeof __names / sizeof *__names,
|
||||
__inx, __errtmp, 0);
|
||||
|
||||
if (1 < __inx && __sizes [__sign < 0]) {
|
||||
|
||||
// failed to match the remainder of the sign to
|
||||
// the input and the first character of the sign
|
||||
// does not form the complete (positive or negative)
|
||||
// sign
|
||||
__ebits = _RW::__rw_failbit;
|
||||
__buf [1] = '\0';
|
||||
}
|
||||
else if (!_Traits::eq (*__ps.data (), *__ns.data ())) {
|
||||
|
||||
// if the first extracted character of the sign string
|
||||
// forms the complete sign whose first character doesn't
|
||||
// form an initial substring of the other sign string
|
||||
// the resulting sign is determined by the one-character
|
||||
// sign string
|
||||
if (1 < __inx)
|
||||
__inx = 0 < __sizes [__sign < 0];
|
||||
|
||||
// if both signs begin with the same character,
|
||||
// the result is positive (22.2.6.1.2, p3)
|
||||
*__buf = __inx ? '-' : '+';
|
||||
__sign = -int (__inx);
|
||||
}
|
||||
}
|
||||
else if (__sign < 0) {
|
||||
*__buf = '-';
|
||||
}
|
||||
|
||||
if (__pstr && !(__ebits & _RW::__rw_failbit)) {
|
||||
// skip over the leading sign and any redundant zeros after it
|
||||
const char *__start = __buf + 1;
|
||||
for (; '0' == *__start && '0' == __start [1]; ++__start);
|
||||
|
||||
// invert the sign if negative
|
||||
__sign = __sign < 0;
|
||||
|
||||
// widen narrow digits optionally preceded by the minus sign
|
||||
// into the basic_string object as required by 22.2.6.1.2, p1
|
||||
__pstr->resize ((__pcur - __start) + _SizeT (__sign));
|
||||
|
||||
if (__sign)
|
||||
_Traits::assign ((*__pstr)[0], __ctp.widen ('-'));
|
||||
|
||||
__ctp.widen (__start, __pcur, &(*__pstr)[_SizeT (__sign)]);
|
||||
}
|
||||
|
||||
const char *__grs = "";
|
||||
_SizeT __grn = 0;
|
||||
|
||||
// 22.2.6.1.2, p1: thousands separators are optional
|
||||
|
||||
// add the length of the last group to the array of groups
|
||||
// store UCHAR_MAX if group length exceeds the size of char
|
||||
if (__grpstart) {
|
||||
const _RWSTD_PTRDIFF_T __len =
|
||||
(__grpend ? __grpend : __pcur) - __grpstart;
|
||||
|
||||
typedef unsigned char _UChar;
|
||||
|
||||
*__pgrp++ = char (__len < _UChar (-1) ? __len : -1);
|
||||
*__pgrp = '\0';
|
||||
__grs = __gr.data ();
|
||||
__grn = __gr.size ();
|
||||
}
|
||||
|
||||
if (__pval) {
|
||||
// produce a number from the extracted string of digits
|
||||
// and (optionally) check grouping
|
||||
|
||||
const int __errtmp =
|
||||
_RW::__rw_get_num (__pval, __buf, _C_ldouble, 0,
|
||||
__grpbuf, __pgrp - __grpbuf,
|
||||
__grs, __grn);
|
||||
|
||||
__ebits |= _RWSTD_IOSTATE (__errtmp);
|
||||
}
|
||||
else if (0 > _RW::__rw_check_grouping (__grpbuf, __pgrp - __grpbuf,
|
||||
__grs, __grn))
|
||||
__ebits |= _RW::__rw_failbit;
|
||||
}
|
||||
else
|
||||
__ebits |= _RW::__rw_failbit;
|
||||
}
|
||||
|
||||
if (__it == __end)
|
||||
__ebits |= _RW::__rw_eofbit;
|
||||
|
||||
__err |= __ebits;
|
||||
|
||||
return __it;
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
155
extern/stdcxx/4.2.1/include/loc/_money_get.h
vendored
Normal file
155
extern/stdcxx/4.2.1/include/loc/_money_get.h
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _money_get.h - definition of the std::money_get class templates
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _money_get.h 637130 2008-03-14 15:16:33Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 2001-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_MONEY_GET_H_INCLUDED
|
||||
#define _RWSTD_LOC_MONEY_GET_H_INCLUDED
|
||||
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <rw/_ioiter.h>
|
||||
#include <rw/_iosfwd.h>
|
||||
#include <loc/_facet.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _InputIter = istreambuf_iterator<_CharT> >
|
||||
struct money_get: _RW::__rw_facet
|
||||
{
|
||||
typedef _CharT char_type;
|
||||
typedef _InputIter iter_type;
|
||||
typedef
|
||||
basic_string<char_type, char_traits<char_type>, allocator<char_type> >
|
||||
string_type;
|
||||
|
||||
_EXPLICIT money_get (_RWSTD_SIZE_T __ref = 0)
|
||||
: _RW::__rw_facet (__ref) { }
|
||||
|
||||
iter_type get (iter_type __begin, iter_type __end, bool __intl,
|
||||
ios_base &__flags, _RWSTD_IOSTATE &__err,
|
||||
long double &__val) const {
|
||||
return do_get (__begin, __end, __intl, __flags, __err, __val);
|
||||
}
|
||||
|
||||
iter_type get (iter_type __begin, iter_type __end, bool __intl,
|
||||
ios_base &__flags, _RWSTD_IOSTATE &__err,
|
||||
string_type &__str) const {
|
||||
return do_get (__begin, __end, __intl, __flags, __err, __str);
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
#ifndef _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type __it, iter_type __end, bool __intl, ios_base &__fl,
|
||||
_RWSTD_IOSTATE &__err, long double &__val) const {
|
||||
return _C_get (__it, __end, __intl, __fl, __err, &__val, 0);
|
||||
}
|
||||
|
||||
#else // if defined (_RWSTD_NO_LONG_DOUBLE)
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type __it, iter_type __end, bool __intl, ios_base &__fl,
|
||||
_RWSTD_IOSTATE &__err, double &__val) const {
|
||||
return _C_get (__it, __end, __intl, __fl, __err, &__val, 0);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type __it, iter_type __end, bool __intl, ios_base &__fl,
|
||||
_RWSTD_IOSTATE &__err, string_type &__str) const {
|
||||
return _C_get (__it, __end, __intl, __fl, __err, 0, &__str);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
iter_type
|
||||
_C_get (iter_type, iter_type, bool, ios_base&,
|
||||
_RWSTD_IOSTATE&, void*, string_type*) const;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id money_get<char, istreambuf_iterator<char> >::id;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id money_get<wchar_t, istreambuf_iterator<wchar_t> >::id;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_MONEY_GET)
|
||||
# include <loc/_money_get.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_MONEY_GET)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_MONEY_GET, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT money_get<char>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_MONEY_GET, _CHAR)
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_MONEY_GET, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT money_get<wchar_t>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_MONEY_GET, _WCHAR_T)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_MONEY_GET)
|
||||
# include <loc/_money_get.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_MONEY_GET)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_MONEY_GET_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_money_put.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_money_put.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_money_put.c
|
||||
*
|
||||
* $Id: _money_put.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_money_put.cc>
|
||||
413
extern/stdcxx/4.2.1/include/loc/_money_put.cc
vendored
Normal file
413
extern/stdcxx/4.2.1/include/loc/_money_put.cc
vendored
Normal file
@@ -0,0 +1,413 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _money_put.cc - definition of std::num_put members
|
||||
*
|
||||
* $Id: _money_put.cc 651012 2008-04-23 19:10:45Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2008 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <streambuf>
|
||||
#include <loc/_moneypunct.h>
|
||||
#include <loc/_ctype.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
_RWSTD_EXPORT _RWSTD_SIZE_T
|
||||
__rw_put_num (char**, _RWSTD_SIZE_T, unsigned, int, _RWSTD_STREAMSIZE,
|
||||
const void*, const char*);
|
||||
|
||||
_RWSTD_EXPORT _RWSTD_SIZE_T
|
||||
__rw_put_groups (char **, _RWSTD_SIZE_T, _RWSTD_SIZE_T,
|
||||
const char*, const char*);
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template <class _CharT, class _OutputIter>
|
||||
_RW::__rw_facet_id money_put<_CharT, _OutputIter>::id;
|
||||
|
||||
|
||||
template <class _CharT, class _OutputIter>
|
||||
/* private */ _TYPENAME money_put<_CharT, _OutputIter>::iter_type
|
||||
money_put<_CharT, _OutputIter>::
|
||||
_C_put (iter_type __it, int __opts, ios_base &__flags, char_type __fill,
|
||||
const char_type *__s, _RWSTD_SIZE_T __n, int __fd,
|
||||
const char *__groups, _RWSTD_SIZE_T __ngroups) const
|
||||
{
|
||||
// static const arrays of pointers to moneypunct<charT, Intl> members
|
||||
// to avoid "if (intl)" conditionals when retrieving punct values
|
||||
|
||||
const bool __intl = 0 != (__opts & _C_intl);
|
||||
const bool __num = 0 != (__opts & _C_ldbl);
|
||||
|
||||
typedef moneypunct<_CharT, false> _Punct0;
|
||||
typedef moneypunct<_CharT, true> _Punct1;
|
||||
|
||||
const _Punct0* __pun0;
|
||||
const _Punct1* __pun1;
|
||||
|
||||
#ifdef __GNUG__
|
||||
// silence bogus gcc -Wuninitialized warning:
|
||||
// object may be used uninitialized in this function
|
||||
// while avoiding bogus HP aCC/cadvise warning 20200:
|
||||
// potential null pointer dereference
|
||||
__pun0 = 0;
|
||||
__pun1 = 0;
|
||||
#endif // gcc
|
||||
|
||||
if (__intl) {
|
||||
__pun1 = &_RWSTD_USE_FACET (_Punct1, __flags.getloc ());
|
||||
}
|
||||
else {
|
||||
__pun0 = &_RWSTD_USE_FACET (_Punct0, __flags.getloc ());
|
||||
}
|
||||
|
||||
const ctype<_CharT> &__ctp =
|
||||
_RWSTD_USE_FACET (ctype<_CharT>,__flags.getloc ());
|
||||
|
||||
const char __signchar = __ctp.narrow (*__s, '\0');
|
||||
|
||||
money_base::pattern __fmat; // negative or positive format
|
||||
string_type __sign; // negative or positive sign
|
||||
|
||||
if ('-' == __signchar) {
|
||||
if (__intl) {
|
||||
__fmat = __pun1->neg_format ();
|
||||
__sign = __pun1->negative_sign ();
|
||||
}
|
||||
else {
|
||||
__fmat = __pun0->neg_format ();
|
||||
__sign = __pun0->negative_sign ();
|
||||
}
|
||||
++__s;
|
||||
--__n;
|
||||
}
|
||||
else {
|
||||
if (__intl) {
|
||||
__fmat = __pun1->pos_format ();
|
||||
__sign = __pun1->positive_sign ();
|
||||
}
|
||||
else {
|
||||
__fmat = __pun0->pos_format ();
|
||||
__sign = __pun0->positive_sign ();
|
||||
}
|
||||
if ('+' == __signchar) {
|
||||
++__s;
|
||||
--__n;
|
||||
}
|
||||
}
|
||||
|
||||
// optional currency sumbol
|
||||
const string_type __curr = (__flags.flags () & _RWSTD_IOS_SHOWBASE) ?
|
||||
__intl ? __pun1->curr_symbol () : __pun0->curr_symbol ()
|
||||
: string_type ();
|
||||
|
||||
// size of fractional and integral parts, respectively, to output
|
||||
long __dint = long (__n - __fd);
|
||||
|
||||
// must have at least one group (even if there are no thousands_sep)
|
||||
_RWSTD_ASSERT (__ngroups > 0);
|
||||
|
||||
// adjust padding by the sizes of each component, including the
|
||||
// number of thousands separators to be inserted
|
||||
long __pad = long (
|
||||
__flags.width () - __curr.size () - __sign.size ()
|
||||
- !__dint - !!__fd - (__dint > 0 ? __dint : -__dint) - __fd
|
||||
- ( money_base::space == __fmat.field [1]
|
||||
|| money_base::space == __fmat.field [2])
|
||||
- (__ngroups - 1));
|
||||
|
||||
const int __adj = __flags.flags () & _RWSTD_IOS_ADJUSTFIELD;
|
||||
|
||||
if (__adj != _RWSTD_IOS_INTERNAL && __adj != _RWSTD_IOS_LEFT) {
|
||||
|
||||
for (; __pad > 0; --__pad, ++__it)
|
||||
*__it = __fill;
|
||||
}
|
||||
|
||||
for (_RWSTD_SIZE_T __i = 0, __j; __i != sizeof __fmat; ++__i) {
|
||||
|
||||
switch (__fmat.field [__i]) {
|
||||
|
||||
case money_base::symbol: // exactly one occurrence required
|
||||
for (__j = 0; __j != __curr.size (); ++__j, ++__it)
|
||||
*__it = __curr [__j];
|
||||
break;
|
||||
|
||||
case money_base::sign: // exactly one occurrence required
|
||||
if (__sign.size ()) {
|
||||
// first character of sign only
|
||||
*__it = __sign [0];
|
||||
++__it;
|
||||
}
|
||||
break;
|
||||
|
||||
case money_base::space: // optional (required if none not present)
|
||||
// 22.2.6.3, p1: the value space, if present,
|
||||
// is neither first nor last.
|
||||
|
||||
_RWSTD_REQUIRES (0 != __i && sizeof __fmat != __i - 1,
|
||||
(_RWSTD_ERROR_RUNTIME_ERROR,
|
||||
_RWSTD_FUNC ("std::num_put<>::do_put()")));
|
||||
|
||||
// an ordinary space, not `fill', is required here
|
||||
// will precede any required padding
|
||||
*__it = __ctp.widen (' ');
|
||||
++__it;
|
||||
|
||||
case money_base::none: // optional (required if space not present)
|
||||
// 22.2.6.3, p1: the value none, if present, is not first
|
||||
|
||||
_RWSTD_REQUIRES (0 != __i,
|
||||
(_RWSTD_ERROR_RUNTIME_ERROR,
|
||||
_RWSTD_FUNC ("std::num_put<>::do_put()")));
|
||||
|
||||
if ( (__adj & _RWSTD_IOS_ADJUSTFIELD) == _RWSTD_IOS_INTERNAL
|
||||
&& sizeof __fmat != __i - 1)
|
||||
for (; __pad > 0; --__pad, ++__it)
|
||||
*__it = __fill;
|
||||
|
||||
break;
|
||||
|
||||
case money_base::value: { // exactly one occurrence required
|
||||
|
||||
if (__dint < 0 || 0 == __dint && __fd > 0) {
|
||||
const char_type __zero = __ctp.widen ('0');
|
||||
|
||||
// insert leading zero and decimal point
|
||||
*__it = __zero;
|
||||
++__it;
|
||||
|
||||
*__it = __intl ?
|
||||
__pun1->decimal_point () : __pun0->decimal_point ();
|
||||
++__it;
|
||||
|
||||
// insert leading fractional zeros
|
||||
for (; __dint++; ++__it)
|
||||
*__it = __zero;
|
||||
|
||||
// prevent insertion of the decimal point below
|
||||
__dint = -1;
|
||||
}
|
||||
|
||||
_RWSTD_SIZE_T __grplen = 0;
|
||||
|
||||
for (const char_type *__e = __s + __n; __s != __e; ++__it, ++__s) {
|
||||
|
||||
if (!__num && !__ctp.is (ctype_base::digit, *__s))
|
||||
break;
|
||||
|
||||
typedef unsigned char _UChar;
|
||||
|
||||
if (0 < __dint) {
|
||||
|
||||
_RWSTD_ASSERT (0 != __groups);
|
||||
|
||||
if (*__groups && __grplen == _UChar (*__groups)) {
|
||||
*__it = __intl ? __pun1->thousands_sep ()
|
||||
: __pun0->thousands_sep ();
|
||||
__grplen = 0;
|
||||
++__groups;
|
||||
++__it;
|
||||
}
|
||||
}
|
||||
else if (0 == __dint) {
|
||||
*__it = __intl ? __pun1->decimal_point ()
|
||||
: __pun0->decimal_point ();
|
||||
++__it;
|
||||
}
|
||||
|
||||
--__dint;
|
||||
++__grplen;
|
||||
|
||||
switch (*__s) {
|
||||
// replace either the period or the comma with the
|
||||
// decimal point in case a setlocale() call made by
|
||||
// the program changed the default '.' to ','
|
||||
case '.':
|
||||
case ',':
|
||||
*__it = __intl ? __pun1->decimal_point ()
|
||||
: __pun0->decimal_point ();
|
||||
break;
|
||||
|
||||
case ';':
|
||||
*__it = __intl ? __pun1->thousands_sep ()
|
||||
: __pun0->thousands_sep ();
|
||||
break;
|
||||
|
||||
default: *__it = *__s;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// output the remaining characters of sign (if any)
|
||||
for (_RWSTD_SIZE_T __k = 1; __k < __sign.size (); ++__k, ++__it)
|
||||
*__it = __sign [__k];
|
||||
|
||||
// left ajustment
|
||||
for (; __pad > 0; --__pad, ++__it)
|
||||
*__it = __fill;
|
||||
|
||||
// 22.2.6.2.2, p1: reset width()
|
||||
__flags.width (0);
|
||||
|
||||
return __it;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT, class _OutputIter>
|
||||
/* virtual */ _TYPENAME money_put<_CharT, _OutputIter>::iter_type
|
||||
money_put<_CharT, _OutputIter>::
|
||||
do_put (iter_type __i, bool __intl, ios_base &__flags, char_type __fill,
|
||||
long double __val) const
|
||||
{
|
||||
int __fd;
|
||||
string __grouping;
|
||||
|
||||
if (__intl) {
|
||||
typedef moneypunct<_CharT, true> _Punct;
|
||||
const _Punct &__pun = _RWSTD_USE_FACET (_Punct, __flags.getloc ());
|
||||
|
||||
__fd = __pun.frac_digits ();
|
||||
__grouping = __pun.grouping ();
|
||||
}
|
||||
else {
|
||||
typedef moneypunct<_CharT, false> _Punct;
|
||||
const _Punct &__pun = _RWSTD_USE_FACET (_Punct, __flags.getloc ());
|
||||
|
||||
__fd = __pun.frac_digits ();
|
||||
__grouping = __pun.grouping ();
|
||||
}
|
||||
|
||||
char __buf [304];
|
||||
char_type __wbuf [sizeof __buf];
|
||||
|
||||
char *__pbuf = __buf;
|
||||
|
||||
// format a floating point number in fixed precision into narrow buffer
|
||||
// will insert thousands_sep placeholders (';') accroding to grouping
|
||||
const _RWSTD_SIZE_T __n =
|
||||
_RW::__rw_put_num (&__pbuf, sizeof __buf, _RWSTD_IOS_FIXED,
|
||||
_C_ldouble | _C_ptr,
|
||||
_RWSTD_STATIC_CAST (_RWSTD_STREAMSIZE, -__fd),
|
||||
&__val, __grouping.c_str ());
|
||||
|
||||
// widen narrow buffer (necessary even if char_type == char)
|
||||
const ctype<_CharT> &__ctp =
|
||||
_RWSTD_USE_FACET (ctype<_CharT>, __flags.getloc ());
|
||||
|
||||
__ctp.widen (__buf, __buf + __n, __wbuf);
|
||||
|
||||
// write the widened buffer out, replacing any commas
|
||||
// with the actual thousands_sep punct character
|
||||
return _C_put (__i, (__intl ? _C_intl : 0) | _C_ldbl,
|
||||
__flags, __fill, __wbuf, __n, 0, "", 1);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT, class _OutputIter>
|
||||
/* virtual */ _TYPENAME money_put<_CharT, _OutputIter>::iter_type
|
||||
money_put<_CharT, _OutputIter>::
|
||||
do_put (iter_type __i, bool __intl, ios_base &__flags, char_type __fill,
|
||||
const string_type &__str) const
|
||||
{
|
||||
// fractional part does not undergo grouping and will be removed
|
||||
int __fd;
|
||||
|
||||
string __grouping;
|
||||
|
||||
if (__intl) {
|
||||
typedef moneypunct<_CharT, true> _Punct;
|
||||
|
||||
const _Punct &__pun = _RWSTD_USE_FACET (_Punct, __flags.getloc ());
|
||||
|
||||
__fd = __pun.frac_digits ();
|
||||
__grouping = __pun.grouping ();
|
||||
}
|
||||
else {
|
||||
typedef moneypunct<_CharT, false> _Punct;
|
||||
|
||||
const _Punct &__pun = _RWSTD_USE_FACET (_Punct, __flags.getloc ());
|
||||
|
||||
__fd = __pun.frac_digits ();
|
||||
__grouping = __pun.grouping ();
|
||||
}
|
||||
|
||||
_RWSTD_SIZE_T __ngroups = 1; // always at least one group
|
||||
_RWSTD_SIZE_T __strdigs = 0; // number of digits in `str'
|
||||
|
||||
typedef string::traits_type _Traits;
|
||||
typedef _TYPENAME string_type::const_iterator _StringIter;
|
||||
|
||||
char __buf [304]; // buffer for groups
|
||||
static char __nul = '\0'; // `groups' must be non-0
|
||||
char *__groups = __grouping.size () ? __buf : &__nul;
|
||||
|
||||
const ctype<_CharT> &__ctp =
|
||||
_RWSTD_USE_FACET (ctype<_CharT>, __flags.getloc ());
|
||||
|
||||
// narrow digits into a temporary buffer to determine grouping
|
||||
for (_StringIter __it = __str.begin (); __it != __str.end (); ++__it) {
|
||||
if (__ctp.is (ctype_base::digit, *__it)) {
|
||||
if (__groups != &__nul)
|
||||
_Traits::assign (*__groups++, __ctp.narrow (*__it, '\0'));
|
||||
}
|
||||
else if (__str.begin () != __it || '-' != __ctp.narrow (*__it, '\0'))
|
||||
break;
|
||||
++__strdigs;
|
||||
}
|
||||
|
||||
if (__groups != &__nul && __fd >= 0 && __fd < __groups - __buf) {
|
||||
__groups -= __fd;
|
||||
|
||||
// compute the size of each group relative to the formatted number
|
||||
// e.g., with `str' of "9876543210" and `grouping' of "\1\2\3",
|
||||
// `groups' will point at "\1\3\3\2\1" since `str' will be
|
||||
// formatted as "9,876,543,21,0" with thousands_sep's inserted
|
||||
|
||||
char *__pbuf = __buf;
|
||||
|
||||
*__pbuf = '\0';
|
||||
|
||||
__ngroups =
|
||||
_RW::__rw_put_groups (&__pbuf, __groups - __pbuf, sizeof __buf,
|
||||
0, __grouping.c_str ());
|
||||
__pbuf [__ngroups] = '\0';
|
||||
__groups = __pbuf;
|
||||
}
|
||||
|
||||
return _C_put (__i, __intl ? _C_intl : 0,
|
||||
__flags, __fill, __str.c_str (), __strdigs,
|
||||
__fd, __groups, __ngroups);
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
141
extern/stdcxx/4.2.1/include/loc/_money_put.h
vendored
Normal file
141
extern/stdcxx/4.2.1/include/loc/_money_put.h
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _money_put.h - definition of the std::num_put class templates
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _money_put.h 637130 2008-03-14 15:16:33Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 2001-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_MONEY_PUT_H_INCLUDED
|
||||
#define _RWSTD_LOC_MONEY_PUT_H_INCLUDED
|
||||
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <rw/_ioiter.h>
|
||||
#include <loc/_facet.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
struct _RWSTD_EXPORT ios_base;
|
||||
|
||||
|
||||
// 22.2.6.2
|
||||
_EXPORT
|
||||
template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT> >
|
||||
struct money_put: _RW::__rw_facet
|
||||
{
|
||||
typedef _CharT char_type;
|
||||
typedef _OutputIter iter_type;
|
||||
|
||||
typedef
|
||||
basic_string<char_type, char_traits<char_type>, allocator<char_type> >
|
||||
string_type;
|
||||
|
||||
_EXPLICIT money_put (_RWSTD_SIZE_T __ref = 0)
|
||||
: _RW::__rw_facet (__ref) { }
|
||||
|
||||
// 22.2.6.2.1, p1
|
||||
iter_type put (iter_type __it, bool __intl, ios_base &__flags,
|
||||
char_type __fill, long double __val) const {
|
||||
return do_put (__it, __intl, __flags, __fill, __val);
|
||||
}
|
||||
|
||||
iter_type put (iter_type __it, bool __intl, ios_base &__flags,
|
||||
char_type __fill, const string_type &__val) const {
|
||||
return do_put (__it, __intl, __flags, __fill, __val);
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
// 22.2.6.2.2, p1
|
||||
virtual iter_type
|
||||
do_put (iter_type, bool, ios_base&, char_type, long double) const;
|
||||
|
||||
virtual iter_type
|
||||
do_put (iter_type, bool, ios_base&, char_type, const string_type&) const;
|
||||
|
||||
private:
|
||||
|
||||
enum { _C_intl = 0x1, _C_ldbl = 0x2 };
|
||||
|
||||
iter_type _C_put (iter_type, int, ios_base&, char_type,
|
||||
const char_type*, _RWSTD_SIZE_T, int,
|
||||
const char*, _RWSTD_SIZE_T) const;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id money_put<char, ostreambuf_iterator<char> >::id;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id money_put<wchar_t, ostreambuf_iterator<wchar_t> >::id;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_MONEY_PUT)
|
||||
# include <loc/_money_put.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_MONEY_PUT)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_MONEY_PUT, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT money_put<char>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_MONEY_PUT, _CHAR)
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_MONEY_PUT, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT money_put<wchar_t>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_MONEY_PUT, _WCHAR_T)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_MONEY_PUT)
|
||||
# include <loc/_money_put.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_MONEY_PUT)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_MONEY_PUT_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_moneypunct.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_moneypunct.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_moneypunct.c
|
||||
*
|
||||
* $Id: _moneypunct.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_moneypunct.cc>
|
||||
43
extern/stdcxx/4.2.1/include/loc/_moneypunct.cc
vendored
Normal file
43
extern/stdcxx/4.2.1/include/loc/_moneypunct.cc
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _moneypunct.cc - definition of std::moneypunct members
|
||||
*
|
||||
* $Id: _moneypunct.cc 597181 2007-11-21 18:59:19Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
template <class _CharT, bool _Intl>
|
||||
_RW::__rw_facet_id moneypunct<_CharT, _Intl>::id;
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_STATIC_CONST_MEMBER_INIT
|
||||
|
||||
template <class _CharT, bool _Intl>
|
||||
const bool moneypunct<_CharT, _Intl>::intl /* = _Intl */;
|
||||
|
||||
#endif // _RWSTD_NO_STATIC_CONST_MEMBER_INIT
|
||||
|
||||
} // namespace std
|
||||
249
extern/stdcxx/4.2.1/include/loc/_moneypunct.h
vendored
Normal file
249
extern/stdcxx/4.2.1/include/loc/_moneypunct.h
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _moneypunct.h - definition of the std::moneypunct class templates
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _moneypunct.h 648752 2008-04-16 17:01:56Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_MONEYPUNCT_H_INCLUDED
|
||||
#define _RWSTD_LOC_MONEYPUNCT_H_INCLUDED
|
||||
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <loc/_facet.h>
|
||||
#include <loc/_punct.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
// 22.2.6.3
|
||||
struct money_base
|
||||
{
|
||||
enum part { none, space, symbol, sign, value };
|
||||
struct pattern { char field [4]; };
|
||||
};
|
||||
|
||||
|
||||
// 22.2.6.3
|
||||
_EXPORT
|
||||
template <class _CharT, bool _Intl = false>
|
||||
struct moneypunct: _RW::__rw_facet, public money_base
|
||||
{
|
||||
typedef _CharT char_type;
|
||||
typedef
|
||||
basic_string<char_type, char_traits<char_type>, allocator<char_type> >
|
||||
string_type;
|
||||
|
||||
_EXPLICIT moneypunct (_RWSTD_SIZE_T __refs = 0)
|
||||
: _RW::__rw_facet (__refs) { }
|
||||
|
||||
char_type decimal_point () const {
|
||||
return do_decimal_point ();
|
||||
}
|
||||
|
||||
char_type thousands_sep () const {
|
||||
return do_thousands_sep ();
|
||||
}
|
||||
|
||||
string grouping () const {
|
||||
return do_grouping ();
|
||||
}
|
||||
|
||||
string_type curr_symbol () const {
|
||||
return do_curr_symbol ();
|
||||
}
|
||||
|
||||
string_type positive_sign () const {
|
||||
return do_positive_sign ();
|
||||
}
|
||||
|
||||
string_type negative_sign () const {
|
||||
return do_negative_sign ();
|
||||
}
|
||||
|
||||
int frac_digits () const {
|
||||
return do_frac_digits ();
|
||||
}
|
||||
|
||||
pattern pos_format () const {
|
||||
return do_pos_format ();
|
||||
}
|
||||
|
||||
pattern neg_format () const {
|
||||
return do_neg_format ();
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
_RWSTD_STATIC_CONST (bool, intl = _Intl);
|
||||
|
||||
protected:
|
||||
|
||||
// 22.2.6.3.1, p1
|
||||
virtual char_type do_decimal_point () const {
|
||||
return *_C_get (this, _RW::__rw_dp);
|
||||
}
|
||||
|
||||
// 22.2.6.3.1, p2
|
||||
virtual char_type do_thousands_sep () const {
|
||||
return *_C_get (this, _RW::__rw_ts);
|
||||
}
|
||||
|
||||
// 22.2.6.3.1, p3
|
||||
virtual string do_grouping () const {
|
||||
return
|
||||
_RWSTD_REINTERPRET_CAST (const char*, _C_get (this, _RW::__rw_gr));
|
||||
}
|
||||
|
||||
// 22.2.6.3.1, p4
|
||||
virtual string_type do_curr_symbol () const {
|
||||
return _C_get (this, _RW::__rw_cs);
|
||||
}
|
||||
|
||||
// 22.2.6.3.1, p5
|
||||
virtual string_type do_positive_sign () const {
|
||||
return _C_get (this, _RW::__rw_ps);
|
||||
}
|
||||
|
||||
// 22.2.6.3.1, p5
|
||||
virtual string_type do_negative_sign () const {
|
||||
return _C_get (this, _RW::__rw_ns);
|
||||
}
|
||||
|
||||
// 22.2.6.3.1, p6
|
||||
virtual int do_frac_digits () const {
|
||||
return _RWSTD_STATIC_CAST(int, _RWSTD_REINTERPRET_CAST (_RWSTD_SIZE_T,
|
||||
_C_get (this, _RW::__rw_fd)));
|
||||
}
|
||||
|
||||
// 22.2.6.3.1, p7
|
||||
virtual pattern do_pos_format () const {
|
||||
return *_RWSTD_REINTERPRET_CAST (const pattern*,
|
||||
_C_get (this, _RW::__rw_pf));
|
||||
}
|
||||
|
||||
// 22.2.6.3.1, p5
|
||||
virtual pattern do_neg_format () const {
|
||||
return *_RWSTD_REINTERPRET_CAST (const pattern*,
|
||||
_C_get (this, _RW::__rw_nf));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static const char_type* _C_get (const _RW::__rw_facet*, int);
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id moneypunct<char, false>::id;
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id moneypunct<char, true>::id;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id moneypunct<wchar_t, false>::id;
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id moneypunct<wchar_t, true>::id;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
|
||||
template <class _CharT, bool _Intl /* = false */>
|
||||
inline const _CharT*
|
||||
moneypunct<_CharT, _Intl>::_C_get (const _RW::__rw_facet *__pf, int __fl)
|
||||
{
|
||||
if (intl)
|
||||
__fl |= _RW::__rw_intl;
|
||||
|
||||
__fl |= _RW::__rw_mon;
|
||||
|
||||
return _RWSTD_STATIC_CAST (const char_type*,
|
||||
_RW::__rw_get_punct(__pf, __fl, char_type()));
|
||||
}
|
||||
|
||||
|
||||
// 22.2.6.4
|
||||
template <class _CharT, bool _Intl = false>
|
||||
class moneypunct_byname: public moneypunct<_CharT, _Intl>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT moneypunct_byname (const char *__name, _RWSTD_SIZE_T __ref = 0)
|
||||
: moneypunct<_CharT, _Intl>(__ref) {
|
||||
this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_MONEYPUNCT)
|
||||
# include <loc/_moneypunct.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_MONEYPUNCT)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_MONEYPUNCT, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_2 (struct _RWSTD_TI_EXPORT moneypunct<char, true>);
|
||||
_RWSTD_INSTANTIATE_2 (struct _RWSTD_TI_EXPORT moneypunct<char, false>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_MONEYPUNCT, _CHAR)
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_MONEYPUNCT, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_2 (struct _RWSTD_TI_EXPORT moneypunct<wchar_t, true>);
|
||||
_RWSTD_INSTANTIATE_2 (struct _RWSTD_TI_EXPORT moneypunct<wchar_t, false>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_MONEYPUNCT, _WCHAR_T)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_MONEYPUNCT)
|
||||
# include <loc/_moneypunct.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_MONEYPUNCT)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_MONEYPUNCT_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_num_get.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_num_get.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_num_get.c
|
||||
*
|
||||
* $Id: _num_get.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_num_get.cc>
|
||||
509
extern/stdcxx/4.2.1/include/loc/_num_get.cc
vendored
Normal file
509
extern/stdcxx/4.2.1/include/loc/_num_get.cc
vendored
Normal file
@@ -0,0 +1,509 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _num_get.cc - definition of std::num_get members
|
||||
*
|
||||
* $Id: _num_get.cc 648752 2008-04-16 17:01:56Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 2001-2008 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include <loc/_ctype.h>
|
||||
#include <loc/_locale.h>
|
||||
#include <loc/_numpunct.h>
|
||||
#include <rw/_basic_ios.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
_RWSTD_EXPORT int
|
||||
__rw_get_num (void*, const char*, int, int,
|
||||
const char*, _RWSTD_SIZE_T, const char*, _RWSTD_SIZE_T);
|
||||
|
||||
|
||||
// array of values of each base 2 through 36 digit, i.e., 0-9, A-Z,
|
||||
// and a-z; elements with a value greater than 35 do not correspond
|
||||
// to any valid digit
|
||||
_RWSTD_EXPORT extern const unsigned char __rw_digit_map[];
|
||||
|
||||
// array of 1-based indices for each 8-bit character into an internal
|
||||
// table of values of each roman digit, i.e., I, V, X, L, C, D, and M
|
||||
// elements with a value greater than 7 do not correspond to a roman digit
|
||||
_RWSTD_EXPORT extern const unsigned char __rw_roman_inxs[];
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template <class _CharT, class _InputIter>
|
||||
_RW::__rw_facet_id num_get<_CharT, _InputIter>::id;
|
||||
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_NUM_GET
|
||||
|
||||
template <class _CharT, class _InputIter>
|
||||
_TYPENAME num_get<_CharT, _InputIter>::iter_type
|
||||
num_get<_CharT, _InputIter>::
|
||||
get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, short &__val) const
|
||||
{
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
|
||||
// preserve original value in case it's non-zero and
|
||||
// do_get() fails for reason other than bad grouping
|
||||
long __tmp = __val;
|
||||
|
||||
__begin = do_get (__begin, __end, __flags, __err, __tmp);
|
||||
__val = __rw_check_overflow_short (__tmp, __flags.flags (), __err);
|
||||
|
||||
return __begin;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT, class _InputIter>
|
||||
_TYPENAME num_get<_CharT, _InputIter>::iter_type
|
||||
num_get<_CharT, _InputIter>::
|
||||
get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, int &__val) const
|
||||
{
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
|
||||
// preserve original value in case it's non-zero and
|
||||
// do_get() fails for reason other than bad grouping
|
||||
long __tmp = long (__val);
|
||||
|
||||
__begin = do_get (__begin, __end, __flags, __err, __tmp);
|
||||
__val = __rw_check_overflow_int (__tmp, __flags.flags (), __err);
|
||||
|
||||
return __begin;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_EXT_NUM_GET
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_NATIVE_BOOL
|
||||
|
||||
template <class _CharT, class _InputIter /* = istreambuf_iterator<_CharT> */>
|
||||
_TYPENAME num_get<_CharT, _InputIter>::iter_type
|
||||
num_get<_CharT, _InputIter>::
|
||||
do_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, bool &__val) const
|
||||
{
|
||||
if (0 == (__flags.flags () & _RWSTD_IOS_BOOLALPHA)) {
|
||||
// initialize to an invalid value
|
||||
long __lval = -1L;
|
||||
|
||||
// avoid calling overridden do_get() if it exists
|
||||
typedef num_get<_CharT, _InputIter> _This;
|
||||
__begin = _This::do_get (__begin, __end, __flags, __err, __lval);
|
||||
|
||||
// set failbit in accordance with 22.2.2.1.2, p14 but without
|
||||
// testing for failbit in `err' since the bit could be set even
|
||||
// for valid `val' (e.g., when the positions of thousands_seps
|
||||
// in otherwise valid input do not match grouping)
|
||||
if (_RWSTD_STATIC_CAST (unsigned long, __lval) < 2)
|
||||
__val = 0L != __lval;
|
||||
else
|
||||
__err |= _RW::__rw_failbit;
|
||||
|
||||
return __begin;
|
||||
}
|
||||
|
||||
__err = _RW::__rw_goodbit;
|
||||
|
||||
const numpunct<char_type> &__pun =
|
||||
_RWSTD_USE_FACET (numpunct<char_type>, __flags.getloc ());
|
||||
|
||||
// lwg issue 17
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
const string_type __tnm = __pun.truename ();
|
||||
const string_type __fnm = __pun.falsename ();
|
||||
|
||||
const char_type* const __names[] = {
|
||||
__fnm.c_str (), __tnm.c_str ()
|
||||
};
|
||||
|
||||
const _RWSTD_SIZE_T __sizes[] = {
|
||||
__fnm.size (), __tnm.size ()
|
||||
};
|
||||
|
||||
_RWSTD_SIZE_T __inx = 0;
|
||||
|
||||
int __errtmp = 1; // maximum number of allowed duplicates
|
||||
|
||||
__begin = _RW::__rw_match_name (__begin, __end, __names, __sizes,
|
||||
sizeof __names / sizeof *__names,
|
||||
__inx, __errtmp, 0);
|
||||
|
||||
if (_RWSTD_SIZE_MAX == __inx)
|
||||
__err |= _RW::__rw_failbit;
|
||||
else
|
||||
__val = !!__inx;
|
||||
|
||||
__err |= _RWSTD_IOSTATE (__errtmp);
|
||||
|
||||
return __begin;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_NATIVE_BOOL
|
||||
|
||||
|
||||
template <class _CharT, class _InputIter /* = istreambuf_iterator<_CharT> */>
|
||||
_TYPENAME num_get<_CharT, _InputIter>::iter_type
|
||||
num_get<_CharT, _InputIter>::
|
||||
_C_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, int __type, void *__pval) const
|
||||
{
|
||||
__err = _RW::__rw_goodbit;
|
||||
|
||||
const int __fl = __flags.flags ();
|
||||
|
||||
// boolalpha parsing not handled here
|
||||
_RWSTD_ASSERT (__type != _C_bool || !(__fl & _RWSTD_IOS_BOOLALPHA));
|
||||
|
||||
const locale &__loc = __flags.getloc ();
|
||||
|
||||
const numpunct<char_type> &__pun =
|
||||
_RWSTD_USE_FACET (numpunct<char_type>, __loc);
|
||||
|
||||
// 22.2.2.1.2, p8: Stage 2
|
||||
|
||||
char __buf [128 + 2]; // default buffer (128 bits + 2)
|
||||
char *__pbuf = __buf; // pointer to allocated buffer
|
||||
char *__pcur = __buf; // currently processed digit
|
||||
_RWSTD_SIZE_T __bufsize = sizeof __buf; // size of allocated buffer
|
||||
|
||||
_RWSTD_UNUSED (__bufsize);
|
||||
|
||||
const ctype<char_type> &__ctp = _RWSTD_USE_FACET (ctype<char_type>, __loc);
|
||||
|
||||
const _CharT __decimal_point = __pun.decimal_point ();
|
||||
const _CharT __thousands_sep = __pun.thousands_sep ();
|
||||
|
||||
// grouping string and size are lazily initialized only
|
||||
// when the first thousands_sep() is encountered
|
||||
string __grouping;
|
||||
int __grpsz = -1;
|
||||
|
||||
// buffer containing the sizes of thousands_sep-separated
|
||||
// groups of digits and a pointer to the next grouping
|
||||
char __grpbuf [sizeof __buf];
|
||||
char *__pgrp = __grpbuf;
|
||||
|
||||
const char *__grpbeg = 0; // the beginning of the last group
|
||||
const char *__grpend = 0; // the end of the last group
|
||||
|
||||
int __base = unsigned (__fl) >> _RWSTD_IOS_BASEOFF;
|
||||
|
||||
// switch to base-16 for pointer parsing
|
||||
if (_RW::__rw_facet::_C_pvoid == __type)
|
||||
__base = 16;
|
||||
else if (10 == __base && !(__fl & _RWSTD_IOS_BASEFIELD))
|
||||
__base = 0;
|
||||
|
||||
int __subtype = __type; // type of the number being parsed
|
||||
|
||||
typedef unsigned char _UChar;
|
||||
|
||||
// insert a plus sign (ovewrite it with a minus sign if found)
|
||||
// to avoid having to deal with the fact that it's optional
|
||||
*__pcur++ = '+';
|
||||
|
||||
static const _UChar _HexX = _RW::__rw_digit_map [_UChar ('X')];
|
||||
static const _UChar _Sign = _RW::__rw_digit_map [_UChar ('+')];
|
||||
|
||||
// 'x' or 'X' after a leading '0' (the same value for both),
|
||||
// any value outside the valid range [0, 36) is invalid and
|
||||
// will not match any character
|
||||
_UChar __hex_x = _HexX;
|
||||
|
||||
// leading plus or minus sign (the same value for both)
|
||||
// any value outside the valid range [0, 36) is invalid
|
||||
_UChar __ld_sgn = _Sign;
|
||||
|
||||
for ( ; ; ++__begin) {
|
||||
|
||||
if (__begin == __end) {
|
||||
// 22.2.2.1, p13
|
||||
__err |= _RW::__rw_eofbit;
|
||||
break;
|
||||
}
|
||||
|
||||
if (__pcur == __buf + sizeof __buf - 1) {
|
||||
// FIXME: handle long strings of digits
|
||||
__err |= _RW::__rw_failbit;
|
||||
break;
|
||||
}
|
||||
|
||||
const _CharT __wc = *__begin;
|
||||
const char __dp = __decimal_point == __wc ? '.' : '\0';
|
||||
|
||||
if ( __thousands_sep == __wc
|
||||
&& _RW::__rw_digit_map [_UChar (__pcur [-1])] < 36
|
||||
&& ( __grpsz > 0
|
||||
|| __grpsz < 0
|
||||
&& (__grpsz = int((__grouping = __pun.grouping ()).size ())))) {
|
||||
|
||||
// the current character is the thousands separator,
|
||||
// the previous character was a digit (and not a sign),
|
||||
// and grouping (lazily initialized above) is not empty
|
||||
|
||||
if (__pcur == __pbuf + 1) {
|
||||
// 22.2.3.1, p2: thousands_sep not allowed to be first
|
||||
// non-fatal error, set failbit but continue parsing
|
||||
__err |= _RW::__rw_failbit;
|
||||
}
|
||||
|
||||
if (__grpend) {
|
||||
// thousands_sep not allowed or recognized after the
|
||||
// end of the mantissa has been reached (i.e., after
|
||||
// the decimal point or after 'E' or 'e')
|
||||
break;
|
||||
}
|
||||
|
||||
// add the length of the current group to the array groups
|
||||
// store UCHAR_MAX if group length exceeds the size of char
|
||||
const _RWSTD_PTRDIFF_T __len = __grpbeg ?
|
||||
__pcur - __grpbeg : __pcur - __pbuf - 1 - (_HexX != __hex_x);
|
||||
|
||||
if (0 == __len) {
|
||||
// fatal error: thousands_sep characters must be separated
|
||||
// by groups of one or more digits
|
||||
__err |= _RW::__rw_failbit;
|
||||
return __begin;
|
||||
}
|
||||
|
||||
*__pgrp++ = char (__len < _UChar (_RWSTD_UCHAR_MAX) ? __len : -1);
|
||||
__grpbeg = __pcur;
|
||||
}
|
||||
else if (!__dp) {
|
||||
|
||||
const char __ch = __ctp.narrow (__wc, '\0');
|
||||
|
||||
// get the digit value of the character; anything over
|
||||
// 35 is not a digit (43 is either the plus sign or
|
||||
// the minus sign, for efficiency); the value 99
|
||||
// indicates an invalid character
|
||||
const _UChar __digit = _RW::__rw_digit_map [_UChar (__ch)];
|
||||
|
||||
// 22.2.2.1.2, p8: Stage 8 calls for widening of the sequence
|
||||
// of narrow digits ("0123456789abcdefABCDEFX+-") and looking
|
||||
// up the current wide character in the widened sequence, but
|
||||
// that may not possible unless the wide character type has
|
||||
// operator==() defined
|
||||
|
||||
if (__subtype & _C_floating) {
|
||||
|
||||
if (__digit < 10)
|
||||
*__pcur++ = __ch;
|
||||
else if (__pcur == __pbuf + 1) {
|
||||
// plus or minus only permitted (but not required)
|
||||
// as the first character of the mantissa
|
||||
if (__ld_sgn == __digit) {
|
||||
// overwrite the default plus with the sign
|
||||
__pcur [-1] = __ch;
|
||||
|
||||
// disable future recognition of the leading sign
|
||||
__ld_sgn = 36;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if (/* 'E' or 'e' == __ch */
|
||||
14 == _RW::__rw_digit_map [_UChar (__ch)]) {
|
||||
const _RWSTD_PTRDIFF_T __diff = __pcur - __pbuf;
|
||||
|
||||
if (2 == __diff && '.' == __pcur [-1])
|
||||
break;
|
||||
|
||||
if (!__grpend)
|
||||
__grpend = __pcur;
|
||||
*__pcur++ = 'e';
|
||||
|
||||
if (__grpsz) {
|
||||
const char __ts =
|
||||
__ctp.narrow (__thousands_sep, '\0');
|
||||
if (/* '+' or '-' == __ts */
|
||||
_Sign == _RW::__rw_digit_map [_UChar (__ts)])
|
||||
__grpsz = 0;
|
||||
}
|
||||
}
|
||||
else if ( 'e' == __pcur [-1]
|
||||
&& /* '+' or '-' == __ch */
|
||||
_Sign == _RW::__rw_digit_map [_UChar (__ch)]) {
|
||||
// '+' or '-' only permitted (but not required)
|
||||
// as the first character after 'e' or 'E'
|
||||
|
||||
*__pcur++ = __ch;
|
||||
|
||||
// reached the exponent part of a floating point number
|
||||
// switch to parsing a decimal integer
|
||||
__base = 10;
|
||||
__subtype = _C_int;
|
||||
}
|
||||
else
|
||||
break; // invalid character terminates input
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (__pcur == __pbuf + 1 && __digit == __ld_sgn) {
|
||||
__pcur [-1] = __ch; // overwrite the default '+'
|
||||
__ld_sgn = 36; // disable leading sign
|
||||
}
|
||||
else if (16 == __base) {
|
||||
if (__digit < 16)
|
||||
*__pcur++ = __ch;
|
||||
else if ( __digit == __hex_x
|
||||
&& __pcur == __pbuf + 2
|
||||
&& __pcur [-1] == '0') {
|
||||
// don't append the 'x' part of the "0x" prefix
|
||||
// and disable the recognition of any future 'x'
|
||||
__hex_x = 36;
|
||||
}
|
||||
else
|
||||
break; // invalid character terminates input
|
||||
}
|
||||
else if (__base > 1) {
|
||||
if (__digit < __base)
|
||||
*__pcur++ = __ch;
|
||||
else
|
||||
break; // invalid character terminates input
|
||||
}
|
||||
else if (0 == __base) {
|
||||
|
||||
// autodetect the base
|
||||
|
||||
if (__digit < 10) {
|
||||
if ( __digit && __digit < 8
|
||||
&& *(__pcur - 1) == '0' && __pcur == __pbuf + 2)
|
||||
__base = 8;
|
||||
*__pcur++ = __ch;
|
||||
}
|
||||
else if ( __digit == __hex_x
|
||||
&& __pcur == __pbuf + 2
|
||||
&& __pcur [-1] == '0') {
|
||||
__hex_x = 36; // disable future 'x'
|
||||
__base = 16; // set base-16
|
||||
--__pcur; // remove leading '0'
|
||||
}
|
||||
else
|
||||
break; // invalid character terminates input
|
||||
}
|
||||
else {
|
||||
if (_RW::__rw_roman_inxs [_UChar (__ch)] <= 7)
|
||||
*__pcur++ = __ch;
|
||||
else if (__pcur == __pbuf + 1 && __digit < 10) {
|
||||
*__pcur++ = __ch;
|
||||
// if the first character is a digit
|
||||
// switch to decimal (base-10) parsing
|
||||
__base = 10;
|
||||
}
|
||||
else {
|
||||
// invalid character terminates input
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (__subtype & _C_floating) {
|
||||
if (__grpend)
|
||||
break;
|
||||
|
||||
__grpend = __pcur;
|
||||
*__pcur++ = '.';
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
// add the length of the last group to the array of groups
|
||||
{
|
||||
// add the length of the current group to the array groups
|
||||
// store UCHAR_MAX if group length exceeds the size of char
|
||||
_RWSTD_PTRDIFF_T __len;
|
||||
|
||||
if (__grpend) {
|
||||
|
||||
#if defined (_RWSTD_NO_STRTOLD) && defined (_RWSTD_NO_STRTOLD_IN_LIBC)
|
||||
|
||||
// detect invalid formats in case strtold() is not
|
||||
// available (scanf() will not detect these)
|
||||
|
||||
if ( 'e' == __pcur [-1]
|
||||
|| '-' == __pcur [-1] || '+' == __pcur [-1]) {
|
||||
__err |= _RW::__rw_failbit;
|
||||
return __begin;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_STRTOLD && _RWSTD_NO_STRTOLD_IN_LIBC
|
||||
|
||||
}
|
||||
else
|
||||
__grpend = __pcur;
|
||||
|
||||
__len = __grpbeg ?
|
||||
__grpend - __grpbeg : __grpend - __pbuf - 1 - (_HexX != __hex_x);
|
||||
|
||||
if (__grpbeg && 0 == __len) {
|
||||
// fatal error: according to the grammar in [locale.numpunct]
|
||||
// thousands_sep characters must be separated by groups of one
|
||||
// or more digits (i.e., valid input cannot start or end with
|
||||
// a thousands_sep); this needs to be clarified in the text
|
||||
__err |= _RW::__rw_failbit;
|
||||
return __begin;
|
||||
}
|
||||
|
||||
*__pgrp++ = char (__len < _UChar (_RWSTD_UCHAR_MAX) ? __len : -1);
|
||||
}
|
||||
|
||||
*__pgrp = '\0';
|
||||
*__pcur = '\0';
|
||||
|
||||
// verify that the buffers haven't overflowed
|
||||
_RWSTD_ASSERT (__pgrp < __grpbuf + sizeof __grpbuf);
|
||||
_RWSTD_ASSERT (__pcur < __pbuf + __bufsize);
|
||||
|
||||
// set the base determined above
|
||||
const unsigned __fl2 =
|
||||
__fl & ~_RWSTD_IOS_BASEFIELD
|
||||
& ~( _RWSTD_STATIC_CAST (unsigned, _RWSTD_IOS_BASEMASK)
|
||||
<< _RWSTD_IOS_BASEOFF)
|
||||
| __base << _RWSTD_IOS_BASEOFF;
|
||||
|
||||
// 22.2.2.1.2, p11: Stage 3
|
||||
const int __errtmp =
|
||||
_RW::__rw_get_num (__pval, __pbuf, __type, __fl2,
|
||||
__grpbuf, __pgrp - __grpbuf,
|
||||
__grouping.data (), __grouping.size ());
|
||||
|
||||
__err |= _RWSTD_IOSTATE (__errtmp);
|
||||
|
||||
return __begin;
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
378
extern/stdcxx/4.2.1/include/loc/_num_get.h
vendored
Normal file
378
extern/stdcxx/4.2.1/include/loc/_num_get.h
vendored
Normal file
@@ -0,0 +1,378 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _num_get.h - definition of the std::num_get class template
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _num_get.h 648752 2008-04-16 17:01:56Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 2001-2008 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_NUM_GET_H_INCLUDED
|
||||
#define _RWSTD_LOC_NUM_GET_H_INCLUDED
|
||||
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
|
||||
#include <loc/_facet.h>
|
||||
#include <rw/_ioiter.h>
|
||||
#include <rw/_iosfwd.h>
|
||||
#include <rw/_traits.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
// 22.2.2.1
|
||||
_EXPORT
|
||||
template <class _CharT, class _InputIter = istreambuf_iterator<_CharT> >
|
||||
struct num_get: _RW::__rw_facet
|
||||
{
|
||||
typedef _CharT char_type;
|
||||
typedef _InputIter iter_type;
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
_EXPLICIT num_get (_RWSTD_SIZE_T __refs = 0)
|
||||
: _RW::__rw_facet (__refs) { }
|
||||
|
||||
#ifndef _RWSTD_NO_NATIVE_BOOL
|
||||
|
||||
iter_type get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, bool &__val) const {
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
return do_get (__begin, __end, __flags, __err, __val);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_NATIVE_BOOL
|
||||
|
||||
iter_type get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, unsigned short &__val) const {
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
return do_get (__begin, __end, __flags, __err, __val);
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_NUM_GET
|
||||
|
||||
// extension
|
||||
iter_type
|
||||
get (iter_type, iter_type, ios_base&, _RWSTD_IOSTATE&, short&) const;
|
||||
|
||||
// extension
|
||||
iter_type
|
||||
get (iter_type, iter_type, ios_base&, _RWSTD_IOSTATE&, int&) const;
|
||||
|
||||
#endif // _RWSTD_NO_EXT_NUM_GET
|
||||
|
||||
iter_type get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, unsigned int &__val) const {
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
return do_get (__begin, __end, __flags, __err, __val);
|
||||
}
|
||||
|
||||
iter_type get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, long &__val) const {
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
return do_get (__begin, __end, __flags, __err, __val);
|
||||
}
|
||||
|
||||
iter_type get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, unsigned long &__val) const {
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
return do_get (__begin, __end, __flags, __err, __val);
|
||||
}
|
||||
|
||||
iter_type get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, float &__val) const {
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
return do_get (__begin, __end, __flags, __err, __val);
|
||||
}
|
||||
|
||||
iter_type get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, double &__val) const {
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
return do_get (__begin, __end, __flags, __err, __val);
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_LONG_DOUBLE
|
||||
|
||||
iter_type get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, long double &__val) const {
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
return do_get (__begin, __end, __flags, __err, __val);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_LONG_DOUBLE
|
||||
|
||||
iter_type get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, void* &__val) const {
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
return do_get (__begin, __end, __flags, __err, __val);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _RWSTD_LONG_LONG
|
||||
|
||||
// extension
|
||||
iter_type get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, _RWSTD_LONG_LONG &__val) const {
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
return do_get (__begin, __end, __flags, __err, __val);
|
||||
}
|
||||
|
||||
// extension
|
||||
iter_type get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err,
|
||||
unsigned _RWSTD_LONG_LONG &__val) const {
|
||||
_RWSTD_ASSERT_RANGE (__begin, __end);
|
||||
return do_get (__begin, __end, __flags, __err, __val);
|
||||
}
|
||||
#endif // _RWSTD_LONG_LONG
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
#ifndef _RWSTD_NO_NATIVE_BOOL
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type, iter_type, ios_base&, _RWSTD_IOSTATE&, bool&) const;
|
||||
|
||||
#endif // _RWSTD_NO_NATIVE_BOOL
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, unsigned short &__val) const {
|
||||
return _C_get (__begin, __end, __flags, __err, _C_ushort, &__val);
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, unsigned int &__val) const {
|
||||
return _C_get (__begin, __end, __flags, __err, _C_uint, &__val);
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, long &__val) const {
|
||||
return _C_get (__begin, __end, __flags, __err, _C_long, &__val);
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, unsigned long &__val) const {
|
||||
return _C_get (__begin, __end, __flags, __err, _C_ulong, &__val);
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, float &__val) const {
|
||||
return _C_get (__begin, __end, __flags, __err, _C_float, &__val);
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, double &__val) const {
|
||||
return _C_get (__begin, __end, __flags, __err, _C_double, &__val);
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_LONG_DOUBLE
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, long double &__val) const {
|
||||
return _C_get (__begin, __end, __flags, __err, _C_ldouble, &__val);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_LONG_DOUBLE
|
||||
|
||||
virtual iter_type
|
||||
do_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, void* &__val) const {
|
||||
return _C_get (__begin, __end, __flags, __err, _C_pvoid, &__val);
|
||||
}
|
||||
|
||||
#ifdef _RWSTD_LONG_LONG
|
||||
|
||||
// extension
|
||||
virtual iter_type
|
||||
do_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, _RWSTD_LONG_LONG &__val) const {
|
||||
return _C_get (__begin, __end, __flags, __err, _C_llong, &__val);
|
||||
}
|
||||
|
||||
// extension
|
||||
virtual iter_type
|
||||
do_get (iter_type __begin, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, unsigned _RWSTD_LONG_LONG &__val) const {
|
||||
return _C_get (__begin, __end, __flags, __err, _C_ullong, &__val);
|
||||
}
|
||||
|
||||
|
||||
#endif // _RWSTD_LONG_LONG
|
||||
|
||||
private:
|
||||
|
||||
iter_type
|
||||
_C_get (iter_type, iter_type, ios_base&,
|
||||
_RWSTD_IOSTATE&, int, void*) const;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id num_get<char, istreambuf_iterator<char> >::id;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id num_get<wchar_t, istreambuf_iterator<wchar_t> >::id;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
inline short
|
||||
__rw_check_overflow_short (long __lval, _RWSTD_FMTFLAGS __flags,
|
||||
_RWSTD_IOSTATE &__err)
|
||||
{
|
||||
#if _RWSTD_SHRT_MAX < _RWSTD_LONG_MAX
|
||||
|
||||
long __shrt_min;
|
||||
long __shrt_max;
|
||||
|
||||
if ( __lval < 0
|
||||
|| (__flags & _RW::__rw_basefield) == _RW::__rw_dec) {
|
||||
// decimal parsing overflows outside the range below
|
||||
__shrt_max = long (_RWSTD_SHRT_MAX);
|
||||
__shrt_min = long (_RWSTD_SHRT_MIN);
|
||||
}
|
||||
else {
|
||||
// other than decimal parsing overflows outside the range below
|
||||
// (unreliable if basefield is 0 and the sequence is decimal)
|
||||
__shrt_max = long (_RWSTD_USHRT_MAX);
|
||||
__shrt_min = long (_RWSTD_USHRT_MIN);
|
||||
}
|
||||
|
||||
// lwg issue 23: check for overflow
|
||||
if (__lval < __shrt_min) {
|
||||
__err |= _RW::__rw_failbit;
|
||||
return short (_RWSTD_SHRT_MIN);
|
||||
}
|
||||
else if (__lval > __shrt_max) {
|
||||
__err |= _RW::__rw_failbit;
|
||||
return short (_RWSTD_SHRT_MAX);
|
||||
}
|
||||
|
||||
#else // if LONG_MAX <= SHRT_MAX
|
||||
|
||||
_RWSTD_UNUSED (__flags);
|
||||
_RWSTD_UNUSED (__err);
|
||||
|
||||
#endif // _RWSTD_SHRT_MAX < _RWSTD_LONG_MAX
|
||||
|
||||
return _RWSTD_STATIC_CAST (short, __lval);
|
||||
}
|
||||
|
||||
inline int
|
||||
__rw_check_overflow_int (long __lval, _RWSTD_FMTFLAGS __flags,
|
||||
_RWSTD_IOSTATE &__err)
|
||||
{
|
||||
#if _RWSTD_INT_MAX < _RWSTD_LONG_MAX
|
||||
|
||||
long __int_min;
|
||||
long __int_max;
|
||||
|
||||
if ( __lval < 0
|
||||
|| (__flags & _RW::__rw_basefield) == _RW::__rw_dec) {
|
||||
// decimal parsing overflows outside the range below
|
||||
__int_max = long (_RWSTD_INT_MAX);
|
||||
__int_min = long (_RWSTD_INT_MIN);
|
||||
}
|
||||
else {
|
||||
// other than decimal parsing overflows outside the range below
|
||||
// (unreliable if basefield is 0 and the sequence is decimal)
|
||||
__int_max = long (_RWSTD_UINT_MAX);
|
||||
__int_min = long (_RWSTD_UINT_MIN);
|
||||
}
|
||||
|
||||
// lwg issue 23: check for overflow
|
||||
if (__lval < __int_min) {
|
||||
__err |= _RW::__rw_failbit;
|
||||
return int (_RWSTD_INT_MIN);
|
||||
}
|
||||
else if (__lval > __int_max) {
|
||||
__err |= _RW::__rw_failbit;
|
||||
return int (_RWSTD_INT_MAX);
|
||||
}
|
||||
|
||||
#else // if LONG_MAX <= INT_MAX
|
||||
|
||||
_RWSTD_UNUSED (__flags);
|
||||
_RWSTD_UNUSED (__err);
|
||||
|
||||
#endif // _RWSTD_INT_MAX < _RWSTD_LONG_MAX
|
||||
|
||||
return _RWSTD_STATIC_CAST (int, __lval);
|
||||
}
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_NUM_GET)
|
||||
# include <loc/_num_get.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_NUM_GET)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_NUM_GET, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT num_get<char>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_NUM_GET, _CHAR)
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_NUM_GET, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT num_get<wchar_t>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_NUM_GET, _WCHAR_T)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_NUM_GET)
|
||||
# include <loc/_num_get.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_NUM_GET)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_NUM_GET_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_num_put.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_num_put.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_num_put.c
|
||||
*
|
||||
* $Id: _num_put.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_num_put.cc>
|
||||
209
extern/stdcxx/4.2.1/include/loc/_num_put.cc
vendored
Normal file
209
extern/stdcxx/4.2.1/include/loc/_num_put.cc
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _num_put.cc - definition of std::num_put members
|
||||
*
|
||||
* $Id: _num_put.cc 597438 2007-11-22 15:44:53Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 2001-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_locale.h> // for use_facet
|
||||
#include <loc/_ctype.h> // for ctype
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
_RWSTD_EXPORT _RWSTD_SIZE_T
|
||||
__rw_put_num (char**, _RWSTD_SIZE_T, unsigned, int, _RWSTD_STREAMSIZE,
|
||||
const void*, const char*);
|
||||
|
||||
_RWSTD_EXPORT extern const unsigned char
|
||||
__rw_digit_map[];
|
||||
|
||||
|
||||
template <class _OutputIter>
|
||||
inline bool
|
||||
__rw_iter_failed (const _OutputIter&) { return false; }
|
||||
|
||||
// const commented to resolve ambiguity on MSVC 7.0:
|
||||
// error C2667: '__rw_iter_failed' : none of 2 overloads have a best conversion
|
||||
template <class _CharT, class _Traits>
|
||||
inline bool
|
||||
__rw_iter_failed (/*const */_STD::ostreambuf_iterator<_CharT, _Traits> &__it)
|
||||
{
|
||||
return __it.failed ();
|
||||
}
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template <class _CharT, class _OutputIter>
|
||||
_RW::__rw_facet_id num_put<_CharT, _OutputIter>::id;
|
||||
|
||||
|
||||
template <class _CharT, class _OutputIter /* = ostreambuf_iterator<_CharT> */>
|
||||
/* virtual */ num_put<_CharT, _OutputIter>::~num_put ()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT, class _OutputIter /* = ostreambuf_iterator<_CharT> */>
|
||||
_TYPENAME num_put<_CharT, _OutputIter>::iter_type
|
||||
num_put<_CharT, _OutputIter>::
|
||||
_C_put (iter_type __it, ios_base &__flags, char_type __fill, int __type,
|
||||
const void *__pval) const
|
||||
{
|
||||
const numpunct<char_type> &__np =
|
||||
_RWSTD_USE_FACET (numpunct<char_type>, __flags.getloc ());
|
||||
|
||||
char __buf [_RWSTD_DBL_MAX_10_EXP];
|
||||
|
||||
// will grow as necessary and may need to be deleted
|
||||
char *__pbuf = __buf;
|
||||
|
||||
const string __grouping = __np.grouping ();
|
||||
const char* const __grp = __grouping.c_str ();
|
||||
const _RWSTD_STREAMSIZE __prec = __flags.precision ();
|
||||
|
||||
const int __f = __flags.flags ();
|
||||
|
||||
// format value, ignore C++ decimal_point and thousands_sep
|
||||
_RWSTD_SIZE_T __res =
|
||||
_RW::__rw_put_num (&__pbuf, sizeof __buf, __f, __type,
|
||||
__prec, __pval, __grp);
|
||||
|
||||
// for bool values and boolalpha bit set, retrieve the "truth" string
|
||||
basic_string<char_type, char_traits<char_type>, allocator<char_type> >
|
||||
__boolstr;
|
||||
|
||||
if (!__res) {
|
||||
// avoid an IBM VAC++ 7.0 code generation bug that causes
|
||||
// local string objects to get incorrectly destroyed (see
|
||||
// bug #546)
|
||||
// __boolstr = __pval ? __np.truename () : __np.falsename ();
|
||||
|
||||
if (__pval)
|
||||
__boolstr = __np.truename ();
|
||||
else
|
||||
__boolstr = __np.falsename ();
|
||||
|
||||
__res = __boolstr.size ();
|
||||
}
|
||||
|
||||
// number of fill chars to pad with
|
||||
streamsize __pad = __flags.width () - streamsize (__res);
|
||||
|
||||
#ifdef _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
|
||||
|
||||
// unconditionally reset width before inserting anything
|
||||
// in case the insertion causes an exception to be thrown
|
||||
__flags.width (0);
|
||||
|
||||
#endif // _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
|
||||
|
||||
// adjustfield bits (left, internal, or the default right)
|
||||
const int __adj = __f & _RWSTD_IOS_ADJUSTFIELD;
|
||||
|
||||
if (__pad > 0 && !(__adj & (_RWSTD_IOS_LEFT | _RWSTD_IOS_INTERNAL))) {
|
||||
|
||||
// right justify if either no justification or
|
||||
// right justification specified in adjustfield
|
||||
|
||||
for (; __pad--; ++__it)
|
||||
*__it = __fill;
|
||||
}
|
||||
|
||||
const ctype<char_type> &__ctp =
|
||||
_RWSTD_USE_FACET (ctype<char_type>, __flags.getloc ());
|
||||
|
||||
const char *__p = __pbuf;
|
||||
|
||||
if (__pad > 0 && _RWSTD_IOS_INTERNAL == __adj) {
|
||||
|
||||
typedef unsigned char _UChar;
|
||||
|
||||
// internal padding only between the leading "0x"
|
||||
// prefix or the leading sign and the number
|
||||
|
||||
if (43 /* '+' or '-' */ == _RW::__rw_digit_map [_UChar (*__p)])
|
||||
*__it++ = __ctp.widen (*__p++);
|
||||
else if ( '0' == *__p && __res > 2
|
||||
&& 33 == /* 'X' */ _RW::__rw_digit_map [_UChar (__p [1])]) {
|
||||
*__it++ = __ctp.widen (*__p++);
|
||||
*__it++ = __ctp.widen (*__p++);
|
||||
}
|
||||
|
||||
// right justify if not internally padded
|
||||
for (; __pad--; ++__it)
|
||||
*__it = __fill;
|
||||
}
|
||||
|
||||
if (__type & _RW::__rw_facet::_C_integral && !*__grp && __prec >= 0) {
|
||||
// optimized for integer output, no grouping
|
||||
for (const char *__end = __pbuf + __res; __p != __end; ++__p, ++__it)
|
||||
*__it = __ctp.widen (*__p);
|
||||
}
|
||||
else if (_RW::__rw_facet::_C_bool == __type) {
|
||||
// boolalpha output
|
||||
for (_RWSTD_SIZE_T __i = 0; __i != __res; ++__i, ++__it)
|
||||
*__it = __boolstr [__i];
|
||||
}
|
||||
else {
|
||||
// all other numeric output
|
||||
for (const char *__end = __pbuf + __res; __p != __end; ++__p, ++__it) {
|
||||
switch (*__p) {
|
||||
// replace either the period or the comma with the
|
||||
// decimal point in case a setlocale() call made by
|
||||
// the program changed the default '.' to ','
|
||||
case '.':
|
||||
case ',': *__it = __np.decimal_point (); break;
|
||||
case ';': *__it = __np.thousands_sep (); break;
|
||||
default: *__it = __ctp.widen (*__p); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// delete if the buffer was dynamically allocated
|
||||
if (__pbuf != __buf)
|
||||
delete[] __pbuf;
|
||||
|
||||
// left justify if necessary
|
||||
for (; __pad > 0; ++__it, --__pad)
|
||||
*__it = __fill;
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
|
||||
|
||||
// reset width only if the insertion has been successful
|
||||
// (i.e., no exception and the iterator has not failed)
|
||||
if (!_RW::__rw_iter_failed (__it))
|
||||
__flags.width (0);
|
||||
|
||||
#endif // _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
|
||||
|
||||
return __it;
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
239
extern/stdcxx/4.2.1/include/loc/_num_put.h
vendored
Normal file
239
extern/stdcxx/4.2.1/include/loc/_num_put.h
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _num_put.h - definition of the std::num_put class templates
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _num_put.h 637130 2008-03-14 15:16:33Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_NUM_PUT_H_INCLUDED
|
||||
#define _RWSTD_LOC_NUM_PUT_H_INCLUDED
|
||||
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
|
||||
#include <streambuf>
|
||||
|
||||
#include <rw/_ioiter.h>
|
||||
#include <loc/_facet.h>
|
||||
#include <loc/_numpunct.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
// 22.2.2.2
|
||||
_EXPORT
|
||||
template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT> >
|
||||
struct num_put: _RW::__rw_facet
|
||||
{
|
||||
typedef _CharT char_type;
|
||||
typedef _OutputIter iter_type;
|
||||
|
||||
_EXPLICIT num_put (_RWSTD_SIZE_T __refs = 0)
|
||||
: _RW::__rw_facet (__refs) { }
|
||||
|
||||
virtual ~num_put ();
|
||||
|
||||
#ifndef _RWSTD_NO_BOOL
|
||||
|
||||
iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
|
||||
bool __val) const {
|
||||
return do_put (__it, __flags, __fill, __val);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_BOOL
|
||||
|
||||
iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
long __val) const {
|
||||
return do_put (__it, __flags, __fill, __val);
|
||||
}
|
||||
|
||||
iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
unsigned long __val) const {
|
||||
return do_put (__it, __flags, __fill, __val);
|
||||
}
|
||||
|
||||
iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
double __val) const {
|
||||
return do_put (__it, __flags, __fill, __val);
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
long double __val) const {
|
||||
return do_put (__it, __flags, __fill, __val);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
const void* __val) const {
|
||||
return do_put (__it, __flags, __fill, __val);
|
||||
}
|
||||
|
||||
// prevent gcc warning: cast to pointer from integer of different size
|
||||
#define _TO_VOID(x) \
|
||||
_RWSTD_REINTERPRET_CAST (const void*, _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, x))
|
||||
|
||||
#ifdef _RWSTD_LONG_LONG
|
||||
|
||||
// extensions
|
||||
iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
_RWSTD_LONG_LONG __val) const {
|
||||
return do_put (__it, __flags, __fill, __val);
|
||||
}
|
||||
|
||||
iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
unsigned _RWSTD_LONG_LONG __val) const {
|
||||
return do_put (__it, __flags, __fill, __val);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_LONG_LONG
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
#ifndef _RWSTD_NO_BOOL
|
||||
|
||||
virtual iter_type
|
||||
do_put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
bool __val) const {
|
||||
return _C_put (__it, __flags, __fill,
|
||||
__flags.flags () & _RWSTD_IOS_BOOLALPHA
|
||||
? _C_bool : _C_int, _TO_VOID (__val));
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_BOOL
|
||||
|
||||
virtual iter_type
|
||||
do_put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
long __val) const {
|
||||
return _C_put (__it, __flags, __fill, _C_long, _TO_VOID (__val));
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
unsigned long __val) const {
|
||||
return _C_put (__it, __flags, __fill, _C_ulong, _TO_VOID (__val));
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
double __val) const {
|
||||
return _C_put (__it, __flags, __fill, _C_double | _C_ptr, &__val);
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
virtual iter_type
|
||||
do_put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
long double __val) const {
|
||||
return _C_put (__it, __flags, __fill, _C_ldouble | _C_ptr, &__val);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
virtual iter_type
|
||||
do_put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
const void *__val) const {
|
||||
return _C_put (__it, __flags, __fill, _C_pvoid, __val);
|
||||
}
|
||||
|
||||
#ifdef _RWSTD_LONG_LONG
|
||||
|
||||
// extensions
|
||||
virtual iter_type
|
||||
do_put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
_RWSTD_LONG_LONG __val) const {
|
||||
return _C_put (__it, __flags, __fill, _C_llong, &__val);
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
unsigned _RWSTD_LONG_LONG __val) const {
|
||||
return _C_put (__it, __flags, __fill, _C_ullong, &__val);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_LONG_LONG
|
||||
|
||||
#undef _TO_VOID
|
||||
|
||||
private:
|
||||
|
||||
iter_type _C_put (iter_type, ios_base&, char_type, int, const void*) const;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id num_put<char, ostreambuf_iterator<char> >::id;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id num_put<wchar_t, ostreambuf_iterator<wchar_t> >::id;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_NUM_PUT)
|
||||
# include <loc/_num_put.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_NUM_PUT)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_NUM_PUT, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT num_put<char>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_NUM_PUT, _CHAR)
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_NUM_PUT, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT num_put<wchar_t>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_NUM_PUT, _WCHAR_T)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_NUM_PUT)
|
||||
# include <loc/_num_put.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_NUM_PUT)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_NUM_PUT_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_numpunct.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_numpunct.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_numpunct.c
|
||||
*
|
||||
* $Id: _numpunct.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_numpunct.cc>
|
||||
48
extern/stdcxx/4.2.1/include/loc/_numpunct.cc
vendored
Normal file
48
extern/stdcxx/4.2.1/include/loc/_numpunct.cc
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _numpunct.cc - definition of std::moneypunct members
|
||||
*
|
||||
* $Id: _numpunct.cc 597181 2007-11-21 18:59:19Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
// #ifndef _RWSTD_NO_EXT_NUMPUNCT_PRIMARY
|
||||
|
||||
template <class _CharT>
|
||||
_RW::__rw_facet_id numpunct<_CharT>::id;
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
/* virtual */ numpunct<_CharT>::~numpunct ()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
// #endif // _RWSTD_NO_EXT_NUMPUNCT_PRIMARY
|
||||
|
||||
|
||||
} // namespace std
|
||||
273
extern/stdcxx/4.2.1/include/loc/_numpunct.h
vendored
Normal file
273
extern/stdcxx/4.2.1/include/loc/_numpunct.h
vendored
Normal file
@@ -0,0 +1,273 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _numpunct.h - definition of the std::numpunct class templates
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _numpunct.h 637130 2008-03-14 15:16:33Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_NUMPUNCT_H_INCLUDED
|
||||
#define _RWSTD_LOC_NUMPUNCT_H_INCLUDED
|
||||
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <loc/_facet.h>
|
||||
#include <loc/_punct.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
// FIXME: provide just required specializations when #defined
|
||||
// #ifndef _RWSTD_NO_EXT_NUMPUNCT_PRIMARY
|
||||
|
||||
// 22.2.3.1
|
||||
_EXPORT
|
||||
template <class _CharT>
|
||||
struct numpunct: _RW::__rw_facet
|
||||
{
|
||||
typedef _CharT char_type;
|
||||
typedef
|
||||
basic_string<char_type, char_traits<char_type>, allocator<char_type> >
|
||||
string_type;
|
||||
|
||||
_EXPLICIT numpunct (_RWSTD_SIZE_T __ref = 0)
|
||||
: _RW::__rw_facet (__ref), _C_flags (0) { }
|
||||
|
||||
virtual ~numpunct ();
|
||||
|
||||
// 22.2.3.1.1, p1
|
||||
char_type decimal_point () const;
|
||||
|
||||
// 22.2.3.1.1, p2
|
||||
char_type thousands_sep () const;
|
||||
|
||||
// 22.2.3.1.1, p3
|
||||
string grouping () const;
|
||||
|
||||
// 22.2.3.1.1, p4
|
||||
string_type truename () const;
|
||||
|
||||
// 22.2.3.1.1, p4
|
||||
string_type falsename () const;
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
// 22.2.3.1.2, p1
|
||||
virtual char_type do_decimal_point () const {
|
||||
return *_RW::__rw_get_punct (this, _RW::__rw_dp, char_type ());
|
||||
}
|
||||
|
||||
// 22.2.3.1.2, p2
|
||||
virtual char_type do_thousands_sep () const {
|
||||
return *_RW::__rw_get_punct (this, _RW::__rw_ts, char_type ());
|
||||
}
|
||||
|
||||
// 22.2.3.1.2, p3
|
||||
virtual string do_grouping () const {
|
||||
return _RWSTD_REINTERPRET_CAST (const char*,
|
||||
_RW::__rw_get_punct (this, _RW::__rw_gr, char_type ()));
|
||||
}
|
||||
|
||||
// 22.2.3.1.2, p4
|
||||
virtual string_type do_truename () const {
|
||||
return _RW::__rw_get_punct (this, _RW::__rw_tn, char_type ());
|
||||
}
|
||||
|
||||
// 22.2.3.1.2, p4
|
||||
virtual string_type do_falsename () const {
|
||||
return _RW::__rw_get_punct (this, _RW::__rw_fn, char_type ());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
int _C_flags; // bitmap of "cached data valid" flags
|
||||
string _C_grouping; // cached results of virtual members
|
||||
string_type _C_truename;
|
||||
string_type _C_falsename;
|
||||
char_type _C_decimal_point;
|
||||
char_type _C_thousands_sep;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id numpunct<char>::id;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id numpunct<wchar_t>::id;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline _TYPENAME numpunct<_CharT>::char_type
|
||||
numpunct<_CharT>::decimal_point () const
|
||||
{
|
||||
if (!(_C_flags & _RW::__rw_dp)) {
|
||||
|
||||
numpunct* const __self = _RWSTD_CONST_CAST (numpunct*, this);
|
||||
|
||||
// [try to] get the decimal point first (may throw)
|
||||
// then set a flag to avoid future initializations
|
||||
__self->_C_decimal_point = do_decimal_point ();
|
||||
__self->_C_flags |= _RW::__rw_dp;
|
||||
}
|
||||
|
||||
return _C_decimal_point;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline _TYPENAME numpunct<_CharT>::char_type
|
||||
numpunct<_CharT>::thousands_sep () const
|
||||
{
|
||||
if (!(_C_flags & _RW::__rw_ts)) {
|
||||
|
||||
numpunct* const __self = _RWSTD_CONST_CAST (numpunct*, this);
|
||||
|
||||
// [try to] get the thousands_sep first (may throw)
|
||||
// then set a flag to avoid future initializations
|
||||
__self->_C_thousands_sep = do_thousands_sep ();
|
||||
__self->_C_flags |= _RW::__rw_ts;
|
||||
}
|
||||
|
||||
return _C_thousands_sep;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline string numpunct<_CharT>::grouping () const
|
||||
{
|
||||
if (!(_C_flags & _RW::__rw_gr)) {
|
||||
|
||||
numpunct* const __self = _RWSTD_CONST_CAST (numpunct*, this);
|
||||
|
||||
// [try to] get the grouping first (may throw)
|
||||
// then set a flag to avoid future initializations
|
||||
__self->_C_grouping = do_grouping ();
|
||||
__self->_C_flags |= _RW::__rw_gr;
|
||||
}
|
||||
|
||||
return _C_grouping;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline _TYPENAME numpunct<_CharT>::string_type
|
||||
numpunct<_CharT>::truename () const
|
||||
{
|
||||
if (!(_C_flags & _RW::__rw_tn)) {
|
||||
|
||||
numpunct* const __self = _RWSTD_CONST_CAST (numpunct*, this);
|
||||
|
||||
// [try to] get the true name first (may throw)
|
||||
// then set a flag to avoid future initializations
|
||||
__self->_C_truename = do_truename ();
|
||||
__self->_C_flags |= _RW::__rw_tn;
|
||||
}
|
||||
|
||||
return _C_truename;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
inline _TYPENAME numpunct<_CharT>::string_type
|
||||
numpunct<_CharT>::falsename () const
|
||||
{
|
||||
if (!(_C_flags & _RW::__rw_fn)) {
|
||||
|
||||
numpunct* const __self = _RWSTD_CONST_CAST (numpunct*, this);
|
||||
|
||||
// [try to] get the false name first (may throw)
|
||||
// then set a flag to avoid future initializations
|
||||
__self->_C_falsename = do_falsename ();
|
||||
__self->_C_flags |= _RW::__rw_fn;
|
||||
}
|
||||
|
||||
return _C_falsename;
|
||||
}
|
||||
|
||||
// #endif _RWSTD_NO_EXT_NUMPUNCT_PRIMARY
|
||||
|
||||
|
||||
// 22.2.3.2
|
||||
template <class _CharT>
|
||||
class numpunct_byname: public numpunct<_CharT>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT numpunct_byname (const char *__name, _RWSTD_SIZE_T __refs = 0)
|
||||
: numpunct<_CharT>(__refs) {
|
||||
this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_NUMPUNCT)
|
||||
# include <loc/_numpunct.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_NUMPUNCT)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_NUMPUNCT, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT numpunct<char>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_NUMPUNCT, _CHAR)
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_NUMPUNCT, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT numpunct<wchar_t>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_NUMPUNCT, _WCHAR_T)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_NUMPUNCT)
|
||||
# include <loc/_numpunct.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_NUMPUNCT)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_NUMPUNCT_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_punct.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_punct.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_punct.c
|
||||
*
|
||||
* $Id: _punct.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_punct.cc>
|
||||
182
extern/stdcxx/4.2.1/include/loc/_punct.cc
vendored
Normal file
182
extern/stdcxx/4.2.1/include/loc/_punct.cc
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _punct.cc
|
||||
*
|
||||
* $Id: _punct.cc 597438 2007-11-22 15:44:53Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include <streambuf>
|
||||
#include <loc/_ctype.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _InputIter>
|
||||
_InputIter __rw_match_name (_InputIter __it, _InputIter __end,
|
||||
const _CharT* const *__names,
|
||||
const _RWSTD_SIZE_T *__sizes,
|
||||
_RWSTD_SIZE_T __count,
|
||||
_RWSTD_SIZE_T &__inx,
|
||||
int &__err,
|
||||
_STD::ios_base *__flags)
|
||||
{
|
||||
const _RWSTD_SIZE_T __badval = _RWSTD_SIZE_MAX;
|
||||
|
||||
// make sure there are enough bits for all `count' `names'
|
||||
_RWSTD_ASSERT (__count <= sizeof (_RWSTD_SIZE_T) * _RWSTD_CHAR_BIT);
|
||||
|
||||
// on input, `err' contains the maximum allowed number of matches
|
||||
const _RWSTD_SIZE_T __matchmax = (_RWSTD_SIZE_T)__err;
|
||||
|
||||
__err = 0;
|
||||
|
||||
_RWSTD_SIZE_T __bits = ~0UL; // a bit for each `name'
|
||||
_RWSTD_SIZE_T __nmatch = __count; // total number of positive matches
|
||||
_RWSTD_SIZE_T __pos = 0; // position within input
|
||||
_RWSTD_SIZE_T __num = __inx; // input as a number
|
||||
|
||||
__inx = __badval; // invalidate
|
||||
|
||||
const _STD::ctype<_CharT> *__ctp = __flags ?
|
||||
&_RWSTD_USE_FACET (_STD::ctype<_CharT>, __flags->getloc ()) : 0;
|
||||
|
||||
_CharT __ch;
|
||||
|
||||
for (; (__bits || __num != __badval) && !__err; ++__it, ++__pos) {
|
||||
|
||||
if (__it == __end) {
|
||||
__err |= _RWSTD_IOS_EOFBIT;
|
||||
__ch = _CharT ();
|
||||
}
|
||||
else
|
||||
__ch = *__it;
|
||||
|
||||
if (__ctp && __num != __badval) {
|
||||
if (__ctp->is (_STD::ctype_base::digit, __ch))
|
||||
__num = __num * 10 + __ctp->narrow (__ch, '0') - '0';
|
||||
else
|
||||
__num = __badval;
|
||||
}
|
||||
|
||||
// iterate over all names, clear bits of those that do not match
|
||||
for (_RWSTD_SIZE_T __k = 0; __k != __count; ++__k) {
|
||||
|
||||
typedef _STD::char_traits<_CharT> _Traits;
|
||||
|
||||
const _RWSTD_SIZE_T __mask =
|
||||
_RWSTD_STATIC_CAST (_RWSTD_SIZE_T, 1UL) << __k;
|
||||
|
||||
if (__bits & __mask) {
|
||||
// `name' is still in the set, see if the next char matches
|
||||
// (case insensitive comparison done if `ctp' is nonzero)
|
||||
if ( __pos < __sizes [__k]
|
||||
&& !__err
|
||||
&& (__ctp ?
|
||||
_Traits::eq ((__ctp->toupper)(__names [__k][__pos]),
|
||||
(__ctp->toupper)(__ch))
|
||||
: _Traits::eq (__names [__k][__pos], __ch))) {
|
||||
|
||||
// next character on `name' mactches input
|
||||
if (__badval == __inx) {
|
||||
// no prior match, remember this one
|
||||
__inx = __k;
|
||||
}
|
||||
else if ( __k != __inx
|
||||
&& __sizes [__k] == __sizes [__inx]
|
||||
&& __pos + 1 == __sizes [__inx]) {
|
||||
|
||||
// this match is a duplicate of the last best one
|
||||
// remove this match from the set
|
||||
__bits &= ~__mask;
|
||||
--__nmatch;
|
||||
}
|
||||
else if ( __sizes [__k] < __sizes [__inx]
|
||||
|| __pos >= __sizes [__inx]) {
|
||||
// this match is either shorter than the last one
|
||||
// or the last one will be eliminated
|
||||
__inx = __k;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (1 == __nmatch) {
|
||||
if (__badval == __inx && __badval == __num)
|
||||
return __it;
|
||||
goto __endloop;
|
||||
}
|
||||
|
||||
if (__inx == __k) {
|
||||
// if this `name' is the current shortest match...
|
||||
if (__err && __pos == __sizes [__k]) {
|
||||
// ...and we're at eof, return successfully
|
||||
return __it;
|
||||
}
|
||||
// otherwise forget the match
|
||||
__inx = __badval;
|
||||
}
|
||||
|
||||
// clear the bit for the `name' that failed to match
|
||||
// and decrement the numeber of matches
|
||||
__bits &= ~__mask;
|
||||
--__nmatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (1 == __nmatch && __pos + 1 == __sizes [__inx])
|
||||
return ++__it;
|
||||
}
|
||||
|
||||
__endloop:
|
||||
|
||||
if (__matchmax < __nmatch || __pos < __sizes [__inx])
|
||||
__inx = __badval;
|
||||
|
||||
if (__ctp && __badval == __inx && !__err && __num != __badval) {
|
||||
|
||||
// if symbolic matching fails, fall back on numeric parsing
|
||||
for ( ; ; ) {
|
||||
if (++__it == __end) {
|
||||
__err |= _RWSTD_IOS_EOFBIT;
|
||||
break;
|
||||
}
|
||||
|
||||
__ch = *__it;
|
||||
|
||||
if (__ctp->is (_STD::ctype_base::digit, __ch))
|
||||
__num = __num * 10 + __ctp->narrow (__ch, '0') - '0';
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
__inx = __count + __num;
|
||||
}
|
||||
|
||||
return __it;
|
||||
}
|
||||
|
||||
|
||||
} // namespace __rw
|
||||
164
extern/stdcxx/4.2.1/include/loc/_punct.h
vendored
Normal file
164
extern/stdcxx/4.2.1/include/loc/_punct.h
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _punct.h - definition of the __rw_punct class template
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _punct.h 637130 2008-03-14 15:16:33Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_PUNCT_H_INCLUDED
|
||||
#define _RWSTD_LOC_PUNCT_H_INCLUDED
|
||||
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
#include <rw/_ioiter.h>
|
||||
#include <rw/_traits.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
struct _RWSTD_EXPORT ios_base;
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
enum {
|
||||
// bitset elements representing decimal_point, thousands_sep, grouping,
|
||||
// truename, falsename, currency_sym, positive_sign, negative_sign,
|
||||
// frac_digits, pos_format, neg_format
|
||||
|
||||
// values are bitset elements since they are used to indicate which
|
||||
// members have already been cached by std::moneypunct and std::numpunct
|
||||
__rw_dp = 0x0001, __rw_ts = 0x0002, __rw_gr = 0x0004, __rw_tn = 0x0008,
|
||||
__rw_fn = 0x0010, __rw_cs = 0x0020, __rw_ps = 0x0040, __rw_ns = 0x0080,
|
||||
__rw_fd = 0x0100, __rw_pf = 0x0200, __rw_nf = 0x0400,
|
||||
|
||||
// bitset elements used by std::time_get and std::time_put
|
||||
__rw_abday = 0x0001, __rw_day = 0x0002, __rw_abmon = 0x0004,
|
||||
__rw_month = 0x0008, __rw_ampm = 0x0010, __rw_d_t_fmt = 0x0020,
|
||||
__rw_d_fmt = 0x0040, __rw_t_fmt = 0x0080, __rw_t_fmt_ampm = 0x0100,
|
||||
|
||||
// bitset elements used by std::time_get and std::time_put
|
||||
// for alternative date/time representions and eras
|
||||
__rw_era_d_t_fmt = 0x0200, __rw_era_d_fmt = 0x0400, __rw_era_t_fmt = 0x0800,
|
||||
__rw_era_names = 0x1000, __rw_era_fmts = 0x2000,
|
||||
__rw_alt_digits = 0x4000,
|
||||
|
||||
// other flags
|
||||
__rw_wide = 0x100000, __rw_mon = 0x200000, __rw_intl = 0x400000
|
||||
};
|
||||
|
||||
struct __rw_facet;
|
||||
|
||||
template <class _CharT>
|
||||
inline const _CharT*
|
||||
__rw_get_punct (const _RW::__rw_facet*, int, _CharT)
|
||||
{
|
||||
// body provided to work around bugs in compilers such as IBM
|
||||
// VAC++ 7.0 (see bug #562) that instantiate the function when
|
||||
// e.g., use_facet<numpunct<int> >(locale) is called
|
||||
_RWSTD_ASSERT (!"must not be called");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// use overloading instead of specialization below to prevent
|
||||
// linker unsats when using Intel C++ on Windows (PR #29178)
|
||||
/* _RWSTD_SPECIALIZED_FUNCTION */ _RWSTD_EXPORT
|
||||
const char* __rw_get_punct (const _RW::__rw_facet*, int, char);
|
||||
|
||||
#ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
/* _RWSTD_SPECIALIZED_FUNCTION */ _RWSTD_EXPORT
|
||||
const wchar_t* __rw_get_punct (const _RW::__rw_facet*, int, wchar_t);
|
||||
|
||||
#endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
// extracts as many values from the given range as necessary to
|
||||
// (not necessarily unambiguously) match one or more names (in
|
||||
// case of duplicates) in the array of sequences given by the
|
||||
// third and fourth arguments
|
||||
// case insensitive comparison (characters are compared after
|
||||
// converting to uppercase using std::ctype<charT>::toupper())
|
||||
// is performed if the last argument is nonzero
|
||||
// retuns the iterator pointing one past the last extracted value,
|
||||
// fills 6th argument with the index of the matched name and sets
|
||||
// the 7th argument to eofbit if the end of input has been reached
|
||||
// while trying to match a name (note that the returned iterator
|
||||
// may be equal to the end iterator and eofbit may not be set)
|
||||
_EXPORT
|
||||
template <class _CharT, class _InputIter>
|
||||
_InputIter __rw_match_name (_InputIter, _InputIter,
|
||||
const _CharT* const*, const _RWSTD_SIZE_T*,
|
||||
_RWSTD_SIZE_T, _RWSTD_SIZE_T&, int&,
|
||||
_STD::ios_base*);
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_PUNCT)
|
||||
# include <loc/_punct.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_PUNCT)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
#define _RWSTD_ARG_LIST(charT) \
|
||||
_RWSTD_ISTREAMBUF_ITER (charT), _RWSTD_ISTREAMBUF_ITER (charT), \
|
||||
const charT* const*, const _RWSTD_SIZE_T*, _RWSTD_SIZE_T, \
|
||||
_RWSTD_SIZE_T&, int&, _STD::ios_base*
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_PUNCT, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _RW::__rw_istreambuf_iterator
|
||||
__rw_match_name (_RWSTD_ARG_LIST (char)));
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_PUNCT, _CHAR)
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_PUNCT, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _RW::__rw_wistreambuf_iterator
|
||||
__rw_match_name (_RWSTD_ARG_LIST (wchar_t)));
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_PUNCT, _WCHAR_T)
|
||||
|
||||
#undef _RWSTD_ARG_LIST
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_PUNCT)
|
||||
# include <loc/_punct.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_PUNCT)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_PUNCT_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_time_get.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_time_get.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_time_get.c
|
||||
*
|
||||
* $Id: _time_get.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_time_get.cc>
|
||||
359
extern/stdcxx/4.2.1/include/loc/_time_get.cc
vendored
Normal file
359
extern/stdcxx/4.2.1/include/loc/_time_get.cc
vendored
Normal file
@@ -0,0 +1,359 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _time_get.cc - definition of std::time_get members
|
||||
*
|
||||
* $Id: _time_get.cc 597438 2007-11-22 15:44:53Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include <streambuf>
|
||||
#include <loc/_ctype.h>
|
||||
#include <loc/_punct.h>
|
||||
#include <loc/_locale.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
_RWSTD_EXPORT _RWSTD_SIZE_T
|
||||
__rw_get_timepunct (const __rw_facet *pfacet,
|
||||
int data [4], _RWSTD_C::tm *tmb, int **pmem,
|
||||
const void *names[], _RWSTD_SIZE_T sizes[]);
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template <class _CharT, class _InputIter>
|
||||
_RW::__rw_facet_id time_get<_CharT, _InputIter>::id;
|
||||
|
||||
|
||||
template <class _CharT, class _InputIter>
|
||||
_TYPENAME time_get<_CharT, _InputIter>::iter_type
|
||||
time_get<_CharT, _InputIter>::
|
||||
get (iter_type __it, iter_type __end, ios_base &__fl, _RWSTD_IOSTATE &__err,
|
||||
tm *__tmb, const char_type *__pat, const char_type *__pat_end) const
|
||||
{
|
||||
_RWSTD_ASSERT (0 != __pat);
|
||||
_RWSTD_ASSERT (__pat <= __pat_end);
|
||||
|
||||
const ctype<char_type> &__ctp =
|
||||
_RWSTD_USE_FACET (ctype<char_type>, __fl.getloc ());
|
||||
|
||||
// extension: `tmb' may be 0
|
||||
tm __tmp = __tmb ? *__tmb : tm ();
|
||||
|
||||
_RWSTD_IOSTATE __errtmp = _RW::__rw_goodbit;
|
||||
|
||||
char __fmt [] = { '\0', '\0' };
|
||||
|
||||
for (; __pat != __pat_end; ++__pat) {
|
||||
|
||||
if (__errtmp) {
|
||||
// failed to match the whole pattern
|
||||
__errtmp |= _RW::__rw_failbit;
|
||||
break;
|
||||
}
|
||||
|
||||
const char __ch = __ctp.narrow (*__pat, '\0');
|
||||
|
||||
if (__fmt [0]) {
|
||||
if ('E' == __ch || 'O' == __ch)
|
||||
__fmt [1] = __ch;
|
||||
else if ('.' == __ch || __ch >= '0' && __ch <= '9') {
|
||||
// FIXME: handle the "%.[0-9]*" HP-UX extension
|
||||
}
|
||||
else {
|
||||
__it = do_get (__it, __end, __fl, __errtmp, &__tmp, __ch,
|
||||
__fmt [1]);
|
||||
__fmt [0] = __fmt [1] = '\0'; // reset
|
||||
}
|
||||
}
|
||||
else if ('%' == __ch) {
|
||||
__fmt [0] = __ch;
|
||||
}
|
||||
else if (__ctp.is (ctype_base::space, *__pat)) {
|
||||
// skip all whitespace characters
|
||||
while (__it != __end && __ctp.is (ctype_base::space, *__it))
|
||||
++__it;
|
||||
}
|
||||
else {
|
||||
if (__it != __end && __ch == __ctp.narrow (*__it, '\0'))
|
||||
++__it;
|
||||
else {
|
||||
// mismatch between pattern and input
|
||||
__errtmp |= _RW::__rw_failbit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// store value only on success
|
||||
if (!(__errtmp & ~_RW::__rw_eofbit) && __tmb)
|
||||
*__tmb = __tmp;
|
||||
|
||||
__err |= __errtmp;
|
||||
|
||||
return __it;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT, class _InputIter>
|
||||
/* virtual */ _TYPENAME time_get<_CharT, _InputIter>::iter_type
|
||||
time_get<_CharT, _InputIter>::
|
||||
do_get (iter_type __it, iter_type __end, ios_base &__fl,
|
||||
_RWSTD_IOSTATE &__err, tm *__tmb,
|
||||
char __fmt, char __modifier /* = '\0' */) const
|
||||
{
|
||||
// enough pointers for 100 alternative numeric symbols and their sizes
|
||||
const char_type* __names [100];
|
||||
_RWSTD_SIZE_T __sizes [sizeof __names / sizeof *__names];
|
||||
|
||||
const void** __pv =
|
||||
_RWSTD_REINTERPRET_CAST (const void**, __names);
|
||||
|
||||
tm __tmp = __tmb ? *__tmb : tm ();
|
||||
|
||||
int *__pmem = 0; // pointer to std::tm member
|
||||
|
||||
_RWSTD_SIZE_T __dup; // number of allowed duplicates
|
||||
|
||||
const ctype<char_type> &__ctp =
|
||||
_RWSTD_USE_FACET (ctype<char_type>, __fl.getloc ());
|
||||
|
||||
switch (__fmt) {
|
||||
|
||||
case 'A': case 'a': case 'B': case 'b': case 'h':
|
||||
// names of days and months can have duplicates (i.e.,
|
||||
// it can be either a full name aor an abbreviation)
|
||||
__dup = 2;
|
||||
break;
|
||||
|
||||
case 'n': case 't': { // any whitespace
|
||||
|
||||
for ( ; ; ++__it) {
|
||||
|
||||
if (__it == __end) {
|
||||
__err |= _RW::__rw_eofbit;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!__ctp.is (ctype_base::space, *__it))
|
||||
break;
|
||||
}
|
||||
|
||||
return __it;
|
||||
}
|
||||
|
||||
default: __dup = 1;
|
||||
}
|
||||
|
||||
int __data [4] = {
|
||||
// array of input data for __rw_get_timepunct will on output
|
||||
// contain data needed to interpret values parsed below
|
||||
__fmt, __modifier, sizeof (char_type) > sizeof (char), 0
|
||||
};
|
||||
|
||||
// get the number of punctuator (or format) string(s) and their values
|
||||
const _RWSTD_SIZE_T __cnt =
|
||||
_RW::__rw_get_timepunct (this, __data, &__tmp,
|
||||
&__pmem, __pv, __sizes);
|
||||
|
||||
if (1 == __cnt) {
|
||||
_RWSTD_ASSERT (0 != __names [0]);
|
||||
|
||||
// single punctuator string stored in `names [0]'
|
||||
// e.g., "%m/%d/%y" for the format of "%D" (`fmt' == 'D')
|
||||
return get (__it, __end, __fl, __err, __tmb,
|
||||
__names [0], __names [0] + __sizes [0]);
|
||||
}
|
||||
|
||||
_RWSTD_IOSTATE __errtmp = _RW::__rw_goodbit;
|
||||
|
||||
if (__cnt > 1) {
|
||||
|
||||
// parse string on input
|
||||
|
||||
// set `inx' to 0 to allow numeric input, SIZE_MAX otherwise
|
||||
_RWSTD_SIZE_T __inx = 'O' == __modifier ? 0 : _RWSTD_SIZE_MAX;
|
||||
|
||||
// on function input, `interr' contains the maximum number
|
||||
// of duplicates; on output, it contains an iostate value
|
||||
// and `inx' contains the index of the parsed name within
|
||||
// the `names' array
|
||||
int __interr = int (__dup);
|
||||
|
||||
__it = _RW::__rw_match_name (__it, __end, __names, __sizes,
|
||||
__cnt, __inx, __interr, &__fl);
|
||||
|
||||
__errtmp = _RWSTD_IOSTATE (__interr);
|
||||
|
||||
if (__inx == _RWSTD_SIZE_MAX) {
|
||||
|
||||
// if no name matches, and the first name is the empty
|
||||
// (i.e., alt_digits 0 is not defined), try to match
|
||||
// and extract all zeros
|
||||
if ( !__errtmp && 0 == __sizes [0]
|
||||
&& __it != __end && '0' == __ctp.narrow (*__it, '\0')) {
|
||||
|
||||
while ('0' == __ctp.narrow (*__it, '\0')) {
|
||||
|
||||
if (++__it == __end) {
|
||||
__errtmp |= _RW::__rw_eofbit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
__errtmp |= _RW::__rw_failbit;
|
||||
}
|
||||
}
|
||||
else if ('p' == __fmt) {
|
||||
if (__pmem) {
|
||||
if (!__inx && 11 == *__pmem)
|
||||
*__pmem = 0;
|
||||
else if (*__pmem < 12) {
|
||||
if (!__inx || 11 != *__pmem)
|
||||
*__pmem += int (__inx * 12) + 1;
|
||||
else
|
||||
*__pmem += 1;
|
||||
}
|
||||
else {
|
||||
// invalid data
|
||||
__errtmp |= _RW::__rw_failbit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// invalid (or unimplemented) format
|
||||
__errtmp |= _RW::__rw_failbit;
|
||||
}
|
||||
}
|
||||
else if (__pmem) {
|
||||
_RWSTD_ASSERT (0 != __pmem);
|
||||
|
||||
if (__inx == __cnt && !__sizes [0] || __inx >= 2 * __cnt)
|
||||
*__pmem = int (__inx - __cnt);
|
||||
else if (__inx < __cnt)
|
||||
*__pmem = int (__inx % (__cnt / __dup));
|
||||
else
|
||||
__errtmp |= _RW::__rw_failbit;
|
||||
|
||||
const int __adj = __data [0]; // value to increment result by
|
||||
const int __fac = __data [1]; // value to multiply result by
|
||||
|
||||
*__pmem = *__pmem * __fac + __adj;
|
||||
|
||||
const int __lob = __data [2]; // lower bound on valid input
|
||||
const int __hib = __data [3]; // upper bound on valid input
|
||||
|
||||
// validate input value
|
||||
if (*__pmem < __lob || *__pmem > __hib)
|
||||
__errtmp |= _RW::__rw_failbit;
|
||||
}
|
||||
else {
|
||||
// invalid (or unimplemented) format
|
||||
__errtmp |= _RW::__rw_failbit;
|
||||
}
|
||||
}
|
||||
else if (__pmem) {
|
||||
|
||||
// parse numeric input
|
||||
|
||||
_RWSTD_SIZE_T __nread = 0;
|
||||
|
||||
int __mem = 0;
|
||||
|
||||
for ( ; ; ++__it, ++__nread) {
|
||||
if (__it == __end) {
|
||||
__err |= _RW::__rw_eofbit;
|
||||
break;
|
||||
}
|
||||
|
||||
const char_type __c = *__it;
|
||||
if (!__ctp.is (ctype_base::digit, __c))
|
||||
break;
|
||||
|
||||
const char __ch = __ctp.narrow (__c, '\0');
|
||||
if (__ch < '0' || __ch > '9')
|
||||
break;
|
||||
|
||||
__mem = 10 * __mem + __ch - '0';
|
||||
}
|
||||
|
||||
if (__nread) {
|
||||
|
||||
const int __adj = __data [0]; // value to increment result by
|
||||
const int __fac = __data [1]; // value to multiply result by
|
||||
|
||||
int __lob = __data [2]; // lower bound on valid input
|
||||
int __hib = __data [3]; // upper bound on valid input
|
||||
|
||||
if ('y' == __fmt) {
|
||||
|
||||
// IEEE Std 1003.1-2001: When a century is not otherwise
|
||||
// specified, values in the range [69,99] shall refer to
|
||||
// years 1969 to 1999 inclusive, and values in the range
|
||||
// [00,68] shall refer to years 2000 to 2068 inclusive.
|
||||
|
||||
if (__mem > 99) {
|
||||
__lob = -1900;
|
||||
__hib = _RWSTD_INT_MAX - 1900;
|
||||
__mem -= 1900;
|
||||
}
|
||||
else {
|
||||
__lob = 69;
|
||||
__hib = 168;
|
||||
|
||||
if (__mem < 69)
|
||||
__mem += 100;
|
||||
}
|
||||
}
|
||||
|
||||
*__pmem = __mem * __fac + __adj;
|
||||
|
||||
// validate input value
|
||||
if (*__pmem < __lob || *__pmem > __hib)
|
||||
__errtmp |= _RW::__rw_failbit;
|
||||
}
|
||||
else {
|
||||
// invalid data
|
||||
__errtmp |= _RW::__rw_failbit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// invalid (or unimplemented) format
|
||||
__errtmp |= _RW::__rw_failbit;
|
||||
}
|
||||
|
||||
if (!(__errtmp & ~_RW::__rw_eofbit) && __tmb)
|
||||
*__tmb = __tmp;
|
||||
|
||||
__err |= __errtmp;
|
||||
|
||||
return __it;
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
242
extern/stdcxx/4.2.1/include/loc/_time_get.h
vendored
Normal file
242
extern/stdcxx/4.2.1/include/loc/_time_get.h
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _time_get.h - definition of the std::time_get class templates
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _time_get.h 637130 2008-03-14 15:16:33Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 2001-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_TIME_GET_H_INCLUDED
|
||||
#define _RWSTD_LOC_TIME_GET_H_INCLUDED
|
||||
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
|
||||
#include <loc/_facet.h>
|
||||
#include <rw/_ioiter.h>
|
||||
#include <rw/_iosfwd.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
#include _RWSTD_CTIME
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
const void* __rw_get_timepunct (const _RW::__rw_facet*, int, _RWSTD_SIZE_T);
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
// 22.2.5.1
|
||||
struct _RWSTD_EXPORT time_base
|
||||
{
|
||||
enum dateorder { no_order, dmy, mdy, ymd, ydm };
|
||||
};
|
||||
|
||||
|
||||
// 22.2.5.1
|
||||
_EXPORT
|
||||
template <class _CharT, class _InputIter = istreambuf_iterator<_CharT> >
|
||||
class time_get: public _RW::__rw_facet, public time_base
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef _InputIter iter_type;
|
||||
|
||||
_EXPLICIT time_get (_RWSTD_SIZE_T __ref = 0)
|
||||
: _RW::__rw_facet (__ref) { }
|
||||
|
||||
dateorder date_order() const {
|
||||
return do_date_order();
|
||||
}
|
||||
|
||||
iter_type
|
||||
get_time (iter_type __start, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, tm *__time) const {
|
||||
return do_get_time (__start, __end, __flags, __err, __time);
|
||||
}
|
||||
|
||||
iter_type
|
||||
get_date (iter_type __start, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, tm *__time) const {
|
||||
return do_get_date(__start, __end, __flags, __err, __time);
|
||||
}
|
||||
|
||||
iter_type
|
||||
get_weekday (iter_type __start, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, tm *__time) const {
|
||||
return do_get_weekday (__start, __end, __flags, __err, __time);
|
||||
}
|
||||
|
||||
iter_type
|
||||
get_monthname (iter_type __start, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, tm *__time) const {
|
||||
return do_get_monthname (__start, __end, __flags, __err, __time);
|
||||
}
|
||||
|
||||
iter_type
|
||||
get_year (iter_type __start, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, tm *__time) const {
|
||||
return do_get_year (__start, __end, __flags, __err, __time);
|
||||
}
|
||||
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_EXT_TIME_GET
|
||||
|
||||
private:
|
||||
|
||||
#endif // _RWSTD_NO_EXT_TIME_GET
|
||||
|
||||
// extension
|
||||
iter_type
|
||||
get (iter_type, iter_type, ios_base&, _RWSTD_IOSTATE&, tm*,
|
||||
const char_type*, const char_type*) const;
|
||||
|
||||
// extension
|
||||
iter_type
|
||||
get (iter_type __it, iter_type __end, ios_base &__flags,
|
||||
_RWSTD_IOSTATE &__err, tm *__time,
|
||||
char __fmt, char __modifier = '\0') const {
|
||||
return do_get (__it, __end, __flags, __err, __time, __fmt, __modifier);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual dateorder do_date_order() const {
|
||||
return dateorder ();
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_get_time (iter_type __it, iter_type __end, ios_base &__fl,
|
||||
_RWSTD_IOSTATE &__err, tm *__tmb) const {
|
||||
return do_get (__it, __end, __fl, __err, __tmb, 'X');
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_get_date (iter_type __it, iter_type __end, ios_base &__fl,
|
||||
_RWSTD_IOSTATE &__err, tm *__tmb) const {
|
||||
return do_get (__it, __end, __fl, __err, __tmb, 'x');
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_get_weekday (iter_type __it, iter_type __end, ios_base &__fl,
|
||||
_RWSTD_IOSTATE &__err, tm *__tmb) const {
|
||||
return do_get (__it, __end, __fl, __err, __tmb, 'a');
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_get_monthname (iter_type __it, iter_type __end, ios_base &__fl,
|
||||
_RWSTD_IOSTATE &__err, tm *__tmb) const {
|
||||
return do_get (__it, __end, __fl, __err, __tmb, 'b');
|
||||
}
|
||||
|
||||
virtual iter_type
|
||||
do_get_year (iter_type __it, iter_type __end, ios_base &__fl,
|
||||
_RWSTD_IOSTATE &__err, tm *__tmb) const {
|
||||
return do_get (__it, __end, __fl, __err, __tmb, 'Y');
|
||||
}
|
||||
|
||||
#ifdef _RWSTD_NO_EXT_TIME_GET
|
||||
|
||||
private:
|
||||
|
||||
#endif // _RWSTD_NO_EXT_TIME_GET
|
||||
|
||||
// extension
|
||||
virtual iter_type
|
||||
do_get (iter_type, iter_type, ios_base&, _RWSTD_IOSTATE&, tm*,
|
||||
char, char = '\0') const;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id time_get<char, istreambuf_iterator<char> >::id;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id time_get<wchar_t, istreambuf_iterator<wchar_t> >::id;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
|
||||
// 22.2.5.2
|
||||
template <class _CharT, class _InputIter = istreambuf_iterator<_CharT> >
|
||||
class time_get_byname: public time_get<_CharT, _InputIter>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT time_get_byname (const char *__name, _RWSTD_SIZE_T __ref = 0)
|
||||
: time_get<_CharT, _InputIter>(__ref) {
|
||||
this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_TIME_GET)
|
||||
# include <loc/_time_get.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_TIME_GET)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_TIME_GET, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT time_get<char>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_TIME_GET, _CHAR)
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_TIME_GET, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT time_get<wchar_t>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_TIME_GET, _WCHAR_T)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_TIME_GET)
|
||||
# include <loc/_time_get.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_TIME_GET)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_TIME_GET_H_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/loc/_time_put.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/loc/_time_put.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* loc/_time_put.c
|
||||
*
|
||||
* $Id: _time_put.c 580483 2007-09-28 20:55:52Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <loc/_time_put.cc>
|
||||
176
extern/stdcxx/4.2.1/include/loc/_time_put.cc
vendored
Normal file
176
extern/stdcxx/4.2.1/include/loc/_time_put.cc
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _time_put.cc - definition of std::time_put members
|
||||
*
|
||||
* $Id: _time_put.cc 597438 2007-11-22 15:44:53Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 1994-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <streambuf>
|
||||
#include <rw/_iosbase.h>
|
||||
#include <loc/_ctype.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
|
||||
// defined in time_put.cpp
|
||||
_RWSTD_EXPORT char*
|
||||
__rw_put_time (const __rw_facet*, char*, _RWSTD_SIZE_T,
|
||||
_STD::ios_base&, char, const _RWSTD_C::tm*,
|
||||
char, char, int, int);
|
||||
|
||||
#ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
// defined in time_put.cpp
|
||||
_RWSTD_EXPORT wchar_t*
|
||||
__rw_put_time (const __rw_facet*, wchar_t*, _RWSTD_SIZE_T,
|
||||
_STD::ios_base&, wchar_t, const _RWSTD_C::tm*,
|
||||
char, char, int, int);
|
||||
|
||||
#endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template <class _CharT, class _OutputIter>
|
||||
_RW::__rw_facet_id time_put<_CharT, _OutputIter>::id;
|
||||
|
||||
|
||||
template <class _CharT, class _OutputIter /* = ostreambuf_iterator<_CharT> */ >
|
||||
/* virtual */ _TYPENAME time_put<_CharT, _OutputIter>::iter_type
|
||||
time_put<_CharT, _OutputIter>::
|
||||
do_put (iter_type __it, ios_base &__flags, char_type __fill,
|
||||
const tm *__tmb, char __fmt, char __modifier /* = 0 */) const
|
||||
{
|
||||
char_type __buf [256];
|
||||
|
||||
const char_type *__end =
|
||||
_RW::__rw_put_time (this, __buf + 0, sizeof __buf / sizeof *__buf,
|
||||
__flags, __fill, __tmb, __fmt, __modifier, -1, -1);
|
||||
|
||||
// number of fill chars to pad with
|
||||
streamsize __pad = __flags.width () - streamsize (__end - __buf);
|
||||
|
||||
// adjustfield bits (left, internal, or the default right)
|
||||
const int __adj = __flags.flags () & _RWSTD_IOS_ADJUSTFIELD;
|
||||
|
||||
if (__pad > 0 && _RWSTD_IOS_LEFT != __adj) {
|
||||
|
||||
// right justify unless left justification requested
|
||||
for (; __pad--; ++__it)
|
||||
*__it = __fill;
|
||||
}
|
||||
|
||||
for (const char_type *__p = __buf; __p != __end; ++__p, ++__it) {
|
||||
*__it = *__p;
|
||||
}
|
||||
|
||||
// left justify if necessary
|
||||
for (; __pad-- > 0; ++__it)
|
||||
*__it = __fill;
|
||||
|
||||
return __it;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT, class _OutputIter /* = ostreambuf_iterator<_CharT> */ >
|
||||
_TYPENAME time_put<_CharT, _OutputIter>::iter_type
|
||||
time_put<_CharT, _OutputIter>::
|
||||
put (iter_type __it, ios_base &__flags, char_type __fill, const tm *__tmb,
|
||||
const char_type *__pat, const char_type *__end) const
|
||||
{
|
||||
_RWSTD_ASSERT (0 != __pat);
|
||||
|
||||
if (!__end) // convenience extension
|
||||
__end = __pat + char_traits<char_type>::length (__pat);
|
||||
|
||||
const ctype<char_type> &__ctp =
|
||||
_RWSTD_USE_FACET (ctype<char_type>, __flags.getloc ());
|
||||
|
||||
for (; __pat != __end; ++__pat) {
|
||||
|
||||
if ('%' == __ctp.narrow (*__pat, 0) && __pat + 1 < __end) {
|
||||
|
||||
char __fmtmod = __ctp.narrow (*++__pat, 0); // format modifier
|
||||
char __fmt; // format specifier
|
||||
|
||||
if ('E' == __fmtmod) {
|
||||
|
||||
__fmt = __ctp.narrow (__pat [1], 0);
|
||||
|
||||
switch (__fmt) {
|
||||
// check valid format modifiers
|
||||
case 'c': case 'C': case 'x': case 'X': case 'y': case 'Y':
|
||||
++__pat;
|
||||
break;
|
||||
|
||||
case '\0':
|
||||
break;
|
||||
|
||||
default:
|
||||
__fmt = 0; // `pat' doesn't point to a valid format
|
||||
}
|
||||
}
|
||||
else if ('O' == __fmtmod) {
|
||||
|
||||
__fmt = __ctp.narrow (__pat [1], 0);
|
||||
|
||||
switch (__fmt) {
|
||||
// check valid format modifiers
|
||||
case 'd': case 'e': case 'H': case 'I': case 'm': case 'M':
|
||||
case 'S': case 'u': case 'U': case 'V': case 'w': case 'W':
|
||||
case 'y':
|
||||
++__pat;
|
||||
break;
|
||||
|
||||
case '\0':
|
||||
break;
|
||||
|
||||
default:
|
||||
__fmt = 0; // `pat' doesn't point to a valid format
|
||||
}
|
||||
}
|
||||
else {
|
||||
__fmt = __fmtmod;
|
||||
__fmtmod = 0;
|
||||
}
|
||||
|
||||
if (char (-1) != __fmt) {
|
||||
__it = do_put (__it, __flags, __fill, __tmb, __fmt, __fmtmod);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
*__it = *__pat;
|
||||
++__it;
|
||||
}
|
||||
|
||||
return __it;
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
141
extern/stdcxx/4.2.1/include/loc/_time_put.h
vendored
Normal file
141
extern/stdcxx/4.2.1/include/loc/_time_put.h
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _time_put.h - definition of the std::time_put class templates
|
||||
*
|
||||
* This is an internal header file used to implement the C++ Standard
|
||||
* Library. It should never be #included directly by a program.
|
||||
*
|
||||
* $Id: _time_put.h 637130 2008-03-14 15:16:33Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* Copyright 2001-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LOC_TIME_PUT_H_INCLUDED
|
||||
#define _RWSTD_LOC_TIME_PUT_H_INCLUDED
|
||||
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
|
||||
#include <loc/_facet.h>
|
||||
#include <rw/_ioiter.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
#include _RWSTD_CTIME
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
struct _RWSTD_EXPORT ios_base;
|
||||
|
||||
|
||||
// 22.2.5.3
|
||||
_EXPORT
|
||||
template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT> >
|
||||
struct time_put: _RW::__rw_facet
|
||||
{
|
||||
typedef _CharT char_type;
|
||||
typedef _OutputIter iter_type;
|
||||
|
||||
_EXPLICIT time_put (_RWSTD_SIZE_T __refs = 0)
|
||||
: _RW::__rw_facet (__refs) { }
|
||||
|
||||
// 22.2.5.3.1, p1
|
||||
iter_type put (iter_type, ios_base&, char_type, const tm*,
|
||||
const char_type*, const char_type*) const;
|
||||
|
||||
iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
|
||||
const tm* __tmb, char __fmt, char __modifier = 0) const {
|
||||
return do_put (__it, __flags, __fill, __tmb, __fmt, __modifier);
|
||||
}
|
||||
|
||||
static _RW::__rw_facet_id id;
|
||||
|
||||
protected:
|
||||
|
||||
// 22.2.5.3.2, p1
|
||||
virtual iter_type
|
||||
do_put (iter_type, ios_base&, char_type, const tm*, char, char) const;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id time_put<char, ostreambuf_iterator<char> >::id;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
_RW::__rw_facet_id time_put<wchar_t, ostreambuf_iterator<wchar_t> >::id;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_NO_SPECIALIZED_FACET_ID
|
||||
|
||||
|
||||
// 22.2.5.2
|
||||
template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT> >
|
||||
class time_put_byname: public time_put<_CharT, _OutputIter>
|
||||
{
|
||||
char _C_namebuf [32];
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT time_put_byname (const char *__name, _RWSTD_SIZE_T __ref = 0)
|
||||
: time_put<_CharT, _OutputIter>(__ref) {
|
||||
this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_TIME_PUT)
|
||||
# include <loc/_time_put.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_TIME_PUT)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_TIME_PUT, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT time_put<char>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_TIME_PUT, _CHAR)
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_TIME_PUT, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT time_put<wchar_t>);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_TIME_PUT, _WCHAR_T)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_TIME_PUT)
|
||||
# include <loc/_time_put.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_TIME_PUT)
|
||||
|
||||
|
||||
#endif // _RWSTD_LOC_TIME_PUT_H_INCLUDED
|
||||
Reference in New Issue
Block a user