first commit
This commit is contained in:
1256
extern/stdcxx/4.2.1/include/algorithm
vendored
Normal file
1256
extern/stdcxx/4.2.1/include/algorithm
vendored
Normal file
File diff suppressed because it is too large
Load Diff
29
extern/stdcxx/4.2.1/include/algorithm.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/algorithm.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* algorithm.c
|
||||
*
|
||||
* $Id: algorithm.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 <algorithm.cc>
|
||||
1894
extern/stdcxx/4.2.1/include/algorithm.cc
vendored
Normal file
1894
extern/stdcxx/4.2.1/include/algorithm.cc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
58
extern/stdcxx/4.2.1/include/ansi/_cassert.h
vendored
Normal file
58
extern/stdcxx/4.2.1/include/ansi/_cassert.h
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* _cassert.h - C++ Standard library interface to the ANSI C header assert.h
|
||||
*
|
||||
* $Id: _cassert.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
void _RWSTD_EXPORT
|
||||
__rw_assert_fail (const char*, const char*, int, const char*)
|
||||
_RWSTD_GNUC_ATTRIBUTE ((noreturn));
|
||||
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
#undef assert
|
||||
|
||||
#if !defined (NDEBUG)
|
||||
# if defined (__GNUG__) || defined (__HP_aCC)
|
||||
# define assert(expr) \
|
||||
((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __FILE__, __LINE__, \
|
||||
__PRETTY_FUNCTION__))
|
||||
# elif !defined (_RWSTD_NO_FUNC)
|
||||
# define assert(expr) \
|
||||
((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __FILE__, __LINE__, \
|
||||
__func__))
|
||||
# else // if !__GNUG__ && _RWSTD_NO_FUNC
|
||||
# define assert(expr) \
|
||||
((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __FILE__, __LINE__, 0))
|
||||
# endif
|
||||
#else // if !defined (NDEBUG)
|
||||
# define assert(ignore) ((void)0)
|
||||
#endif // NDEBUG
|
||||
59
extern/stdcxx/4.2.1/include/ansi/_cctype.h
vendored
Normal file
59
extern/stdcxx/4.2.1/include/ansi/_cctype.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* _cctype.h - C++ Standard library interface to the ANSI C header ctype.h
|
||||
*
|
||||
* $Id: _cctype.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CCTYPE_H_INCLUDED
|
||||
#define _RWSTD_CCTYPE_H_INCLUDED
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
extern "C" {
|
||||
|
||||
int isalnum (int);
|
||||
int isalpha (int);
|
||||
int iscntrl (int);
|
||||
int isdigit (int);
|
||||
int isgraph (int);
|
||||
int islower (int);
|
||||
int isprint (int);
|
||||
int ispunct (int);
|
||||
int isspace (int);
|
||||
int isupper (int);
|
||||
int isxdigit (int);
|
||||
int tolower (int);
|
||||
int toupper (int);
|
||||
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_CCTYPE_H_INCLUDED
|
||||
95
extern/stdcxx/4.2.1/include/ansi/_cerrno.h
vendored
Normal file
95
extern/stdcxx/4.2.1/include/ansi/_cerrno.h
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* _cerrno.h - C++ Standard library interface to the ANSI C header errno.h
|
||||
*
|
||||
* $Id: _cerrno.h 584948 2007-10-15 22:38:42Z 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 2005-2007 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CERRNO_H_INCLUDED
|
||||
#define _RWSTD_CERRNO_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern int* __errno_location ();
|
||||
|
||||
|
||||
// 17.4.1.2, p5 - errno may be a macro
|
||||
// lwg issue 310 - errno must be a macro
|
||||
#define errno (*_STD::__errno_location ())
|
||||
|
||||
|
||||
#define EDOM 33
|
||||
#define ERANGE 34
|
||||
|
||||
// lwg issue 288
|
||||
#define EILSEQ 84
|
||||
|
||||
} // extern "C"
|
||||
|
||||
} // namespace std
|
||||
|
||||
#elif defined (__sun__) || defined (__sun)
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern int errno;
|
||||
|
||||
extern int* ___errno ();
|
||||
|
||||
#ifdef _RWSTD_REENTRANT
|
||||
// 17.4.1.2, p5 - errno may be a macro
|
||||
// lwg issue 310 - errno must be a macro
|
||||
# define errno (*_STD::___errno ())
|
||||
#else // if !defined (_RWSTD_REENTRANT)
|
||||
# define errno _STD::errno
|
||||
#endif // _RWSTD_REENTRANT
|
||||
|
||||
|
||||
#define EDOM 33
|
||||
#define ERANGE 34
|
||||
|
||||
// lwg issue 288
|
||||
#define EILSEQ 84
|
||||
|
||||
} // extern "C"
|
||||
|
||||
} // namespace std
|
||||
|
||||
#else // if !__linux__ && !__sun__
|
||||
# include _RWSTD_ANSI_C_ERRNO_H
|
||||
#endif // __linux__
|
||||
|
||||
|
||||
#endif // _RWSTD_CERRNO_H_INCLUDED
|
||||
70
extern/stdcxx/4.2.1/include/ansi/_cfloat.h
vendored
Normal file
70
extern/stdcxx/4.2.1/include/ansi/_cfloat.h
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* _cfloat.h - C++ Standard library interface to the ANSI C header float.h
|
||||
*
|
||||
* $Id: _cfloat.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CFLOAT_H_INCLUDED
|
||||
#define _RWSTD_CFLOAT_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
#define FLT_ROUNDS _RWSTD_FLT_ROUNDS
|
||||
|
||||
#define FLT_DIG _RWSTD_FLT_DIG
|
||||
#define FLT_MANT_DIG _RWSTD_FLT_MANT_DIG
|
||||
#define FLT_MAX_10_EXP _RWSTD_FLT_MAX_10_EXP
|
||||
#define FLT_MAX_EXP _RWSTD_FLT_MAX_EXP
|
||||
#define FLT_MIN_10_EXP _RWSTD_FLT_MIN_10_EXP
|
||||
#define FLT_MIN_EXP _RWSTD_FLT_MIN_EXP
|
||||
#define FLT_RADIX _RWSTD_FLT_RADIX
|
||||
#define FLT_MAX _RWSTD_FLT_MAX
|
||||
#define FLT_MIN _RWSTD_FLT_MIN
|
||||
#define FLT_EPSILON _RWSTD_FLT_EPSILON
|
||||
|
||||
#define DBL_DIG _RWSTD_DBL_DIG
|
||||
#define DBL_MANT_DIG _RWSTD_DBL_MANT_DIG
|
||||
#define DBL_MAX_10_EXP _RWSTD_DBL_MAX_10_EXP
|
||||
#define DBL_MAX_EXP _RWSTD_DBL_MAX_EXP
|
||||
#define DBL_MIN_10_EXP _RWSTD_DBL_MIN_10_EXP
|
||||
#define DBL_MIN_EXP _RWSTD_DBL_MIN_EXP
|
||||
#define DBL_MAX _RWSTD_DBL_MAX
|
||||
#define DBL_MIN _RWSTD_DBL_MIN
|
||||
#define DBL_EPSILON _RWSTD_DBL_EPSILON
|
||||
|
||||
#define LDBL_DIG _RWSTD_LDBL_DIG
|
||||
#define LDBL_MANT_DIG _RWSTD_LDBL_MANT_DIG
|
||||
#define LDBL_MAX_10_EXP _RWSTD_LDBL_MAX_10_EXP
|
||||
#define LDBL_MAX_EXP _RWSTD_LDBL_MAX_EXP
|
||||
#define LDBL_MIN_10_EXP _RWSTD_LDBL_MIN_10_EXP
|
||||
#define LDBL_MIN_EXP _RWSTD_LDBL_MIN_EXP
|
||||
#define LDBL_MAX _RWSTD_LDBL_MAX
|
||||
#define LDBL_MIN _RWSTD_LDBL_MIN
|
||||
#define LDBL_EPSILON _RWSTD_LDBL_EPSILON
|
||||
|
||||
#endif // _RWSTD_CFLOAT_H_INCLUDED
|
||||
82
extern/stdcxx/4.2.1/include/ansi/_clocale.h
vendored
Normal file
82
extern/stdcxx/4.2.1/include/ansi/_clocale.h
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* _clocale.h - C++ Standard library interface to the ANSI C header locale.h
|
||||
*
|
||||
* $Id: _clocale.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CLOCALE_H_INCLUDED
|
||||
#define _RWSTD_CLOCALE_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
#ifndef LC_ALL
|
||||
# define LC_ALL _RWSTD_LC_ALL
|
||||
#endif // LC_ALL
|
||||
|
||||
#ifndef LC_COLLATE
|
||||
# define LC_COLLATE _RWSTD_LC_COLLATE
|
||||
#endif // LC_COLLATE
|
||||
|
||||
#ifndef LC_CTYPE
|
||||
# define LC_CTYPE _RWSTD_LC_CTYPE
|
||||
#endif // LC_CTYPE
|
||||
|
||||
#ifndef LC_MONETARY
|
||||
# define LC_MONETARY _RWSTD_LC_MONETARY
|
||||
#endif // LC_MONETARY
|
||||
|
||||
#ifndef LC_NUMERIC
|
||||
# define LC_NUMERIC _RWSTD_LC_NUMERIC
|
||||
#endif // LC_NUMERIC
|
||||
|
||||
#ifndef LC_TIME
|
||||
# define LC_TIME _RWSTD_LC_TIME
|
||||
#endif // LC_TIME
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif // NULL
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
struct lconv _RWSTD_LCONV;
|
||||
|
||||
char* setlocale (int, const char*);
|
||||
struct lconv* localeconv ();
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_CLOCALE_H_INCLUDED
|
||||
75
extern/stdcxx/4.2.1/include/ansi/_cmath.h
vendored
Normal file
75
extern/stdcxx/4.2.1/include/ansi/_cmath.h
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cmath - C++ Standard library interface to the ANSI C header math.h
|
||||
*
|
||||
* $Id: _cmath.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CMATH_H_INCLUDED
|
||||
#define _RWSTD_CMATH_H_INCLUDED
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
#ifndef HUGE_VAL
|
||||
# define HUGE_VAL _RWSTD_DBL_MAX
|
||||
#endif // HUGE_VAL
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
double acos (double);
|
||||
double asin (double);
|
||||
double atan (double);
|
||||
double atan2(double, double);
|
||||
double cos (double);
|
||||
double sin (double);
|
||||
double tan (double);
|
||||
double cosh (double);
|
||||
double sinh (double);
|
||||
double tanh (double);
|
||||
double exp (double);
|
||||
double frexp (double, int *);
|
||||
double ldexp (double, int);
|
||||
double log (double);
|
||||
double log10 (double);
|
||||
double modf (double, double*);
|
||||
double pow (double, double);
|
||||
double sqrt (double);
|
||||
double ceil (double);
|
||||
double fabs (double);
|
||||
double floor (double);
|
||||
double fmod (double, double);
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_CMATH_H_INCLUDED
|
||||
55
extern/stdcxx/4.2.1/include/ansi/_csetjmp.h
vendored
Normal file
55
extern/stdcxx/4.2.1/include/ansi/_csetjmp.h
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* csetjmp - C++ Standard library interface to the ANSI C header setjmp.h
|
||||
*
|
||||
* $Id: _csetjmp.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CSETJMP_H_INCLUDED
|
||||
#define _RWSTD_CSETJMP_H_INCLUDED
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
typedef char jmp_buf [8];
|
||||
|
||||
int setjmp (jmp_buf);
|
||||
void longjmp (jmp_buf, int);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
// 18.7, p1, Table 20
|
||||
#define setjmp _RWSTD_C::setjmp
|
||||
|
||||
|
||||
#endif // _RWSTD_CSETJMP_H_INCLUDED
|
||||
101
extern/stdcxx/4.2.1/include/ansi/_csignal.h
vendored
Normal file
101
extern/stdcxx/4.2.1/include/ansi/_csignal.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* csignal - C++ Standard library interface to the ANSI C header signal.h
|
||||
*
|
||||
* $Id: _csignal.h 497651 2007-01-19 00:16:30Z 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 2001-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CSIGNAL_H_INCLUDED
|
||||
#define _RWSTD_CSIGNAL_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#ifndef SIGABRT
|
||||
# define SIGABRT _RWSTD_SIGABRT
|
||||
#endif // SIGABRT
|
||||
|
||||
#ifndef SIGFPE
|
||||
# define SIGFPE _RWSTD_SIGFPE
|
||||
#endif // SIGFPE
|
||||
|
||||
#ifndef SIGILL
|
||||
# define SIGILL _RWSTD_SIGILL
|
||||
#endif // SIGILL
|
||||
|
||||
#ifndef SIGINT
|
||||
# define SIGINT _RWSTD_SIGINT
|
||||
#endif // SIGINT
|
||||
|
||||
#ifndef SIGSEGV
|
||||
# define SIGSEGV _RWSTD_SIGSEGV
|
||||
#endif // SIGSEGV
|
||||
|
||||
#ifndef SIGTERM
|
||||
# define SIGTERM _RWSTD_SIGTERM
|
||||
#endif // SIGTERM
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
#ifdef _RWSTD_SIG_ATOMIC_T
|
||||
typedef _RWSTD_SIG_ATOMIC_T sig_atomic_t;
|
||||
#else
|
||||
typedef long sig_atomic_t;
|
||||
#endif // _RWSTD_SIG_ATOMIC_T
|
||||
|
||||
|
||||
// helper type (necessary in order to be extern "C")
|
||||
typedef void __rw_sighandler_t (int);
|
||||
|
||||
#ifndef SIG_DFL
|
||||
# define SIG_DFL \
|
||||
_RWSTD_REINTERPRET_CAST (_STD::__rw_sighandler_t*, _RWSTD_SIG_DFL)
|
||||
#endif // SIG_DFL
|
||||
|
||||
#ifndef SIG_ERR
|
||||
# define SIG_ERR \
|
||||
_RWSTD_REINTERPRET_CAST (_STD::__rw_sighandler_t*, _RWSTD_SIG_ERR)
|
||||
#endif // SIG_ERR
|
||||
|
||||
#ifndef SIG_IGN
|
||||
# define SIG_IGN \
|
||||
_RWSTD_REINTERPRET_CAST (_STD::__rw_sighandler_t*, _RWSTD_SIG_IGN)
|
||||
#endif // SIG_IGN
|
||||
|
||||
|
||||
void (*signal(int, void (*)(int))) (int);
|
||||
int raise (int);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_CSIGNAL_H_INCLUDED
|
||||
62
extern/stdcxx/4.2.1/include/ansi/_cstdarg.h
vendored
Normal file
62
extern/stdcxx/4.2.1/include/ansi/_cstdarg.h
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* _cstdarg.h - C++ Standard library interface to the ANSI C header stdarg.h
|
||||
*
|
||||
* $Id: _cstdarg.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CSTDARG_H_INCLUDED
|
||||
#define _RWSTD_CSTDARG_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
extern "C" {
|
||||
|
||||
#ifdef _RWSTD_VA_LIST
|
||||
typedef _RWSTD_VA_LIST va_list;
|
||||
#else
|
||||
typedef void* va_list;
|
||||
#endif // _RWSTD_VA_LIST
|
||||
|
||||
|
||||
#define va_arg(va, T) \
|
||||
((T*)(va = (va_list)((char*)va + sizeof (T))))[-1]
|
||||
|
||||
#define va_start(va, name) \
|
||||
(void)(va = (va_list)((char*)&name \
|
||||
+ ((sizeof (name) + (sizeof (int) - 1)) & ~(sizeof (int) - 1))))
|
||||
|
||||
#define va_end(ignore) (void)0
|
||||
|
||||
} // extern "C"
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_CSTDARG_H_INCLUDED
|
||||
69
extern/stdcxx/4.2.1/include/ansi/_cstddef.h
vendored
Normal file
69
extern/stdcxx/4.2.1/include/ansi/_cstddef.h
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* _cstddef.h - C++ Standard library interface to the ANSI C header stddef.h
|
||||
*
|
||||
* $Id: _cstddef.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CSTDDEF_H_INCLUDED
|
||||
#define _RWSTD_CSTDDEF_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif // NULL
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
#ifdef _RWSTD_PTRDIFF_T
|
||||
typedef _RWSTD_PTRDIFF_T ptrdiff_t;
|
||||
#else
|
||||
typedef long ptrdiff_t;
|
||||
#endif // _RWSTD_PTRDIFF_T
|
||||
|
||||
#ifdef _RWSTD_SIZE_T
|
||||
typedef _RWSTD_SIZE_T size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif // _RWSTD_SIZE_T
|
||||
|
||||
|
||||
#define offsetof(class, member) ((size_t)&(((class*)0)->member))
|
||||
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_CSTDDEF_H_INCLUDED
|
||||
193
extern/stdcxx/4.2.1/include/ansi/_cstdio.h
vendored
Normal file
193
extern/stdcxx/4.2.1/include/ansi/_cstdio.h
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cstdio - C++ Standard library interface to the ANSI C header stdio.h
|
||||
*
|
||||
* $Id: _cstdio.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CSTDIO_H_INCLUDED
|
||||
#define _RWSTD_CSTDIO_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#ifdef __linux__
|
||||
// prevent multiple definitions of SEEK_XXX constants
|
||||
// when Linux glibc's <unistd.h> is #included
|
||||
# define _STDIO_H
|
||||
#endif // __linux__
|
||||
|
||||
|
||||
#ifndef _IOFBF
|
||||
# define _IOFBF _RWSTD_IOFBF
|
||||
#endif
|
||||
|
||||
#ifndef _IOLBF
|
||||
# define _IOLBF _RWSTD_IOLBF
|
||||
#endif
|
||||
|
||||
#ifndef _IONBF
|
||||
# define _IONBF _RWSTD_IONBF
|
||||
#endif
|
||||
|
||||
#ifndef BUFSIZ
|
||||
# define BUFSIZ _RWSTD_BUFSIZ
|
||||
#endif
|
||||
|
||||
#ifndef EOF
|
||||
# define EOF _RWSTD_EOF
|
||||
#endif
|
||||
|
||||
struct FILE;
|
||||
|
||||
#ifndef FILE
|
||||
# define FILE FILE
|
||||
#endif
|
||||
|
||||
#ifndef FILENAME_MAX
|
||||
# define FILENAME_MAX _RWSTD_FILENAME_MAX
|
||||
#endif
|
||||
|
||||
#ifndef FOPEN_MAX
|
||||
# define FOPEN_MAX _RWSTD_FOPEN_MAX
|
||||
#endif
|
||||
|
||||
#ifndef L_tmpnam
|
||||
# define L_tmpnam _RWSTD_L_TMPNAM
|
||||
#endif // L_tmpnam
|
||||
|
||||
#ifndef SEEK_CUR
|
||||
# define SEEK_CUR _RWSTD_SEEK_CUR
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_END
|
||||
# define SEEK_END _RWSTD_SEEK_END
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET _RWSTD_SEEK_SET
|
||||
#endif
|
||||
|
||||
#ifndef stderr
|
||||
# define stderr _RW::__rw_stderr
|
||||
#endif
|
||||
|
||||
#ifndef stdin
|
||||
# define stdin _RW::__rw_stdin
|
||||
#endif
|
||||
|
||||
#ifndef stdout
|
||||
# define stdout _RW::__rw_stdout
|
||||
#endif
|
||||
|
||||
#ifndef TMP_MAX
|
||||
# define TMP_MAX _RWSTD_TMP_MAX
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
|
||||
#ifdef _RWSTD_SIZE_T
|
||||
typedef _RWSTD_SIZE_T size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif // _RWSTD_SIZE_T
|
||||
|
||||
|
||||
#ifdef _RWSTD_FPOS_T
|
||||
typedef _RWSTD_FPOS_T fpos_t;
|
||||
#elif defined (_RWSTD_FPOS_T_SIZE)
|
||||
|
||||
struct fpos_t
|
||||
{
|
||||
char _C_fill [_RWSTD_FPOS_T_SIZE];
|
||||
};
|
||||
|
||||
#else
|
||||
typedef long fpos_t;
|
||||
#endif // _RWSTD_FPOS_T
|
||||
|
||||
|
||||
int remove (const char*);
|
||||
int rename (const char*, const char*);
|
||||
FILE* tmpfile (void);
|
||||
char* tmpnam (char*);
|
||||
int fclose (FILE*);
|
||||
int fflush (FILE*);
|
||||
FILE* fopen (const char*, const char*);
|
||||
FILE* freopen (const char*, const char*, FILE*);
|
||||
void setbuf (FILE*, char*);
|
||||
int setvbuf (FILE*, char*, int, size_t);
|
||||
int fprintf (FILE*, const char*, ...);
|
||||
int fscanf (FILE*, const char*, ...);
|
||||
int printf (const char*, ...);
|
||||
int scanf (const char*, ...);
|
||||
int sprintf (char*, const char*, ...);
|
||||
int sscanf (const char*, const char*, ...);
|
||||
int vfprintf (FILE*, const char*, _RWSTD_VA_LIST);
|
||||
int vprintf (const char*, _RWSTD_VA_LIST);
|
||||
int vsprintf (char*, const char*, _RWSTD_VA_LIST);
|
||||
int fgetc (FILE*);
|
||||
char* fgets (char*, int , FILE*);
|
||||
int fputc (int, FILE*);
|
||||
int fputs (const char*, FILE*);
|
||||
int getc (FILE*);
|
||||
int getchar (void);
|
||||
char* gets (char*);
|
||||
int putc (int, FILE*);
|
||||
int putchar (int);
|
||||
int puts (const char*);
|
||||
int ungetc (int c, FILE*);
|
||||
size_t fread (void*, size_t size, size_t, FILE*);
|
||||
size_t fwrite (const void*, size_t, size_t, FILE*);
|
||||
int fgetpos (FILE*, fpos_t*);
|
||||
int fseek (FILE*, long, int);
|
||||
int fsetpos (FILE*, const fpos_t*);
|
||||
long ftell (FILE*);
|
||||
void rewind (FILE*);
|
||||
void clearerr (FILE*);
|
||||
int feof (FILE*);
|
||||
int ferror (FILE*);
|
||||
void perror (const char*);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
extern _STD::FILE* __rw_stdin;
|
||||
extern _STD::FILE* __rw_stdout;
|
||||
extern _STD::FILE* __rw_stderr;
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
|
||||
#endif // _RWSTD_CSTDIO_H_INCLUDED
|
||||
167
extern/stdcxx/4.2.1/include/ansi/_cstdlib.h
vendored
Normal file
167
extern/stdcxx/4.2.1/include/ansi/_cstdlib.h
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cstdlib - C++ Standard library interface to the ANSI C header stdlib.h
|
||||
*
|
||||
* $Id: _cstdlib.h 497905 2007-01-19 18:51:23Z 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 2001-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CSTDLIB_H_INCLUDED
|
||||
#define _RWSTD_CSTDLIB_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
#ifndef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
#ifndef EXIT_SUCCESS
|
||||
# define EXIT_SUCCESS 0
|
||||
#endif
|
||||
|
||||
#ifndef MB_CUR_MAX
|
||||
# define MB_CUR_MAX _RWSTD_MB_CUR_MAX
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef RAND_MAX
|
||||
# define RAND_MAX _RWSTD_RAND_MAX
|
||||
#endif
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
struct div_t
|
||||
{
|
||||
// traditional layout (e.g., HP-UX, Linux, Solaris)
|
||||
int quot;
|
||||
int rem;
|
||||
};
|
||||
|
||||
struct ldiv_t
|
||||
{
|
||||
// traditional layout (e.g., HP-UX, Linux, Solaris)
|
||||
long quot;
|
||||
long rem;
|
||||
};
|
||||
|
||||
|
||||
#ifdef _RWSTD_SIZE_T
|
||||
typedef _RWSTD_SIZE_T size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif // _RWSTD_SIZE_T
|
||||
|
||||
|
||||
double atof (const char*);
|
||||
int atoi (const char*);
|
||||
long int atol (const char*);
|
||||
double strtod (const char*, char**);
|
||||
long int strtol (const char*, char**, int);
|
||||
unsigned long int strtoul (const char*, char**, int);
|
||||
int rand (void);
|
||||
void srand (unsigned int);
|
||||
void* calloc (size_t, size_t);
|
||||
void free (void*);
|
||||
void* malloc (size_t) ;
|
||||
void* realloc (void*, size_t);
|
||||
void abort (void);
|
||||
int atexit (void (*) (void));
|
||||
void exit (int);
|
||||
char* getenv (const char*);
|
||||
int system (const char*);
|
||||
void* bsearch (const void*, const void*, size_t, size_t,
|
||||
int (*) (const void*, const void*));
|
||||
void qsort (void*, size_t, size_t, int (*) (const void *, const void *));
|
||||
int abs (int);
|
||||
div_t div (int, int);
|
||||
long int labs (long int);
|
||||
ldiv_t ldiv (long int, long int);
|
||||
int mblen (const char*, size_t);
|
||||
int mbtowc (wchar_t*, const char*, size_t);
|
||||
int wctomb (char*, wchar_t);
|
||||
size_t mbstowcs (wchar_t*, const char*, size_t);
|
||||
size_t wcstombs (char*, const wchar_t*, size_t);
|
||||
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#ifndef _RWSTD_NO_EXTERN_C_COMPATIBILITY
|
||||
# ifndef _RWSTD_NO_EXTERN_C_OVERLOAD
|
||||
|
||||
extern "C" {
|
||||
typedef int (*__rw_compar_t)(const void*, const void*);
|
||||
}
|
||||
|
||||
extern "C++" {
|
||||
|
||||
// 25.4, p3 of ISO/IEC 14882:1998
|
||||
inline void*
|
||||
bsearch (const void *__key, const void *__base, size_t __n, size_t __size,
|
||||
int (*__cmp)(const void*, const void*))
|
||||
{
|
||||
return bsearch (__key, __base, __n, __size,
|
||||
_RWSTD_REINTERPRET_CAST (__rw_compar_t, __cmp));
|
||||
}
|
||||
|
||||
// 25.4, p4 of ISO/IEC 14882:1998
|
||||
inline void
|
||||
qsort (void *__base, size_t __n, size_t __size,
|
||||
int (*__cmp)(const void*, const void*))
|
||||
{
|
||||
return _RWSTD_C::qsort (__base, __n, __size,
|
||||
_RWSTD_REINTERPRET_CAST (__rw_compar_t, __cmp));
|
||||
}
|
||||
|
||||
inline long
|
||||
abs (long __x)
|
||||
{
|
||||
return labs (__x);
|
||||
}
|
||||
|
||||
inline ldiv_t
|
||||
div (long __x, long __y)
|
||||
{
|
||||
return ldiv (__x, __y);
|
||||
}
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
# endif // _RWSTD_NO_EXTERN_C_OVERLOAD
|
||||
#endif // _RWSTD_NO_EXTERN_C_COMPATIBILITY
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_CSTDLIB_H_INCLUDED
|
||||
114
extern/stdcxx/4.2.1/include/ansi/_cstring.h
vendored
Normal file
114
extern/stdcxx/4.2.1/include/ansi/_cstring.h
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cstring - C++ Standard library interface to the ANSI C header string.h
|
||||
*
|
||||
* $Id: _cstring.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CSTRING_H_INCLUDED
|
||||
#define _RWSTD_CSTRING_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif // NULL
|
||||
|
||||
extern "C" {
|
||||
|
||||
#ifdef _RWSTD_SIZE_T
|
||||
typedef _RWSTD_SIZE_T size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif // _RWSTD_SIZE_T
|
||||
|
||||
|
||||
void* memcpy (void*, const void*, size_t);
|
||||
void* memmove (void*, const void*, size_t);
|
||||
char* strcpy (char*, const char*);
|
||||
char* strncpy (char*, const char*, size_t);
|
||||
char* strcat (char*, const char*);
|
||||
char* strncat (char*, const char*, size_t);
|
||||
int memcmp (const void*, const void*, size_t);
|
||||
int strcmp (const char*, const char*);
|
||||
int strcoll (const char*, const char*);
|
||||
int strncmp (const char*, const char*, size_t);
|
||||
size_t strxfrm (char*, const char*, size_t);
|
||||
void* memchr (void*, int, size_t); // 21.4, p12 of ISO/IEC 14882:1998
|
||||
char* strchr (char*, int); // 21.4, p4 of ISO/IEC 14882:1998
|
||||
size_t strcspn (const char*, const char*);
|
||||
char* strpbrk (char*, const char*); // 21.4, p6 of ISO/IEC 14882:1998
|
||||
char* strrchr (char*, int); // 21.4, p8 of ISO/IEC 14882:1998
|
||||
size_t strspn (const char*, const char*);
|
||||
char* strstr (char*, const char*); // 21.4, p10 of ISO/IEC 14882:1998
|
||||
char* strtok (char*, const char*);
|
||||
void* memset (void*, int, size_t);
|
||||
char* strerror (int);
|
||||
size_t strlen (const char*);
|
||||
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
// 21.4, p12 of ISO/IEC 14882:1998
|
||||
inline const void* memchr (const void *__p, int __c, size_t __n)
|
||||
{
|
||||
return memchr (_RWSTD_CONST_CAST (void*, __p), __c, __n);
|
||||
}
|
||||
|
||||
// 21.4, p4 of ISO/IEC 14882:1998
|
||||
inline const char* strchr (const char *__s, int __c)
|
||||
{
|
||||
return strchr (_RWSTD_CONST_CAST (char*, __s), __c);
|
||||
}
|
||||
|
||||
// 21.4, p6 of ISO/IEC 14882:1998
|
||||
inline const char* strpbrk (const char *__s1, const char *__s2)
|
||||
{
|
||||
return strpbrk (_RWSTD_CONST_CAST (char*, __s1), __s2);
|
||||
}
|
||||
|
||||
// 21.4, p8 of ISO/IEC 14882:1998
|
||||
inline const char* strrchr (const char *__s, int __c)
|
||||
{
|
||||
return strrchr (_RWSTD_CONST_CAST (char*, __s), __c);
|
||||
}
|
||||
|
||||
// 21.4, p10 of ISO/IEC 14882:1998
|
||||
inline const char* strstr (const char *__s1, const char *__s2)
|
||||
{
|
||||
return strstr (_RWSTD_CONST_CAST (char*, __s1), __s2);
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_CSTRING_H_INCLUDED
|
||||
91
extern/stdcxx/4.2.1/include/ansi/_ctime.h
vendored
Normal file
91
extern/stdcxx/4.2.1/include/ansi/_ctime.h
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* ctime - C++ Standard library interface to the ANSI C header time.h
|
||||
*
|
||||
* $Id: _ctime.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CTIME_H_INCLUDED
|
||||
#define _RWSTD_CTIME_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
#ifndef CLOCKS_PER_SEC
|
||||
# define CLOCKS_PER_SEC _RWSTD_CLOCKS_PER_SEC
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _RWSTD_CLOCK_T
|
||||
typedef _RWSTD_CLOCK_T clock_t;
|
||||
#else
|
||||
typedef long clock_t;
|
||||
#endif // _RWSTD_CLOCK_T
|
||||
|
||||
#ifdef _RWSTD_TIME_T
|
||||
typedef _RWSTD_TIME_T time_t;
|
||||
#else
|
||||
typedef long time_t;
|
||||
#endif // _RWSTD_TIME_T
|
||||
|
||||
#ifdef _RWSTD_SIZE_T
|
||||
typedef _RWSTD_SIZE_T size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif // _RWSTD_SIZE_T
|
||||
|
||||
|
||||
struct tm _RWSTD_STRUCT_TM;
|
||||
|
||||
|
||||
clock_t clock ();
|
||||
double difftime (time_t, time_t);
|
||||
time_t mktime (struct tm*);
|
||||
time_t time (time_t*);
|
||||
char* asctime (const struct tm*);
|
||||
char* ctime (const time_t*);
|
||||
struct tm* gmtime (const time_t*);
|
||||
struct tm* localtime (const time_t*);
|
||||
size_t strftime (char*, size_t, const char*, const struct tm*);
|
||||
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_CTIME_H_INCLUDED
|
||||
176
extern/stdcxx/4.2.1/include/ansi/_cwchar.h
vendored
Normal file
176
extern/stdcxx/4.2.1/include/ansi/_cwchar.h
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cwchar - C++ Standard library interface to the ANSI C header wchar.h
|
||||
*
|
||||
* $Id: _cwchar.h 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CWCHAR_H_INCLUDED
|
||||
#define _RWSTD_CWCHAR_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_mbstate.h> // for _RWSTD_MBSTATE_T
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif // NULL
|
||||
|
||||
#ifdef _RWSTD_SIZE_T
|
||||
typedef _RWSTD_SIZE_T size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif // _RWSTD_SIZE_T
|
||||
|
||||
extern "C" {
|
||||
|
||||
// _RWSTD_MBSTATE_T is defined in <rw/_mbstate.h>
|
||||
typedef _RWSTD_MBSTATE_T mbstate_t;
|
||||
|
||||
struct tm;
|
||||
|
||||
#ifndef WCHAR_MIN
|
||||
# define WCHAR_MIN _RWSTD_WCHAR_MIN
|
||||
#endif // WCHAR_MIN
|
||||
|
||||
#ifndef WCHAR_MAX
|
||||
# define WCHAR_MAX _RWSTD_WCHAR_MAX
|
||||
#endif // WCHAR_MAX
|
||||
|
||||
#ifndef WEOF
|
||||
# define WEOF _RWSTD_WEOF
|
||||
#endif // WEOF
|
||||
|
||||
#ifndef _RWSTD_NO_WINT_T
|
||||
typedef _RWSTD_WINT_T wint_t;
|
||||
#else
|
||||
typedef int wint_t;
|
||||
#endif // _RWSTD_NO_WINT_T
|
||||
|
||||
// declared, not defined (FILE need not be a complete type)
|
||||
struct FILE;
|
||||
|
||||
int fwprintf (FILE*, const wchar_t*, ...);
|
||||
int fwscanf (FILE*, const wchar_t*, ...);
|
||||
int wprintf (const wchar_t*, ...);
|
||||
int wscanf (const wchar_t*, ...);
|
||||
int swprintf (wchar_t*, size_t, const wchar_t*, ...);
|
||||
int swscanf (const wchar_t*, const wchar_t*, ...);
|
||||
int vfwprintf (FILE*, const wchar_t *format, _RWSTD_VA_LIST);
|
||||
int vwprintf (const wchar_t*, _RWSTD_VA_LIST);
|
||||
int vswprintf (wchar_t*, size_t, const wchar_t*, _RWSTD_VA_LIST);
|
||||
wint_t fgetwc (FILE*);
|
||||
wchar_t* fgetws (wchar_t*, int, FILE*);
|
||||
wint_t fputwc (wchar_t, FILE*);
|
||||
int fputws (const wchar_t*, FILE*);
|
||||
wint_t getwc (FILE*);
|
||||
wint_t getwchar();
|
||||
wint_t putwc (wchar_t, FILE*);
|
||||
wint_t putwchar (wchar_t);
|
||||
wint_t ungetwc (wint_t, FILE*);
|
||||
int fwide (FILE*, int);
|
||||
double wcstod (const wchar_t*, wchar_t**);
|
||||
long int wcstol (const wchar_t*, wchar_t**, int);
|
||||
unsigned long int wcstoul (const wchar_t*, wchar_t**, int);
|
||||
wchar_t* wcscpy (wchar_t*, const wchar_t*);
|
||||
wchar_t* wcsncpy (wchar_t*, const wchar_t*, size_t);
|
||||
wchar_t* wcscat (wchar_t*, const wchar_t*);
|
||||
wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t);
|
||||
int wcscmp (const wchar_t*, const wchar_t*);
|
||||
int wcscoll (const wchar_t*, const wchar_t*);
|
||||
int wcsncmp (const wchar_t*, const wchar_t*, size_t);
|
||||
size_t wcsxfrm (wchar_t*, const wchar_t*, size_t);
|
||||
wchar_t* wcschr (wchar_t*, wchar_t);
|
||||
size_t wcscspn (const wchar_t*, const wchar_t*);
|
||||
wchar_t* wcspbrk (wchar_t*, const wchar_t*);
|
||||
wchar_t* wcsrchr (wchar_t*, wchar_t);
|
||||
size_t wcsspn (const wchar_t*, const wchar_t*);
|
||||
wchar_t* wcsstr (wchar_t*, const wchar_t*);
|
||||
wchar_t* wcstok (wchar_t*, const wchar_t*, wchar_t**);
|
||||
size_t wcslen (const wchar_t*);
|
||||
wchar_t* wmemchr (wchar_t*, wchar_t, size_t);
|
||||
int wmemcmp (const wchar_t*, const wchar_t*, size_t);
|
||||
wchar_t* wmemcpy (wchar_t*, const wchar_t*, size_t);
|
||||
wchar_t* wmemmove (wchar_t*, const wchar_t*, size_t);
|
||||
wchar_t* wmemset (wchar_t*, wchar_t, size_t);
|
||||
|
||||
size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
|
||||
wint_t btowc (int);
|
||||
int wctob (wint_t);
|
||||
|
||||
int mbsinit (const mbstate_t*);
|
||||
size_t mbrlen (const char*, size_t, mbstate_t*);
|
||||
size_t mbrtowc (wchar_t*, const char*, size_t, mbstate_t*);
|
||||
size_t wcrtomb (char*, wchar_t, mbstate_t*);
|
||||
size_t mbsrtowcs (wchar_t*, const char**, size_t, mbstate_t*);
|
||||
size_t wcsrtombs (char*, const wchar_t**, size_t, mbstate_t*);
|
||||
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
// 21.4, p14 of ISO/IEC 14882:1998
|
||||
inline const wchar_t* wcschr (const wchar_t *__s, wchar_t __c)
|
||||
{
|
||||
return wcschr (_RWSTD_CONST_CAST (wchar_t*, __s), __c);
|
||||
}
|
||||
|
||||
|
||||
// 21.4, p16 of ISO/IEC 14882:1998
|
||||
inline const wchar_t* wcspbrk (const wchar_t *__s1, const wchar_t *__s2)
|
||||
{
|
||||
return wcspbrk (_RWSTD_CONST_CAST (wchar_t*, __s1), __s2);
|
||||
}
|
||||
|
||||
|
||||
// 21.4, p18 of ISO/IEC 14882:1998
|
||||
inline const wchar_t* wcsrchr (const wchar_t *__s, wchar_t __c)
|
||||
{
|
||||
return wcsrchr (_RWSTD_CONST_CAST (wchar_t*, __s), __c);
|
||||
}
|
||||
|
||||
|
||||
// 21.4, p20 of ISO/IEC 14882:1998
|
||||
inline const wchar_t* wcsstr (const wchar_t *__s1, const wchar_t *__s2)
|
||||
{
|
||||
return wcsstr (_RWSTD_CONST_CAST (wchar_t*, __s1), __s2);
|
||||
}
|
||||
|
||||
|
||||
// 21.4, p22 of ISO/IEC 14882:1998
|
||||
inline const wchar_t* wmemchr (const wchar_t *__p, wchar_t __c, size_t __n)
|
||||
{
|
||||
return wmemchr (_RWSTD_CONST_CAST (wchar_t*, __p), __c, __n);
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_CWCHAR_H_INCLUDED
|
||||
91
extern/stdcxx/4.2.1/include/ansi/_cwctype.h
vendored
Normal file
91
extern/stdcxx/4.2.1/include/ansi/_cwctype.h
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cwctype - C++ Standard library interface to the ANSI C header wctype.h
|
||||
*
|
||||
* $Id: _cwctype.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CWCTYPE_H_INCLUDED
|
||||
#define _RWSTD_CWCTYPE_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
#ifndef WEOF
|
||||
# define WEOF _RWSTD_WEOF
|
||||
#endif // WEOF
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
#ifdef _RWSTD_WCTRANS_T
|
||||
typedef _RWSTD_WCTRANS_T wctrans_t;
|
||||
#else
|
||||
typedef int wctrans_t;
|
||||
#endif // _RWSTD_WCTRANS_T
|
||||
|
||||
#ifdef _RWSTD_WCTYPE_T
|
||||
typedef _RWSTD_WCTYPE_T wctype_t;
|
||||
#else
|
||||
typedef int wctype_t;
|
||||
#endif // _RWSTD_WCTYPE_T
|
||||
|
||||
#ifdef _RWSTD_WINT_T
|
||||
typedef _RWSTD_WINT_T wint_t;
|
||||
#else
|
||||
typedef long wint_t;
|
||||
#endif // _RWSTD_WINT_T
|
||||
|
||||
|
||||
int iswalnum (wint_t);
|
||||
int iswalpha (wint_t);
|
||||
int iswcntrl (wint_t);
|
||||
int iswdigit (wint_t);
|
||||
int iswgraph (wint_t);
|
||||
int iswlower (wint_t);
|
||||
int iswprint (wint_t);
|
||||
int iswpunct (wint_t);
|
||||
int iswspace (wint_t);
|
||||
int iswupper (wint_t);
|
||||
int iswxdigit (wint_t);
|
||||
wctype_t wctype (const char*);
|
||||
int iswctype (wint_t, wctype_t);
|
||||
wint_t towlower (wint_t);
|
||||
wint_t towupper (wint_t);
|
||||
wctrans_t wctrans (const char*);
|
||||
wint_t towctrans (wint_t, wctrans_t);
|
||||
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_CWCTYPE_H_INCLUDED
|
||||
35
extern/stdcxx/4.2.1/include/ansi/assert.h
vendored
Normal file
35
extern/stdcxx/4.2.1/include/ansi/assert.h
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* assert.h
|
||||
*
|
||||
* $Id: assert.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
# include <cassert>
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_ASSERT_H
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
36
extern/stdcxx/4.2.1/include/ansi/cassert
vendored
Normal file
36
extern/stdcxx/4.2.1/include/ansi/cassert
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cassert - C++ Standard library interface to the ANSI C header assert.h
|
||||
*
|
||||
* $Id: cassert 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_cassert.h>
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_ASSERT_H
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
121
extern/stdcxx/4.2.1/include/ansi/cctype
vendored
Normal file
121
extern/stdcxx/4.2.1/include/ansi/cctype
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cctype - C++ Standard library interface to the ANSI C header ctype.h
|
||||
*
|
||||
* $Id: cctype 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_cctype.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 2
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_CTYPE_H
|
||||
|
||||
// 17.4.1.2, p6 - masking macros are not allowed
|
||||
#undef isalnum
|
||||
#undef isalpha
|
||||
#undef iscntrl
|
||||
#undef isdigit
|
||||
#undef isgraph
|
||||
#undef islower
|
||||
#undef isprint
|
||||
#undef ispunct
|
||||
#undef isspace
|
||||
#undef isupper
|
||||
#undef isxdigit
|
||||
#undef tolower
|
||||
#undef toupper
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 2
|
||||
# undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 2
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CCTYPE_INCLUDED
|
||||
#define _RWSTD_CCTYPE_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_CTYPE_H
|
||||
|
||||
// 17.4.1.2, p6 - masking macros are not allowed
|
||||
#undef isalnum
|
||||
#undef isalpha
|
||||
#undef iscntrl
|
||||
#undef isdigit
|
||||
#undef isgraph
|
||||
#undef islower
|
||||
#undef isprint
|
||||
#undef ispunct
|
||||
#undef isspace
|
||||
#undef isupper
|
||||
#undef isxdigit
|
||||
#undef tolower
|
||||
#undef toupper
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_HONOR_STD) && \
|
||||
!defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
namespace std {
|
||||
|
||||
// 7.3 of C89
|
||||
using ::isalnum;
|
||||
using ::isalpha;
|
||||
using ::iscntrl;
|
||||
using ::isdigit;
|
||||
using ::isgraph;
|
||||
using ::islower;
|
||||
using ::isprint;
|
||||
using ::ispunct;
|
||||
using ::isspace;
|
||||
using ::isupper;
|
||||
using ::isxdigit;
|
||||
using ::tolower;
|
||||
using ::toupper;
|
||||
|
||||
} // std
|
||||
|
||||
#endif // !_RWSTD_NO_NAMESPACE && !_RWSTD_NO_HONOR_STD && !_RWSTD_NO_USING_LIBC_IN_STD
|
||||
|
||||
#endif // _RWSTD_CCTYPE_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
86
extern/stdcxx/4.2.1/include/ansi/cerrno
vendored
Normal file
86
extern/stdcxx/4.2.1/include/ansi/cerrno
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cerrno - C++ Standard library interface to the ANSI C header errno.h
|
||||
*
|
||||
* $Id: cerrno 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_cerrno.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 3
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_ERRNO_H
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 3
|
||||
# undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 3
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CERRNO_INCLUDED
|
||||
#define _RWSTD_CERRNO_INCLUDED
|
||||
|
||||
#if !defined (errno) \
|
||||
|| !defined (EDOM) || !defined (ERANGE) || !defined (EAGAIN)
|
||||
# include _RWSTD_ANSI_C_ERRNO_H
|
||||
#endif // errno ...
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
namespace std {
|
||||
|
||||
// 17.4.1.2, p5 - errno may be a macro
|
||||
#ifndef errno
|
||||
using ::errno;
|
||||
|
||||
// lwg issue 310 - errno shall be a macro
|
||||
# define errno errno
|
||||
#endif // errno
|
||||
|
||||
} // std
|
||||
|
||||
#endif // !_RWSTD_NO_NAMESPACE && !_RWSTD_NO_USING_LIBC_IN_STD
|
||||
|
||||
#endif // _RWSTD_CERRNO_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
77
extern/stdcxx/4.2.1/include/ansi/cfloat
vendored
Normal file
77
extern/stdcxx/4.2.1/include/ansi/cfloat
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cfloat - C++ Standard library interface to the ANSI C header float.h
|
||||
*
|
||||
* $Id: cfloat 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_cfloat.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 4
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_FLOAT_H
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 4
|
||||
# undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 4
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
# ifndef _RWSTD_CFLOAT_INCLUDED
|
||||
# define _RWSTD_CFLOAT_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_FLOAT_H
|
||||
|
||||
# endif // _RWSTD_CFLOAT_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
# if defined (__EDG__) && defined (__linux__) && !defined (__INTEL_COMPILER)
|
||||
|
||||
// avoid relying on dubious gcc extensions
|
||||
# undef LDBL_MIN
|
||||
# undef LDBL_MAX
|
||||
# define LDBL_MIN _RWSTD_LDBL_MIN
|
||||
# define LDBL_MAX _RWSTD_LDBL_MAX
|
||||
|
||||
# endif // __EDG__ && __linux__ && !__INTEL_COMPILER
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
32
extern/stdcxx/4.2.1/include/ansi/ciso646
vendored
Normal file
32
extern/stdcxx/4.2.1/include/ansi/ciso646
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* ciso646 - C++ Standard library interface to the ANSI C header iso646.h
|
||||
*
|
||||
* $Id: ciso646 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#include _RWSTD_ANSI_C_ISO646_H
|
||||
124
extern/stdcxx/4.2.1/include/ansi/climits
vendored
Normal file
124
extern/stdcxx/4.2.1/include/ansi/climits
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* climits - C++ Standard library interface to the ANSI C header limits.h
|
||||
*
|
||||
* $Id: climits 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-2008 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_CLIMITS_INCLUDED
|
||||
#define _RWSTD_CLIMITS_INCLUDED
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_PURE_C_HEADERS) || defined (_RWSTD_NO_LIMITS_H)
|
||||
|
||||
// 18.2.2, p1
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT _RWSTD_CHAR_BIT
|
||||
#endif // CHAR_BIT
|
||||
|
||||
#ifndef CHAR_MAX
|
||||
# define CHAR_MAX _RWSTD_CHAR_MAX
|
||||
#endif // CHAR_MAX
|
||||
|
||||
#ifndef CHAR_MIN
|
||||
# define CHAR_MIN _RWSTD_CHAR_MIN
|
||||
#endif // CHAR_MIN
|
||||
|
||||
#ifndef SCHAR_MAX
|
||||
# define SCHAR_MAX _RWSTD_SCHAR_MAX
|
||||
#endif // SCHAR_MAX
|
||||
|
||||
#ifndef SCHAR_MIN
|
||||
# define SCHAR_MIN _RWSTD_SCHAR_MIN
|
||||
#endif // SCHAR_MIN
|
||||
|
||||
#ifndef UCHAR_MAX
|
||||
# define UCHAR_MAX _RWSTD_UCHAR_MAX
|
||||
#endif // UCHAR_MAX
|
||||
|
||||
#ifndef SHRT_MAX
|
||||
# define SHRT_MAX _RWSTD_SHRT_MAX
|
||||
#endif // SHRT_MAX
|
||||
|
||||
#ifndef SHRT_MIN
|
||||
# define SHRT_MIN _RWSTD_SHRT_MIN
|
||||
#endif // SHRT_MIN
|
||||
|
||||
#ifndef USHRT_MAX
|
||||
# define USHRT_MAX _RWSTD_USHRT_MAX
|
||||
#endif // USHRT_MAX
|
||||
|
||||
#ifndef INT_MAX
|
||||
# define INT_MAX _RWSTD_INT_MAX
|
||||
#endif // INT_MAX
|
||||
|
||||
#ifndef INT_MIN
|
||||
# define INT_MIN _RWSTD_INT_MIN
|
||||
#endif // INT_MIN
|
||||
|
||||
#ifndef UINT_MAX
|
||||
# define UINT_MAX _RWSTD_UINT_MAX
|
||||
#endif // UINT_MAX
|
||||
|
||||
#ifndef LONG_MAX
|
||||
# define LONG_MAX _RWSTD_LONG_MAX
|
||||
#endif // LONG_MAX
|
||||
|
||||
#ifndef LONG_MIN
|
||||
# define LONG_MIN _RWSTD_LONG_MIN
|
||||
#endif // LONG_MIN
|
||||
|
||||
#ifndef ULONG_MAX
|
||||
# define ULONG_MAX _RWSTD_ULONG_MAX
|
||||
#endif // ULONG_MAX
|
||||
|
||||
#ifndef MB_LEN_MAX
|
||||
# define MB_LEN_MAX _RWSTD_MB_LEN_MAX
|
||||
#endif // MB_LEN_MAX
|
||||
|
||||
#else // if defined (_RWSTD_NO_PURE_C_HEADERS)
|
||||
|
||||
# ifdef __GNUC__
|
||||
# if __GNUC__ >= 3
|
||||
// silence gcc warnings about #include_next below
|
||||
# pragma GCC system_header
|
||||
# endif // gcc >= 3
|
||||
|
||||
// use the gcc extension to #include the compiler's limits.h
|
||||
# include_next <limits.h>
|
||||
# else
|
||||
# include _RWSTD_ANSI_C_LIMITS_H
|
||||
# endif // gcc
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
|
||||
#if (MB_LEN_MAX != _RWSTD_MB_LEN_MAX)
|
||||
# undef MB_LEN_MAX
|
||||
# define MB_LEN_MAX _RWSTD_MB_LEN_MAX
|
||||
#endif // MB_LEN_MAX
|
||||
|
||||
#endif // _RWSTD_CLIMITS_INCLUDED
|
||||
82
extern/stdcxx/4.2.1/include/ansi/clocale
vendored
Normal file
82
extern/stdcxx/4.2.1/include/ansi/clocale
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* clocale - C++ Standard library interface to the ANSI C header locale.h
|
||||
*
|
||||
* $Id: clocale 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_clocale.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 7
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_LOCALE_H
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 7
|
||||
# undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 7
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CLOCALE_INCLUDED
|
||||
#define _RWSTD_CLOCALE_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_LOCALE_H
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_HONOR_STD) && \
|
||||
!defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
namespace std {
|
||||
|
||||
// 7.4 of C89
|
||||
using ::lconv;
|
||||
|
||||
using ::localeconv;
|
||||
using ::setlocale;
|
||||
|
||||
} // std
|
||||
|
||||
#endif // !_RWSTD_NO_NAMESPACE && !_RWSTD_NO_HONOR_STD && !_RWSTD_NO_USING_LIBC_IN_STD
|
||||
|
||||
#endif // _RWSTD_CLOCALE_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
1053
extern/stdcxx/4.2.1/include/ansi/cmath
vendored
Normal file
1053
extern/stdcxx/4.2.1/include/ansi/cmath
vendored
Normal file
File diff suppressed because it is too large
Load Diff
84
extern/stdcxx/4.2.1/include/ansi/csetjmp
vendored
Normal file
84
extern/stdcxx/4.2.1/include/ansi/csetjmp
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* csetjmp - C++ Standard library interface to the ANSI C header stddef.h
|
||||
*
|
||||
* $Id: csetjmp 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_csetjmp.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 9
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_SETJMP_H
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 9
|
||||
# undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 9
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CSETJMP_INCLUDED
|
||||
#define _RWSTD_CSETJMP_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_SETJMP_H
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_HONOR_STD) && \
|
||||
!defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::jmp_buf;
|
||||
|
||||
using ::longjmp;
|
||||
|
||||
} // std
|
||||
|
||||
#endif // !_RWSTD_NO_NAMESPACE && !_RWSTD_NO_HONOR_STD && !_RWSTD_NO_USING_LIBC_IN_STD
|
||||
|
||||
#endif // _RWSTD_CSETJMP_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef setjmp
|
||||
# define setjmp(env) setjmp (env)
|
||||
#endif
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
80
extern/stdcxx/4.2.1/include/ansi/csignal
vendored
Normal file
80
extern/stdcxx/4.2.1/include/ansi/csignal
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* csignal - C++ Standard library interface to the ANSI C header signal.h
|
||||
*
|
||||
* $Id: csignal 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_csignal.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 10
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_SIGNAL_H
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 10
|
||||
# undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 10
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CSIGNAL_INCLUDED
|
||||
#define _RWSTD_CSIGNAL_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_SIGNAL_H
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_HONOR_STD) && \
|
||||
!defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::sig_atomic_t;
|
||||
using ::raise;
|
||||
using ::signal;
|
||||
|
||||
} // std
|
||||
|
||||
#endif // !_RWSTD_NO_NAMESPACE && !_RWSTD_NO_HONOR_STD && !_RWSTD_NO_USING_LIBC_IN_STD
|
||||
|
||||
#endif // _RWSTD_CSIGNAL_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
77
extern/stdcxx/4.2.1/include/ansi/cstdarg
vendored
Normal file
77
extern/stdcxx/4.2.1/include/ansi/cstdarg
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cstdarg - C++ Standard library interface to the ANSI C header stdarg.h
|
||||
*
|
||||
* $Id: cstdarg 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_cstdarg.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 11
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_STDARG_H
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 11
|
||||
# undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 11
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CSTDARG_INCLUDED
|
||||
#define _RWSTD_CSTDARG_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_STDARG_H
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::va_list;
|
||||
|
||||
} // std
|
||||
|
||||
#endif // !_RWSTD_NO_NAMESPACE && !defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
#endif // _RWSTD_CSTDARG_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
78
extern/stdcxx/4.2.1/include/ansi/cstddef
vendored
Normal file
78
extern/stdcxx/4.2.1/include/ansi/cstddef
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cstddef - C++ Standard library interface to the ANSI C header stddef.h
|
||||
*
|
||||
* $Id: cstddef 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_cstddef.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 12
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_STDDEF_H
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 12
|
||||
# undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 12
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CSTDDEF_INCLUDED
|
||||
#define _RWSTD_CSTDDEF_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_STDDEF_H
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::size_t;
|
||||
using ::ptrdiff_t;
|
||||
|
||||
} // std
|
||||
|
||||
#endif // !_RWSTD_NO_NAMESPACE && !_RWSTD_NO_USING_LIBC_IN_STD
|
||||
|
||||
#endif // _RWSTD_CSTDDEF_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
313
extern/stdcxx/4.2.1/include/ansi/cstdio
vendored
Normal file
313
extern/stdcxx/4.2.1/include/ansi/cstdio
vendored
Normal file
@@ -0,0 +1,313 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cstdio - C++ Standard library interface to the ANSI C header stdio.h
|
||||
*
|
||||
* $Id: cstdio 609466 2008-01-06 23:18:56Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_cstdio.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 14
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_STDIO_H
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 14
|
||||
# undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 14
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CSTDIO_INCLUDED
|
||||
#define _RWSTD_CSTDIO_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_STDIO_H
|
||||
|
||||
|
||||
// 27.8.2, p1, Table 94
|
||||
#ifndef stdin
|
||||
# define stdin stdin
|
||||
#endif
|
||||
|
||||
#ifndef stdout
|
||||
# define stdout stdout
|
||||
#endif
|
||||
|
||||
#ifndef stderr
|
||||
# define stderr stderr
|
||||
#endif
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_HONOR_STD) && \
|
||||
!defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::size_t;
|
||||
using ::FILE;
|
||||
|
||||
#ifndef _RWSTD_NO_FPOS_T
|
||||
using ::fpos_t;
|
||||
#endif // _RWSTD_NO_FPOS_T
|
||||
|
||||
#ifndef _RWSTD_NO_CLEARERR
|
||||
using ::clearerr;
|
||||
#endif // _RWSTD_NO_CLEARERR
|
||||
|
||||
#ifndef _RWSTD_NO_FCLOSE
|
||||
using ::fclose;
|
||||
#endif // _RWSTD_NO_FCLOSE
|
||||
|
||||
#ifndef _RWSTD_NO_FEOF
|
||||
using ::feof;
|
||||
#endif // _RWSTD_NO_FEOF
|
||||
|
||||
#ifndef _RWSTD_NO_FERROR
|
||||
using ::ferror;
|
||||
#endif // _RWSTD_NO_FERROR
|
||||
|
||||
#ifndef _RWSTD_NO_FFLUSH
|
||||
using ::fflush;
|
||||
#endif // _RWSTD_NO_FFLUSH
|
||||
|
||||
#ifndef _RWSTD_NO_FGETC
|
||||
using ::fgetc;
|
||||
#endif // _RWSTD_NO_FGETC
|
||||
|
||||
#ifndef _RWSTD_NO_FGETPOS
|
||||
using ::fgetpos;
|
||||
#endif // _RWSTD_NO_FGETPOS
|
||||
|
||||
#ifndef _RWSTD_NO_FGETS
|
||||
using ::fgets;
|
||||
#endif // _RWSTD_NO_FGETS
|
||||
|
||||
#ifndef _RWSTD_NO_FOPEN
|
||||
using ::fopen;
|
||||
#endif // _RWSTD_NO_FOPEN
|
||||
|
||||
#ifndef _RWSTD_NO_FPRINTF
|
||||
using ::fprintf;
|
||||
#endif // _RWSTD_NO_FPRINTF
|
||||
|
||||
#ifndef _RWSTD_NO_FPUTC
|
||||
using ::fputc;
|
||||
#endif // _RWSTD_NO_FPUTC
|
||||
|
||||
#ifndef _RWSTD_NO_FPUTS
|
||||
using ::fputs;
|
||||
#endif // _RWSTD_NO_FPUTS
|
||||
|
||||
#ifndef _RWSTD_NO_FREAD
|
||||
using ::fread;
|
||||
#endif // _RWSTD_NO_FREAD
|
||||
|
||||
#ifndef _RWSTD_NO_FREOPEN
|
||||
using ::freopen;
|
||||
#endif // _RWSTD_NO_FREOPEN
|
||||
|
||||
#ifndef _RWSTD_NO_FSCANF
|
||||
using ::fscanf;
|
||||
#endif // _RWSTD_NO_FSCANF
|
||||
|
||||
#ifndef _RWSTD_NO_FSEEK
|
||||
using ::fseek;
|
||||
#endif // _RWSTD_NO_FSEEK
|
||||
|
||||
#ifndef _RWSTD_NO_FSETPOS
|
||||
using ::fsetpos;
|
||||
#endif // _RWSTD_NO_FSETPOS
|
||||
|
||||
#ifndef _RWSTD_NO_FTELL
|
||||
using ::ftell;
|
||||
#endif // _RWSTD_NO_FTELL
|
||||
|
||||
#ifndef _RWSTD_NO_FWRITE
|
||||
using ::fwrite;
|
||||
#endif // _RWSTD_NO_FWRITE
|
||||
|
||||
#ifndef _RWSTD_NO_GETC
|
||||
using ::getc;
|
||||
#endif // _RWSTD_NO_GETC
|
||||
|
||||
#ifndef _RWSTD_NO_GETCHAR
|
||||
using ::getchar;
|
||||
#endif // _RWSTD_NO_GETCHAR
|
||||
|
||||
#ifndef _RWSTD_NO_GETS
|
||||
using ::gets;
|
||||
#endif // _RWSTD_NO_GETS
|
||||
|
||||
#ifndef _RWSTD_NO_PERROR
|
||||
using ::perror;
|
||||
#endif // _RWSTD_NO_PERROR
|
||||
|
||||
#ifndef _RWSTD_NO_PRINTF
|
||||
using ::printf;
|
||||
#endif // _RWSTD_NO_PRINTF
|
||||
|
||||
#ifndef _RWSTD_NO_PUTC
|
||||
using ::putc;
|
||||
#endif // _RWSTD_NO_PUTC
|
||||
|
||||
#ifndef _RWSTD_NO_PUTCHAR
|
||||
using ::putchar;
|
||||
#endif // _RWSTD_NO_PUTCHAR
|
||||
|
||||
#ifndef _RWSTD_NO_PUTS
|
||||
using ::puts;
|
||||
#endif // _RWSTD_NO_PUTS
|
||||
|
||||
#ifndef _RWSTD_NO_REMOVE
|
||||
using ::remove;
|
||||
#endif // _RWSTD_NO_REMOVE
|
||||
|
||||
#ifndef _RWSTD_NO_RENAME
|
||||
using ::rename;
|
||||
#endif // _RWSTD_NO_RENAME
|
||||
|
||||
#ifndef _RWSTD_NO_REWIND
|
||||
using ::rewind;
|
||||
#endif // _RWSTD_NO_REWIND
|
||||
|
||||
#ifndef _RWSTD_NO_SCANF
|
||||
using ::scanf;
|
||||
#endif // _RWSTD_NO_SCANF
|
||||
|
||||
#ifndef _RWSTD_NO_SETBUF
|
||||
using ::setbuf;
|
||||
#endif // _RWSTD_NO_SETBUF
|
||||
|
||||
#ifndef _RWSTD_NO_SETVBUF
|
||||
using ::setvbuf;
|
||||
#endif // _RWSTD_NO_SETVBUF
|
||||
|
||||
#ifndef _RWSTD_NO_SPRINTF
|
||||
using ::sprintf;
|
||||
#endif // _RWSTD_NO_SPRINTF
|
||||
|
||||
#ifndef _RWSTD_NO_SSCANF
|
||||
using ::sscanf;
|
||||
#endif // _RWSTD_NO_SSCANF
|
||||
|
||||
#ifndef _RWSTD_NO_TMPFILE
|
||||
using ::tmpfile;
|
||||
#endif // _RWSTD_NO_TMPFILE
|
||||
|
||||
#ifndef _RWSTD_NO_TMPNAM
|
||||
using ::tmpnam;
|
||||
#else
|
||||
# ifndef _RWSTD_NO_TMPNAM_IN_LIBC
|
||||
extern "C" char *tmpnam (char *);
|
||||
# endif // _RWSTD_NO_TMPNAM_IN_LIBC
|
||||
#endif // _RWSTD_NO_TMPNAM
|
||||
|
||||
#ifndef _RWSTD_NO_UNGETC
|
||||
using ::ungetc;
|
||||
#endif // _RWSTD_NO_UNGETC
|
||||
|
||||
#ifndef _RWSTD_NO_VFPRINTF
|
||||
using ::vfprintf;
|
||||
#endif // _RWSTD_NO_VFPRINTF
|
||||
|
||||
#ifndef _RWSTD_NO_VPRINTF
|
||||
using ::vprintf;
|
||||
#endif // _RWSTD_NO_VPRINTF
|
||||
|
||||
#ifndef _RWSTD_NO_VSPRINTF
|
||||
using ::vsprintf;
|
||||
#endif // _RWSTD_NO_VSPRINTF
|
||||
|
||||
} // std
|
||||
|
||||
|
||||
#ifdef _RWSTD_STRICT_ANSI
|
||||
// undefine shadow macros in strict mode
|
||||
# undef fpos_t
|
||||
# undef remove
|
||||
# undef rename
|
||||
# undef tmpfile
|
||||
# undef tmpnam
|
||||
# undef fclose
|
||||
# undef fflush
|
||||
# undef fopen
|
||||
# undef freopen
|
||||
# undef setbuf
|
||||
# undef setvbuf
|
||||
# undef fprintf
|
||||
# undef fscanf
|
||||
# undef printf
|
||||
# undef scanf
|
||||
# undef sprintf
|
||||
# undef sscanf
|
||||
# undef vfprintf
|
||||
# undef vprintf
|
||||
# undef vsprintf
|
||||
# undef fgetc
|
||||
# undef fgets
|
||||
# undef fputc
|
||||
# undef fputs
|
||||
# undef getc
|
||||
# undef getchar
|
||||
# undef gets
|
||||
# undef putc
|
||||
# undef putchar
|
||||
# undef puts
|
||||
# undef ungetc
|
||||
# undef fread
|
||||
# undef fwrite
|
||||
# undef fgetpos
|
||||
# undef fseek
|
||||
# undef fsetpos
|
||||
# undef ftell
|
||||
# undef rewind
|
||||
# undef clearerr
|
||||
# undef feof
|
||||
# undef ferror
|
||||
# undef perror
|
||||
#endif
|
||||
|
||||
|
||||
#endif // !_NO_NAMESPACE && !__NO_HONOR_STD && !_NO_USING_LIBC_IN_STD
|
||||
|
||||
#endif // _RWSTD_CSTDIO_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
263
extern/stdcxx/4.2.1/include/ansi/cstdlib
vendored
Normal file
263
extern/stdcxx/4.2.1/include/ansi/cstdlib
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cstdlib - C++ Standard library interface to the ANSI C header stdlib.h
|
||||
*
|
||||
* $Id: cstdlib 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_cstdlib.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 15
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_STDLIB_H
|
||||
|
||||
#ifndef _RWSTD_CSTDLIB_INCLUDED
|
||||
#define _RWSTD_CSTDLIB_INCLUDED
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_ABS_LONG
|
||||
|
||||
inline long abs (long __x)
|
||||
{
|
||||
return __x < 0L ? -__x : __x;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_ABS_LONG
|
||||
|
||||
#ifdef _RWSTD_NO_DIV_LONG
|
||||
# ifndef _RWSTD_NO_LDIV
|
||||
|
||||
inline ldiv_t div (long __x, long __y)
|
||||
{
|
||||
return ldiv (__x, __y);
|
||||
}
|
||||
|
||||
# endif // _RWSTD_NO_LDIV
|
||||
#endif // _RWSTD_NO_DIV_LONG
|
||||
|
||||
|
||||
#endif // _RWSTD_CSTDLIB_INCLUDED
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 15
|
||||
# undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 15
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CSTDLIB_INCLUDED
|
||||
#define _RWSTD_CSTDLIB_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_STDLIB_H
|
||||
|
||||
#undef ldiv
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_HONOR_STD) && \
|
||||
!defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
namespace std {
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_ABS_UINT
|
||||
|
||||
inline unsigned abs (unsigned __x)
|
||||
{
|
||||
return __x;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_ABS_UINT
|
||||
|
||||
#ifdef _RWSTD_NO_ABS_LONG
|
||||
|
||||
inline long abs (long __x)
|
||||
{
|
||||
return __x < 0L ? -__x : __x;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_ABS_LONG
|
||||
|
||||
#ifdef _RWSTD_NO_ABS_ULONG
|
||||
|
||||
inline unsigned long abs (unsigned long __x)
|
||||
{
|
||||
return __x;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_ABS_ULONG
|
||||
|
||||
#ifdef _RWSTD_LONG_LONG
|
||||
# ifdef _RWSTD_NO_ABS_LLONG
|
||||
|
||||
inline _RWSTD_LONG_LONG abs (_RWSTD_LONG_LONG __x)
|
||||
{
|
||||
return __x < (_RWSTD_LONG_LONG)0 ? -__x : __x;
|
||||
}
|
||||
|
||||
# endif // _RWSTD_NO_ABS_LLONG
|
||||
|
||||
# ifdef _RWSTD_NO_ABS_ULLONG
|
||||
|
||||
inline unsigned _RWSTD_LONG_LONG abs (unsigned _RWSTD_LONG_LONG __x)
|
||||
{
|
||||
return __x;
|
||||
}
|
||||
|
||||
# endif // _RWSTD_NO_ABS_ULLONG
|
||||
#endif // _RWSTD_LONG_LONG
|
||||
|
||||
#ifdef _RWSTD_NO_DIV_LONG
|
||||
# ifndef _RWSTD_NO_LDIV
|
||||
|
||||
inline ldiv_t div (long __x, long __y)
|
||||
{
|
||||
return ldiv (__x, __y);
|
||||
}
|
||||
|
||||
# endif // _RWSTD_NO_LDIV
|
||||
#endif // _RWSTD_NO_DIV_LONG
|
||||
|
||||
#ifndef _RWSTD_NO_EXTERN_C_COMPATIBILITY
|
||||
# ifndef _RWSTD_NO_EXTERN_C_OVERLOAD
|
||||
|
||||
extern "C" {
|
||||
typedef int (*__rw_compar_t)(const void*, const void*);
|
||||
}
|
||||
|
||||
extern "C++" {
|
||||
|
||||
// 25.4, p3
|
||||
inline void*
|
||||
bsearch (const void *__key, const void *__base, size_t __n, size_t __size,
|
||||
int (*__cmp)(const void*, const void*))
|
||||
{
|
||||
return ::bsearch (__key, __base, __n, __size,
|
||||
_RWSTD_REINTERPRET_CAST (__rw_compar_t, __cmp));
|
||||
}
|
||||
|
||||
// 25.4, p4
|
||||
inline void
|
||||
qsort (void *__base, size_t __n, size_t __size,
|
||||
int (*__cmp)(const void*, const void*))
|
||||
{
|
||||
return ::qsort (__base, __n, __size,
|
||||
_RWSTD_REINTERPRET_CAST (__rw_compar_t, __cmp));
|
||||
}
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
# endif // _RWSTD_NO_EXTERN_C_OVERLOAD
|
||||
#endif // _RWSTD_NO_EXTERN_C_COMPATIBILITY
|
||||
|
||||
// using statements must come after the overloads.
|
||||
// working around MSVC6 PR# 27677
|
||||
using ::size_t;
|
||||
using ::div_t;
|
||||
|
||||
#ifndef _RWSTD_NO_LDIV
|
||||
using ::ldiv_t;
|
||||
#endif // _RWSTD_NO_LDIV
|
||||
|
||||
using ::abort;
|
||||
|
||||
#if defined (_RWSTD_NO_ABS) && defined (_RWSTD_NO_ABS_INT) \
|
||||
|| defined (__HP_aCC) \
|
||||
&& defined (_MATH_INCLUDED) && !defined (__MATH_INCLUDED)
|
||||
|
||||
// hacking around an HP aCC quirk when using system headers
|
||||
// in /usr/include without the compiler's wrappers (i.e.,
|
||||
// when -I/usr/include is on the command line)
|
||||
|
||||
} // namespace std
|
||||
|
||||
extern "C" {
|
||||
|
||||
inline int abs (int __x)
|
||||
{
|
||||
return __x < 0 ? -__x : __x;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
namespace std {
|
||||
|
||||
#endif // _RWSTD_NO_ABS && _RWSTD_NO_ABS_INT ...
|
||||
|
||||
using ::abs;
|
||||
|
||||
using ::atexit;
|
||||
using ::atof;
|
||||
using ::atoi;
|
||||
using ::atol;
|
||||
using ::bsearch;
|
||||
using ::calloc;
|
||||
using ::div;
|
||||
using ::exit;
|
||||
using ::free;
|
||||
using ::getenv;
|
||||
using ::labs;
|
||||
using ::ldiv;
|
||||
using ::malloc;
|
||||
using ::mblen;
|
||||
using ::mbstowcs;
|
||||
|
||||
#ifndef _RWSTD_NO_MBTOWC
|
||||
using ::mbtowc;
|
||||
#endif // _RWSTD_NO_MBTOWC
|
||||
|
||||
using ::qsort;
|
||||
using ::rand;
|
||||
using ::realloc;
|
||||
using ::srand;
|
||||
using ::strtod;
|
||||
using ::strtol;
|
||||
using ::strtoul;
|
||||
using ::system;
|
||||
using ::wcstombs;
|
||||
using ::wctomb;
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // !_RWSTD_NO_NAMESPACE && !_RWSTD_NO_HONOR_STD && !_RWSTD_NO_USING_LIBC_IN_STD
|
||||
|
||||
#endif // _RWSTD_CSTDLIB_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
447
extern/stdcxx/4.2.1/include/ansi/cstring
vendored
Normal file
447
extern/stdcxx/4.2.1/include/ansi/cstring
vendored
Normal file
@@ -0,0 +1,447 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cstring - C++ Standard library interface to the ANSI C header string.h
|
||||
*
|
||||
* $Id: cstring 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_cstring.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 15
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_STRING_H
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 15
|
||||
#undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 15
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if 0
|
||||
|
||||
const char* strchr (const char *__s, int __c);
|
||||
const char* strpbrk (const char *__s1, const char *__s2);
|
||||
const char* strrchr (const char *__s, int __c);
|
||||
const char* strstr (const char *__s1, const char *__s2);
|
||||
const void* memchr (const void *__p, int __c, size_t __n);
|
||||
|
||||
#endif // 0/1
|
||||
|
||||
|
||||
#ifndef _RWSTD_CSTRING_INCLUDED
|
||||
#define _RWSTD_CSTRING_INCLUDED
|
||||
|
||||
inline char* strchr (char *__s, int __c)
|
||||
{
|
||||
return strchr ((const char*)__s, __c);
|
||||
}
|
||||
|
||||
inline char* strpbrk (char *__s1, const char *__s2)
|
||||
{
|
||||
return strpbrk ((const char*)__s1, __s2);
|
||||
}
|
||||
|
||||
inline char* strrchr (char *__s, int __c)
|
||||
{
|
||||
return strrchr ((const char*)__s, __c);
|
||||
}
|
||||
|
||||
inline char* strstr (char *__s1, const char *__s2)
|
||||
{
|
||||
return strstr ((const char*)__s1, __s2);
|
||||
}
|
||||
|
||||
inline void* memchr (void *__p, int __c, size_t __n)
|
||||
{
|
||||
return memchr ((const void*)__p, __c, __n);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_CSTRING_INCLUDED
|
||||
|
||||
} // namespace std
|
||||
|
||||
#else // if defined (_RWSTD_NO_NAMESPACE)
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_STRING_H
|
||||
|
||||
|
||||
#endif // _RWSTD_NO_NAMESPACE
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CSTRING_INCLUDED
|
||||
#define _RWSTD_CSTRING_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_STRING_H
|
||||
|
||||
# undef index
|
||||
# undef rindex
|
||||
|
||||
# undef strcpy
|
||||
# undef strcmp
|
||||
|
||||
# undef strlen
|
||||
# undef strchr
|
||||
# undef strrchr
|
||||
# undef strcat
|
||||
# undef memchr
|
||||
# undef memcpy
|
||||
# undef memmove
|
||||
# undef memcmp
|
||||
# undef memset
|
||||
|
||||
# undef memccpy
|
||||
# undef strncat
|
||||
# undef strncmp
|
||||
# undef strncpy
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif // NULL
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_HONOR_STD) && \
|
||||
!defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::size_t;
|
||||
|
||||
#ifndef _RWSTD_NO_MEMCHR
|
||||
using ::memchr;
|
||||
#elif !defined (_RWSTD_NO_MEMCHR_IN_LIBC)
|
||||
|
||||
} // namespace std
|
||||
|
||||
extern "C" void* memchr (void*, int, size_t);
|
||||
|
||||
inline const void* memchr (const void *__p, int __c, size_t __n)
|
||||
{
|
||||
return memchr (_RWSTD_CONST_CAST (void*, __p), __c, __n);
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::memchr;
|
||||
|
||||
# undef _RWSTD_NO_MEMCHR
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMCHR)
|
||||
#endif // _RWSTD_NO_MEMCHR
|
||||
|
||||
#ifndef _RWSTD_NO_MEMCMP
|
||||
using ::memcmp;
|
||||
#elif !defined (_RWSTD_NO_MEMCMP_IN_LIBC)
|
||||
|
||||
} // namespace std
|
||||
|
||||
extern "C" int memcmp (const void*, const void*, size_t);
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::memcmp;
|
||||
|
||||
# undef _RWSTD_NO_MEMCMP
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMCMP)
|
||||
|
||||
} // namespace std
|
||||
|
||||
extern "C" {
|
||||
|
||||
inline int memcmp (const void *__s1, const void *__s2, size_t __n)
|
||||
{
|
||||
const char *__ss1 = _RWSTD_REINTERPRET_CAST (const char*, __s1);
|
||||
const char *__ss2 = _RWSTD_REINTERPRET_CAST (const char*, __s2);
|
||||
|
||||
for (; __n; --__n, ++__ss1, ++__ss2)
|
||||
if (*__ss1 != *__ss2)
|
||||
return *__ss1 - *__ss2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::memcmp;
|
||||
|
||||
# undef _RWSTD_NO_MEMCMP
|
||||
|
||||
#endif // _RWSTD_NO_MEMCMP
|
||||
|
||||
#ifndef _RWSTD_NO_MEMCPY
|
||||
using ::memcpy;
|
||||
#elif !defined (_RWSTD_NO_MEMCPY_IN_LIBC)
|
||||
|
||||
} // namespace std
|
||||
|
||||
extern "C" void* memcpy (void*, const void*, size_t);
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::memcpy;
|
||||
|
||||
# undef _RWSTD_NO_MEMCPY
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_MEMCPY
|
||||
|
||||
#ifndef _RWSTD_NO_MEMMOVE
|
||||
using ::memmove;
|
||||
#elif !defined (_RWSTD_NO_MEMMOVE_IN_LIBC)
|
||||
|
||||
} // namespace std
|
||||
|
||||
extern "C" void* memmove (void*, const void*, size_t);
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::memmove;
|
||||
|
||||
# undef _RWSTD_NO_MEMMOVE
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMMOVE)
|
||||
|
||||
} // namespace std
|
||||
|
||||
extern "C" {
|
||||
|
||||
inline void* memmove (void *__dest, const void *__src, size_t __n)
|
||||
{
|
||||
char *__d = _RWSTD_REINTERPRET_CAST (char*, __dest);
|
||||
const char *__s = _RWSTD_REINTERPRET_CAST (const char*, __src);
|
||||
|
||||
if (__d < __s || __d >= __s + __n)
|
||||
memcpy (__d, __s, __n);
|
||||
else {
|
||||
// regions overlap
|
||||
__d += __n;
|
||||
__s += __n;
|
||||
while (__n--)
|
||||
*--__d = *--__s;
|
||||
}
|
||||
return __dest;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::memmove;
|
||||
|
||||
# undef _RWSTD_NO_MEMMOVE
|
||||
|
||||
#endif // _RWSTD_NO_MEMMOVE
|
||||
|
||||
#ifndef _RWSTD_NO_MEMSET
|
||||
using ::memset;
|
||||
#else // if defined (_RWSTD_NO_MEMSET)
|
||||
#endif // _RWSTD_NO_MEMSET
|
||||
|
||||
#ifndef _RWSTD_NO_STRCAT
|
||||
using ::strcat;
|
||||
#else // if defined (_RWSTD_NO_STRCAT)
|
||||
#endif // _RWSTD_NO_STRCAT
|
||||
|
||||
#ifndef _RWSTD_NO_STRCHR
|
||||
using ::strchr;
|
||||
#elif !defined (_RWSTD_NO_STRCHR_IN_LIBC)
|
||||
|
||||
} // namespace std
|
||||
|
||||
extern "C" char* strchr (char*, int);
|
||||
|
||||
inline const char* strchr (const char *__s, int __c)
|
||||
{
|
||||
return strchr (_RWSTD_CONST_CAST (char*, __s), __c);
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::strchr;
|
||||
|
||||
# undef _RWSTD_NO_STRCHR
|
||||
|
||||
#else // if defined (_RWSTD_NO_STRCHR)
|
||||
#endif // _RWSTD_NO_STRCHR
|
||||
|
||||
#ifndef _RWSTD_NO_STRCMP
|
||||
using ::strcmp;
|
||||
#elif !defined (_RWSTD_NO_STRCMP_IN_LIBC)
|
||||
#else // if defined (_RWSTD_NO_STRCMP)
|
||||
#endif // _RWSTD_NO_STRCMP
|
||||
|
||||
#ifndef _RWSTD_NO_STRCOLL
|
||||
using ::strcoll;
|
||||
#else // if defined (_RWSTD_NO_STRCOLL)
|
||||
#endif // _RWSTD_NO_STRCOLL
|
||||
|
||||
#ifndef _RWSTD_NO_STRCPY
|
||||
using ::strcpy;
|
||||
#else // if defined (_RWSTD_NO_STRCPY)
|
||||
#endif // _RWSTD_NO_STRCPY
|
||||
|
||||
#ifndef _RWSTD_NO_STRCSPN
|
||||
using ::strcspn;
|
||||
#else // if defined (_RWSTD_NO_STRCSPN)
|
||||
#endif // _RWSTD_NO_STRCSPN
|
||||
|
||||
#ifndef _RWSTD_NO_STRERROR
|
||||
using ::strerror;
|
||||
#else // if defined (_RWSTD_NO_STRERROR)
|
||||
#endif // _RWSTD_NO_STRERROR
|
||||
|
||||
#ifndef _RWSTD_NO_STRLEN
|
||||
using ::strlen;
|
||||
#else // if defined (_RWSTD_NO_STRLEN)
|
||||
#endif // _RWSTD_NO_STRLEN
|
||||
|
||||
#ifndef _RWSTD_NO_STRNCAT
|
||||
using ::strncat;
|
||||
#else // if defined (_RWSTD_NO_STRNCAT)
|
||||
#endif // _RWSTD_NO_STRNCAT
|
||||
|
||||
#ifndef _RWSTD_NO_STRNCMP
|
||||
using ::strncmp;
|
||||
#else // if defined (_RWSTD_NO_STRNCMP)
|
||||
#endif // _RWSTD_NO_STRNCMP
|
||||
|
||||
#ifndef _RWSTD_NO_STRNCPY
|
||||
using ::strncpy;
|
||||
#else // if defined (_RWSTD_NO_STRNCPY)
|
||||
#endif // _RWSTD_NO_STRNCPY
|
||||
|
||||
#ifndef _RWSTD_NO_STRPBRK
|
||||
using ::strpbrk;
|
||||
#elif !defined (_RWSTD_NO_STRPBRK_IN_LIBC)
|
||||
|
||||
} // namespace std
|
||||
|
||||
extern "C" char* strpbrk (char*, const char*);
|
||||
|
||||
inline const char* strpbrk (const char *__s, const char *__pat)
|
||||
{
|
||||
return strpbrk (_RWSTD_CONST_CAST (char*, __s), __pat);
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::strpbrk;
|
||||
|
||||
# undef _RWSTD_NO_STRPBRK
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_STRPBRK
|
||||
|
||||
#ifndef _RWSTD_NO_STRRCHR
|
||||
using ::strrchr;
|
||||
#elif !defined (_RWSTD_NO_STRRCHR_IN_LIBC)
|
||||
|
||||
} // namespace std
|
||||
|
||||
extern "C" char* strrchr (char*, int);
|
||||
|
||||
inline const char* strrchr (const char *__s, int __c)
|
||||
{
|
||||
return strrchr (_RWSTD_CONST_CAST (char*, __s), __c);
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::strrchr;
|
||||
|
||||
# undef _RWSTD_NO_STRRCHR
|
||||
|
||||
#else // if defined (_RWSTD_NO_STRRCHR)
|
||||
|
||||
#endif // _RWSTD_NO_STRRCHR
|
||||
|
||||
#ifndef _RWSTD_NO_STRSPN
|
||||
using ::strspn;
|
||||
#else // if defined (_RWSTD_NO_STRSPN)
|
||||
#endif // _RWSTD_NO_STRSPN
|
||||
|
||||
#ifndef _RWSTD_NO_STRSTR
|
||||
using ::strstr;
|
||||
#elif !defined (_RWSTD_NO_STRSTR_IN_LIBC)
|
||||
|
||||
} // namespace std
|
||||
|
||||
extern "C" char* strstr (char*, const char*);
|
||||
|
||||
inline const char* strstr (const char *__s1, const char *__s2)
|
||||
{
|
||||
return strstr (_RWSTD_CONST_CAST (char*, __s1), __s2);
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::strstr;
|
||||
|
||||
# undef _RWSTD_NO_STRSTR
|
||||
|
||||
#else // if defined (_RWSTD_NO_STRSTR)
|
||||
#endif // _RWSTD_NO_STRSTR
|
||||
|
||||
#ifndef _RWSTD_NO_STRTOK
|
||||
using ::strtok;
|
||||
#else // if defined (_RWSTD_NO_STRTOK)
|
||||
#endif // _RWSTD_NO_STRTOK
|
||||
|
||||
#ifndef _RWSTD_NO_STRXFRM
|
||||
using ::strxfrm;
|
||||
#else // if defined (_RWSTD_NO_STRXFRM)
|
||||
#endif // _RWSTD_NO_STRXFRM
|
||||
|
||||
} // std
|
||||
|
||||
#endif // !NO_NAMESPACE && !NO_HONOR_STD && !NO_USING_LIBC_IN_STD
|
||||
|
||||
#endif // _RWSTD_CSTRING_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
91
extern/stdcxx/4.2.1/include/ansi/ctime
vendored
Normal file
91
extern/stdcxx/4.2.1/include/ansi/ctime
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* ctime - C++ Standard library interface to the ANSI C header time.h
|
||||
*
|
||||
* $Id: ctime 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_ctime.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 16
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_TIME_H
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 16
|
||||
# undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 16
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CTIME_INCLUDED
|
||||
#define _RWSTD_CTIME_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_TIME_H
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_HONOR_STD) && \
|
||||
!defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::size_t;
|
||||
using ::clock_t;
|
||||
using ::time_t;
|
||||
using ::tm;
|
||||
|
||||
using ::asctime;
|
||||
using ::clock;
|
||||
using ::ctime;
|
||||
using ::difftime;
|
||||
using ::gmtime;
|
||||
using ::localtime;
|
||||
using ::mktime;
|
||||
using ::strftime;
|
||||
using ::time;
|
||||
|
||||
} // std
|
||||
|
||||
#endif // !_RWSTD_NO_NAMESPACE && !_RWSTD_NO_HONOR_STD && !_RWSTD_NO_USING_LIBC_IN_STD
|
||||
|
||||
#endif // _RWSTD_CTIME_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
58
extern/stdcxx/4.2.1/include/ansi/ctype.h
vendored
Normal file
58
extern/stdcxx/4.2.1/include/ansi/ctype.h
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* ctype.h
|
||||
*
|
||||
* $Id: ctype.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
# ifndef _RWSTD_CTYPE_H_INCLUDED
|
||||
# define _RWSTD_CTYPE_H_INCLUDED
|
||||
|
||||
# include <cctype>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
using std::isalnum;
|
||||
using std::isalpha;
|
||||
using std::iscntrl;
|
||||
using std::isdigit;
|
||||
using std::isgraph;
|
||||
using std::islower;
|
||||
using std::isprint;
|
||||
using std::ispunct;
|
||||
using std::isspace;
|
||||
using std::isupper;
|
||||
using std::isxdigit;
|
||||
using std::tolower;
|
||||
using std::toupper;
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
# endif // _RWSTD_CTYPE_H_INCLUDED
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_CTYPE_H
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
1372
extern/stdcxx/4.2.1/include/ansi/cwchar
vendored
Normal file
1372
extern/stdcxx/4.2.1/include/ansi/cwchar
vendored
Normal file
File diff suppressed because it is too large
Load Diff
263
extern/stdcxx/4.2.1/include/ansi/cwctype
vendored
Normal file
263
extern/stdcxx/4.2.1/include/ansi/cwctype
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* cwctype - C++ Standard library interface to the ANSI C header wctype.h
|
||||
*
|
||||
* $Id: cwctype 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_PURE_C_HEADERS
|
||||
# include <ansi/_cwctype.h>
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#ifndef _RWSTD_NAMESPACE_STD_OPEN
|
||||
#define _RWSTD_NAMESPACE_STD_OPEN 18
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
|
||||
#include _RWSTD_ANSI_C_WCTYPE_H
|
||||
|
||||
|
||||
#if _RWSTD_NAMESPACE_STD_OPEN == 18
|
||||
#undef _RWSTD_NAMESPACE_STD_OPEN
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_NAMESPACE_STD_OPEN == 18
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
#ifndef _RWSTD_CWCTYPE_INCLUDED
|
||||
#define _RWSTD_CWCTYPE_INCLUDED
|
||||
|
||||
#include _RWSTD_ANSI_C_WCTYPE_H
|
||||
|
||||
#ifdef __hpux
|
||||
# include _RWSTD_ANSI_C_WCHAR_H
|
||||
#endif // __hpux
|
||||
|
||||
// #define WEOF when not #defined (see also <cwchar>)
|
||||
#if !defined WEOF
|
||||
# ifndef _RWSTD_NO_WINT_T
|
||||
# define WEOF _RWSTD_STATIC_CAST (_RWSTD_WINT_T, -1)
|
||||
# else
|
||||
# define WEOF (-1)
|
||||
# endif
|
||||
#endif // WEOF
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_HONOR_STD) && \
|
||||
!defined (_RWSTD_NO_USING_LIBC_IN_STD)
|
||||
|
||||
# ifndef _RWSTD_NO_WCTYPE_H
|
||||
|
||||
namespace std {
|
||||
|
||||
#ifndef _RWSTD_NO_WCTRANS_T
|
||||
using ::wctrans_t;
|
||||
#else
|
||||
typedef int wctrans_t;
|
||||
#endif // _RWSTD_NO_WCTRANS_T
|
||||
|
||||
#ifndef _RWSTD_NO_WCTYPE_T
|
||||
using ::wctype_t;
|
||||
#else
|
||||
typedef unsigned wctype_t;
|
||||
#endif // _RWSTD_NO_WCTYPE_T
|
||||
|
||||
#ifndef _RWSTD_NO_WINT_T
|
||||
using ::wint_t;
|
||||
#else
|
||||
typedef unsigned wint_t;
|
||||
#endif // _RWSTD_NO_WINT_T
|
||||
|
||||
#ifndef _RWSTD_NO_ISWALNUM
|
||||
using ::iswalnum;
|
||||
#elif !defined (_RWSTD_NO_ISWALNUM_IN_LIBC)
|
||||
|
||||
extern "C" int iswalnum (wint_t);
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWALNUM
|
||||
|
||||
#ifndef _RWSTD_NO_ISWALPHA
|
||||
using ::iswalpha;
|
||||
#elif !defined (_RWSTD_NO_ISWALPHA_IN_LIBC)
|
||||
|
||||
extern "C" int iswalpha (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWALPHA
|
||||
|
||||
#ifndef _RWSTD_NO_ISWCNTRL
|
||||
using ::iswcntrl;
|
||||
#elif !defined (_RWSTD_NO_ISWCNTRL_IN_LIBC)
|
||||
|
||||
extern "C" int iswcntrl (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWCNTRL
|
||||
|
||||
#ifndef _RWSTD_NO_ISWCTYPE
|
||||
using ::iswctype;
|
||||
#elif !defined (_RWSTD_NO_ISWCTYPE_IN_LIBC)
|
||||
|
||||
extern "C" int iswctype (wint_t, wctype_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWCTYPE
|
||||
|
||||
#ifndef _RWSTD_NO_ISWDIGIT
|
||||
using ::iswdigit;
|
||||
#elif !defined (_RWSTD_NO_ISWDIGIT_IN_LIBC)
|
||||
|
||||
extern "C" int iswdigit (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWDIGIT
|
||||
|
||||
#ifndef _RWSTD_NO_ISWGRAPH
|
||||
using ::iswgraph;
|
||||
#elif !defined (_RWSTD_NO_ISWGRAPH_IN_LIBC)
|
||||
|
||||
extern "C" int iswgraph (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWGRAPH
|
||||
|
||||
#ifndef _RWSTD_NO_ISWLOWER
|
||||
using ::iswlower;
|
||||
#elif !defined (_RWSTD_NO_ISWLOWER_IN_LIBC)
|
||||
|
||||
extern "C" int iswlower (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWLOWER
|
||||
|
||||
#ifndef _RWSTD_NO_ISWPRINT
|
||||
using ::iswprint;
|
||||
#elif !defined (_RWSTD_NO_ISWPRINT_IN_LIBC)
|
||||
|
||||
extern "C" int iswprint (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWPRINT
|
||||
|
||||
#ifndef _RWSTD_NO_ISWPUNCT
|
||||
using ::iswpunct;
|
||||
#elif !defined (_RWSTD_NO_ISWPUNCT_IN_LIBC)
|
||||
|
||||
extern "C" int iswpunct (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWPUNCT
|
||||
|
||||
#ifndef _RWSTD_NO_ISWSPACE
|
||||
using ::iswspace;
|
||||
#elif !defined (_RWSTD_NO_ISWSPACE_IN_LIBC)
|
||||
|
||||
extern "C" int iswspace (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWSPACE
|
||||
|
||||
#ifndef _RWSTD_NO_ISWUPPER
|
||||
using ::iswupper;
|
||||
#elif !defined (_RWSTD_NO_ISWUPPER_IN_LIBC)
|
||||
|
||||
extern "C" int iswupper (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWUPPER
|
||||
|
||||
#ifndef _RWSTD_NO_ISWXDIGIT
|
||||
using ::iswxdigit;
|
||||
#elif !defined (_RWSTD_NO_ISWXDIGIT_IN_LIBC)
|
||||
|
||||
extern "C" int iswxdigit (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_ISWXDIGIT
|
||||
|
||||
#ifndef _RWSTD_NO_TOWCTRANS
|
||||
using ::towctrans;
|
||||
#elif !defined (_RWSTD_NO_TOWCTRANS_IN_LIBC)
|
||||
|
||||
extern "C" wint_t towctrans (wint_t, wctrans_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_TOWCTRANS
|
||||
|
||||
#ifndef _RWSTD_NO_TOWLOWER
|
||||
using ::towlower;
|
||||
#elif !defined (_RWSTD_NO_TOWLOWER_IN_LIBC)
|
||||
|
||||
extern "C" wint_t towlower (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_TOWLOWER
|
||||
|
||||
#ifndef _RWSTD_NO_TOWUPPER
|
||||
using ::towupper;
|
||||
#elif !defined (_RWSTD_NO_TOWUPPER_IN_LIBC)
|
||||
|
||||
extern "C" wint_t towupper (wint_t);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_TOWUPPER
|
||||
|
||||
#ifndef _RWSTD_NO_WCTRANS
|
||||
using ::wctrans;
|
||||
#elif !defined (_RWSTD_NO_WCTRANS_IN_LIBC)
|
||||
|
||||
extern "C" wctrans_t wctrans (const char*);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_WCTRANS
|
||||
|
||||
#ifndef _RWSTD_NO_WCTYPE
|
||||
using ::wctype;
|
||||
#elif !defined (_RWSTD_NO_WCTYPE_IN_LIBC)
|
||||
|
||||
extern "C" wctype_t wctype (const char*);
|
||||
|
||||
#else
|
||||
#endif // _RWSTD_NO_WCTYPE
|
||||
|
||||
} // std
|
||||
|
||||
# endif // _RWSTD_NO_WCTYPE_H
|
||||
|
||||
#endif // !_RWSTD_NO_NAMESPACE && !_RWSTD_NO_HONOR_STD && !_RWSTD_NO_USING_LIBC_IN_STD
|
||||
|
||||
#endif // _RWSTD_CWCTYPE_INCLUDED
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_NO_PURE_C_HEADERS
|
||||
60
extern/stdcxx/4.2.1/include/ansi/errno.h
vendored
Normal file
60
extern/stdcxx/4.2.1/include/ansi/errno.h
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* errno.h
|
||||
*
|
||||
* $Id: errno.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
# ifndef _RWSTD_ERRNO_H_INCLUDED
|
||||
# define _RWSTD_ERRNO_H_INCLUDED
|
||||
|
||||
# include <cerrno>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
# ifndef errno
|
||||
|
||||
// be prepared to handle 17.4.1.2, p5 and lwg issue 310
|
||||
// which say that errno may and must be a macro, respectively
|
||||
|
||||
using std::errno;
|
||||
|
||||
# endif // errno
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
|
||||
# endif // _RWSTD_ERRNO_H_INCLUDED
|
||||
|
||||
#else
|
||||
|
||||
# if !defined (errno) \
|
||||
|| !defined (EDOM) || !defined (ERANGE) || !defined (EAGAIN)
|
||||
# include _RWSTD_ANSI_C_ERRNO_H
|
||||
# endif // errno ...
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
46
extern/stdcxx/4.2.1/include/ansi/float.h
vendored
Normal file
46
extern/stdcxx/4.2.1/include/ansi/float.h
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* float.h - C++ Standard library wrapper for the ANSI C library header
|
||||
*
|
||||
* $Id: float.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
# include <cfloat>
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_FLOAT_H
|
||||
|
||||
# if defined (__EDG__) && defined (__linux__) && !defined (__INTEL_COMPILER)
|
||||
|
||||
// avoid relying on dubious gcc extensions
|
||||
# undef LDBL_MIN
|
||||
# undef LDBL_MAX
|
||||
# define LDBL_MIN _RWSTD_LDBL_MIN
|
||||
# define LDBL_MAX _RWSTD_LDBL_MAX
|
||||
|
||||
# endif // __EDG__ && __linux__ && !__INTEL_COMPILER
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
129
extern/stdcxx/4.2.1/include/ansi/limits.h
vendored
Normal file
129
extern/stdcxx/4.2.1/include/ansi/limits.h
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* limits.h
|
||||
*
|
||||
* $Id: limits.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-2008 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LIMITS_H_INCLUDED
|
||||
#define _RWSTD_LIMITS_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_PURE_C_HEADERS) || defined (_RWSTD_NO_LIMITS_H)
|
||||
|
||||
// 18.2.2, p2
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT _RWSTD_CHAR_BIT
|
||||
#endif // CHAR_BIT
|
||||
|
||||
#ifndef CHAR_MAX
|
||||
# define CHAR_MAX _RWSTD_CHAR_MAX
|
||||
#endif // CHAR_MAX
|
||||
|
||||
#ifndef CHAR_MIN
|
||||
# define CHAR_MIN _RWSTD_CHAR_MIN
|
||||
#endif // CHAR_MIN
|
||||
|
||||
#ifndef SCHAR_MAX
|
||||
# define SCHAR_MAX _RWSTD_SCHAR_MAX
|
||||
#endif // SCHAR_MAX
|
||||
|
||||
#ifndef SCHAR_MIN
|
||||
# define SCHAR_MIN _RWSTD_SCHAR_MIN
|
||||
#endif // SCHAR_MIN
|
||||
|
||||
#ifndef UCHAR_MAX
|
||||
# define UCHAR_MAX _RWSTD_UCHAR_MAX
|
||||
#endif // UCHAR_MAX
|
||||
|
||||
#ifndef SHRT_MAX
|
||||
# define SHRT_MAX _RWSTD_SHRT_MAX
|
||||
#endif // SHRT_MAX
|
||||
|
||||
#ifndef SHRT_MIN
|
||||
# define SHRT_MIN _RWSTD_SHRT_MIN
|
||||
#endif // SHRT_MIN
|
||||
|
||||
#ifndef USHRT_MAX
|
||||
# define USHRT_MAX _RWSTD_USHRT_MAX
|
||||
#endif // USHRT_MAX
|
||||
|
||||
#ifndef INT_MAX
|
||||
# define INT_MAX _RWSTD_INT_MAX
|
||||
#endif // INT_MAX
|
||||
|
||||
#ifndef INT_MIN
|
||||
# define INT_MIN _RWSTD_INT_MIN
|
||||
#endif // INT_MIN
|
||||
|
||||
#ifndef UINT_MAX
|
||||
# define UINT_MAX _RWSTD_UINT_MAX
|
||||
#endif // UINT_MAX
|
||||
|
||||
#ifndef LONG_MAX
|
||||
# define LONG_MAX _RWSTD_LONG_MAX
|
||||
#endif // LONG_MAX
|
||||
|
||||
#ifndef LONG_MIN
|
||||
# define LONG_MIN _RWSTD_LONG_MIN
|
||||
#endif // LONG_MIN
|
||||
|
||||
#ifndef ULONG_MAX
|
||||
# define ULONG_MAX _RWSTD_ULONG_MAX
|
||||
#endif // ULONG_MAX
|
||||
|
||||
#ifndef MB_LEN_MAX
|
||||
# define MB_LEN_MAX _RWSTD_MB_LEN_MAX
|
||||
#endif // MB_LEN_MAX
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
# if __GNUC__ > 2
|
||||
# pragma GCC system_header
|
||||
# endif
|
||||
|
||||
# ifdef __GNUC__
|
||||
// use the gcc extension to #include the compiler's limits.h
|
||||
# include_next <limits.h>
|
||||
# else
|
||||
# include _RWSTD_ANSI_C_LIMITS_H
|
||||
# endif // gcc
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#if defined (__hpux__) || defined (__hpux) || defined (hpux)
|
||||
# ifndef _POSIX_PATH_MAX
|
||||
# define _POSIX_PATH_MAX 255
|
||||
# endif // _POSIX_PATH_MAX
|
||||
#endif // HP-UX
|
||||
|
||||
#if (MB_LEN_MAX != _RWSTD_MB_LEN_MAX)
|
||||
# undef MB_LEN_MAX
|
||||
# define MB_LEN_MAX _RWSTD_MB_LEN_MAX
|
||||
#endif // MB_LEN_MAX
|
||||
|
||||
#endif // _RWSTD_LIMITS_H_INCLUDED
|
||||
47
extern/stdcxx/4.2.1/include/ansi/locale.h
vendored
Normal file
47
extern/stdcxx/4.2.1/include/ansi/locale.h
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* locale.h
|
||||
*
|
||||
* $Id: locale.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
# ifndef _RWSTD_LOCALE_H_INCLUDED
|
||||
# define _RWSTD_LOCALE_H_INCLUDED
|
||||
|
||||
# include <clocale>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
using std::lconv;
|
||||
|
||||
using std::localeconv;
|
||||
using std::setlocale;
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
# endif // _RWSTD_LOCALE_H_INCLUDED
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_LOCALE_H
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
82
extern/stdcxx/4.2.1/include/ansi/math.h
vendored
Normal file
82
extern/stdcxx/4.2.1/include/ansi/math.h
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* math.h - C++ Standard library wrapper for the ANSI C library header
|
||||
*
|
||||
* $Id: math.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
# ifndef _RWSTD_MATH_H_INCLUDED
|
||||
# define _RWSTD_MATH_H_INCLUDED
|
||||
|
||||
# include <cmath>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
using std::acos;
|
||||
using std::asin;
|
||||
using std::atan2;
|
||||
using std::atan;
|
||||
using std::ceil;
|
||||
using std::cos;
|
||||
using std::cosh;
|
||||
using std::exp;
|
||||
using std::fabs;
|
||||
using std::floor;
|
||||
using std::fmod;
|
||||
using std::frexp;
|
||||
using std::ldexp;
|
||||
using std::log10;
|
||||
using std::log;
|
||||
using std::modf;
|
||||
using std::pow;
|
||||
using std::sin;
|
||||
using std::sinh;
|
||||
using std::sqrt;
|
||||
using std::tan;
|
||||
using std::tanh;
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
# endif // _RWSTD_MATH_H_INCLUDED
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_MATH_H
|
||||
|
||||
#undef exception
|
||||
#undef abs
|
||||
#undef acos
|
||||
#undef asin
|
||||
#undef atan
|
||||
#undef atan2
|
||||
#undef cos
|
||||
#undef exp
|
||||
#undef fabs
|
||||
#undef log
|
||||
#undef log10
|
||||
#undef sin
|
||||
#undef sqrt
|
||||
#undef tan
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
51
extern/stdcxx/4.2.1/include/ansi/setjmp.h
vendored
Normal file
51
extern/stdcxx/4.2.1/include/ansi/setjmp.h
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* setjmp.h
|
||||
*
|
||||
* $Id: setjmp.h 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_SETJMP_H_INCLUDED
|
||||
#define _RWSTD_SETJMP_H_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
# include <csetjmp>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
using std::jmp_buf;
|
||||
|
||||
using std::longjmp;
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_SETJMP_H
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
#endif // _RWSTD_SETJMP_H_INCLUDED
|
||||
67
extern/stdcxx/4.2.1/include/ansi/signal.h
vendored
Normal file
67
extern/stdcxx/4.2.1/include/ansi/signal.h
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* signal.h
|
||||
*
|
||||
* $Id: signal.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
# ifndef _RWSTD_SIGNAL_H_INCLUDED
|
||||
# define _RWSTD_SIGNAL_H_INCLUDED
|
||||
|
||||
# include <csignal>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
using std::sig_atomic_t;
|
||||
|
||||
using std::raise;
|
||||
using std::signal;
|
||||
|
||||
# ifdef __linux__
|
||||
|
||||
// hackery needed by <pthread.h>
|
||||
|
||||
# ifndef _SIGSET_H_types
|
||||
# define _SIGSET_H_types 1
|
||||
|
||||
typedef int __sig_atomic_t;
|
||||
|
||||
# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
|
||||
|
||||
typedef struct {
|
||||
unsigned long int __val[_SIGSET_NWORDS];
|
||||
} __sigset_t;
|
||||
|
||||
# endif // _SIGSET_H_types
|
||||
# endif // __linux__
|
||||
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
# endif // _RWSTD_SIGNAL_H_INCLUDED
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_SIGNAL_H
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
56
extern/stdcxx/4.2.1/include/ansi/stdarg.h
vendored
Normal file
56
extern/stdcxx/4.2.1/include/ansi/stdarg.h
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* stdarg.h
|
||||
*
|
||||
* $Id: stdarg.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
# ifndef _RWSTD_STDARG_H_INCLUDED
|
||||
# define _RWSTD_STDARG_H_INCLUDED
|
||||
|
||||
# include <cstdarg>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
// not implemented - va_list is declared in the global namespace
|
||||
// see <ansi/_cstdarg.h>
|
||||
// using std::va_list;
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
|
||||
# endif // _RWSTD_STDARG_H_INCLUDED
|
||||
|
||||
#else
|
||||
|
||||
#if !defined (__EDG__) || defined (__DECCXX) || defined (__INTEL_COMPILER)
|
||||
# include _RWSTD_ANSI_C_STDARG_H
|
||||
#else // vanilla EDG eccp
|
||||
# include <../include/stdarg.h>
|
||||
#endif
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
46
extern/stdcxx/4.2.1/include/ansi/stddef.h
vendored
Normal file
46
extern/stdcxx/4.2.1/include/ansi/stddef.h
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* stddef.h
|
||||
*
|
||||
* $Id: stddef.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
# ifndef _RWSTD_STDDEF_H_INCLUDED
|
||||
# define _RWSTD_STDDEF_H_INCLUDED
|
||||
|
||||
# include <cstddef>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
using std::ptrdiff_t;
|
||||
using std::size_t;
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
# endif // _RWSTD_STDDEF_H_INCLUDED
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_STDDEF_H
|
||||
#endif // _RWSTD_STDDEF_H_INCLUDED
|
||||
93
extern/stdcxx/4.2.1/include/ansi/stdio.h
vendored
Normal file
93
extern/stdcxx/4.2.1/include/ansi/stdio.h
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* stdio.h
|
||||
*
|
||||
* $Id: stdio.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
# ifndef _RWSTD_STDIO_H_INCLUDED
|
||||
# define _RWSTD_STDIO_H_INCLUDED
|
||||
|
||||
# include <cstdio>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
using std::FILE;
|
||||
|
||||
#ifndef _RWSTD_NO_FPOS_T
|
||||
using std::fpos_t;
|
||||
#endif // _RWSTD_NO_FPOS_T
|
||||
|
||||
using std::size_t;
|
||||
|
||||
using std::clearerr;
|
||||
using std::fclose;
|
||||
using std::feof;
|
||||
using std::ferror;
|
||||
using std::fflush;
|
||||
using std::fgetc;
|
||||
using std::fgetpos;
|
||||
using std::fgets;
|
||||
using std::fopen;
|
||||
using std::fprintf;
|
||||
using std::fputc;
|
||||
using std::fputs;
|
||||
using std::fread;
|
||||
using std::freopen;
|
||||
using std::fscanf;
|
||||
using std::fseek;
|
||||
using std::fsetpos;
|
||||
using std::ftell;
|
||||
using std::fwrite;
|
||||
using std::getc;
|
||||
using std::getchar;
|
||||
using std::gets;
|
||||
using std::perror;
|
||||
using std::printf;
|
||||
using std::putc;
|
||||
using std::putchar;
|
||||
using std::puts;
|
||||
using std::remove;
|
||||
using std::rename;
|
||||
using std::rewind;
|
||||
using std::scanf;
|
||||
using std::setbuf;
|
||||
using std::setvbuf;
|
||||
using std::sprintf;
|
||||
using std::sscanf;
|
||||
using std::tmpfile;
|
||||
using std::tmpnam;
|
||||
using std::ungetc;
|
||||
using std::vfprintf;
|
||||
using std::vprintf;
|
||||
using std::vsprintf;
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
# endif // _RWSTD_STDIO_H_INCLUDED
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_STDIO_H
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
121
extern/stdcxx/4.2.1/include/ansi/stdlib.h
vendored
Normal file
121
extern/stdcxx/4.2.1/include/ansi/stdlib.h
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* stdlib.h
|
||||
*
|
||||
* $Id: stdlib.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
# ifndef _RWSTD_STDLIB_H_INCLUDED
|
||||
# define _RWSTD_STDLIB_H_INCLUDED
|
||||
|
||||
# include <cstdlib>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
using std::div_t;
|
||||
using std::ldiv_t;
|
||||
using std::size_t;
|
||||
|
||||
#if !defined (__GNUG__) || __GNUG__ > 2
|
||||
|
||||
// prevent collisions with gcc's intrinsic functions
|
||||
using std::abort;
|
||||
using std::abs;
|
||||
using std::exit;
|
||||
using std::labs;
|
||||
|
||||
#endif // gcc > 2
|
||||
|
||||
using std::atexit;
|
||||
using std::atof;
|
||||
using std::atoi;
|
||||
using std::atol;
|
||||
using std::bsearch;
|
||||
using std::calloc;
|
||||
using std::div;
|
||||
using std::free;
|
||||
using std::getenv;
|
||||
using std::ldiv;
|
||||
using std::malloc;
|
||||
using std::mblen;
|
||||
using std::mbstowcs;
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MBTOWC
|
||||
using std::mbtowc;
|
||||
#elif !defined (_RWSTD_NO_MBTOWC_IN_LIBC)
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
extern "C" int mbtowc (wchar_t*, const char*, size_t);
|
||||
|
||||
# undef _RWSTD_NO_MBTOWC
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_NO_MBTOWC
|
||||
|
||||
|
||||
using std::qsort;
|
||||
using std::rand;
|
||||
using std::realloc;
|
||||
using std::srand;
|
||||
using std::strtod;
|
||||
using std::strtol;
|
||||
using std::strtoul;
|
||||
using std::system;
|
||||
using std::wcstombs;
|
||||
using std::wctomb;
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
|
||||
# endif // _RWSTD_STDLIB_H_INCLUDED
|
||||
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_STDLIB_H
|
||||
|
||||
# if defined (__HP_aCC) \
|
||||
&& defined (_MATH_INCLUDED) && !defined (__MATH_INCLUDED)
|
||||
|
||||
// hacking around an HP aCC quirk when using system headers
|
||||
// in /usr/include without the compiler's wrappers (i.e.,
|
||||
// when -I/usr/include is on the command line)
|
||||
|
||||
extern "C" {
|
||||
|
||||
inline int abs (int __x)
|
||||
{
|
||||
return __x < 0 ? -__x : __x;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
# endif // HP aCC && /usr/include/math.h included
|
||||
|
||||
# undef ldiv
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
172
extern/stdcxx/4.2.1/include/ansi/string.h
vendored
Normal file
172
extern/stdcxx/4.2.1/include/ansi/string.h
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* string.h
|
||||
*
|
||||
* $Id: string.h 550991 2007-06-26 23:58:07Z 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-2005 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
# ifndef _RWSTD_STRING_H_INCLUDED
|
||||
# define _RWSTD_STRING_H_INCLUDED
|
||||
# include <cstring>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
using std::size_t;
|
||||
|
||||
using std::memchr;
|
||||
|
||||
#if !defined (__GNUG__) || __GNUG__ > 2
|
||||
|
||||
// predeclared intrinsic functions cannot be redeclared
|
||||
using std::memcmp;
|
||||
using std::memcpy;
|
||||
using std::strcmp;
|
||||
using std::strcpy;
|
||||
using std::strlen;
|
||||
|
||||
#endif // < gcc 3.0
|
||||
|
||||
using std::memmove;
|
||||
using std::memset;
|
||||
using std::strcat;
|
||||
using std::strchr;
|
||||
using std::strcoll;
|
||||
using std::strcspn;
|
||||
using std::strerror;
|
||||
using std::strncat;
|
||||
using std::strncmp;
|
||||
using std::strncpy;
|
||||
using std::strpbrk;
|
||||
using std::strrchr;
|
||||
using std::strspn;
|
||||
using std::strstr;
|
||||
using std::strtok;
|
||||
using std::strxfrm;
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
# endif // _RWSTD_STRING_H_INCLUDED
|
||||
|
||||
#else
|
||||
|
||||
#ifndef _RWSTD_STRING_H_INCLUDED
|
||||
#define _RWSTD_STRING_H_INCLUDED
|
||||
|
||||
# include _RWSTD_ANSI_C_STRING_H
|
||||
|
||||
# undef index
|
||||
# undef rindex
|
||||
|
||||
# undef strcpy
|
||||
# undef strcmp
|
||||
|
||||
# undef strlen
|
||||
# undef strchr
|
||||
# undef strrchr
|
||||
# undef strcat
|
||||
# undef memchr
|
||||
# undef memcpy
|
||||
# undef memmove
|
||||
# undef memcmp
|
||||
# undef memset
|
||||
|
||||
# undef memccpy
|
||||
# undef strncat
|
||||
# undef strncmp
|
||||
# undef strncpy
|
||||
|
||||
|
||||
#if defined (_RWSTD_NO_MEMCHR) && !defined (_RWSTD_NO_MEMCHR_IN_LIBC)
|
||||
|
||||
extern "C" void* memchr (void*, int, _RWSTD_SIZE_T);
|
||||
|
||||
inline const void* memchr (const void *__s, int __c, _RWSTD_SIZE_T __n)
|
||||
{
|
||||
return memchr (_RWSTD_CONST_CAST (void*, __s), __c, __n);
|
||||
}
|
||||
|
||||
# undef _RWSTD_NO_MEMCHR
|
||||
|
||||
#endif // _RWSTD_NO_MEMCHR && !_RWSTD_NO_MEMCHR_IN_LIBC
|
||||
|
||||
|
||||
#if defined (_RWSTD_NO_STRPBRK) && !defined (_RWSTD_NO_STRPBRK_IN_LIBC)
|
||||
|
||||
extern "C" char* strpbrk (char*, const char*);
|
||||
|
||||
inline const char* strpbrk (const char *__s, const char *__pat)
|
||||
{
|
||||
return strpbrk (_RWSTD_CONST_CAST (char*, __s), __pat);
|
||||
}
|
||||
|
||||
# undef _RWSTD_NO_STRPBRK
|
||||
|
||||
#endif // _RWSTD_NO_STRPBRK && !_RWSTD_NO_STRPBRK_IN_LIBC
|
||||
|
||||
|
||||
#if defined (_RWSTD_NO_STRCHR) && !defined (_RWSTD_NO_STRCHR_IN_LIBC)
|
||||
|
||||
extern "C" char* strchr (char*, int);
|
||||
|
||||
inline const char* strchr (const char *__s, int __c)
|
||||
{
|
||||
return strchr (_RWSTD_CONST_CAST (char*, __s), __c);
|
||||
}
|
||||
|
||||
# undef _RWSTD_NO_STRCHR
|
||||
|
||||
#endif // _RWSTD_NO_STRCHR && !_RWSTD_NO_STRCHR_IN_LIBC
|
||||
|
||||
|
||||
#if defined (_RWSTD_NO_STRRCHR) && !defined (_RWSTD_NO_STRRCHR_IN_LIBC)
|
||||
|
||||
extern "C" char* strrchr (char*, int);
|
||||
|
||||
inline const char* strrchr (const char *__s, int __c)
|
||||
{
|
||||
return strrchr (_RWSTD_CONST_CAST (char*, __s), __c);
|
||||
}
|
||||
|
||||
# undef _RWSTD_NO_STRRCHR
|
||||
|
||||
#endif // _RWSTD_NO_STRRCHR && !_RWSTD_NO_STRRCHR_IN_LIBC
|
||||
|
||||
|
||||
#if defined (_RWSTD_NO_STRSTR) && !defined (_RWSTD_NO_STRSTR_IN_LIBC)
|
||||
|
||||
extern "C" char* strstr (char*, const char*);
|
||||
|
||||
inline const char* strstr (const char *__s1, const char *__s2)
|
||||
{
|
||||
return strstr (_RWSTD_CONST_CAST (char*, __s1), __s2);
|
||||
}
|
||||
|
||||
# undef _RWSTD_NO_STRSTR
|
||||
|
||||
#endif // _RWSTD_NO_STRSTR && !_RWSTD_NO_STRSTR_IN_LIBC
|
||||
|
||||
# endif // _RWSTD_STRING_H_INCLUDED
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
63
extern/stdcxx/4.2.1/include/ansi/time.h
vendored
Normal file
63
extern/stdcxx/4.2.1/include/ansi/time.h
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* time.h
|
||||
*
|
||||
* $Id: time.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
# ifndef _RWSTD_TIME_H_INCLUDED
|
||||
# define _RWSTD_TIME_H_INCLUDED
|
||||
|
||||
# include <ctime>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
using std::clock_t;
|
||||
using std::size_t;
|
||||
using std::time_t;
|
||||
using std::tm;
|
||||
|
||||
using std::asctime;
|
||||
using std::clock;
|
||||
using std::ctime;
|
||||
using std::difftime;
|
||||
using std::gmtime;
|
||||
using std::localtime;
|
||||
using std::mktime;
|
||||
using std::strftime;
|
||||
using std::time;
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
|
||||
# endif // _RWSTD_TIME_H_INCLUDED
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
# include _RWSTD_ANSI_C_TIME_H
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
410
extern/stdcxx/4.2.1/include/ansi/wchar.h
vendored
Normal file
410
extern/stdcxx/4.2.1/include/ansi/wchar.h
vendored
Normal file
@@ -0,0 +1,410 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* wchar.h
|
||||
*
|
||||
* $Id: wchar.h 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
# ifndef _RWSTD_WCHAR_H_INCLUDED
|
||||
# define _RWSTD_WCHAR_H_INCLUDED
|
||||
|
||||
# include <cwchar>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
#ifndef _RWSTD_NO_MBSTATE_T
|
||||
using std::mbstate_t;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WINT_T
|
||||
using std::wint_t;
|
||||
#endif
|
||||
using std::size_t;
|
||||
#ifndef _RWSTD_NO_BTOWC
|
||||
using std::btowc;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_FGETWC
|
||||
using std::fgetwc;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_FGETWS
|
||||
using std::fgetws;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_FPUTWC
|
||||
using std::fputwc;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_FPUTWS
|
||||
using std::fputws;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_FWPRINTF
|
||||
using std::fwprintf;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_FWSCANF
|
||||
using std::fwscanf;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_GETWC
|
||||
using std::getwc;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_GETWCHAR
|
||||
using std::getwchar;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_MBRLEN
|
||||
using std::mbrlen;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_MBRTOWC
|
||||
using std::mbrtowc;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_MBSINIT
|
||||
using std::mbsinit;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_MBSRTOWCS
|
||||
using std::mbsrtowcs;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_PUTWC
|
||||
using std::putwc;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_PUTWCHAR
|
||||
using std::putwchar;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_SWPRINTF
|
||||
using std::swprintf;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_SWSCANF
|
||||
using std::swscanf;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_UNGETWC
|
||||
using std::ungetwc;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_VFWPRINTF
|
||||
using std::vfwprintf;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_VWPRINTF
|
||||
using std::vwprintf;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCRTOMB
|
||||
using std::wcrtomb;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSCAT
|
||||
using std::wcscat;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSCHR
|
||||
using std::wcschr;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSCMP
|
||||
using std::wcscmp;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSCOLL
|
||||
using std::wcscoll;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSCPY
|
||||
using std::wcscpy;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSCSPN
|
||||
using std::wcscspn;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSLEN
|
||||
using std::wcslen;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSNCAT
|
||||
using std::wcsncat;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSNCMP
|
||||
using std::wcsncmp;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSNCPY
|
||||
using std::wcsncpy;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSPBRK
|
||||
using std::wcspbrk;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSRCHR
|
||||
using std::wcsrchr;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSRTOMBS
|
||||
using std::wcsrtombs;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSSPN
|
||||
using std::wcsspn;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSSTR
|
||||
using std::wcsstr;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSTOD
|
||||
using std::wcstod;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSTOK
|
||||
using std::wcstok;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSTOL
|
||||
using std::wcstol;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSTOUL
|
||||
using std::wcstoul;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCSXFRM
|
||||
using std::wcsxfrm;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WCTOB
|
||||
using std::wctob;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WMEMCHR
|
||||
using std::wmemchr;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WMEMCMP
|
||||
using std::wmemcmp;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WMEMCPY
|
||||
using std::wmemcpy;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WMEMMOVE
|
||||
using std::wmemmove;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WMEMSET
|
||||
using std::wmemset;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WPRINTF
|
||||
using std::wprintf;
|
||||
#endif
|
||||
#ifndef _RWSTD_NO_WSCANF
|
||||
using std::wscanf;
|
||||
#endif
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
# endif // _RWSTD_WCHAR_H_INCLUDED
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEPRECATED_C_HEADERS)
|
||||
|
||||
# include _RWSTD_ANSI_C_WCHAR_H
|
||||
|
||||
# include <rw/_mbstate.h>
|
||||
|
||||
# ifndef WCHAR_MAX
|
||||
# define WCHAR_MAX _RWSTD_WCHAR_MAX
|
||||
# endif
|
||||
|
||||
# ifndef WCHAR_MIN
|
||||
# define WCHAR_MIN _RWSTD_WCHAR_MIN
|
||||
# endif
|
||||
|
||||
extern "C" {
|
||||
|
||||
// add missing declarations for functions known to be defined
|
||||
// in the system libc
|
||||
|
||||
# if defined (_RWSTD_NO_MBSTATE_T) && defined (_RWSTD_MBSTATE_T)
|
||||
typedef _RWSTD_MBSTATE_T mbstate_t;
|
||||
# endif // _RWSTD_NO_MBSTATE_T && _RWSTD_MBSTATE_T
|
||||
|
||||
# if defined (_RWSTD_NO_FWPRINTF) && !defined (_RWSTD_NO_FWPRINTF_IN_LIBC)
|
||||
int fwprintf (FILE*, const wchar_t*, ...);
|
||||
# undef _RWSTD_NO_FWPRINTF
|
||||
# endif // _RWSTD_NO_FWPRINTF && !_RWSTD_NO_FWPRINTF_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_FWSCANF) && !defined (_RWSTD_NO_FWSCANF_IN_LIBC)
|
||||
int fwscanf (FILE*, const wchar_t*, ...);
|
||||
# undef _RWSTD_NO_FWSCANF
|
||||
# endif // _RWSTD_NO_FWSCANF && !_RWSTD_NO_FWSCANF_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_SWPRINTF) && !defined (_RWSTD_NO_SWPRINTF_IN_LIBC)
|
||||
# if !defined (_MSC_VER)
|
||||
|
||||
// disabled for MSVC to avoid running into its awful declaration hackery
|
||||
int swprintf (wchar_t*, _RWSTD_SIZE_T, const wchar_t*, ...);
|
||||
|
||||
# endif // !MSVC
|
||||
# undef _RWSTD_NO_SWPRINTF
|
||||
# endif // _RWSTD_NO_SWPRINTF && !_RWSTD_NO_SWPRINTF_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_SWSCANF) && !defined (_RWSTD_NO_SWSCANF_IN_LIBC)
|
||||
int swscanf (const wchar_t*, const wchar_t*, ...);
|
||||
# undef _RWSTD_NO_SWSCANF
|
||||
# endif // _RWSTD_NO_SWSCANF && !_RWSTD_NO_SWSCANF_IN_LIBC
|
||||
|
||||
# ifdef _RWSTD_VA_LIST
|
||||
# if defined (_RWSTD_NO_VFWPRINTF) && !defined (_RWSTD_NO_VFWPRINTF_IN_LIBC)
|
||||
int vfwprintf (FILE*, const wchar_t*, _RWSTD_VA_LIST);
|
||||
# undef _RWSTD_NO_VFWPRINTF
|
||||
# endif // _RWSTD_NO_VFWPRINTF && !_RWSTD_NO_VFWPRINTF_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_VFWSCANF) && !defined (_RWSTD_NO_VFWSCANF_IN_LIBC)
|
||||
int vfwscanf (FILE*, const wchar_t*, _RWSTD_VA_LIST);
|
||||
# undef _RWSTD_NO_VFWSCANF
|
||||
# endif // _RWSTD_NO_VFWSCANF && !_RWSTD_NO_VFWSCANF_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_VWPRINTF) && !defined (_RWSTD_NO_VWPRINTF_IN_LIBC)
|
||||
int vwprintf (const wchar_t*, _RWSTD_VA_LIST);
|
||||
# undef _RWSTD_NO_VWPRINTF
|
||||
# endif // _RWSTD_NO_VWPRINTF && !_RWSTD_NO_VWPRINTF_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_VWSCANF) && !defined (_RWSTD_NO_VWSCANF_IN_LIBC)
|
||||
int vwscanf (const wchar_t*, _RWSTD_VA_LIST);
|
||||
# undef _RWSTD_NO_VWSCANF
|
||||
# endif // _RWSTD_NO_VWSCANF && !_RWSTD_NO_VWSCANF_IN_LIBC
|
||||
# endif // _RWSTD_VA_LIST
|
||||
|
||||
# if defined (_RWSTD_NO_MBRLEN) && !defined (_RWSTD_NO_MBRLEN_IN_LIBC)
|
||||
_RWSTD_SIZE_T mbrlen (const char*, _RWSTD_SIZE_T, _RWSTD_MBSTATE_T*);
|
||||
# undef _RWSTD_NO_MBRLEN
|
||||
# endif // _RWSTD_NO_MBRLEN && !_RWSTD_NO_MBRLEN_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_MBRTOWC) && !defined (_RWSTD_NO_MBRTOWC_IN_LIBC)
|
||||
_RWSTD_SIZE_T mbrtowc (wchar_t*, const char*, _RWSTD_SIZE_T, _RWSTD_MBSTATE_T*);
|
||||
# undef _RWSTD_NO_MBRTOWC
|
||||
# endif // _RWSTD_NO_MBRTOWC && !_RWSTD_NO_MBRTOWC_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_MBSINIT) && !defined (_RWSTD_NO_MBSINIT_IN_LIBC)
|
||||
int mbsinit (const _RWSTD_MBSTATE_T*);
|
||||
# undef _RWSTD_NO_MBSINIT
|
||||
# endif // _RWSTD_NO_MBSINIT && !_RWSTD_NO_MBSINIT_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_MBSRTOWCS) && !defined (_RWSTD_NO_MBSRTOWCS_IN_LIBC)
|
||||
_RWSTD_SIZE_T mbsrtowcs (const wchar_t*, const char**, _RWSTD_SIZE_T,
|
||||
_RWSTD_MBSTATE_T*);
|
||||
# undef _RWSTD_NO_MBSRTOWCS
|
||||
# endif // _RWSTD_NO_MBSRTOWCS && !_RWSTD_NO_MBSRTOWCS_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_WCRTOMB) && !defined (_RWSTD_NO_WCRTOMB_IN_LIBC)
|
||||
_RWSTD_SIZE_T wcrtomb (char*, wchar_t, _RWSTD_MBSTATE_T*);
|
||||
# undef _RWSTD_NO_WCRTOMB
|
||||
# endif // _RWSTD_NO_WCRTOMB && !_RWSTD_NO_WCRTOMB_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_WCSRTOMBS) && !defined (_RWSTD_NO_WCSRTOMBS_IN_LIBC)
|
||||
_RWSTD_SIZE_T wcsrtombs (char*, const char**, _RWSTD_SIZE_T,
|
||||
_RWSTD_MBSTATE_T*);
|
||||
# undef _RWSTD_NO_WCSRTOMBS
|
||||
# endif // _RWSTD_NO_WCSRTOMBS && !_RWSTD_NO_WCSRTOMBS_IN_LIBC
|
||||
|
||||
|
||||
# if defined (_RWSTD_NO_WCSCHR) && !defined (_RWSTD_NO_WCSCHR_IN_LIBC)
|
||||
|
||||
wchar_t* wcschr (wchar_t*, wchar_t);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
inline const wchar_t*
|
||||
wcschr (const wchar_t *__s, wchar_t __c)
|
||||
{
|
||||
return wcschr (_RWSTD_CONST_CAST (wchar_t*, __s), __c);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
# undef _RWSTD_NO_WCSCHR
|
||||
# endif // _RWSTD_NO_WCSCHR && !_RWSTD_NO_WCSCHR_IN_LIBC
|
||||
|
||||
|
||||
# if defined (_RWSTD_NO_WCSRCHR) && !defined (_RWSTD_NO_WCSRCHR_IN_LIBC)
|
||||
|
||||
wchar_t* wcsrchr (wchar_t*, wchar_t);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
inline const wchar_t*
|
||||
wcsrchr (const wchar_t *__s, wchar_t __c)
|
||||
{
|
||||
return wcsrchr (_RWSTD_CONST_CAST (wchar_t*, __s), __c);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
# undef _RWSTD_NO_WCSCHR
|
||||
# endif // _RWSTD_NO_WCSCHR && !_RWSTD_NO_WCSCHR_IN_LIBC
|
||||
|
||||
|
||||
# if defined (_RWSTD_NO_WCSSTR) && !defined (_RWSTD_NO_WCSSTR_IN_LIBC)
|
||||
|
||||
wchar_t* wcsstr (wchar_t*, const wchar_t*);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
inline const wchar_t*
|
||||
wcsstr (const wchar_t *__s1, const wchar_t *__s2)
|
||||
{
|
||||
return wcsstr (_RWSTD_CONST_CAST (wchar_t*, __s1), __s2);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
# undef _RWSTD_NO_WCSSTR
|
||||
# endif // _RWSTD_NO_WCSSTR && !_RWSTD_NO_WCSSTR_IN_LIBC
|
||||
|
||||
|
||||
# if defined (_RWSTD_NO_WMEMCHR) && !defined (_RWSTD_NO_WMEMCHR_IN_LIBC)
|
||||
|
||||
wchar_t* wmemchr (wchar_t*, wchar_t, _RWSTD_SIZE_T);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
inline const wchar_t*
|
||||
wmemchr (const wchar_t *__s, wchar_t __c, _RWSTD_SIZE_T __n)
|
||||
{
|
||||
return wmemchr (_RWSTD_CONST_CAST (wchar_t*, __s), __c, __n);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
# undef _RWSTD_NO_WMEMCHR
|
||||
# endif // _RWSTD_NO_WMEMCHR && !_RWSTD_NO_WMEMCHR_IN_LIBC
|
||||
|
||||
|
||||
# if defined (_RWSTD_NO_WMEMCMP) && !defined (_RWSTD_NO_WMEMCMP_IN_LIBC)
|
||||
int wmemcmp (const wchar_t*, const wchar_t*, _RWSTD_SIZE_T);
|
||||
# undef _RWSTD_NO_WMEMCMP
|
||||
# endif // _RWSTD_NO_WMEMCMP && !_RWSTD_NO_WMEMCMP_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_WMEMCPY) && !defined (_RWSTD_NO_WMEMCPY_IN_LIBC)
|
||||
wchar_t* wmemcpy (wchar_t*, const wchar_t*, _RWSTD_SIZE_T);
|
||||
# undef _RWSTD_NO_WMEMCPY
|
||||
# endif // _RWSTD_NO_WMEMCPY && !_RWSTD_NO_WMEMCPY_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_WMEMMOVE) && !defined (_RWSTD_NO_WMEMMOVE_IN_LIBC)
|
||||
wchar_t* wmemmove (wchar_t*, const wchar_t*, _RWSTD_SIZE_T);
|
||||
# undef _RWSTD_NO_WMEMMOVE
|
||||
# endif // _RWSTD_NO_WMEMMOVE && !_RWSTD_NO_WMEMMOVE_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_WMEMSET) && !defined (_RWSTD_NO_WMEMSET_IN_LIBC)
|
||||
wchar_t* wmemset (wchar_t*, wchar_t, _RWSTD_SIZE_T);
|
||||
# undef _RWSTD_NO_WMEMSET
|
||||
# endif // _RWSTD_NO_WMEMSET && !_RWSTD_NO_WMEMSET_IN_LIBC
|
||||
|
||||
|
||||
# if defined (_RWSTD_NO_WPRINTF) && !defined (_RWSTD_NO_WPRINTF_IN_LIBC)
|
||||
int wprintf (const wchar_t*, ...);
|
||||
# undef _RWSTD_NO_WPRINTF
|
||||
# endif // _RWSTD_NO_WPRINTF && !_RWSTD_NO_WPRINTF_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_WSCANF) && !defined (_RWSTD_NO_WSCANF_IN_LIBC)
|
||||
int wscanf (const wchar_t*, ...);
|
||||
# undef _RWSTD_NO_WSCANF
|
||||
# endif // _RWSTD_NO_WSCANF && !_RWSTD_NO_WSCANF_IN_LIBC
|
||||
|
||||
# if defined (_RWSTD_NO_WCTOB) && !defined (_RWSTD_NO_WCTOB_IN_LIBC)
|
||||
int wctob (_RWSTD_WINT_T);
|
||||
# undef _RWSTD_NO_WCTOB
|
||||
# endif // _RWSTD_NO_WCTOB && !_RWSTD_NO_WCTOB_IN_LIBC
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
66
extern/stdcxx/4.2.1/include/ansi/wctype.h
vendored
Normal file
66
extern/stdcxx/4.2.1/include/ansi/wctype.h
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* wctype.h
|
||||
*
|
||||
* $Id: wctype.h 550991 2007-06-26 23:58:07Z 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 <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
# ifndef _RWSTD_WCTYPE_H_INCLUDED
|
||||
# define _RWSTD_WCTYPE_H_INCLUDED
|
||||
|
||||
# include <cwctype>
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
using std::wctrans_t;
|
||||
using std::wctype_t;
|
||||
using std::wint_t;
|
||||
|
||||
using std::iswalnum;
|
||||
using std::iswalpha;
|
||||
using std::iswcntrl;
|
||||
using std::iswctype;
|
||||
using std::iswdigit;
|
||||
using std::iswgraph;
|
||||
using std::iswlower;
|
||||
using std::iswprint;
|
||||
using std::iswpunct;
|
||||
using std::iswspace;
|
||||
using std::iswupper;
|
||||
using std::iswxdigit;
|
||||
using std::towctrans;
|
||||
using std::towlower;
|
||||
using std::towupper;
|
||||
using std::wctrans;
|
||||
using std::wctype;
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
# endif // _RWSTD_WCTYPE_H_INCLUDED
|
||||
#else
|
||||
# include _RWSTD_ANSI_C_WCTYPE_H
|
||||
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
|
||||
|
||||
713
extern/stdcxx/4.2.1/include/bitset
vendored
Normal file
713
extern/stdcxx/4.2.1/include/bitset
vendored
Normal file
@@ -0,0 +1,713 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* <bitset> - definition of the bitset template
|
||||
*
|
||||
* $Id: bitset 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_BITSET_INCLUDED
|
||||
#define _RWSTD_BITSET_INCLUDED
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <rw/_iosfwd.h>
|
||||
#include <rw/_error.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
// helper, implements bitset converting ctor
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits>
|
||||
void
|
||||
__rw_bitset (unsigned long*, _RWSTD_SIZE_T,
|
||||
const _CharT*, _RWSTD_SIZE_T,
|
||||
const _Traits*, _CharT, _CharT,
|
||||
_RWSTD_SIZE_T, _RWSTD_SIZE_T,
|
||||
const char*, const char*);
|
||||
|
||||
_RWSTD_SPECIALIZED_FUNCTION
|
||||
_RWSTD_EXPORT void
|
||||
__rw_bitset (unsigned long*, _RWSTD_SIZE_T,
|
||||
const char*, _RWSTD_SIZE_T,
|
||||
const _STD::char_traits<char>*, char, char,
|
||||
_RWSTD_SIZE_T, _RWSTD_SIZE_T,
|
||||
const char*, const char*);
|
||||
|
||||
#ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZED_FUNCTION
|
||||
_RWSTD_EXPORT void
|
||||
__rw_bitset (unsigned long*, _RWSTD_SIZE_T,
|
||||
const wchar_t*, _RWSTD_SIZE_T,
|
||||
const _STD::char_traits<wchar_t>*, wchar_t, wchar_t,
|
||||
_RWSTD_SIZE_T, _RWSTD_SIZE_T,
|
||||
const char*, const char*);
|
||||
|
||||
#endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
// helper, implements bitset::count()
|
||||
_RWSTD_EXPORT _RWSTD_SIZE_T
|
||||
__rw_bit_count (const unsigned long*, _RWSTD_SIZE_T) _THROWS (());
|
||||
|
||||
// helpers, implement bitset<>::operator<<=() and operator>>=()
|
||||
_RWSTD_EXPORT void
|
||||
__rw_shl (unsigned long*, _RWSTD_SIZE_T, _RWSTD_SIZE_T) _THROWS (());
|
||||
|
||||
_RWSTD_EXPORT void
|
||||
__rw_shr (unsigned long*, _RWSTD_SIZE_T, _RWSTD_SIZE_T) _THROWS (());
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <_RWSTD_SIZE_T _Size>
|
||||
class bitset
|
||||
{
|
||||
enum { _C_elembits = _RWSTD_CHAR_BIT * sizeof (unsigned long) };
|
||||
enum { _C_nelems = _Size ? 1 + (_Size - 1) / _C_elembits : 0 };
|
||||
|
||||
// must have at least one element even if size is 0
|
||||
unsigned long _C_bits [_C_nelems ? _C_nelems : 1];
|
||||
|
||||
bool _C_valid_pos (_RWSTD_SIZE_T __pos) const _THROWS (()) {
|
||||
// prevent warnings if _Size == 0
|
||||
return _Size + 1 > __pos + 1;
|
||||
}
|
||||
|
||||
void _C_from_ulong (unsigned long __n) _THROWS (()) {
|
||||
reset ();
|
||||
_C_bits [0] =
|
||||
__n & (_RWSTD_ULONG_MAX >> ((_Size > _C_elembits ? 0 :
|
||||
_C_elembits - _Size % _C_elembits) % _C_elembits));
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
void _C_from_char (const _CharT *__str, _RWSTD_SIZE_T __len,
|
||||
const _Traits *__traits, _CharT __b0, _CharT __b1,
|
||||
_RWSTD_SIZE_T __pos, _RWSTD_SIZE_T __n,
|
||||
const char *__file, const char *__fun) {
|
||||
_RW::__rw_bitset (_C_bits, _Size, __str, __len,
|
||||
__traits, __b0, __b1,
|
||||
__pos, __n, __file, __fun);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
class reference {
|
||||
friend class bitset<_Size>;
|
||||
|
||||
bitset<_Size>& _C_ref;
|
||||
_RWSTD_SIZE_T _C_pos;
|
||||
|
||||
reference (bitset<_Size> &__r, _RWSTD_SIZE_T __p) _THROWS (())
|
||||
: _C_ref (__r), _C_pos (__p) { }
|
||||
public:
|
||||
|
||||
reference& operator= (bool __val) _THROWS (()) {
|
||||
return _C_ref.set (_C_pos, __val), *this;
|
||||
}
|
||||
|
||||
reference& operator= (const reference &__rhs) _THROWS (()) {
|
||||
return *this = bool (__rhs);
|
||||
}
|
||||
|
||||
bool operator~ () const _THROWS (()) {
|
||||
return !bool (*this);
|
||||
}
|
||||
|
||||
operator bool () const _THROWS (()) {
|
||||
return _RWSTD_CONST_CAST (const bitset<_Size>&, _C_ref)[_C_pos];
|
||||
}
|
||||
|
||||
reference& flip () _THROWS (()) {
|
||||
return _C_ref.flip (_C_pos), *this;
|
||||
}
|
||||
};
|
||||
|
||||
// 23.3.5.1, p1
|
||||
bitset () _THROWS (()) {
|
||||
reset ();
|
||||
}
|
||||
|
||||
// 23.3.5.1, p2
|
||||
bitset (unsigned long __n) _THROWS (()) {
|
||||
_C_from_ulong (__n);
|
||||
}
|
||||
|
||||
#if !defined (_RWSTD_NO_NONDEDUCED_CONTEXT) \
|
||||
&& (!defined (__SUNPRO_CC) || __SUNPRO_CC > 0x550)
|
||||
|
||||
// 23.3.5.1, p3
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_EXPLICIT
|
||||
bitset (const basic_string<_CharT, _Traits, _Allocator> &__str,
|
||||
_TYPENAME basic_string<_CharT, _Traits,
|
||||
_Allocator>::size_type __pos = 0,
|
||||
_TYPENAME basic_string<_CharT, _Traits,
|
||||
_Allocator>::size_type __n =
|
||||
_RWSTD_SIZE_MAX,
|
||||
_CharT __b0 = '0', _CharT __b1 = '1') {
|
||||
_C_from_char (__str.data (), __str.size (),
|
||||
(_Traits*)0, __b0, __b1, __pos, __n,
|
||||
_RWSTD_FUNC ("bitset::bitset (const basic_string&, "
|
||||
"size_type, size_type)"));
|
||||
}
|
||||
|
||||
#else // if defined (_RWSTD_NO_NONDEDUCED_CONTEXT)
|
||||
|
||||
// working around a SunPro 5.5 and prior bug (PR #28992)
|
||||
|
||||
// 23.3.5.1, p3
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_EXPLICIT
|
||||
bitset (const basic_string<_CharT, _Traits, _Allocator> &__str,
|
||||
_RWSTD_SIZE_T __pos = 0, _RWSTD_SIZE_T __n = _RWSTD_SIZE_MAX,
|
||||
_CharT __b0 = '0', _CharT __b1 = '1') {
|
||||
_C_from_char (__str.data (), __str.size (),
|
||||
(const _Traits*)0, __b0, __b1, __pos, __n,
|
||||
_RWSTD_FUNC ("bitset::bitset (const basic_string&, "
|
||||
"size_t, size_t)"));
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_NONDEDUCED_CONTEXT
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_BITSET_CTOR_STRING
|
||||
# ifndef _RWSTD_NO_MEMBER_TEMPLATE_OVERLOAD
|
||||
|
||||
// extension
|
||||
_EXPLICIT
|
||||
bitset (const string &__str,
|
||||
_RWSTD_SIZE_T __pos = 0, _RWSTD_SIZE_T __n = _RWSTD_SIZE_MAX,
|
||||
char __b0 = '0', char __b1 = '1') {
|
||||
_C_from_char (__str.data (), __str.size (),
|
||||
(const char_traits<char>*)0, __b0, __b1, __pos, __n,
|
||||
_RWSTD_FUNC ("bitset::bitset (const string&, "
|
||||
"size_t, size_t)"));
|
||||
}
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
// extension
|
||||
_EXPLICIT
|
||||
bitset (const wstring &__str,
|
||||
_RWSTD_SIZE_T __pos = 0, _RWSTD_SIZE_T __n = _RWSTD_SIZE_MAX,
|
||||
wchar_t __b0 = L'0', wchar_t __b1 = L'1') {
|
||||
_C_from_char (__str.data (), __str.size (),
|
||||
(const char_traits<wchar_t>*)0, __b0, __b1, __pos, __n,
|
||||
_RWSTD_FUNC ("bitset::bitset (const wstring&, "
|
||||
"size_t, size_t)"));
|
||||
}
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
# endif // _RWSTD_NO_MEMBER_TEMPLATE_OVERLOAD
|
||||
#endif // _RWSTD_NO_EXT_BITSET_CTOR_STRING
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_BITSET_CTOR_CHAR_ARRAY
|
||||
|
||||
// extension
|
||||
_EXPLICIT
|
||||
bitset (const char *__str,
|
||||
_RWSTD_SIZE_T __pos = 0, _RWSTD_SIZE_T __n = _RWSTD_SIZE_MAX,
|
||||
char __b0 = '0', char __b1 = '1') {
|
||||
_C_from_char (__str, _RWSTD_SIZE_MAX,
|
||||
(const char_traits<char>*)0, __b0, __b1, __pos, __n,
|
||||
_RWSTD_FUNC ("bitset::bitset (const char*, "
|
||||
"size_t, size_t)"));
|
||||
}
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
// extension
|
||||
_EXPLICIT
|
||||
bitset (const wchar_t *__str,
|
||||
_RWSTD_SIZE_T __pos = 0, _RWSTD_SIZE_T __n = _RWSTD_SIZE_MAX,
|
||||
wchar_t __b0 = L'0', wchar_t __b1 = L'1') {
|
||||
_C_from_char (__str, _RWSTD_SIZE_MAX,
|
||||
(const char_traits<wchar_t>*)0, __b0, __b1, __pos, __n,
|
||||
_RWSTD_FUNC ("bitset::bitset (const wchar_t*, "
|
||||
"size_t, size_t)"));
|
||||
}
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
// extension:
|
||||
// uses char_traits<CharT>::length() to compute the length of the string
|
||||
// and char_traits<CharT>::eq() to compare characters with `b0' and `b1'
|
||||
template <class _CharT>
|
||||
_EXPLICIT
|
||||
bitset (const _CharT *__str,
|
||||
_RWSTD_SIZE_T __pos = 0, _RWSTD_SIZE_T __n = _RWSTD_SIZE_MAX,
|
||||
_CharT __b0 = '0', _CharT __b1 = '1') {
|
||||
_C_from_char (__str, _RWSTD_SIZE_MAX,
|
||||
(const char_traits<_CharT>*)0, __b0, __b1, __pos, __n,
|
||||
_RWSTD_FUNC ("bitset::bitset (const charT*, "
|
||||
"size_t, size_t)"));
|
||||
}
|
||||
|
||||
// extensions:
|
||||
// prevent ambiguities between the above and bitset(unsigned long)
|
||||
bitset (int __n) _THROWS (()) {
|
||||
_C_from_ulong (__n);
|
||||
}
|
||||
|
||||
bitset (unsigned __n) _THROWS (()) {
|
||||
_C_from_ulong (__n);
|
||||
}
|
||||
|
||||
bitset (long __n) _THROWS (()) {
|
||||
_C_from_ulong (__n);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_EXT_BITSET_CTOR_CHAR_ARRAY
|
||||
|
||||
// 23.3.5.2, p1
|
||||
bitset& operator&= (const bitset &__rhs) _THROWS (()) {
|
||||
for (_RWSTD_SIZE_T __i = 0; __i != _C_nelems; ++__i)
|
||||
_C_bits [__i] &= __rhs._C_bits [__i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 23.3.5.2, p3
|
||||
bitset& operator|= (const bitset &__rhs) _THROWS (()) {
|
||||
for (_RWSTD_SIZE_T __i = 0; __i != _C_nelems; ++__i)
|
||||
_C_bits[__i] |= __rhs._C_bits [__i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 23.3.5.2, p5
|
||||
bitset& operator^= (const bitset& __rhs) _THROWS (()) {
|
||||
for (_RWSTD_SIZE_T __i = 0; __i != _C_nelems; ++__i)
|
||||
_C_bits [__i] ^= __rhs._C_bits [__i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 23.3.5.2, p7
|
||||
bitset& operator<<= (_RWSTD_SIZE_T) _THROWS (());
|
||||
|
||||
// 23.3.5.2, p9
|
||||
bitset& operator>>= (_RWSTD_SIZE_T) _THROWS (());
|
||||
|
||||
// 23.3.5.2, p11
|
||||
bitset& set () _THROWS (());
|
||||
|
||||
// 23.3.5.2, p13: follows proposed resolution of lwg issue 186
|
||||
bitset& set (_RWSTD_SIZE_T, bool = true);
|
||||
|
||||
// 23.3.5.2, p17
|
||||
bitset& reset () _THROWS (()) {
|
||||
return 1 == _C_nelems ? (void)(_C_bits [0] = 0)
|
||||
: (void)_RWSTD_MEMSET (_C_bits, 0, sizeof (_C_bits)), *this;
|
||||
}
|
||||
|
||||
// 23.3.5.2, p19
|
||||
bitset& reset (_RWSTD_SIZE_T __pos) {
|
||||
return set (__pos, false);
|
||||
}
|
||||
|
||||
// 23.3.5.2, p23
|
||||
bitset operator~ () const _THROWS (()) {
|
||||
return bitset (*this).flip ();
|
||||
}
|
||||
|
||||
// 23.3.5.2, p25
|
||||
bitset& flip () _THROWS (()) {
|
||||
for (_RWSTD_SIZE_T __i = 0; __i != _C_nelems; __i++)
|
||||
_C_bits [__i] = ~_C_bits [__i];
|
||||
_C_bits [_C_nelems - !!_C_nelems] &=
|
||||
_RWSTD_ULONG_MAX >> (_C_elembits - _Size % _C_elembits) % _C_elembits;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 23.3.5.2, p27
|
||||
bitset& flip (_RWSTD_SIZE_T __pos) {
|
||||
_RWSTD_REQUIRES (_C_valid_pos (__pos),
|
||||
(_RWSTD_ERROR_OUT_OF_RANGE,
|
||||
_RWSTD_FUNC ("bitset::flip(size_t)"),
|
||||
__pos, _C_nelems));
|
||||
|
||||
_C_bits [__pos / _C_elembits] ^= 1UL << __pos % _C_elembits;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 23.3.5.2, p??
|
||||
bool operator[] (_RWSTD_SIZE_T __pos) const _THROWS (()) {
|
||||
_RWSTD_ASSERT (_C_valid_pos (__pos));
|
||||
return !!(_C_bits [__pos / _C_elembits] & (1UL << __pos % _C_elembits));
|
||||
}
|
||||
|
||||
// 23.3.5.2, p??
|
||||
reference operator[] (_RWSTD_SIZE_T __pos) _THROWS (()) {
|
||||
_RWSTD_ASSERT (_C_valid_pos (__pos));
|
||||
return reference (*this, __pos);
|
||||
}
|
||||
|
||||
// 23.3.5.2, p31
|
||||
unsigned long to_ulong () const;
|
||||
|
||||
#if !defined (_RWSTD_NO_MEMBER_TEMPLATES) \
|
||||
&& !defined (_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE) \
|
||||
&& !defined (_RWSTD_NO_MEMBER_TEMPLATE_OVERLOAD)
|
||||
|
||||
// 23.3.5.2, p33
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>
|
||||
to_string (_CharT = '0', _CharT = '1') const;
|
||||
|
||||
# define _RWSTD_BITSET_TO_STRING(charT, Traits) \
|
||||
template to_string<charT, Traits, allocator <charT> >()
|
||||
|
||||
# ifndef _RWSTD_NO_EXT_BITSET_TO_STRING
|
||||
|
||||
// convenience extensions
|
||||
template <class _CharT, class _Traits>
|
||||
basic_string<_CharT, _Traits, allocator<_CharT> >
|
||||
to_string (_CharT __b0 = '0', _CharT __b1 = '1') const {
|
||||
return to_string<_CharT, _Traits, allocator<_CharT> >(__b0, __b1);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
|
||||
to_string (_CharT __b0 = '0', _CharT __b1 = '1') const {
|
||||
return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
|
||||
(__b0, __b1);
|
||||
}
|
||||
|
||||
basic_string<char, char_traits<char>, allocator<char> >
|
||||
to_string (char __b0 = '0', char __b1 = '1') const {
|
||||
return to_string<char, char_traits<char>, allocator<char> >
|
||||
(__b0, __b1);
|
||||
}
|
||||
|
||||
# endif // !_NO_EXT_BITSET_TO_STRING
|
||||
|
||||
#else // if _MEMBER_TEMPLATES || _NO_TEMPLATE_ON_RETURN_TYPE || ...
|
||||
|
||||
// 23.3.5.2, p33
|
||||
string to_string (char = '0', char = '1') const;
|
||||
|
||||
# define _RWSTD_BITSET_TO_STRING(ign1, ign2) to_string ()
|
||||
|
||||
#endif // !_NO_MEMBER_TEMPLATES && !_NO_TEMPLATE_ON_RETURN_TYPE && ...
|
||||
|
||||
// 23.3.5.2, p35
|
||||
_RWSTD_SIZE_T count () const _THROWS (()) {
|
||||
return _Size ? _RW::__rw_bit_count (_C_bits, _C_nelems) : 0;
|
||||
}
|
||||
|
||||
// 23.3.5.2, p36
|
||||
_RWSTD_SIZE_T size () const _THROWS (()) {
|
||||
return _Size;
|
||||
}
|
||||
|
||||
// 23.3.5.2, p37
|
||||
bool operator== (const bitset& __rhs) const _THROWS (()) {
|
||||
for (_RWSTD_SIZE_T __i = 0; __i != _C_nelems; ++__i)
|
||||
if (_C_bits [__i] != __rhs._C_bits [__i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// 23.3.5.2, p38
|
||||
bool operator!= (const bitset& __rhs) const _THROWS (()) {
|
||||
return !(*this == __rhs);
|
||||
}
|
||||
|
||||
// 23.3.5.2, p39
|
||||
bool test (_RWSTD_SIZE_T __pos) const {
|
||||
_RWSTD_REQUIRES (_C_valid_pos (__pos),
|
||||
(_RWSTD_ERROR_OUT_OF_RANGE,
|
||||
_RWSTD_FUNC ("bitset::test(size_t) const"),
|
||||
__pos, _C_nelems));
|
||||
|
||||
return !!(_C_bits [__pos / _C_elembits] & (1UL << __pos % _C_elembits));
|
||||
}
|
||||
|
||||
// 23.3.5.2, p42
|
||||
bool any () const _THROWS (()) {
|
||||
for (_RWSTD_SIZE_T __i = 0; __i != _C_nelems; ++__i)
|
||||
if (_C_bits [__i])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 23.3.5.2, p43
|
||||
bool none () const _THROWS (()) {
|
||||
return !any ();
|
||||
}
|
||||
|
||||
// 23.3.5.2, p44
|
||||
bitset operator<< (_RWSTD_SIZE_T __pos) const _THROWS (()) {
|
||||
return bitset (*this) <<= __pos;
|
||||
}
|
||||
|
||||
// 23.3.5.2, p45
|
||||
bitset operator>> (_RWSTD_SIZE_T __pos) const _THROWS (()) {
|
||||
return bitset (*this) >>= __pos;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 23.3.5.2, p11
|
||||
template <_RWSTD_SIZE_T _Size>
|
||||
inline bitset<_Size>&
|
||||
bitset<_Size>::set () _THROWS (())
|
||||
{
|
||||
if (_C_nelems == 1)
|
||||
_C_bits [0] = _RWSTD_ULONG_MAX;
|
||||
else
|
||||
_RWSTD_MEMSET (_C_bits, -1, sizeof _C_bits);
|
||||
|
||||
_C_bits [_C_nelems - !!_C_nelems] >>=
|
||||
(_C_elembits - _Size % _C_elembits) % _C_elembits;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// 23.3.5.2, p13
|
||||
template <_RWSTD_SIZE_T _Size>
|
||||
inline bitset<_Size>&
|
||||
bitset<_Size>::set (_RWSTD_SIZE_T __pos, bool __val)
|
||||
{
|
||||
_RWSTD_REQUIRES (_C_valid_pos (__pos),
|
||||
(_RWSTD_ERROR_OUT_OF_RANGE,
|
||||
_RWSTD_FUNC ("bitset::set(size_t, bool)"),
|
||||
__pos, _C_nelems));
|
||||
|
||||
if (__val)
|
||||
_C_bits [__pos / _C_elembits] |= (1UL << __pos % _C_elembits);
|
||||
else
|
||||
_C_bits [__pos / _C_elembits] &= ~(1UL << __pos % _C_elembits);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// 23.3.5.2, p7
|
||||
template <_RWSTD_SIZE_T _Size>
|
||||
inline bitset<_Size>&
|
||||
bitset<_Size>::operator<<= (_RWSTD_SIZE_T __n) _THROWS (())
|
||||
{
|
||||
if (_Size >= _C_elembits)
|
||||
_RW::__rw_shl (_C_bits, _C_nelems, __n);
|
||||
else
|
||||
// prevent shifting by sizeof (_C_bits) * CHAR_BIT (undefined)
|
||||
_C_bits [0] <<= __n;
|
||||
|
||||
// clear bits shifted past the MSB
|
||||
if (_Size % _C_elembits) {
|
||||
// prevent warnings about shifting too far
|
||||
_C_bits [_C_nelems - !!_C_nelems] &=
|
||||
_RWSTD_ULONG_MAX >> (_C_elembits - _Size % _C_elembits) % _C_elembits;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// 23.3.5.2, p9
|
||||
template <_RWSTD_SIZE_T _Size>
|
||||
inline bitset<_Size>&
|
||||
bitset<_Size>::operator>>= (_RWSTD_SIZE_T __n) _THROWS (())
|
||||
{
|
||||
if (_Size >= _C_elembits)
|
||||
_RW::__rw_shr (_C_bits, _C_nelems, __n);
|
||||
else
|
||||
// prevent shifting by sizeof (_C_bits) * CHAR_BIT (undefined)
|
||||
_C_bits [0] >>= __n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// 23.3.5.2, p31
|
||||
template <_RWSTD_SIZE_T _Size>
|
||||
inline unsigned long
|
||||
bitset<_Size>::to_ulong () const
|
||||
{
|
||||
// add 1 to prevent warnings about pointless comparison with 0
|
||||
for (_RWSTD_SIZE_T __i = 1; __i + 1 < _C_nelems + 1; ++__i)
|
||||
_RWSTD_REQUIRES (!_C_bits[__i],
|
||||
(_RWSTD_ERROR_OVERFLOW_ERROR,
|
||||
_RWSTD_FUNC ("bitset::to_ulong() const")));
|
||||
|
||||
return _C_bits [0];
|
||||
}
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_MEMBER_TEMPLATES) \
|
||||
&& !defined (_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE) \
|
||||
&& !defined (_RWSTD_NO_MEMBER_TEMPLATE_OVERLOAD)
|
||||
|
||||
// 23.3.5.2, p33
|
||||
template <_RWSTD_SIZE_T _Size>
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline basic_string<_CharT, _Traits, _Allocator>
|
||||
bitset<_Size>::
|
||||
to_string (_CharT __b0 /* = '0' */, _CharT __b1 /* = '1' */) const
|
||||
{
|
||||
// extension: allocate but do not initialize
|
||||
basic_string<_CharT, _Traits, _Allocator> __s ((_CharT*)0, _Size);
|
||||
|
||||
for (_RWSTD_SIZE_T __i = 0; __i != _Size; ++__i)
|
||||
_Traits::assign (__s [_Size - 1 - __i], (*this)[__i] ? __b1 : __b0);
|
||||
|
||||
return __s;
|
||||
}
|
||||
|
||||
#else // _NO_MEMBER_TEMPLATES || _NO_TEMPLATE_ON_RETURN_TYPE ...
|
||||
|
||||
// 23.3.5.2, p33
|
||||
template <_RWSTD_SIZE_T _Size>
|
||||
inline string
|
||||
bitset<_Size>::
|
||||
to_string (char __b0 /* = '0' */, char __b1 /* = '1' */) const
|
||||
{
|
||||
// extension: allocate but do not initialize
|
||||
string __s ((char*)0, _Size);
|
||||
|
||||
for (_RWSTD_SIZE_T __i = 0; __i != _Size; ++__i)
|
||||
__s [_Size - 1 - __i] = (*this)[__i] ? __b1 : __b0;
|
||||
|
||||
return __s;
|
||||
}
|
||||
|
||||
#endif // !_NO_MEMBER_TEMPLATES && !_NO_TEMPLATE_ON_RETURN_TYPE ...
|
||||
|
||||
|
||||
// 23.3.5.3, p1
|
||||
template <_RWSTD_SIZE_T _Size>
|
||||
inline bitset<_Size>
|
||||
operator& (const bitset<_Size>& __lhs, const bitset<_Size>& __rhs) _THROWS (())
|
||||
{
|
||||
return bitset<_Size>(__lhs) &= __rhs;
|
||||
}
|
||||
|
||||
|
||||
// 23.3.5.3, p2
|
||||
template <_RWSTD_SIZE_T _Size>
|
||||
inline bitset<_Size>
|
||||
operator| (const bitset<_Size>& __lhs, const bitset<_Size>& __rhs) _THROWS (())
|
||||
{
|
||||
return bitset<_Size>(__lhs) |= __rhs;
|
||||
}
|
||||
|
||||
|
||||
// 23.3.5.3, p3
|
||||
template <_RWSTD_SIZE_T _Size>
|
||||
inline bitset<_Size>
|
||||
operator^ (const bitset<_Size>& __lhs, const bitset<_Size>& __rhs) _THROWS (())
|
||||
{
|
||||
return bitset<_Size>(__lhs) ^= __rhs;
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
_EXPORT
|
||||
template <_RWSTD_SIZE_T _Size, class _CharT, class _Traits>
|
||||
_STD::basic_istream<_CharT, _Traits>&
|
||||
__rw_extract_bitset (_STD::basic_istream<_CharT, _Traits>&,
|
||||
_STD::bitset<_Size>&);
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
#if !defined (_MSC_VER) || _MSC_VER > 1300
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
// 23.3.5.3, p8
|
||||
template <class _CharT, class _Traits, _RWSTD_SIZE_T _Size>
|
||||
inline basic_ostream<_CharT, _Traits>&
|
||||
operator<< (basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
|
||||
{
|
||||
return __os << __x._RWSTD_BITSET_TO_STRING (_CharT, _Traits);
|
||||
}
|
||||
|
||||
|
||||
// 23.3.5.3, p4
|
||||
template <class _CharT, class _Traits, _RWSTD_SIZE_T _Size>
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
operator>> (basic_istream<_CharT, _Traits>& __strm, bitset<_Size>& __x)
|
||||
{
|
||||
return _RW::__rw_extract_bitset (__strm, __x);
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
#else // if defined (_MSC_VER) && _MSC_VER <= 1300
|
||||
|
||||
# include <ostream>
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
// MSVC 6.0 fails to compile (and with a fix to generate code) for the call
|
||||
// to extract_bitset below if `Size' is the last template parameter
|
||||
|
||||
typedef _RWSTD_SIZE_T _Size_t; // prevent an MSVC 6.0 ICE
|
||||
|
||||
template <_Size_t _Size, class _CharT, class _Traits>
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
operator>> (basic_istream<_CharT, _Traits>& __strm, bitset<_Size>& __x)
|
||||
{
|
||||
return _RW::__rw_extract_bitset (__strm, __x);
|
||||
}
|
||||
|
||||
template <_Size_t _Size>
|
||||
inline ostream& operator<< (ostream &__strm, const bitset<_Size>& __x)
|
||||
{
|
||||
return __strm << __x._RWSTD_BITSET_TO_STRING (char, char_traits<char>);
|
||||
}
|
||||
|
||||
template <_Size_t _Size>
|
||||
inline wostream& operator<< (wostream &__strm, const bitset<_Size>& __x)
|
||||
{
|
||||
const string __s = __x._RWSTD_BITSET_TO_STRING (char, char_traits<char>);
|
||||
wstring __tmp (0, __s.length ()); // extension: allocate uninitialzed
|
||||
for (string::size_type __i = 0; __i != __tmp.size (); ++__i)
|
||||
__tmp [__i] = __s [__i];
|
||||
return __strm << __tmp;
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // !defined (_MSC_VER) || _MSC_VER > 1300
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_IMPLICIT_INCLUSION
|
||||
# include <bitset.cc>
|
||||
#endif
|
||||
|
||||
|
||||
#endif // _RWSTD_BITSET_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/bitset.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/bitset.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* bitset.c
|
||||
*
|
||||
* $Id: bitset.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 <bitset.cc>
|
||||
187
extern/stdcxx/4.2.1/include/bitset.cc
vendored
Normal file
187
extern/stdcxx/4.2.1/include/bitset.cc
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* bitset - definitions of out-of-line bitset members
|
||||
*
|
||||
* $Id: bitset.cc 465512 2006-10-19 06:53:06Z 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 2004-2005 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
|
||||
#if 8 == _RWSTD_CHAR_BIT
|
||||
# define _RWSTD_LOG2_CHAR_BITS 3
|
||||
#elif 16 == _RWSTD_CHAR_BIT
|
||||
# define _RWSTD_LOG2_CHAR_BITS 4
|
||||
#elif 32 == _RWSTD_CHAR_BIT
|
||||
# define _RWSTD_LOG2_CHAR_BITS 5
|
||||
#elif 64 == _RWSTD_CHAR_BIT
|
||||
# define _RWSTD_LOG2_CHAR_BITS 6
|
||||
#endif
|
||||
|
||||
#if 1 == _RWSTD_LONG_SIZE
|
||||
# define _RWSTD_LOG2_LONG_SIZE 0
|
||||
#elif 2 == _RWSTD_LONG_SIZE
|
||||
# define _RWSTD_LOG2_LONG_SIZE 1
|
||||
#elif 4 == _RWSTD_LONG_SIZE
|
||||
# define _RWSTD_LOG2_LONG_SIZE 2
|
||||
#elif 8 == _RWSTD_LONG_SIZE
|
||||
# define _RWSTD_LOG2_LONG_SIZE 3
|
||||
#elif 16 == _RWSTD_LONG_SIZE
|
||||
# define _RWSTD_LOG2_LONG_SIZE 4
|
||||
#endif
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits>
|
||||
void __rw_bitset (unsigned long *__bits, _RWSTD_SIZE_T __maxbits,
|
||||
const _CharT *__str, _RWSTD_SIZE_T __slen,
|
||||
const _Traits*, _CharT __b0, _CharT __b1,
|
||||
_RWSTD_SIZE_T __pos, _RWSTD_SIZE_T __n,
|
||||
const char *__file, const char *__fun)
|
||||
{
|
||||
const _RWSTD_SIZE_T __wordbits = sizeof *__bits * _RWSTD_CHAR_BIT;
|
||||
|
||||
if (_RWSTD_SIZE_MAX == __slen)
|
||||
__slen = _Traits::length (__str);
|
||||
|
||||
// verify that `pos' is a valid offset into `str'
|
||||
_RWSTD_REQUIRES (__pos <= __slen,
|
||||
(_RWSTD_ERROR_OUT_OF_RANGE, __file, __fun, __pos, __slen));
|
||||
|
||||
// compute the number of characters in `str' past the offset `pos'
|
||||
// that will be checked (although not all of them may necessarily
|
||||
// be used)
|
||||
const _RWSTD_SIZE_T __nchars =
|
||||
__n < (__slen - __pos) ? __n : __slen - __pos;
|
||||
|
||||
// compute the number of bits to initialize from `str'
|
||||
const _RWSTD_SIZE_T __nbits = __nchars < __maxbits ? __nchars : __maxbits;
|
||||
|
||||
__str += __pos;
|
||||
|
||||
// compute the number of bytes occupied by `bits'
|
||||
#if defined (_RWSTD_LOG2_CHAR_BITS) && defined (_RWSTD_LOG2_LONG_SIZE)
|
||||
|
||||
const _RWSTD_SIZE_T __nbytes =
|
||||
((__maxbits >> (_RWSTD_LOG2_CHAR_BITS + _RWSTD_LOG2_LONG_SIZE)) +
|
||||
(0 != (__maxbits & (__wordbits - 1)))) << _RWSTD_LOG2_LONG_SIZE;
|
||||
|
||||
#else // #if !defined (_RWSTD_LOG2_CHAR_BITS) || !defined (_RWSTD_LOG2_LONG_SIZE)
|
||||
|
||||
const _RWSTD_SIZE_T __nbytes =
|
||||
(__maxbits / __wordbits + (0 != __maxbits % __wordbits))
|
||||
* sizeof (*__bits);
|
||||
|
||||
#endif // _RWSTD_LOG2_CHAR_BITS && _RWSTD_LOG2_LONG_SIZE
|
||||
|
||||
_RWSTD_MEMSET (__bits, 0, __nbytes);
|
||||
|
||||
// set all bits but also check any extra characters as required
|
||||
for (_RWSTD_SIZE_T __i = 0; __i != __nchars; ++__i) {
|
||||
|
||||
if (_Traits::eq (__b1, __str [__i])) {
|
||||
|
||||
const _RWSTD_SIZE_T __bitno = __nbits - __i - 1;
|
||||
|
||||
if (__i < __nbits)
|
||||
__bits [__bitno / __wordbits] |= 1UL << __bitno % __wordbits;
|
||||
}
|
||||
else {
|
||||
// verify that the character is valid
|
||||
_RWSTD_REQUIRES (_Traits::eq (__b0, __str [__i]),
|
||||
(_RWSTD_ERROR_INVALID_ARGUMENT, __file, __fun));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef _RWSTD_LOG2_CHAR_BITS
|
||||
#undef _RWSTD_LOG2_ULONG_SIZE
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <_RWSTD_SIZE_T _Size, class _CharT, class _Traits>
|
||||
_STD::basic_istream<_CharT, _Traits>&
|
||||
__rw_extract_bitset (_STD::basic_istream<_CharT, _Traits> &__strm,
|
||||
_STD::bitset<_Size> &__x)
|
||||
{
|
||||
typedef _STD::basic_istream<_CharT, _Traits> _Istream;
|
||||
|
||||
_TYPENAME _Istream::iostate __err (__strm.goodbit);
|
||||
|
||||
|
||||
_STD::bitset<_Size> __tmp;
|
||||
|
||||
_RWSTD_SIZE_T __bit = _Size;
|
||||
|
||||
_TRY {
|
||||
|
||||
// sentry may throw an exception
|
||||
const _TYPENAME _Istream::sentry __ipfx (__strm);
|
||||
|
||||
if (__ipfx) {
|
||||
|
||||
// 23.3.5.3, p5 - extract at most _Size chars
|
||||
|
||||
// get next char without extracting
|
||||
_TYPENAME _Traits::int_type __c = __strm.rdbuf ()->sgetc ();
|
||||
|
||||
for ( ; __bit; --__bit) {
|
||||
|
||||
if (_Traits::eq_int_type (_Traits::eof (), __c)) {
|
||||
__err = __strm.eofbit;
|
||||
break;
|
||||
}
|
||||
|
||||
// convert to char_type and narrow to char
|
||||
const char __ch =
|
||||
__strm.narrow (_Traits::to_char_type (__c), _CharT ());
|
||||
|
||||
if ('1' == __ch)
|
||||
__tmp [__bit - 1] = 1;
|
||||
else if ('0' != __ch)
|
||||
break;
|
||||
|
||||
__c = __strm.rdbuf ()->snextc ();
|
||||
}
|
||||
|
||||
// shift tmp right by the number of outstanding bits
|
||||
__tmp >>= __bit;
|
||||
}
|
||||
}
|
||||
_CATCH (...) {
|
||||
__strm.setstate (__strm.badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
|
||||
if (_Size && _Size == __bit)
|
||||
__err |= __strm.failbit;
|
||||
else
|
||||
__x = __tmp;
|
||||
|
||||
if (__err)
|
||||
__strm.setstate (__err);
|
||||
|
||||
return __strm;
|
||||
}
|
||||
|
||||
} // namespace __rw
|
||||
867
extern/stdcxx/4.2.1/include/complex
vendored
Normal file
867
extern/stdcxx/4.2.1/include/complex
vendored
Normal file
@@ -0,0 +1,867 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* <complex> - definitions of the template complex and specializations
|
||||
*
|
||||
* $Id: complex 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 2000-2007 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_COMPLEX_INCLUDED
|
||||
#define _RWSTD_COMPLEX_INCLUDED
|
||||
|
||||
#include <sstream>
|
||||
#include <iosfwd>
|
||||
#include <utility>
|
||||
|
||||
#include <rw/_defs.h>
|
||||
#include _RWSTD_CMATH
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning (push)
|
||||
// disable conversion from 'double' to 'float', possible loss of data
|
||||
// until a conforming <cmath> header with float and long double overloads
|
||||
// for the C functions is provided
|
||||
# pragma warning (disable: 4244)
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
// 26.2.2
|
||||
template <class _TypeT>
|
||||
class complex;
|
||||
|
||||
// 26.2.3
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class complex<float>;
|
||||
|
||||
// 26.2.3
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class complex<double>;
|
||||
|
||||
#ifndef _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
// 26.2.3
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class complex<long double>;
|
||||
|
||||
#endif // _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
|
||||
// 26.2.6 complex non-member operations (used from within member functions)
|
||||
|
||||
// 26.2.6, p7
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator* (const complex<_TypeT> &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return complex<_TypeT>(_TypeT ( __lhs.real () * __rhs.real ()
|
||||
- __lhs.imag () * __rhs.imag ()),
|
||||
_TypeT ( __lhs.imag () * __rhs.real ()
|
||||
+ __lhs.real () * __rhs.imag ()));
|
||||
}
|
||||
|
||||
|
||||
// 26.2.6, p8
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator/ (const complex<_TypeT> &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
_TypeT __den = __rhs.real() * __rhs.real() + __rhs.imag() * __rhs.imag();
|
||||
|
||||
return complex<_TypeT>(_TypeT ( __lhs.real () * __rhs.real ()
|
||||
+ __lhs.imag () * __rhs.imag ()) / __den,
|
||||
_TypeT ( __lhs.imag () * __rhs.real ()
|
||||
- __lhs.real () * __rhs.imag ()) / __den);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
# define _RWSTD_MEMBER_TEMPLATE(name) \
|
||||
template <class _TypeX> \
|
||||
complex<value_type>& name (const complex<_TypeX> &__rhs)
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
# define _RWSTD_MEMBER_TEMPLATE(name) \
|
||||
complex<value_type>& name (const complex &__rhs)
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
|
||||
// 26.2.3 - complex specializations
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class complex<float>
|
||||
{
|
||||
public:
|
||||
typedef float value_type;
|
||||
|
||||
// implicit conversion
|
||||
complex (value_type __re = value_type (), value_type __im = value_type ())
|
||||
: _C_re (__re), _C_im (__im) { }
|
||||
|
||||
// defined after the definition of the incomplete complex<double>
|
||||
_EXPLICIT complex (const complex<double>&);
|
||||
|
||||
#ifndef _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
// defined after the definition of the incomplete complex<long double>
|
||||
_EXPLICIT complex (const complex<long double>&);
|
||||
|
||||
#endif // _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
value_type imag () const {
|
||||
return _C_im;
|
||||
}
|
||||
|
||||
value_type real () const {
|
||||
return _C_re;
|
||||
}
|
||||
|
||||
#if defined (_COMPILER_VERSION) && _COMPILER_VERSION <= 730
|
||||
|
||||
// working around a MIPSpro 7.3.1 bug (SGI serial #0800690BCFC2)
|
||||
complex<value_type>& operator= (const complex<value_type>& __rhs) {
|
||||
return (_C_re = __rhs._C_re), (_C_im = __rhs._C_im), *this;
|
||||
}
|
||||
|
||||
#endif // _COMPILER_VERSION <= 730
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATE
|
||||
|
||||
template <class _TypeT>
|
||||
complex& operator= (const complex<_TypeT>& __rhs) {
|
||||
return (_C_re = __rhs.real ()), (_C_im = __rhs.imag ()), *this;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATE
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator+=) {
|
||||
return (_C_re += __rhs.real ()), (_C_im += __rhs.imag ()), *this;
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator-=) {
|
||||
return (_C_re -= __rhs.real ()), (_C_im -= __rhs.imag ()), *this;
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator*=) {
|
||||
return *this = *this * complex<value_type>(__rhs);
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator/=) {
|
||||
return *this = *this / complex<value_type>(__rhs);
|
||||
}
|
||||
|
||||
complex<value_type>& operator= (value_type __rhs) {
|
||||
return (_C_re = __rhs), (_C_im = value_type ()), *this;
|
||||
}
|
||||
|
||||
complex<value_type>& operator+= (value_type __rhs) {
|
||||
return _C_re += __rhs, *this;
|
||||
}
|
||||
|
||||
complex<value_type>& operator-= (value_type __rhs) {
|
||||
return _C_re -= __rhs, *this;
|
||||
}
|
||||
|
||||
complex<value_type>& operator*= (value_type __rhs) {
|
||||
return (_C_re *= __rhs), (_C_im *= __rhs), *this;
|
||||
}
|
||||
|
||||
complex<value_type>& operator/= (value_type __rhs) {
|
||||
return (_C_re /= __rhs), (_C_im /= __rhs), *this;
|
||||
}
|
||||
|
||||
private:
|
||||
value_type _C_re, _C_im;
|
||||
};
|
||||
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class complex<double>
|
||||
{
|
||||
public:
|
||||
typedef double value_type;
|
||||
|
||||
// implicit conversion
|
||||
complex (value_type __re = value_type (), value_type __im = value_type ())
|
||||
: _C_re (__re), _C_im (__im) { }
|
||||
|
||||
// implicit conversion
|
||||
complex (const complex<float> &__rhs)
|
||||
: _C_re (__rhs.real ()), _C_im (__rhs.imag ()) { }
|
||||
|
||||
#ifndef _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
// defined after the definition of the incomplete complex<long double>
|
||||
_EXPLICIT complex (const complex<long double>&);
|
||||
|
||||
#endif // _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
value_type imag () const {
|
||||
return _C_im;
|
||||
}
|
||||
|
||||
value_type real () const {
|
||||
return _C_re;
|
||||
}
|
||||
|
||||
#if defined (_COMPILER_VERSION) && _COMPILER_VERSION <= 730
|
||||
|
||||
// working around a MIPSpro 7.3.1 bug (SGI serial #0800690BCFC2)
|
||||
complex<value_type>& operator= (const complex<value_type>& __rhs) {
|
||||
return (_C_re = __rhs._C_re), (_C_im = __rhs._C_im), *this;
|
||||
}
|
||||
|
||||
#endif // _COMPILER_VERSION <= 730
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATE
|
||||
|
||||
template <class _TypeT>
|
||||
complex& operator= (const complex<_TypeT>& __rhs) {
|
||||
return (_C_re = __rhs.real ()), (_C_im = __rhs.imag ()), *this;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATE
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator+=) {
|
||||
return (_C_re += __rhs.real ()), (_C_im += __rhs.imag ()), *this;
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator-=) {
|
||||
return (_C_re -= __rhs.real ()), (_C_im -= __rhs.imag ()), *this;
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator*=) {
|
||||
return *this = *this * complex<value_type>(__rhs);
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator/=) {
|
||||
return *this = *this / complex<value_type>(__rhs);
|
||||
}
|
||||
|
||||
complex<value_type>& operator= (value_type __rhs) {
|
||||
return (_C_re = __rhs), (_C_im = value_type ()), *this;
|
||||
}
|
||||
|
||||
complex<value_type>& operator+= (value_type __rhs) {
|
||||
return _C_re += __rhs, *this;
|
||||
}
|
||||
|
||||
complex<value_type>& operator-= (value_type __rhs) {
|
||||
return _C_re -= __rhs, *this;
|
||||
}
|
||||
|
||||
complex<value_type>& operator*= (value_type __rhs) {
|
||||
return (_C_re *= __rhs), (_C_im *= __rhs), *this;
|
||||
}
|
||||
|
||||
complex<value_type>& operator/= (value_type __rhs) {
|
||||
return (_C_re /= __rhs), (_C_im /= __rhs), *this;
|
||||
}
|
||||
|
||||
private:
|
||||
value_type _C_re, _C_im;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
_RWSTD_SPECIALIZED_CLASS
|
||||
class complex<long double>
|
||||
{
|
||||
public:
|
||||
typedef long double value_type;
|
||||
|
||||
// implicit conversion
|
||||
complex (value_type __re = value_type (), value_type __im = value_type ())
|
||||
: _C_re (__re), _C_im (__im) { }
|
||||
|
||||
// implicit conversion
|
||||
complex (const complex<float> &__rhs)
|
||||
: _C_re (__rhs.real ()), _C_im (__rhs.imag ()) { }
|
||||
|
||||
// implicit conversion
|
||||
complex (const complex<double> &__rhs)
|
||||
: _C_re (__rhs.real ()), _C_im (__rhs.imag ()) { }
|
||||
|
||||
value_type imag () const {
|
||||
return _C_im;
|
||||
}
|
||||
|
||||
value_type real () const {
|
||||
return _C_re;
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator+=) {
|
||||
return (_C_re += __rhs.real ()), (_C_im += __rhs.imag ()), *this;
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator-=) {
|
||||
return (_C_re -= __rhs.real ()), (_C_im -= __rhs.imag ()), *this;
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator*=) {
|
||||
return *this = *this * complex<value_type>(__rhs);
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator/=) {
|
||||
return *this = *this / complex<value_type>(__rhs);
|
||||
}
|
||||
|
||||
#if defined (_COMPILER_VERSION) && _COMPILER_VERSION <= 730
|
||||
|
||||
// working around a MIPSpro 7.3.1 bug (SGI serial #0800690BCFC2)
|
||||
complex<value_type>& operator= (const complex<value_type>& __rhs) {
|
||||
return (_C_re = __rhs._C_re), (_C_im = __rhs._C_im), *this;
|
||||
}
|
||||
|
||||
#endif // _COMPILER_VERSION <= 730
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATE
|
||||
|
||||
template <class _TypeT>
|
||||
complex& operator= (const complex<_TypeT>& __rhs) {
|
||||
return (_C_re = __rhs.real ()), (_C_im = __rhs.imag ()), *this;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATE
|
||||
|
||||
complex& operator+= (value_type __rhs) {
|
||||
return _C_re += __rhs, *this;
|
||||
}
|
||||
|
||||
complex& operator-= (value_type __rhs) {
|
||||
return _C_re -= __rhs, *this;
|
||||
}
|
||||
|
||||
complex& operator*= (value_type __rhs) {
|
||||
return (_C_re *= __rhs), (_C_im *= __rhs), *this;
|
||||
}
|
||||
|
||||
complex& operator/= (value_type __rhs) {
|
||||
return (_C_re /= __rhs), (_C_im /= __rhs), *this;
|
||||
}
|
||||
|
||||
private:
|
||||
value_type _C_re, _C_im;
|
||||
};
|
||||
|
||||
#endif // _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
|
||||
inline complex<float>::complex (const complex<double> &__rhs)
|
||||
: _C_re (_RWSTD_STATIC_CAST (value_type, __rhs.real ())),
|
||||
_C_im (_RWSTD_STATIC_CAST (value_type, __rhs.imag ()))
|
||||
{ }
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
inline complex<float>::complex (const complex<long double> &__rhs)
|
||||
: _C_re (_RWSTD_STATIC_CAST (value_type, __rhs.real ())),
|
||||
_C_im (_RWSTD_STATIC_CAST (value_type, __rhs.imag ()))
|
||||
{ }
|
||||
|
||||
inline complex<double>::complex (const complex<long double> &__rhs)
|
||||
: _C_re (_RWSTD_STATIC_CAST (value_type, __rhs.real ())),
|
||||
_C_im (_RWSTD_STATIC_CAST (value_type, __rhs.imag ()))
|
||||
{ }
|
||||
|
||||
#endif // _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
|
||||
|
||||
// 26.2.2
|
||||
template <class _TypeT>
|
||||
class complex
|
||||
{
|
||||
public:
|
||||
typedef _TypeT value_type;
|
||||
|
||||
complex (const value_type &__re = value_type (),
|
||||
const value_type &__im = value_type ())
|
||||
: _C_re (__re), _C_im (__im) { }
|
||||
|
||||
value_type imag () const {
|
||||
return _C_im;
|
||||
}
|
||||
|
||||
value_type real () const {
|
||||
return _C_re;
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATE
|
||||
|
||||
template <class _TypeU>
|
||||
complex (const complex<_TypeU>& __rhs)
|
||||
: _C_re (_RWSTD_STATIC_CAST (value_type, __rhs.real ())),
|
||||
_C_im (_RWSTD_STATIC_CAST (value_type, __rhs.imag ())) { }
|
||||
|
||||
template <class _TypeU>
|
||||
complex& operator= (const complex<_TypeU>& __rhs) {
|
||||
// not recursive: calls the compiler-generated operator=()
|
||||
return *this = complex (__rhs);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATE
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator+=) {
|
||||
return *this = *this + __rhs;
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator-=) {
|
||||
return *this = *this - __rhs;
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator*=) {
|
||||
return *this = *this * __rhs;
|
||||
}
|
||||
|
||||
_RWSTD_MEMBER_TEMPLATE (operator/=) {
|
||||
return *this = *this / __rhs;
|
||||
}
|
||||
|
||||
complex& operator= (value_type __rhs) {
|
||||
return (_C_re = __rhs), (_C_im = value_type ()), *this;
|
||||
}
|
||||
|
||||
complex& operator+= (value_type __rhs) {
|
||||
return _C_re += __rhs, *this;
|
||||
}
|
||||
|
||||
complex& operator-= (value_type __rhs) {
|
||||
return _C_re -= __rhs, *this;
|
||||
}
|
||||
|
||||
complex& operator*= (value_type __rhs) {
|
||||
return (_C_re *= __rhs), (_C_im *= __rhs), *this;
|
||||
}
|
||||
|
||||
complex& operator/= (value_type __rhs) {
|
||||
return (_C_re /= __rhs), (_C_im /= __rhs), *this;
|
||||
}
|
||||
|
||||
private:
|
||||
value_type _C_re, _C_im;
|
||||
};
|
||||
|
||||
|
||||
// 26.2.6 complex non-member operations
|
||||
|
||||
// 26.2.6, p1
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator+ (const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return __rhs;
|
||||
}
|
||||
|
||||
|
||||
// 26.2.6, p3
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator+ (const complex<_TypeT> &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return complex<_TypeT>(_TypeT (__lhs.real () + __rhs.real ()),
|
||||
_TypeT (__lhs.imag () + __rhs.imag ()));
|
||||
}
|
||||
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator+ (const complex<_TypeT> &__lhs, const _TypeT &__rhs)
|
||||
{
|
||||
return complex<_TypeT>(__lhs.real () + __rhs, __lhs.imag ());
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator+ (const _TypeT &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return __rhs + __lhs;
|
||||
}
|
||||
|
||||
|
||||
// 26.2.6, p4
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator- (const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return complex<_TypeT>(-__rhs.real (), -__rhs.imag ());
|
||||
}
|
||||
|
||||
|
||||
// 26.2.6, p6
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator- (const complex<_TypeT> &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return complex<_TypeT>(_TypeT (__lhs.real () - __rhs.real ()),
|
||||
_TypeT (__lhs.imag () - __rhs.imag ()));
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator- (const complex<_TypeT> &__lhs, const _TypeT &__rhs)
|
||||
{
|
||||
return complex<_TypeT>(__lhs.real () - __rhs, __lhs.imag ());
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator- (const _TypeT &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return complex<_TypeT>(__lhs - __rhs.real (), - __rhs.imag ());
|
||||
}
|
||||
|
||||
|
||||
// 26.2.6, p7
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator* (const complex<_TypeT> &__lhs, const _TypeT &__rhs)
|
||||
{
|
||||
return complex<_TypeT>(__lhs.real () * __rhs, __lhs.imag () * __rhs);
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator* (const _TypeT &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return __rhs * __lhs;
|
||||
}
|
||||
|
||||
|
||||
// 26.2.6, p8
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator/ (const complex<_TypeT> &__lhs, const _TypeT &__rhs)
|
||||
{
|
||||
return complex<_TypeT>(__lhs.real () / __rhs,
|
||||
__lhs.imag () / __rhs);
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT>
|
||||
operator/ (const _TypeT &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
_TypeT __den = __rhs.real() * __rhs.real() + __rhs.imag() * __rhs.imag();
|
||||
|
||||
return complex<_TypeT>(_TypeT (__lhs * __rhs.real ()) / __den,
|
||||
-_TypeT (__lhs * __rhs.imag ()) / __den);
|
||||
}
|
||||
|
||||
|
||||
// 26.2.6, p9
|
||||
template <class _TypeT>
|
||||
inline bool
|
||||
operator== (const complex<_TypeT> &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return __lhs.real () == __rhs.real () && __lhs.imag () == __rhs.imag ();
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator== (const complex<_TypeT> &__lhs, const _TypeT &__rhs)
|
||||
{
|
||||
return __lhs.real () == __rhs && __lhs.imag () == _TypeT ();
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator== (const _TypeT &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return __rhs == __lhs;
|
||||
}
|
||||
|
||||
|
||||
// 26.2.6, p11
|
||||
template <class _TypeT>
|
||||
inline bool
|
||||
operator!= (const complex<_TypeT> &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator!= (const complex<_TypeT> &__lhs, const _TypeT &__rhs)
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator!= (const _TypeT &__lhs, const complex<_TypeT> &__rhs)
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
|
||||
// 26.2.7 - complex value operations
|
||||
|
||||
// 26.2.7, p1
|
||||
template<class _TypeT>
|
||||
inline _TypeT real (const complex<_TypeT> &__a)
|
||||
{
|
||||
return __a.real ();
|
||||
}
|
||||
|
||||
|
||||
// 26.2.7, p2
|
||||
template<class _TypeT>
|
||||
inline _TypeT imag (const complex<_TypeT> &__a)
|
||||
{
|
||||
return __a.imag ();
|
||||
}
|
||||
|
||||
|
||||
// 26.2.7, p3
|
||||
template <class _TypeT>
|
||||
inline _TypeT abs (const complex<_TypeT> &__a)
|
||||
{
|
||||
return _RWSTD_C::sqrt (norm (__a));
|
||||
}
|
||||
|
||||
|
||||
// 26.2.7, p4
|
||||
template <class _TypeT>
|
||||
inline _TypeT arg (const complex<_TypeT>& __a)
|
||||
{
|
||||
// guarantee that arg (complex<T>()) == 0
|
||||
return __a == complex<_TypeT>() ? _TypeT ()
|
||||
: _RWSTD_C::atan2 (__a.imag (), __a.real ());
|
||||
}
|
||||
|
||||
|
||||
// 26.2.7, p5
|
||||
template <class _TypeT>
|
||||
inline _TypeT norm (const complex<_TypeT> &__a)
|
||||
{
|
||||
return __a.real () * __a.real () + __a.imag () * __a.imag ();
|
||||
}
|
||||
|
||||
|
||||
// 26.2.7, p6
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> conj (const complex<_TypeT> &__a)
|
||||
{
|
||||
return complex<_TypeT>(__a.real (), -__a.imag ());
|
||||
}
|
||||
|
||||
|
||||
// 26.2.7, p7, lwg issue 79
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> polar (const _TypeT &__rho,
|
||||
const _TypeT &__theta = _TypeT ())
|
||||
{
|
||||
return complex<_TypeT>(__rho * _RWSTD_C::cos (__theta),
|
||||
__rho * _RWSTD_C::sin (__theta));
|
||||
}
|
||||
|
||||
|
||||
// 26.2.8 - complex transcendentals
|
||||
|
||||
|
||||
// complex cosine of complex number `a'
|
||||
// cos (a) = cos u * cosh v - i * sin u * sinh v
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> cos (const complex<_TypeT>& __a)
|
||||
{
|
||||
return complex<_TypeT>( _RWSTD_C::cos (__a.real ())
|
||||
* _RWSTD_C::cosh (__a.imag ()),
|
||||
-_RWSTD_C::sin (__a.real ())
|
||||
* _RWSTD_C::sinh (__a.imag ()));
|
||||
}
|
||||
|
||||
|
||||
// complex hyperbolic cosine of complex number `a'
|
||||
// cosh (a) = cosh u * cosv + i * sinh u * sin v
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> cosh (const complex<_TypeT>& __a)
|
||||
{
|
||||
return complex<_TypeT>( _RWSTD_C::cosh (__a.real ())
|
||||
* _RWSTD_C::cos (__a.imag ()),
|
||||
_RWSTD_C::sinh (__a.real ())
|
||||
* _RWSTD_C::sin (__a.imag ()));
|
||||
}
|
||||
|
||||
|
||||
// complex exponential of complex number `a'
|
||||
// exp (a) = exp(u) * (cos v + i * sin v)
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> exp (const complex<_TypeT>& __a)
|
||||
{
|
||||
_TypeT __e = _RWSTD_C::exp (__a.real ());
|
||||
return complex<_TypeT>(__e * _RWSTD_C::cos (__a.imag ()),
|
||||
__e * _RWSTD_C::sin (__a.imag ()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// complex<T> natural log of complex<T> number `a'
|
||||
// log (a) = log(r) + i * theta
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> log (const complex<_TypeT>& __a)
|
||||
{
|
||||
return complex<_TypeT>(_RWSTD_C::log (abs (__a)), arg (__a));
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
complex<_TypeT> log10 (const complex<_TypeT>&);
|
||||
|
||||
//
|
||||
// For all the power functions:
|
||||
//
|
||||
// 0**0 == 1
|
||||
// 0**x == 0 for x != 0
|
||||
//
|
||||
|
||||
|
||||
// complex number `a' raised to an integer power `n'
|
||||
// a**n = r**n * (cos(n theta) + i sin (n theta))
|
||||
_EXPORT
|
||||
template <class _TypeT>
|
||||
complex<_TypeT>
|
||||
pow (const complex<_TypeT>&, int);
|
||||
|
||||
|
||||
// complex number `a' raised to a real power `s'
|
||||
// a**s = exp(s * log(a))
|
||||
_EXPORT
|
||||
template <class _TypeT>
|
||||
complex<_TypeT>
|
||||
pow (const complex<_TypeT>&, const _TypeT&);
|
||||
|
||||
|
||||
// real number `s' raised to a complex power `a'
|
||||
// s**a = exp(a * log (s))
|
||||
_EXPORT
|
||||
template <class _TypeT>
|
||||
complex<_TypeT>
|
||||
pow (const _TypeT&, const complex<_TypeT>&);
|
||||
|
||||
|
||||
// complex<T> number `a1' raised to `a' complex<T> power `a2'
|
||||
// a1**a2 = rho * (cos(phi) + i sin(phi))
|
||||
// rho = r1 ** u2 * exp (-v2 * theta1)
|
||||
// phi = v2 * log(r1) + u2 * theta1
|
||||
_EXPORT
|
||||
template <class _TypeT>
|
||||
complex<_TypeT>
|
||||
pow (const complex<_TypeT>&, const complex<_TypeT>&);
|
||||
|
||||
|
||||
// complex<T> sine of complex<T> number `a'
|
||||
// sin (a) = sin u * cosh v + i * cos u * sinh v
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> sin (const complex<_TypeT>& __a)
|
||||
{
|
||||
return complex<_TypeT>( _RWSTD_C::sin (__a.real ())
|
||||
* _RWSTD_C::cosh (__a.imag ()),
|
||||
_RWSTD_C::cos (__a.real ())
|
||||
* _RWSTD_C::sinh (__a.imag ()));
|
||||
}
|
||||
|
||||
|
||||
// complex<T> hyperbolic sine of complex<T> number `a'
|
||||
// sinh (a) = sinh u cos v + i cosh u sin v
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> sinh (const complex<_TypeT>& __a)
|
||||
{
|
||||
return complex<_TypeT>( _RWSTD_C::sinh (__a.real ())
|
||||
* _RWSTD_C::cos (__a.imag ()),
|
||||
_RWSTD_C::cosh (__a.real ())
|
||||
* _RWSTD_C::sin (__a.imag ()));
|
||||
}
|
||||
|
||||
|
||||
// complex<T> square root of complex<T> number `a'
|
||||
// sqrt(a) = sqrt(r) * ( cos (theta/2) + i sin (theta/2))
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> sqrt (const complex<_TypeT>& __a)
|
||||
{
|
||||
_TypeT __r = _RWSTD_C::sqrt(abs(__a));
|
||||
_TypeT __th = arg (__a) / _TypeT (2.0);
|
||||
return complex<_TypeT>(__r * _RWSTD_C::cos (__th),
|
||||
__r * _RWSTD_C::sin (__th));
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> tan (const complex<_TypeT>& __a)
|
||||
{
|
||||
return complex<_TypeT>(sin (__a) / cos (__a));
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> tanh (const complex<_TypeT>& __a)
|
||||
{
|
||||
return complex<_TypeT>(sinh (__a) / cosh (__a));
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline complex<_TypeT> log10 (const complex<_TypeT>& __a)
|
||||
{
|
||||
const _TypeT __log10e = _TypeT (0.4342944819032518276511289189166051L);
|
||||
return __log10e * log (__a);
|
||||
}
|
||||
|
||||
|
||||
// 26.2.6, p12: MT-safe extractor (not atomic)
|
||||
_EXPORT
|
||||
template <class _TypeT, class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits >&
|
||||
operator>> (basic_istream<_CharT, _Traits>&, complex<_TypeT>&);
|
||||
|
||||
|
||||
// 26.2.6, p15: MT-safe atomic inserter
|
||||
_EXPORT
|
||||
template <class _TypeT, class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<< (basic_ostream<_CharT, _Traits>&, const complex<_TypeT>&);
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning (pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE (_COMPLEX)
|
||||
# include <complex.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE (_BASIC_OSTREAM)
|
||||
|
||||
|
||||
#endif // _RWSTD_COMPLEX_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/complex.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/complex.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* complex.c
|
||||
*
|
||||
* $Id: complex.c 590060 2007-10-30 13:12:23Z 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 2000-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <complex.cc>
|
||||
180
extern/stdcxx/4.2.1/include/complex.cc
vendored
Normal file
180
extern/stdcxx/4.2.1/include/complex.cc
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* complex.cc - definitions of the template complex and specializations
|
||||
*
|
||||
* $Id: complex.cc 590060 2007-10-30 13:12:23Z 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 2000-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
// complex number `a' raised to an integer power `n'
|
||||
// a**n = r**n * (cos(n theta) + i sin (n theta))
|
||||
_EXPORT
|
||||
template <class _TypeT>
|
||||
complex<_TypeT>
|
||||
pow (const complex<_TypeT>& __a, int __n)
|
||||
{
|
||||
if (__a == complex<_TypeT>())
|
||||
return complex<_TypeT>(0 == __n);
|
||||
|
||||
if (_TypeT () == __a.imag ()) {
|
||||
if (__a.real () < _TypeT ())
|
||||
return pow (__a, complex<_TypeT>(__n));
|
||||
|
||||
return complex<_TypeT>(_RWSTD_C::pow (__a.real (), __n));
|
||||
}
|
||||
|
||||
_TypeT __r = _RWSTD_C::pow (_TypeT (abs (__a)), __n);
|
||||
_TypeT __th = __n * arg (__a);
|
||||
|
||||
return complex<_TypeT>(__r * _RWSTD_C::cos (__th),
|
||||
__r * _RWSTD_C::sin (__th));
|
||||
}
|
||||
|
||||
|
||||
// complex number `a' raised to a real power `s'
|
||||
// a**s = exp(s * log(a))
|
||||
_EXPORT
|
||||
template <class _TypeT>
|
||||
complex<_TypeT>
|
||||
pow (const complex<_TypeT> &__a, const _TypeT &__s)
|
||||
{
|
||||
if (__a == complex<_TypeT>())
|
||||
return complex<_TypeT>(_TypeT () == __s);
|
||||
|
||||
if (_TypeT () == __a.imag ()) {
|
||||
if (__a.real () < _TypeT ())
|
||||
return pow (__a, complex<_TypeT>(__s));
|
||||
|
||||
return complex<_TypeT>(_RWSTD_C::pow (__a.real (), __s));
|
||||
}
|
||||
return exp (__s * log (__a));
|
||||
}
|
||||
|
||||
|
||||
// real number `s' raised to a complex power `a'
|
||||
// s**a = exp(a * log (s))
|
||||
_EXPORT
|
||||
template <class _TypeT>
|
||||
complex<_TypeT>
|
||||
pow (const _TypeT& __s, const complex<_TypeT>& __a)
|
||||
{
|
||||
if (_TypeT() == __s)
|
||||
return complex<_TypeT>(complex<_TypeT>() == __a);
|
||||
|
||||
if (__s < _TypeT ())
|
||||
return pow (complex<_TypeT>(__s), __a);
|
||||
|
||||
if (_TypeT () == __a.imag ())
|
||||
return complex<_TypeT>(_RWSTD_C::pow (__s, __a.real ()));
|
||||
|
||||
return complex<_TypeT>(exp(__a * _TypeT (_RWSTD_C::log (__s))));
|
||||
}
|
||||
|
||||
|
||||
// complex<T> number `a1' raised to `a' complex<T> power `a2'
|
||||
// a1**a2 = rho * (cos(phi) + i sin(phi))
|
||||
// rho = r1 ** u2 * exp (-v2 * theta1)
|
||||
// phi = v2 * log(r1) + u2 * theta1
|
||||
_EXPORT
|
||||
template <class _TypeT>
|
||||
complex<_TypeT>
|
||||
pow (const complex<_TypeT>& __x, const complex<_TypeT>& __y)
|
||||
{
|
||||
if (complex<_TypeT>() == __x)
|
||||
return complex<_TypeT>(complex<_TypeT>() == __y);
|
||||
|
||||
_TypeT __r1 = abs (__x);
|
||||
_TypeT __u2 = real (__y);
|
||||
_TypeT __v2 = imag (__y);
|
||||
_TypeT __th1 = arg (__x);
|
||||
_TypeT __rho = _RWSTD_C::pow (__r1, __u2) * _RWSTD_C::exp (-__v2 * __th1);
|
||||
_TypeT __phi = __v2 * _RWSTD_C::log (__r1) + __u2 * __th1;
|
||||
|
||||
return complex<_TypeT>(__rho * _RWSTD_C::cos (__phi),
|
||||
__rho * _RWSTD_C::sin (__phi));
|
||||
}
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <class _TypeT, class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits >&
|
||||
operator>> (basic_istream<_CharT, _Traits>& __strm, complex<_TypeT> &__val)
|
||||
{
|
||||
// read a complex number in one of the following forms:
|
||||
// "r", "(r)", "(r, i)"
|
||||
|
||||
// lwg issue 156: extraction is performed as a series of simpler
|
||||
// extractions. Therefore, the skipping of whitespace is specified
|
||||
// to be the same for each of the simpler extractions.
|
||||
|
||||
_TypeT __re = _TypeT (),
|
||||
__im = _TypeT ();
|
||||
|
||||
_CharT __ch;
|
||||
|
||||
if (!(__strm >> __ch))
|
||||
return __strm;
|
||||
|
||||
if ('(' == __ch) {
|
||||
if (__strm >> __re && __strm >> __ch) {
|
||||
if (',' == __ch && __strm >> __im)
|
||||
__strm >> __ch;
|
||||
|
||||
// avoid setting failbit if either badbit
|
||||
// or failbit is already set in the stream
|
||||
if (')' != __ch && __strm)
|
||||
__strm.setstate (__strm.failbit);
|
||||
}
|
||||
}
|
||||
else if (__strm.putback (__ch)) {
|
||||
__strm >> __re;
|
||||
}
|
||||
|
||||
if (__strm)
|
||||
__val = complex<_TypeT>(__re, __im);
|
||||
|
||||
return __strm;
|
||||
}
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <class _TypeT, class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<< (basic_ostream<_CharT, _Traits >& __strm,
|
||||
const complex<_TypeT>& __val)
|
||||
{
|
||||
basic_ostringstream<_CharT, _Traits, allocator<_CharT> > __ss;
|
||||
__ss.flags (__strm.flags ());
|
||||
__ss.imbue (__strm.getloc ());
|
||||
__ss.precision (__strm.precision ());
|
||||
__ss << '(' << __val.real () << ',' << __val.imag () << ')';
|
||||
return __strm << __ss.str ();
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
949
extern/stdcxx/4.2.1/include/deque
vendored
Normal file
949
extern/stdcxx/4.2.1/include/deque
vendored
Normal file
@@ -0,0 +1,949 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* <deque> - definition of the C++ Standard Library deque class template
|
||||
*
|
||||
* $Id: deque 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.
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_DEQUE_INCLUDED
|
||||
#define _RWSTD_DEQUE_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_algobase.h>
|
||||
#include <rw/_allocator.h>
|
||||
#include <rw/_iterator.h>
|
||||
#include <rw/_error.h>
|
||||
#include <rw/_select.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
_EXPORT
|
||||
template <class _TypeT, class _Allocator = allocator<_TypeT> >
|
||||
class deque;
|
||||
|
||||
#ifdef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
// declarations of non-member function templates implementing
|
||||
// the functionality of deque member function templates
|
||||
|
||||
_EXPORT
|
||||
template <class _TypeT, class _Allocator, class _InputIter>
|
||||
void __rw_assign_range (deque<_TypeT, _Allocator>*,
|
||||
_InputIter, _InputIter, input_iterator_tag);
|
||||
|
||||
_EXPORT
|
||||
template <class _TypeT, class _Allocator, class _FwdIter>
|
||||
void __rw_assign_range (deque<_TypeT, _Allocator>*,
|
||||
_FwdIter, _FwdIter, forward_iterator_tag);
|
||||
|
||||
_EXPORT
|
||||
template <class _TypeT, class _Allocator, class _DequeIter, class _InputIter>
|
||||
void __rw_insert_range (deque<_TypeT, _Allocator>*, _DequeIter,
|
||||
_InputIter, _InputIter, input_iterator_tag);
|
||||
|
||||
_EXPORT
|
||||
template <class _TypeT, class _Allocator, class _DequeIter, class _BidirIter>
|
||||
void __rw_insert_range (deque<_TypeT, _Allocator>*, _DequeIter,
|
||||
_BidirIter, _BidirIter, bidirectional_iterator_tag);
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT, class _Pointer,
|
||||
class _Reference, class _Allocator>
|
||||
class __rw_deque_iter
|
||||
: public iterator <random_access_iterator_tag, _TypeT, _DiffT,
|
||||
_Pointer, _Reference>
|
||||
{
|
||||
typedef iterator <bidirectional_iterator_tag, _TypeT, _DiffT,
|
||||
_Pointer, _Reference> _C_iter_base;
|
||||
public:
|
||||
|
||||
typedef _Allocator allocator_type;
|
||||
typedef _TYPENAME allocator_type::size_type size_type;
|
||||
typedef _TYPENAME _C_iter_base::value_type value_type;
|
||||
typedef _TYPENAME _C_iter_base::difference_type difference_type;
|
||||
typedef _TYPENAME _C_iter_base::pointer pointer;
|
||||
typedef _TYPENAME _C_iter_base::reference reference;
|
||||
|
||||
typedef random_access_iterator_tag iterator_category;
|
||||
|
||||
typedef __rw_deque_iter<value_type, difference_type,
|
||||
value_type*, value_type&, allocator_type>
|
||||
_C_mutable_iter;
|
||||
|
||||
typedef _RWSTD_REBIND (allocator_type, value_type*) _C_node_alloc_type;
|
||||
typedef _TYPENAME _C_node_alloc_type::pointer _C_node_pointer;
|
||||
|
||||
|
||||
static size_type _C_bufsize () {
|
||||
// deque only uses __rw_new_capacity to retrieve the minimum
|
||||
// allocation amount; this may be specialized to provide a
|
||||
// customized minimum amount
|
||||
typedef deque<_TypeT, _Allocator> _RWDeque;
|
||||
return _RWSTD_NEW_CAPACITY (_RWDeque, (const _RWDeque*)0, 0);
|
||||
}
|
||||
|
||||
#ifdef _RWSTDDEBUG
|
||||
|
||||
__rw_deque_iter (): _C_cur (), _C_node () { /* invalid */ }
|
||||
|
||||
~__rw_deque_iter () {
|
||||
_C_cur = pointer ();
|
||||
_C_node = _C_node_pointer (); // invalidate
|
||||
}
|
||||
|
||||
#else // if !defined (_RWSTDDEBUG)
|
||||
|
||||
__rw_deque_iter () { /* uninitialized */ }
|
||||
|
||||
#endif // _RWSTDDEBUG
|
||||
|
||||
|
||||
// dummy first argument used to easily switch between
|
||||
// iterators with and without support for debugging
|
||||
__rw_deque_iter (pointer __cur, _C_node_pointer __node)
|
||||
: _C_cur (__cur), _C_node (__node) { }
|
||||
|
||||
// no copy ctor other than the one below defined; will use
|
||||
// a compiler generated one if __rw_deque_iter != _C_mutable_iter
|
||||
__rw_deque_iter (const _C_mutable_iter &__rhs)
|
||||
: _C_cur (__rhs._C_cur),
|
||||
_C_node (__rhs._C_node) { }
|
||||
|
||||
__rw_deque_iter& operator++ ();
|
||||
|
||||
__rw_deque_iter& operator-- ();
|
||||
|
||||
__rw_deque_iter operator++ (int) {
|
||||
__rw_deque_iter __tmp (*this);
|
||||
return ++*this, __tmp;
|
||||
}
|
||||
|
||||
__rw_deque_iter operator-- (int) {
|
||||
__rw_deque_iter __tmp (*this);
|
||||
return --*this, __tmp;
|
||||
}
|
||||
|
||||
__rw_deque_iter& operator+= (difference_type);
|
||||
|
||||
__rw_deque_iter& operator-= (difference_type __n) {
|
||||
return *this += -__n;
|
||||
}
|
||||
|
||||
__rw_deque_iter operator+ (difference_type __n) const {
|
||||
return __rw_deque_iter (*this) += __n;
|
||||
}
|
||||
|
||||
__rw_deque_iter operator- (difference_type __n) const {
|
||||
return __rw_deque_iter (*this) -= __n;
|
||||
}
|
||||
|
||||
reference operator* () const {
|
||||
return *_C_cur;
|
||||
}
|
||||
|
||||
_RWSTD_OPERATOR_ARROW (pointer operator-> () const);
|
||||
|
||||
reference operator[] (difference_type __n) const {
|
||||
return *(*this + __n);
|
||||
}
|
||||
|
||||
// `cur' points at the curent element or is null (for the end iterator)
|
||||
// `node' points to the array containing the element or &cur (for end)
|
||||
pointer _C_cur;
|
||||
_C_node_pointer _C_node;
|
||||
};
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT, class _Pointer,
|
||||
class _Reference, class _Allocator>
|
||||
inline __rw_deque_iter<_TypeT, _DiffT, _Pointer, _Reference, _Allocator>&
|
||||
__rw_deque_iter<_TypeT, _DiffT, _Pointer, _Reference, _Allocator>::
|
||||
operator++ ()
|
||||
{
|
||||
_RWSTD_ASSERT (pointer () != _C_cur);
|
||||
_RWSTD_ASSERT (_C_node_pointer () != _C_node);
|
||||
|
||||
if (++_C_cur == *_C_node + _C_bufsize ())
|
||||
_C_cur = *++_C_node;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT, class _Pointer,
|
||||
class _Reference, class _Allocator>
|
||||
inline __rw_deque_iter<_TypeT, _DiffT, _Pointer, _Reference, _Allocator>&
|
||||
__rw_deque_iter<_TypeT, _DiffT, _Pointer, _Reference, _Allocator>::
|
||||
operator-- ()
|
||||
{
|
||||
_RWSTD_ASSERT (_C_node_pointer () != _C_node);
|
||||
|
||||
if (_C_cur == *_C_node)
|
||||
_C_cur = *--_C_node + _C_bufsize ();
|
||||
|
||||
--_C_cur;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT, class _Pointer,
|
||||
class _Reference, class _Allocator>
|
||||
inline __rw_deque_iter<_TypeT, _DiffT, _Pointer, _Reference, _Allocator>&
|
||||
__rw_deque_iter<_TypeT, _DiffT, _Pointer, _Reference, _Allocator>::
|
||||
operator+= (difference_type __n)
|
||||
{
|
||||
_RWSTD_ASSERT (_C_node_pointer () != _C_node);
|
||||
|
||||
const size_type __bufsize = _C_bufsize ();
|
||||
|
||||
const difference_type __offset = __n + (_C_cur - *_C_node);
|
||||
|
||||
if (__bufsize <= size_type (__offset)) {
|
||||
|
||||
_RWSTD_ASSERT (__n != 0);
|
||||
|
||||
const difference_type __jump = __offset >= 0 ? __offset / __bufsize
|
||||
: -difference_type ((__bufsize - __offset - 1) / __bufsize);
|
||||
|
||||
_C_node += __jump;
|
||||
_C_cur = *_C_node + (__offset - __jump * __bufsize);
|
||||
}
|
||||
else
|
||||
_C_cur += __n;
|
||||
|
||||
_RWSTD_ASSERT (size_type (_C_cur - *_C_node) <= __bufsize);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// for symmetry
|
||||
template <class _TypeT, class _DiffT, class _Ptr, class _Ref, class _Alloc>
|
||||
inline __rw_deque_iter<_TypeT, _DiffT, _Ptr, _Ref, _Alloc>
|
||||
operator+ (_DiffT __lhs,
|
||||
const __rw_deque_iter<_TypeT, _DiffT, _Ptr, _Ref, _Alloc> &__rhs)
|
||||
{
|
||||
return __rhs + __lhs;
|
||||
}
|
||||
|
||||
|
||||
#define _RWSTD_DEQUE_ITER(n) \
|
||||
__rw_deque_iter<_TypeT, _DiffT, _Ptr##n, _Ref##n, _Alloc>
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT,
|
||||
class _Ptr1, class _Ref1, class _Ptr2, class _Ref2, class _Alloc>
|
||||
inline _DiffT
|
||||
operator- (const _RWSTD_DEQUE_ITER(1) &__x, const _RWSTD_DEQUE_ITER(2) &__y)
|
||||
{
|
||||
// _RWSTD_ASSERT_RANGE (__x, __y);
|
||||
typedef _TYPENAME _RWSTD_DEQUE_ITER(1)::pointer _Pointer1;
|
||||
typedef _TYPENAME _RWSTD_DEQUE_ITER(2)::pointer _Pointer2;
|
||||
|
||||
if (_Pointer1 () == __x._C_cur && _Pointer2 () == __y._C_cur) {
|
||||
// __x and __y are end-iterator's of the empty deque's
|
||||
return _DiffT (__x._C_cur - __y._C_cur);
|
||||
}
|
||||
|
||||
const _DiffT __bufsize = _DiffT (__x._C_bufsize ());
|
||||
|
||||
return _DiffT ( __bufsize * (__x._C_node - __y._C_node - 1)
|
||||
+ (__x._C_cur - *__x._C_node)
|
||||
+ (*__y._C_node + __bufsize - __y._C_cur));
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT,
|
||||
class _Ptr1, class _Ref1, class _Ptr2, class _Ref2, class _Alloc>
|
||||
inline bool
|
||||
operator== (const _RWSTD_DEQUE_ITER(1) &__x, const _RWSTD_DEQUE_ITER(2) &__y)
|
||||
{
|
||||
return 0 == __x - __y;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT,
|
||||
class _Ptr1, class _Ref1, class _Ptr2, class _Ref2, class _Alloc>
|
||||
inline bool
|
||||
operator< (const _RWSTD_DEQUE_ITER(1) &__x, const _RWSTD_DEQUE_ITER(2) &__y)
|
||||
{
|
||||
return __x - __y < 0;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT,
|
||||
class _Ptr1, class _Ref1, class _Ptr2, class _Ref2, class _Alloc>
|
||||
inline bool
|
||||
operator!= (const _RWSTD_DEQUE_ITER(1) &__x, const _RWSTD_DEQUE_ITER(2) &__y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT,
|
||||
class _Ptr1, class _Ref1, class _Ptr2, class _Ref2, class _Alloc>
|
||||
inline bool
|
||||
operator<= (const _RWSTD_DEQUE_ITER(1) &__x, const _RWSTD_DEQUE_ITER(2) &__y)
|
||||
{
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
template <class _TypeT, class _DiffT,
|
||||
class _Ptr1, class _Ref1, class _Ptr2, class _Ref2, class _Alloc>
|
||||
inline bool
|
||||
operator>= (const _RWSTD_DEQUE_ITER(1) &__x, const _RWSTD_DEQUE_ITER(2) &__y)
|
||||
{
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
template <class _TypeT, class _DiffT,
|
||||
class _Ptr1, class _Ref1, class _Ptr2, class _Ref2, class _Alloc>
|
||||
inline bool
|
||||
operator> (const _RWSTD_DEQUE_ITER(1) &__x, const _RWSTD_DEQUE_ITER(2) &__y)
|
||||
{
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
|
||||
#undef _RWSTD_DEQUE_ITER
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <class _TypeT, class _Allocator>
|
||||
class deque: private _Allocator
|
||||
{
|
||||
public:
|
||||
|
||||
typedef _TypeT value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef _TYPENAME allocator_type::size_type size_type;
|
||||
typedef _TYPENAME allocator_type::difference_type difference_type;
|
||||
typedef _TYPENAME allocator_type::pointer pointer;
|
||||
typedef _TYPENAME allocator_type::const_pointer const_pointer;
|
||||
typedef _TYPENAME allocator_type::reference reference;
|
||||
typedef _TYPENAME allocator_type::const_reference const_reference;
|
||||
|
||||
typedef _RWSTD_ALLOC_TYPE (allocator_type, value_type) _C_value_alloc_type;
|
||||
|
||||
// following two typedefs are used for convenience with debug iters
|
||||
typedef __rw_deque_iter<value_type, difference_type, pointer,
|
||||
reference, allocator_type> _C_deque_iter;
|
||||
|
||||
typedef __rw_deque_iter<value_type, difference_type, const_pointer,
|
||||
const_reference, allocator_type> _C_deque_citer;
|
||||
|
||||
typedef _RWSTD_REBIND (allocator_type, value_type*) _C_node_alloc_type;
|
||||
|
||||
typedef _TYPENAME _C_node_alloc_type::pointer _C_node_pointer;
|
||||
|
||||
#ifndef _RWSTD_NO_DEBUG_ITER
|
||||
|
||||
typedef _RW::__rw_debug_iter<deque, _C_deque_iter, _C_deque_iter>
|
||||
iterator;
|
||||
|
||||
typedef _RW::__rw_debug_iter<deque, _C_deque_citer, _C_deque_iter>
|
||||
const_iterator;
|
||||
|
||||
iterator _C_make_iter (const _C_deque_iter &__iter) {
|
||||
return iterator (*this, __iter);
|
||||
}
|
||||
|
||||
const_iterator _C_make_iter (const _C_deque_citer &__citer) const {
|
||||
return const_iterator (*this, __citer);
|
||||
}
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEBUG_ITER)
|
||||
|
||||
typedef _C_deque_iter iterator;
|
||||
typedef _C_deque_citer const_iterator;
|
||||
|
||||
iterator _C_make_iter (const _C_deque_iter &__iter) {
|
||||
return __iter;
|
||||
}
|
||||
|
||||
const_iterator _C_make_iter (const _C_deque_citer &__citer) const {
|
||||
return __citer;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_DEBUG_ITER
|
||||
|
||||
size_type _C_vecsize (size_type __nodes) const {
|
||||
return _RWSTD_NEW_CAPACITY (deque, this, __nodes);
|
||||
}
|
||||
|
||||
static size_type _C_bufsize () {
|
||||
return _C_deque_iter::_C_bufsize ();
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
||||
|
||||
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _STD::reverse_iterator<iterator> reverse_iterator;
|
||||
|
||||
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||
|
||||
typedef _STD::reverse_iterator<const_iterator, random_access_iterator_tag,
|
||||
value_type, const_reference, const_pointer,
|
||||
difference_type>
|
||||
const_reverse_iterator;
|
||||
|
||||
typedef _STD::reverse_iterator<iterator, random_access_iterator_tag,
|
||||
value_type, reference, pointer,
|
||||
difference_type>
|
||||
reverse_iterator;
|
||||
|
||||
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
|
||||
|
||||
_EXPLICIT
|
||||
deque (const allocator_type &__alloc = allocator_type ())
|
||||
: allocator_type (__alloc) {
|
||||
_C_init ();
|
||||
}
|
||||
|
||||
_EXPLICIT
|
||||
deque (size_type __n, const_reference __x = value_type (),
|
||||
const allocator_type &__alloc = allocator_type ())
|
||||
: allocator_type (__alloc) {
|
||||
_C_init ();
|
||||
assign (__n, __x);
|
||||
}
|
||||
|
||||
template <class _InputIter>
|
||||
deque (_InputIter __first, _InputIter __last,
|
||||
const allocator_type &__alloc = allocator_type ())
|
||||
: allocator_type (__alloc) {
|
||||
_C_init ();
|
||||
assign (__first, __last);
|
||||
}
|
||||
|
||||
deque (const deque &__rhs)
|
||||
: allocator_type (__rhs.get_allocator ()) {
|
||||
_C_init ();
|
||||
assign (__rhs.begin (), __rhs.end ());
|
||||
}
|
||||
|
||||
~deque () {
|
||||
clear ();
|
||||
}
|
||||
|
||||
deque& operator= (const deque&);
|
||||
|
||||
template <class _InputIter>
|
||||
void assign (_InputIter __first, _InputIter __last) {
|
||||
// dispatch either to a range assign or to an assign with repetition
|
||||
_C_assign (__first, __last, _RWSTD_DISPATCH (_InputIter));
|
||||
}
|
||||
|
||||
void assign (size_type __n, const_reference __x) {
|
||||
_C_assign_n (__n, __x);
|
||||
}
|
||||
|
||||
allocator_type get_allocator () const {
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator begin () {
|
||||
return _C_make_iter (_C_beg);
|
||||
}
|
||||
|
||||
const_iterator begin () const {
|
||||
return _C_make_iter (_C_beg);
|
||||
}
|
||||
|
||||
iterator end () {
|
||||
return _C_make_iter (_C_end);
|
||||
}
|
||||
|
||||
const_iterator end () const {
|
||||
return _C_make_iter (_C_end);
|
||||
}
|
||||
|
||||
reverse_iterator rbegin () {
|
||||
return reverse_iterator (end ());
|
||||
}
|
||||
|
||||
const_reverse_iterator rbegin () const {
|
||||
return const_reverse_iterator (end ());
|
||||
}
|
||||
|
||||
reverse_iterator rend () {
|
||||
return reverse_iterator (begin ());
|
||||
}
|
||||
|
||||
const_reverse_iterator rend () const {
|
||||
return const_reverse_iterator (begin ());
|
||||
}
|
||||
|
||||
bool empty () const {
|
||||
return _C_beg._C_node == _C_end._C_node
|
||||
&& _C_beg._C_cur == _C_end._C_cur;
|
||||
}
|
||||
|
||||
size_type size () const {
|
||||
return size_type (end () - begin ());
|
||||
}
|
||||
|
||||
size_type max_size () const {
|
||||
return _RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this, max_size ());
|
||||
}
|
||||
|
||||
void resize (size_type, value_type = value_type ());
|
||||
|
||||
reference operator[] (size_type __inx) {
|
||||
#ifdef _RWSTD_BOUNDS_CHECKING
|
||||
return at (__inx);
|
||||
#else
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
return *(begin () + __inx);
|
||||
#endif
|
||||
}
|
||||
|
||||
const_reference operator[] (size_type __inx) const {
|
||||
#ifdef _RWSTD_BOUNDS_CHECKING
|
||||
return at (__inx);
|
||||
#else
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
return *(begin () + __inx);
|
||||
#endif
|
||||
}
|
||||
|
||||
const_reference at (size_type __inx) const {
|
||||
return _RWSTD_CONST_CAST (deque*, this)->at (__inx);
|
||||
}
|
||||
|
||||
reference at (size_type __inx) {
|
||||
_RWSTD_REQUIRES (__inx < size (),
|
||||
(_RWSTD_ERROR_OUT_OF_RANGE,
|
||||
_RWSTD_FUNC ("deque::at(size_type)"),
|
||||
__inx, size ()));
|
||||
return *(begin () + __inx);
|
||||
}
|
||||
|
||||
reference front () {
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
return *begin ();
|
||||
}
|
||||
|
||||
const_reference front () const {
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
return *begin ();
|
||||
}
|
||||
|
||||
reference back () {
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
return *(end () - 1);
|
||||
}
|
||||
|
||||
const_reference back () const {
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
return *(end () - 1);
|
||||
}
|
||||
|
||||
void push_front (const_reference);
|
||||
|
||||
void push_back (const_reference);
|
||||
|
||||
iterator insert (iterator, const_reference);
|
||||
|
||||
void insert (iterator __it, size_type __n, const_reference __x) {
|
||||
_C_insert_n (__it, __n, __x);
|
||||
}
|
||||
|
||||
template <class _InputIter>
|
||||
void insert (iterator __it, _InputIter __first, _InputIter __last) {
|
||||
_C_insert (__it, __first, __last, _RWSTD_DISPATCH (_InputIter));
|
||||
}
|
||||
|
||||
void pop_front ();
|
||||
|
||||
void pop_back ();
|
||||
|
||||
iterator erase (iterator);
|
||||
|
||||
iterator erase (iterator, iterator);
|
||||
|
||||
void swap (deque&);
|
||||
|
||||
void clear () {
|
||||
erase (begin (), end ());
|
||||
|
||||
_RWSTD_ASSERT (_C_is_valid (1 /* valid and empty */));
|
||||
}
|
||||
|
||||
#if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
|
||||
friend void swap (deque& __lhs, deque& __rhs) {
|
||||
__lhs.swap (__rhs);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// layout of a non-empty deque:
|
||||
//
|
||||
// +------------------- nodes [-1] (not used, 0
|
||||
// | +----------------- nodes [0] (first usable)
|
||||
// | | +------------- beg.node
|
||||
// | | | +------- end.node
|
||||
// | | | | +--- nodes [node_size - 1] (last usable)
|
||||
// | | | | | +- allocated but not used (0)
|
||||
// | | | | | |
|
||||
// v v v v v v
|
||||
// +-+-+-+-+ +-+-+-+-+
|
||||
// |0|X|X| |...| |X|X|0| dynamically sizable
|
||||
// +-+-+-+-+ +-+-+-+-+
|
||||
// ^ | ||| |
|
||||
// | v vvv v
|
||||
// nodes ---+ +-+ +-+ fixed-size arrays, all of the same size
|
||||
// |X|...| |<-- end.node [0][0]
|
||||
// +-+ +-+
|
||||
// beg.cur --->| | | |<-- end.node [0][1]
|
||||
// (begin()) +-+ +-+
|
||||
// | | | |<-- end.node [0][2]
|
||||
// ~ ~ ~ ~
|
||||
// | | | |
|
||||
// +-+ +-+<-- end.cur (end())
|
||||
// | |...|X|<-- (bufsize - 1)
|
||||
// +-+ +-+
|
||||
|
||||
// `beg.node' points to the first fixed-size array in `nodes'
|
||||
// `beg.cur' points at the first element in the array pointed
|
||||
// to by `beg.node' (it is null iff the container is empty)
|
||||
_C_deque_iter _C_beg;
|
||||
|
||||
// `end.node' points to the last fixed-size array in `nodes'
|
||||
// `end.cur' points just past the last element in the array
|
||||
// pointed to by `end.node' (null iff the container is empty)
|
||||
_C_deque_iter _C_end;
|
||||
|
||||
// `nodes' points to a dynamically sizable vector of `node_size'
|
||||
// nodes where each node is a pointer to a fixed-size array of
|
||||
// elements of value_type (null iff the container is empty)
|
||||
_C_node_pointer _C_nodes;
|
||||
|
||||
// the capacity of the dynamically sizable vector of nodes
|
||||
// `node_size' is 0 for an empty deque; each (re)allocation
|
||||
// grows `node_size' to __rw_new_capacity(N, this) where N
|
||||
// is 0 is empty() and `end.node - beg.node + 1' otherwise
|
||||
size_type _C_node_size;
|
||||
|
||||
void _C_init () {
|
||||
// clear both `beg.cur' and `end.cur' and set both `beg.node'
|
||||
// and `end.node' to point to `end.cur' (instead of 0) to avoid
|
||||
// having to check before dereferencing the pointers
|
||||
_C_beg =
|
||||
_C_end = _C_deque_iter (pointer (), &_C_end._C_cur);
|
||||
_C_nodes = _C_node_pointer ();
|
||||
_C_node_size = 0;
|
||||
}
|
||||
|
||||
void _C_push (bool, const_reference);
|
||||
|
||||
void _C_free_at_begin ();
|
||||
|
||||
void _C_free_at_end ();
|
||||
|
||||
private:
|
||||
|
||||
// implements assign with repetition
|
||||
void _C_assign_n (size_type, const_reference);
|
||||
|
||||
// implements a single-element insert
|
||||
void _C_insert_1 (const iterator&, const_reference);
|
||||
|
||||
// implements insert with repetition
|
||||
void _C_insert_n (const iterator&, size_type, const_reference);
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
// implements range insert for BidirectionalIterators
|
||||
template <class _BidirIter>
|
||||
void _C_insert_range (iterator, _BidirIter, _BidirIter,
|
||||
bidirectional_iterator_tag);
|
||||
|
||||
// implements range insert for InputIterators
|
||||
template <class _InputIter>
|
||||
void _C_insert_range (iterator, _InputIter, _InputIter,
|
||||
input_iterator_tag);
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
public:
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
// implements range assign
|
||||
template <class _InputIter>
|
||||
void _C_assign (_InputIter __first, _InputIter __last, void*) {
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
|
||||
_RWSTD_ASSIGN_RANGE (__first, __last, input_iterator_tag ());
|
||||
}
|
||||
|
||||
// implements assign with repetition if value_type == size_type
|
||||
template <class _IntType>
|
||||
void _C_assign (_IntType __n, _IntType __x, int) {
|
||||
// see 23.1.1, p9 and DR 438
|
||||
_C_assign_n (__n, __x);
|
||||
}
|
||||
|
||||
// implements range insert for InputIterators
|
||||
template <class _InputIter>
|
||||
void _C_assign_range (_InputIter, _InputIter, input_iterator_tag);
|
||||
|
||||
// implements range insert
|
||||
template <class _InputIter>
|
||||
void _C_insert (const iterator &__it,
|
||||
_InputIter __first, _InputIter __last, void*) {
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it);
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
|
||||
// dispatch to an insert suitable for the category of InputIter
|
||||
_RWSTD_INSERT_RANGE (__it, __first, __last,
|
||||
_RWSTD_ITERATOR_CATEGORY (_InputIter, __first));
|
||||
}
|
||||
|
||||
// implements insert with repetition if value_type == size_type
|
||||
template <class _IntType>
|
||||
void _C_insert (const iterator &__it,
|
||||
_IntType __n, _IntType __x, int) {
|
||||
// see 23.1.1, p9 and DR 438
|
||||
_C_insert_n (__it, __n, __x);
|
||||
}
|
||||
|
||||
|
||||
bool _C_is_valid (int = -1) const;
|
||||
};
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline void
|
||||
deque<_TypeT, _Allocator>::push_front (const_reference __x)
|
||||
{
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
|
||||
if (_C_beg._C_cur == *_C_beg._C_node) {
|
||||
_C_push (false /* allocate at the beginning of vector */, __x);
|
||||
}
|
||||
else {
|
||||
_RWSTD_ASSERT (pointer () != _C_beg._C_cur);
|
||||
|
||||
_RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this,
|
||||
construct (_C_beg._C_cur - 1, __x));
|
||||
}
|
||||
|
||||
_RWSTD_ASSERT (pointer () != _C_beg._C_cur);
|
||||
|
||||
--_C_beg._C_cur;
|
||||
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline void
|
||||
deque<_TypeT, _Allocator>::push_back (const_reference __x)
|
||||
{
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
|
||||
if ( _C_end._C_cur == *_C_end._C_node + _C_bufsize ()
|
||||
|| pointer () == _C_end._C_cur) {
|
||||
_C_push (true /* allocate at the end of vector */, __x);
|
||||
}
|
||||
else {
|
||||
_RWSTD_ASSERT (pointer () != _C_end._C_cur);
|
||||
|
||||
_RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this,
|
||||
construct (_C_end._C_cur, __x));
|
||||
}
|
||||
|
||||
_RWSTD_ASSERT (pointer () != _C_end._C_cur);
|
||||
|
||||
++_C_end._C_cur;
|
||||
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline void
|
||||
deque<_TypeT, _Allocator>::pop_front ()
|
||||
{
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
|
||||
const pointer __first = _C_beg._C_cur;
|
||||
|
||||
_RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this, destroy (__first));
|
||||
|
||||
++_C_beg._C_cur;
|
||||
|
||||
if (empty () || _C_beg._C_cur == *_C_beg._C_node + _C_bufsize ())
|
||||
_C_free_at_begin ();
|
||||
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline void
|
||||
deque<_TypeT, _Allocator>::pop_back ()
|
||||
{
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
|
||||
const pointer __last = _C_end._C_cur - 1;
|
||||
|
||||
_RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this, destroy (__last));
|
||||
|
||||
--_C_end._C_cur;
|
||||
|
||||
if (empty () || _C_end._C_cur == *_C_end._C_node)
|
||||
_C_free_at_end ();
|
||||
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline void
|
||||
deque<_TypeT, _Allocator>::
|
||||
resize (size_type __new_size, value_type __x /* = value_type () */)
|
||||
{
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
|
||||
const size_type __size = size ();
|
||||
|
||||
if (__size < __new_size)
|
||||
insert (end (), __new_size - __size, __x);
|
||||
else if (__new_size < __size)
|
||||
erase (begin () + __new_size, end ());
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator== (const deque<_TypeT, _Allocator> &__lhs,
|
||||
const deque<_TypeT, _Allocator> &__rhs)
|
||||
{
|
||||
// _RWSTD_ASSERT (__lhs._C_is_valid ());
|
||||
// _RWSTD_ASSERT (__rhs._C_is_valid ());
|
||||
|
||||
return __lhs.size () == __rhs.size ()
|
||||
&& _STD::equal (__lhs.begin (), __lhs.end (), __rhs.begin ());
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator< (const deque<_TypeT, _Allocator> &__lhs,
|
||||
const deque<_TypeT, _Allocator> &__rhs)
|
||||
{
|
||||
// _RWSTD_ASSERT (__lhs._C_is_valid ());
|
||||
// _RWSTD_ASSERT (__rhs._C_is_valid ());
|
||||
|
||||
return _STD::lexicographical_compare (__lhs.begin (), __lhs.end (),
|
||||
__rhs.begin (), __rhs.end ());
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator!= (const deque<_TypeT, _Allocator> &__lhs,
|
||||
const deque<_TypeT, _Allocator> &__rhs)
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator<= (const deque<_TypeT, _Allocator> &__lhs,
|
||||
const deque<_TypeT, _Allocator> &__rhs)
|
||||
{
|
||||
return !(__rhs < __lhs);
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator> (const deque<_TypeT, _Allocator> &__lhs,
|
||||
const deque<_TypeT, _Allocator> &__rhs)
|
||||
{
|
||||
return __rhs < __lhs;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator>= (const deque<_TypeT, _Allocator> &__lhs,
|
||||
const deque<_TypeT, _Allocator> &__rhs)
|
||||
{
|
||||
return !(__lhs < __rhs);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_PART_SPEC_OVERLOAD
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline void
|
||||
swap (deque<_TypeT, _Allocator> &__lhs, deque<_TypeT, _Allocator> &__rhs)
|
||||
{
|
||||
__lhs.swap (__rhs);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_PART_SPEC_OVERLOAD
|
||||
|
||||
} // namespace end
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_IMPLICIT_INCLUSION
|
||||
# include <deque.cc>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_STL_SPECIALIZATION
|
||||
# include "deque_spec.h"
|
||||
#endif // _RWSTD_NO_STL_SPECIALIZATION
|
||||
|
||||
|
||||
#endif // _RWSTD_DEQUE_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/deque.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/deque.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* deque.c
|
||||
*
|
||||
* $Id: deque.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 <deque.cc>
|
||||
866
extern/stdcxx/4.2.1/include/deque.cc
vendored
Normal file
866
extern/stdcxx/4.2.1/include/deque.cc
vendored
Normal file
@@ -0,0 +1,866 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* deque.cc - Non-iniline definitions for the Standard Library deque class
|
||||
*
|
||||
* $Id: deque.cc 550991 2007-06-26 23:58:07Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* 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 _TypeT, class _Allocator>
|
||||
deque<_TypeT, _Allocator>&
|
||||
deque<_TypeT, _Allocator>::
|
||||
operator= (const deque &__rhs)
|
||||
{
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
_RWSTD_ASSERT (__rhs._C_is_valid ());
|
||||
|
||||
const size_type __size = size ();
|
||||
|
||||
if (__size < __rhs.size ()) {
|
||||
const const_iterator __mid = __rhs.begin () + __size;
|
||||
|
||||
_STD::copy (__mid, __rhs.end (),
|
||||
_STD::inserter (*this, _STD::copy (__rhs.begin (), __mid,
|
||||
begin ())));
|
||||
}
|
||||
else
|
||||
erase (_STD::copy (__rhs.begin (), __rhs.end (), begin ()), end ());
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
_TYPENAME deque<_TypeT, _Allocator>::iterator
|
||||
deque<_TypeT, _Allocator>::
|
||||
insert (iterator __it, const_reference __x)
|
||||
{
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it);
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
|
||||
if (__it == begin ()) {
|
||||
push_front (__x);
|
||||
return begin ();
|
||||
}
|
||||
|
||||
if (__it == end ()) {
|
||||
push_back (__x);
|
||||
__it = end () - 1;
|
||||
return __it;
|
||||
}
|
||||
|
||||
const size_type __inx = _DISTANCE (begin (), __it, size_type);
|
||||
|
||||
_RWSTD_ASSERT (__inx < size ());
|
||||
|
||||
if (__inx < size () - __inx) {
|
||||
push_front (front ());
|
||||
_STD::copy (begin () + 2, begin () + (__inx + 1), begin () + 1);
|
||||
}
|
||||
else {
|
||||
push_back (back ());
|
||||
|
||||
_STD::copy_backward (begin () + __inx, end () - 2, end () - 1);
|
||||
}
|
||||
|
||||
__it = begin () + __inx;
|
||||
|
||||
*__it = __x;
|
||||
|
||||
return __it;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
_TYPENAME deque<_TypeT, _Allocator>::iterator
|
||||
deque<_TypeT, _Allocator>::
|
||||
erase (iterator __it)
|
||||
{
|
||||
// `it' must be a dereferenceable iterator into `*this'
|
||||
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it);
|
||||
_RWSTD_ASSERT (!(__it == end ()));
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
|
||||
const iterator __next = ++iterator (__it);
|
||||
|
||||
if (__it - begin () < end () - __it) {
|
||||
|
||||
_STD::copy_backward (begin (), __it, __next);
|
||||
|
||||
pop_front ();
|
||||
|
||||
return empty () ? end () : __next;
|
||||
}
|
||||
|
||||
_STD::copy (__next, end (), __it);
|
||||
|
||||
pop_back ();
|
||||
|
||||
return __it;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
_TYPENAME deque<_TypeT, _Allocator>::iterator
|
||||
deque<_TypeT, _Allocator>::
|
||||
erase (iterator __first, iterator __last)
|
||||
{
|
||||
// (`first', `last'] must be a valid range into `*this'
|
||||
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
_RWSTD_ASSERT_RANGE (begin (), __first);
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
|
||||
size_type __n = _DISTANCE (__first, __last, size_type);
|
||||
|
||||
_RWSTD_ASSERT (__n <= size ());
|
||||
|
||||
if (__first - begin () < end () - __last) {
|
||||
|
||||
_STD::copy_backward (begin (), __first, __last);
|
||||
|
||||
while (__n-- != 0)
|
||||
pop_front ();
|
||||
|
||||
return __last;
|
||||
}
|
||||
|
||||
_STD::copy (__last, end (), __first);
|
||||
|
||||
while (__n-- != 0)
|
||||
pop_back ();
|
||||
|
||||
return __first;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void deque<_TypeT, _Allocator>::
|
||||
swap (deque<_TypeT, _Allocator> &__rhs)
|
||||
{
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
_RWSTD_ASSERT (__rhs._C_is_valid ());
|
||||
|
||||
if (get_allocator () == __rhs.get_allocator ()) {
|
||||
|
||||
_STD::swap (_C_beg, __rhs._C_beg);
|
||||
_STD::swap (_C_end, __rhs._C_end);
|
||||
_STD::swap (_C_nodes, __rhs._C_nodes);
|
||||
_STD::swap (_C_node_size, __rhs._C_node_size);
|
||||
|
||||
if (pointer() == _C_beg._C_cur) {
|
||||
_RWSTD_ASSERT (pointer() == _C_end._C_cur);
|
||||
_RWSTD_ASSERT ( _C_beg._C_node == &__rhs._C_end._C_cur
|
||||
&& _C_end._C_node == &__rhs._C_end._C_cur);
|
||||
|
||||
_C_beg._C_node =
|
||||
_C_end._C_node = &_C_end._C_cur;
|
||||
}
|
||||
else {
|
||||
_RWSTD_ASSERT (pointer() != _C_end._C_cur);
|
||||
}
|
||||
|
||||
if (pointer() == __rhs._C_beg._C_cur) {
|
||||
_RWSTD_ASSERT (pointer() == __rhs._C_end._C_cur);
|
||||
_RWSTD_ASSERT ( __rhs._C_beg._C_node == &_C_end._C_cur
|
||||
&& __rhs._C_end._C_node == &_C_end._C_cur);
|
||||
|
||||
__rhs._C_beg._C_node =
|
||||
__rhs._C_end._C_node = &__rhs._C_end._C_cur;
|
||||
}
|
||||
else {
|
||||
_RWSTD_ASSERT (pointer() != __rhs._C_end._C_cur);
|
||||
}
|
||||
}
|
||||
else {
|
||||
deque __tmp (*this);
|
||||
*this = __rhs;
|
||||
__rhs = __tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void deque<_TypeT, _Allocator>::
|
||||
_C_push (bool __at_back, const_reference __x)
|
||||
{
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
|
||||
const size_type __bufsize = _C_bufsize ();
|
||||
|
||||
_C_value_alloc_type __alloc (*this);
|
||||
|
||||
// allocate a new buffer to store elements in
|
||||
const pointer __buf = __alloc.allocate (__bufsize, pointer ());
|
||||
|
||||
const bool __empty = empty ();
|
||||
|
||||
if ( __empty
|
||||
|| __at_back && _C_end._C_node == _C_nodes + _C_node_size - 1
|
||||
|| !__at_back && _C_beg._C_node == _C_nodes) {
|
||||
|
||||
_C_node_alloc_type __node_alloc (*this);
|
||||
|
||||
_RWSTD_ASSERT (_C_beg._C_node <= _C_end._C_node);
|
||||
|
||||
// compute the current number of used nodes
|
||||
// and the new number of nodes
|
||||
|
||||
const _C_node_pointer __end = _C_end._C_node + !__empty;
|
||||
|
||||
const size_type __nodes = size_type (__end - _C_beg._C_node);
|
||||
|
||||
// obtain the next greater number of nodes for the new vector
|
||||
const size_type __nvecsize = _C_vecsize (__nodes);
|
||||
|
||||
_RWSTD_ASSERT (__nvecsize > __nodes);
|
||||
|
||||
// compute the beginning of the old (current) vector
|
||||
const _C_node_pointer __ovec = _C_nodes - !__empty;
|
||||
_C_node_pointer __nvec;
|
||||
|
||||
_TRY {
|
||||
// allocate enough for two extra unused nodes
|
||||
__nvec = __node_alloc.allocate (__nvecsize + 2, __ovec);
|
||||
|
||||
_RWSTD_ASSERT (!(_C_node_pointer () == __nvec));
|
||||
|
||||
const pointer __where = __buf
|
||||
+ ( __empty ? __bufsize / 2 - !__at_back
|
||||
: __at_back ? 0 : __bufsize - 1);
|
||||
|
||||
_TRY {
|
||||
__alloc.construct (__where, __x);
|
||||
}
|
||||
_CATCH (...) {
|
||||
__node_alloc.deallocate (__nvec, __nvecsize + 2);
|
||||
_RETHROW;
|
||||
}
|
||||
|
||||
// reserve the first and last nodes (must always be 0)
|
||||
++__nvec;
|
||||
}
|
||||
_CATCH (...) {
|
||||
// deallocate buffer and rethrow
|
||||
__alloc.deallocate (__buf, __bufsize);
|
||||
_RETHROW;
|
||||
}
|
||||
|
||||
// compute the new indices into the newly allocated vector
|
||||
// of the first and last occuppied node, respectively
|
||||
const size_type __beg_inx = __nvecsize / (__empty ? 2 : 4);
|
||||
const size_type __end_inx = __beg_inx + __nodes;
|
||||
|
||||
// copy existing nodes into the new buffer
|
||||
_STD::copy (_C_beg._C_node, __end, __nvec + (__beg_inx + !__at_back));
|
||||
|
||||
// deallocate the current buffer only when non-0 to satisfy
|
||||
// the requirement that deallocate() argument be non-zero
|
||||
if (!(__ovec == _C_node_pointer ()))
|
||||
__node_alloc.deallocate (__ovec, _C_node_size + 2);
|
||||
|
||||
// set the pointer and size
|
||||
_C_nodes = __nvec;
|
||||
_C_node_size = __nvecsize;
|
||||
|
||||
// insert the fixed-size array into the vector of nodes...
|
||||
if (__at_back) {
|
||||
|
||||
// ...at the end
|
||||
_C_nodes [__end_inx] = __buf;
|
||||
|
||||
_C_beg._C_node = _C_nodes + __beg_inx;
|
||||
_C_end = _C_deque_iter (__buf, _C_nodes + __end_inx);
|
||||
|
||||
}
|
||||
else {
|
||||
// ...at the beginning
|
||||
_C_nodes [__beg_inx] = __buf;
|
||||
|
||||
_C_beg = _C_deque_iter (__buf + __bufsize, _C_nodes + __beg_inx);
|
||||
_C_end._C_node = _C_nodes + __end_inx;
|
||||
}
|
||||
|
||||
if (__empty) {
|
||||
// set the beginning and end pointers both
|
||||
// to point at the same (future) element
|
||||
_C_beg._C_cur =
|
||||
_C_end._C_cur = __buf + __bufsize / 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_RWSTD_ASSERT (_C_is_valid (0 /* valid and non-empty */));
|
||||
|
||||
_TRY {
|
||||
|
||||
if (__at_back) {
|
||||
__alloc.construct (__buf, __x);
|
||||
|
||||
// append the newly allocated buffer to the end of the vector
|
||||
// of pointers and increment `end' to point at the first
|
||||
// element in it; zero out the following node
|
||||
*++_C_end._C_node = __buf;
|
||||
_C_end._C_cur = __buf;
|
||||
}
|
||||
else {
|
||||
__alloc.construct (__buf + (__bufsize - 1), __x);
|
||||
|
||||
// prepend the newly allocated buffer to the beginning of
|
||||
// the vector of pointers and decrement `begin' to point
|
||||
// at the last element in it; zero out the preceding node
|
||||
*--_C_beg._C_node = __buf;
|
||||
_C_beg._C_cur = __buf + __bufsize;
|
||||
}
|
||||
}
|
||||
_CATCH (...) {
|
||||
__alloc.deallocate (__buf, __bufsize);
|
||||
|
||||
_RETHROW;
|
||||
}
|
||||
}
|
||||
|
||||
_C_end._C_node [+1] = pointer ();
|
||||
_C_beg._C_node [-1] = pointer ();
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void deque<_TypeT, _Allocator>::
|
||||
_C_free_at_begin ()
|
||||
{
|
||||
const size_type __bufsize = _C_bufsize ();
|
||||
|
||||
_RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this,
|
||||
deallocate (*_C_beg._C_node, __bufsize));
|
||||
if (empty ()) {
|
||||
_C_node_alloc_type (*this).
|
||||
deallocate (_C_nodes - 1, _C_node_size + 2);
|
||||
_C_init ();
|
||||
}
|
||||
else {
|
||||
*_C_beg._C_node++ = pointer ();
|
||||
_C_beg = _C_deque_iter (*_C_beg._C_node, _C_beg._C_node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void deque<_TypeT, _Allocator>::
|
||||
_C_free_at_end ()
|
||||
{
|
||||
const size_type __bufsize = _C_bufsize ();
|
||||
|
||||
_RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this,
|
||||
deallocate (*_C_end._C_node, __bufsize));
|
||||
if (empty ()) {
|
||||
_C_node_alloc_type (*this).
|
||||
deallocate (_C_nodes - 1, _C_node_size + 2);
|
||||
_C_init ();
|
||||
}
|
||||
else {
|
||||
*_C_end._C_node-- = pointer ();
|
||||
_C_end = _C_deque_iter (*_C_end._C_node + __bufsize, _C_end._C_node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void deque<_TypeT, _Allocator>::
|
||||
_C_assign_n (size_type __n, const_reference __x)
|
||||
{
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_DEQUE_ASSIGN_IN_PLACE
|
||||
|
||||
// assign over existing elements for better efficiency
|
||||
// and exception safety
|
||||
|
||||
// complexity: linear in n
|
||||
// exception safety:
|
||||
// -- nothrow if size() >= n, and value_type's assignment operator
|
||||
// and iterator operations do not throw
|
||||
// -- basic otherwise
|
||||
|
||||
const iterator __end = end ();
|
||||
|
||||
// avoid using the name __i or __it below so as not to trigger
|
||||
// a (bogus) gcc 2.95.2 -Wshadow warning: declaration of `__i'
|
||||
// shadows previous local
|
||||
for (iterator __ix = begin (); !(__ix == __end); ++__ix, --__n) {
|
||||
if (size_type () == __n) {
|
||||
erase (__ix, __end);
|
||||
return;
|
||||
}
|
||||
*__ix = __x;
|
||||
}
|
||||
|
||||
insert (__end, __n, __x);
|
||||
|
||||
#else // if defined (_RWSTD_NO_EXT_DEQUE_ASSIGN_IN_PLACE)
|
||||
|
||||
// follow the inefficient requirement in 23.2.1.1, p8
|
||||
|
||||
// complexity: linear in n
|
||||
// exception safety: basic
|
||||
|
||||
clear ();
|
||||
insert (begin (), __n, __x);
|
||||
|
||||
#endif // _RWSTD_NO_EXT_DEQUE_ASSIGN_IN_PLACE
|
||||
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void deque<_TypeT, _Allocator>::
|
||||
_C_insert_n (const iterator &__it, size_type __n, const_reference __x)
|
||||
{
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it);
|
||||
_RWSTD_ASSERT (_C_is_valid ());
|
||||
|
||||
const size_type __inx = _DISTANCE (begin (), __it, size_type);
|
||||
const size_type __rem = size () - __inx;
|
||||
|
||||
_RWSTD_ASSERT (__inx <= size ());
|
||||
|
||||
if (__inx < __rem) {
|
||||
|
||||
// inserting `x' into the first half of the container
|
||||
|
||||
if (__inx < __n) {
|
||||
|
||||
for (size_type __i = __n - __inx; __i; --__i)
|
||||
push_front (__x);
|
||||
|
||||
for (size_type __j = __inx; __j; --__j)
|
||||
push_front (*(begin () + (__n - 1)));
|
||||
|
||||
_STD::fill (begin () + __n, begin () + (__n + __inx), __x);
|
||||
}
|
||||
else if (__n) {
|
||||
|
||||
for (size_type __i = __n; __i; --__i)
|
||||
push_front (*(begin () + __n - 1));
|
||||
|
||||
const iterator __tmp = begin () + __n;
|
||||
|
||||
_STD::copy (__tmp + __n, __tmp + __inx, __tmp);
|
||||
|
||||
_STD::fill (begin () + __inx, __tmp + __inx, __x);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
// inserting `x' into the second half of the container
|
||||
|
||||
const size_type __size0 = size ();
|
||||
|
||||
if (__rem < __n) {
|
||||
|
||||
for (size_type __i = __n - __rem; __i; --__i)
|
||||
push_back (__x);
|
||||
|
||||
for (size_type __j = 0; __j != __rem; ++__j)
|
||||
push_back (*(begin () + (__inx + __j)));
|
||||
|
||||
_STD::fill (begin () + __inx, begin () + __size0, __x);
|
||||
}
|
||||
else if (__n) {
|
||||
|
||||
for (size_type __i = 0;__i != __n; ++__i)
|
||||
push_back (*(begin () + __size0 - __n + __i));
|
||||
|
||||
const iterator __tmp = begin () + __inx;
|
||||
|
||||
_STD::copy_backward (__tmp, begin () + __size0 - __n,
|
||||
begin () + __size0);
|
||||
|
||||
_STD::fill (__tmp, __tmp + __n, __x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
template <class _InputIter>
|
||||
void deque<_TypeT, _Allocator>::
|
||||
_C_assign_range (_InputIter __first, _InputIter __last, input_iterator_tag)
|
||||
{
|
||||
typedef deque _Deque;
|
||||
|
||||
deque* const __self = this;
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
template <class _TypeT, class _Allocator, class _InputIter>
|
||||
void
|
||||
__rw_assign_range (deque<_TypeT, _Allocator> *__self,
|
||||
_InputIter __first, _InputIter __last, input_iterator_tag)
|
||||
{
|
||||
typedef deque<_TypeT, _Allocator> _Deque;
|
||||
typedef _TYPENAME _Deque::iterator iterator;
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
_RWSTD_ASSERT (__self->_C_is_valid ());
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_DEQUE_ASSIGN_IN_PLACE
|
||||
|
||||
// assign over existing elements for better efficiency
|
||||
// and exception safety
|
||||
|
||||
// complexity: linear in distance(first, last)
|
||||
// exception safety:
|
||||
// -- nothrow if size() >= distance(first, last), and value_type's
|
||||
// assignment operator and iterator operations do not throw
|
||||
// -- basic otherwise
|
||||
|
||||
const iterator __end = __self->end ();
|
||||
|
||||
// avoid using the name __i or __it below so as not to trigger
|
||||
// a (bogus) gcc 2.95.2 -Wshadow warning: declaration of `__i'
|
||||
// shadows previous local
|
||||
for (iterator __ix = __self->begin (); !(__ix == __end);
|
||||
++__ix, ++__first) {
|
||||
if (__first == __last) {
|
||||
__self->erase (__ix, __end);
|
||||
return;
|
||||
}
|
||||
*__ix = *__first;
|
||||
}
|
||||
|
||||
__self->insert (__end, __first, __last);
|
||||
|
||||
#else // if defined (_RWSTD_NO_EXT_DEQUE_ASSIGN_IN_PLACE)
|
||||
|
||||
// follow the inefficient requirement in 23.2.1.1, p7
|
||||
|
||||
// complexity: linear in distance(first, last)
|
||||
// exception safety: basic
|
||||
|
||||
__self->clear ();
|
||||
__self->insert (__self->begin (), __first, __last);
|
||||
|
||||
#endif // _RWSTD_NO_EXT_DEQUE_ASSIGN_IN_PLACE
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template<class _TypeT, class _Allocator>
|
||||
template <class _InputIter>
|
||||
void deque<_TypeT, _Allocator>::
|
||||
_C_insert_range (iterator __it,
|
||||
_InputIter __first, _InputIter __last,
|
||||
input_iterator_tag)
|
||||
{
|
||||
typedef deque _Deque;
|
||||
|
||||
_Deque* const __self = this;
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
template <class _TypeT, class _Allocator, class _DequeIter, class _InputIter>
|
||||
void
|
||||
__rw_insert_range (deque<_TypeT, _Allocator> *__self, _DequeIter __it,
|
||||
_InputIter __first, _InputIter __last, input_iterator_tag)
|
||||
{
|
||||
typedef deque<_TypeT, _Allocator> _Deque;
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
_RWSTD_ASSERT_RANGE (__it, __self->end ());
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_DEQUE_INSERT_IN_PLACE
|
||||
|
||||
// insert one element at a time to prevent a loss of data
|
||||
// from the input sequence in the case of an exception
|
||||
|
||||
for ( ; !(__first == __last); ++__it, ++__first)
|
||||
__it = __self->insert (__it, *__first);
|
||||
|
||||
#else // if defined (_RWSTD_NO_EXT_DEQUE_INSERT_IN_PLACE)
|
||||
|
||||
// 23.2.1.3, p2: if an exception is thrown other than by the copy
|
||||
// constructor or assignment operator of T there are no effects.
|
||||
|
||||
_Deque __tmp (__self->begin (), __it, __self->get_allocator ());
|
||||
|
||||
for (; !(__first == __last); ++__first)
|
||||
__tmp.push_back (*__first);
|
||||
|
||||
__tmp.insert (__tmp.end (), __it, __self->end ());
|
||||
|
||||
__self->swap (__tmp);
|
||||
|
||||
#endif // _RWSTD_NO_EXT_DEQUE_INSERT_IN_PLACE
|
||||
|
||||
}
|
||||
|
||||
|
||||
// #ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
// template<class _TypeT, class _Allocator>
|
||||
// template <class _FwdIter>
|
||||
// void deque<_TypeT, _Allocator>::
|
||||
// _C_insert_range (iterator __it,
|
||||
// _FwdIter __first, _FwdIter __last,
|
||||
// forward_iterator_tag)
|
||||
// {
|
||||
// typedef deque _Deque;
|
||||
|
||||
// _Deque* const __self = this;
|
||||
|
||||
// #else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
// template <class _TypeT, class _Allocator, class _DequeIter, class _FwdIter>
|
||||
// void
|
||||
// __rw_insert_range (deque<_TypeT, _Allocator> *__self, _DequeIter __it,
|
||||
// _FwdIter __first, _FwdIter __last, forward_iterator_tag)
|
||||
// {
|
||||
// typedef deque<_TypeT, _Allocator> _Deque;
|
||||
|
||||
// #endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
// // implemented in terms of the Input Iterator overload
|
||||
// _RWSTD_INSERT_RANGE (__it, __first, __last, input_iterator_tag ());
|
||||
// }
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
template <class _BidirIter>
|
||||
void deque<_TypeT, _Allocator>::
|
||||
_C_insert_range (iterator __it,
|
||||
_BidirIter __first, _BidirIter __last,
|
||||
bidirectional_iterator_tag)
|
||||
{
|
||||
typedef deque _Deque;
|
||||
|
||||
_Deque* const __self = this;
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
template <class _TypeT, class _Allocator, class _DequeIter, class _BidirIter>
|
||||
void
|
||||
__rw_insert_range (deque<_TypeT, _Allocator> *__self, _DequeIter __it,
|
||||
_BidirIter __first, _BidirIter __last,
|
||||
bidirectional_iterator_tag)
|
||||
|
||||
{
|
||||
typedef deque<_TypeT, _Allocator> _Deque;
|
||||
typedef _TYPENAME _Deque::difference_type difference_type;
|
||||
typedef _TYPENAME _Deque::size_type size_type;
|
||||
typedef _TYPENAME _Deque::iterator iterator;
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
_RWSTD_ASSERT_RANGE (__self->begin (), __it);
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
_RWSTD_ASSERT (__self->_C_is_valid ());
|
||||
|
||||
// compute the distance of `it' from the beginning of the container,
|
||||
// the distance of `it' to the end of the container, and the number
|
||||
// of elements to be inserted
|
||||
const size_type __sz0 = __self->size ();
|
||||
const size_type __inx = _DISTANCE (__self->begin (), __it, size_type);
|
||||
const size_type __rem = __sz0 - __inx;
|
||||
const size_type __n = _DISTANCE (__first, __last, size_type);
|
||||
|
||||
_RWSTD_ASSERT (__inx <= __sz0);
|
||||
|
||||
if (__inx < __rem) {
|
||||
|
||||
// inserting into the first half of the container
|
||||
|
||||
if (__inx < __n) {
|
||||
|
||||
// the number of elements in the range controlled by *this,
|
||||
// [begin, it), is less than the number of elements in the
|
||||
// range [first, last)
|
||||
|
||||
_BidirIter __from (__last);
|
||||
|
||||
_STD::advance (__from, -difference_type (__inx));
|
||||
|
||||
const _BidirIter __mid (__from);
|
||||
|
||||
while (!(__from == __first))
|
||||
__self->push_front (*--__from);
|
||||
|
||||
for (size_type __i = __inx; __i; --__i)
|
||||
__self->push_front (*(__self->begin () + (__n - 1)));
|
||||
|
||||
_STD::copy (__mid, __last, __self->begin () + __n);
|
||||
}
|
||||
else {
|
||||
|
||||
// the number of elements in the range to be inserted,
|
||||
// [first, last), is less than or equal to the number
|
||||
// of elements in the range [begin, it)
|
||||
|
||||
for (size_type __i = __n; __i; --__i)
|
||||
__self->push_front (*(__self->begin () + (__n - 1)));
|
||||
|
||||
const iterator __to = __self->begin () + __n;
|
||||
|
||||
_STD::copy (__to + __n, __to + __inx, __to);
|
||||
_STD::copy (__first, __last, __self->begin () + __inx);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// inserting into the second half of the container
|
||||
|
||||
if (__rem < __n) {
|
||||
|
||||
_BidirIter __from (__first);
|
||||
|
||||
_STD::advance (__from, __rem);
|
||||
|
||||
const _BidirIter __to (__from);
|
||||
|
||||
for ( ; !(__from == __last); ++__from)
|
||||
__self->push_back (*__from);
|
||||
|
||||
for (size_type __i = 0; __i != __rem; ++__i)
|
||||
__self->push_back (*(__self->begin () + (__inx + __i)));
|
||||
|
||||
_STD::copy (__first, __to, __self->begin () + __inx);
|
||||
}
|
||||
else {
|
||||
for (size_type __i = 0; __i != __n; ++__i)
|
||||
__self->push_back (*(__self->begin () + (__sz0 - __n + __i)));
|
||||
|
||||
const iterator __to = __self->begin () + __sz0;
|
||||
const iterator __from = __self->begin () + __inx;
|
||||
const iterator __from_end = __self->begin () + (__sz0 - __n);
|
||||
|
||||
_STD::copy_backward (__from, __from_end, __to);
|
||||
_STD::copy (__first, __last, __from);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class _TypeT, class _Allocator>
|
||||
bool deque<_TypeT, _Allocator>::
|
||||
_C_is_valid (int __emptyfl) const
|
||||
{
|
||||
#ifdef _RWSTDDEBUG
|
||||
|
||||
if (__emptyfl < 0 /* don't care */)
|
||||
return _C_is_valid (0 + empty ());
|
||||
|
||||
// the nodes just prior the first valid node and
|
||||
// just past the last valid node must always be 0
|
||||
if (_C_node_pointer () != _C_nodes) {
|
||||
_RWSTD_ASSERT (pointer () == _C_beg._C_node [-1]);
|
||||
_RWSTD_ASSERT (pointer () == _C_end._C_node [+1]);
|
||||
}
|
||||
|
||||
if (__emptyfl) {
|
||||
// container must be empty
|
||||
_RWSTD_ASSERT (empty ());
|
||||
|
||||
// both `current' pointers must be 0
|
||||
_RWSTD_ASSERT (pointer () == _C_beg._C_cur);
|
||||
_RWSTD_ASSERT (pointer () == _C_end._C_cur);
|
||||
|
||||
// node pointers must be dereferenceable...
|
||||
_RWSTD_ASSERT (_C_node_pointer () != _C_beg._C_node);
|
||||
_RWSTD_ASSERT (_C_node_pointer () != _C_end._C_node);
|
||||
|
||||
// ...and both must dereference the same pointer
|
||||
_RWSTD_ASSERT (*_C_beg._C_node == *_C_end._C_node);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const size_type __bufsize = _C_bufsize ();
|
||||
|
||||
// container must be non-empty
|
||||
_RWSTD_ASSERT (!empty ());
|
||||
|
||||
// current pointers must be non-0
|
||||
_RWSTD_ASSERT (pointer () != _C_beg._C_cur);
|
||||
_RWSTD_ASSERT (pointer () != _C_end._C_cur);
|
||||
|
||||
// `begin' must be less than `end'
|
||||
_RWSTD_ASSERT (_C_beg._C_node <= _C_end._C_node);
|
||||
|
||||
// `begin' must point into the vector of nodes
|
||||
_RWSTD_ASSERT (_C_nodes <= _C_beg._C_node);
|
||||
_RWSTD_ASSERT (_C_beg._C_node <= _C_nodes + _C_node_size);
|
||||
|
||||
// `begin' must point to a non-empty array of elements
|
||||
_RWSTD_ASSERT (pointer () != *_C_beg._C_node);
|
||||
|
||||
// `begin' must point into an array of `bufsize' elements
|
||||
_RWSTD_ASSERT (_C_beg._C_cur >= *_C_beg._C_node);
|
||||
_RWSTD_ASSERT (_C_beg._C_cur <= *_C_beg._C_node + __bufsize);
|
||||
|
||||
// `end' must point into the vector of nodes
|
||||
_RWSTD_ASSERT (_C_nodes <= _C_end._C_node);
|
||||
_RWSTD_ASSERT (_C_end._C_node <= _C_nodes + _C_node_size);
|
||||
|
||||
// `end' must point to a non-empty array of elements
|
||||
_RWSTD_ASSERT (pointer () != *_C_end._C_node);
|
||||
|
||||
// `end' must point into an array of `bufsize' elements
|
||||
_RWSTD_ASSERT (_C_end._C_cur >= *_C_end._C_node);
|
||||
_RWSTD_ASSERT (_C_end._C_cur <= *_C_end._C_node + __bufsize);
|
||||
|
||||
#else // if !defined (_RWSTDDEBUG)
|
||||
|
||||
_RWSTD_UNUSED (__emptyfl);
|
||||
|
||||
#endif // _RWSTDDEBUG
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
622
extern/stdcxx/4.2.1/include/deque_spec.h
vendored
Normal file
622
extern/stdcxx/4.2.1/include/deque_spec.h
vendored
Normal file
@@ -0,0 +1,622 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* deque_spec.h - deque <_TypeT*> partial specialization
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* 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 __STD_DEQUE_SPEC__
|
||||
#define __STD_DEQUE_SPEC__
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
#ifndef __STD_DEQUE__
|
||||
#include <deque>
|
||||
#endif // __STD_DEQUE__
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template class deque <void*, allocator <void*> >;
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
class deque <_TypeT*, allocator <_TypeT*> >
|
||||
{
|
||||
typedef allocator <_TypeT*> _Allocator;
|
||||
typedef _RWSTD_REBIND (_Allocator, void*) __imp_alloc_type;
|
||||
typedef deque <void*, __imp_alloc_type> __imp_type;
|
||||
|
||||
__imp_type __imp;
|
||||
|
||||
public:
|
||||
|
||||
typedef _TypeT* value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
|
||||
class iterator;
|
||||
class const_iterator;
|
||||
friend class iterator;
|
||||
friend class const_iterator;
|
||||
|
||||
typedef _TYPENAME allocator_type::reference reference;
|
||||
typedef _TYPENAME allocator_type::const_reference const_reference;
|
||||
typedef _TYPENAME allocator_type::size_type size_type;
|
||||
typedef _TYPENAME allocator_type::difference_type difference_type;
|
||||
typedef _TYPENAME allocator_type::pointer pointer;
|
||||
typedef _TYPENAME allocator_type::const_pointer const_pointer;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
typedef _RWSTD_REBIND (_Allocator, pointer) __map_alloc_type;
|
||||
typedef _TYPENAME __map_alloc_type::pointer __map_pointer;
|
||||
|
||||
typedef _STD::iterator <random_access_iterator_tag, value_type,
|
||||
difference_type, pointer,reference> __it;
|
||||
|
||||
typedef _STD::iterator <random_access_iterator_tag, value_type,
|
||||
difference_type, const_pointer, const_reference> __cit;
|
||||
|
||||
public:
|
||||
|
||||
class const_iterator;
|
||||
|
||||
class iterator : public __it
|
||||
{
|
||||
typedef _TYPENAME __imp_type::iterator __imp_iter;
|
||||
|
||||
__imp_iter __imp;
|
||||
|
||||
friend class deque<_TypeT, allocator <_TypeT> >;
|
||||
friend class const_iterator;
|
||||
|
||||
// implicit conversions from and to implementation-specific iterator
|
||||
// used only internally
|
||||
iterator (const __imp_iter &imp)
|
||||
: __imp (imp) {}
|
||||
|
||||
operator __imp_iter () {
|
||||
return __imp;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
iterator () {}
|
||||
|
||||
__iterator_base::reference operator* () const {
|
||||
return __iterator_base::reference (*__imp);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_NONCLASS_ARROW_RETURN
|
||||
|
||||
__iterator_base::pointer operator-> () const {
|
||||
return __iterator_base::pointer (&*__imp);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_NONCLASS_ARROW_RETURN
|
||||
|
||||
|
||||
iterator& operator++ () {
|
||||
++__imp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator operator++ (int) {
|
||||
iterator tmp = *this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator& operator-- () {
|
||||
--__imp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator operator-- (int) {
|
||||
iterator tmp = *this;
|
||||
--*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator& operator+= (__iterator_base::difference_type n) {
|
||||
__imp += n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator& operator-= (__iterator_base::difference_type n) {
|
||||
__imp -= n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__iterator_base::difference_type operator- (const iterator& x) const {
|
||||
return __imp - x.__imp;
|
||||
}
|
||||
|
||||
iterator operator- (__iterator_base::difference_type n) {
|
||||
return __imp - n;
|
||||
}
|
||||
|
||||
iterator operator+ (__iterator_base::difference_type n) {
|
||||
return __imp + n;
|
||||
}
|
||||
|
||||
__iterator_base::reference operator[] (__iterator_base::difference_type n) {
|
||||
return __imp [n];
|
||||
}
|
||||
|
||||
bool operator== (const iterator &x) const {
|
||||
return __imp == x.__imp;
|
||||
}
|
||||
|
||||
bool operator< (const iterator &x) const {
|
||||
return __imp < x.__imp;
|
||||
}
|
||||
|
||||
bool operator> (const iterator &x) const {
|
||||
return x.__imp < *this;
|
||||
}
|
||||
|
||||
bool operator!= (const iterator &x) const {
|
||||
return !(*this == x.__imp);
|
||||
}
|
||||
|
||||
bool operator<= (const iterator &x) const {
|
||||
return !(*x.__imp < *this);
|
||||
}
|
||||
|
||||
bool operator>= (const iterator &x) const {
|
||||
return !(x.__imp < *this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class const_iterator : public __cit
|
||||
{
|
||||
typedef _TYPENAME __imp_type::const_iterator __imp_iter;
|
||||
|
||||
__imp_iter __imp;
|
||||
|
||||
friend class deque<_TypeT, allocator <_TypeT> >;
|
||||
|
||||
const_iterator (const __imp_iter &imp): __imp (imp) {}
|
||||
|
||||
public:
|
||||
|
||||
const_iterator () {}
|
||||
|
||||
const_iterator (const iterator &x) : __imp (x.__imp) {}
|
||||
|
||||
const_reference operator* () const {
|
||||
return const_reference (*__imp);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_NONCLASS_ARROW_RETURN
|
||||
|
||||
const_pointer operator-> () const {
|
||||
return const_pointer (&*__imp);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_NONCLASS_ARROW_RETURN
|
||||
|
||||
|
||||
const_iterator& operator++ () {
|
||||
++__imp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_iterator operator++ (int) {
|
||||
const_iterator tmp = *this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const_iterator& operator-- () {
|
||||
--__imp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_iterator operator-- (int) {
|
||||
const_iterator tmp = *this;
|
||||
--*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const_iterator& operator+= (__iterator_base::difference_type n) {
|
||||
__imp += n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_iterator& operator-= (__iterator_base::difference_type n) {
|
||||
__imp -= n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__iterator_base::difference_type operator- (const const_iterator& x) const {
|
||||
return __imp - x.__imp;
|
||||
}
|
||||
|
||||
const_iterator operator- (__iterator_base::difference_type n) {
|
||||
return __imp - n;
|
||||
}
|
||||
|
||||
const_iterator operator+ (__iterator_base::difference_type n) {
|
||||
return __imp + n;
|
||||
}
|
||||
|
||||
const_reference operator[] (__iterator_base::difference_type n) {
|
||||
return __imp [n];
|
||||
}
|
||||
|
||||
bool operator== (const const_iterator &x) const {
|
||||
return __imp == x.__imp;
|
||||
}
|
||||
|
||||
bool operator< (const const_iterator &x) const {
|
||||
return __imp < x.__imp;
|
||||
}
|
||||
|
||||
bool operator> (const const_iterator &x) const {
|
||||
return x.__imp < *this;
|
||||
}
|
||||
|
||||
bool operator!= (const const_iterator &x) const {
|
||||
return !(*this == x.__imp);
|
||||
}
|
||||
|
||||
bool operator<= (const const_iterator &x) const {
|
||||
return !(*x.__imp < *this);
|
||||
}
|
||||
|
||||
bool operator>= (const const_iterator &x) const {
|
||||
return !(x.__imp < *this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
||||
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _STD::reverse_iterator<iterator> reverse_iterator;
|
||||
#else
|
||||
typedef _STD::reverse_iterator<const_iterator,
|
||||
random_access_iterator_tag, value_type,
|
||||
const_reference, const_pointer, difference_type>
|
||||
const_reverse_iterator;
|
||||
|
||||
typedef _STD::reverse_iterator<iterator,
|
||||
random_access_iterator_tag, value_type,
|
||||
reference, pointer, difference_type>
|
||||
reverse_iterator;
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT deque (const _Allocator &alloc _RWSTD_DEFAULT_ARG (_Allocator ()))
|
||||
: __imp (alloc) { }
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
|
||||
|
||||
deque ()
|
||||
: __imp () { }
|
||||
|
||||
deque (size_type n, const_reference x)
|
||||
: __imp (n, x) { }
|
||||
|
||||
#endif // _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
|
||||
|
||||
|
||||
_EXPLICIT deque (size_type n)
|
||||
: __imp (n) { }
|
||||
|
||||
|
||||
deque (size_type n, const_reference x,
|
||||
const _Allocator& alloc _RWSTD_DEFAULT_ARG (_Allocator()))
|
||||
: __imp (n, x, alloc) { }
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template <class InputIterator>
|
||||
deque (InputIterator first, InputIterator last,
|
||||
const _Allocator& alloc _RWSTD_DEFAULT_ARG (_Allocator ()))
|
||||
: __imp (first, last, alloc) { }
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
deque (const_iterator first, const_iterator last,
|
||||
const _Allocator& alloc _RWSTD_DEFAULT_ARG(_Allocator()))
|
||||
: __imp (first, last, alloc) { }
|
||||
|
||||
deque (const_pointer first, const_pointer last,
|
||||
const _Allocator& alloc _RWSTD_DEFAULT_ARG(_Allocator()))
|
||||
: __imp (first, last, alloc) { }
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
|
||||
|
||||
deque (const_iterator first, const_iterator last)
|
||||
: __imp (first, last) { }
|
||||
|
||||
deque (const_pointer first, const_pointer last)
|
||||
: __imp (first, last) { }
|
||||
|
||||
#endif // _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
|
||||
deque (const deque &x)
|
||||
: __imp (x.__imp) { }
|
||||
|
||||
deque& operator= (const deque &x) {
|
||||
__imp = x.__imp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template<class InputIterator>
|
||||
void assign (InputIterator first, InputIterator last) {
|
||||
__imp.assign (first, last);
|
||||
}
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
void assign (const_iterator first, const_iterator last) {
|
||||
__imp.assign (first, last);
|
||||
}
|
||||
|
||||
void assign (const_pointer first, const_pointer last) {
|
||||
__imp.assign (first, last);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
|
||||
void assign (size_type n, const_reference x) {
|
||||
__imp.assign (n, x);
|
||||
}
|
||||
|
||||
allocator_type get_allocator () const
|
||||
{
|
||||
return __imp.get_allocator ();
|
||||
}
|
||||
|
||||
iterator begin () {
|
||||
return __imp.begin ();
|
||||
}
|
||||
|
||||
const_iterator begin () const {
|
||||
return __imp.begin ();
|
||||
}
|
||||
|
||||
iterator end () {
|
||||
return __imp.end ();
|
||||
}
|
||||
|
||||
const_iterator end () const {
|
||||
return __imp.end ();
|
||||
}
|
||||
|
||||
reverse_iterator rbegin () {
|
||||
return reverse_iterator (end ());
|
||||
}
|
||||
|
||||
const_reverse_iterator rbegin () const {
|
||||
return reverse_iterator (end ());
|
||||
}
|
||||
|
||||
reverse_iterator rend () {
|
||||
return reverse_iterator (begin ());
|
||||
}
|
||||
|
||||
const_reverse_iterator rend () const {
|
||||
return reverse_iterator (begin ());
|
||||
}
|
||||
|
||||
bool empty () const {
|
||||
return __imp.empty ();
|
||||
}
|
||||
|
||||
size_type size () const {
|
||||
return __imp.size ();
|
||||
}
|
||||
|
||||
size_type max_size () const {
|
||||
return __imp.max_size ();
|
||||
}
|
||||
|
||||
void resize (size_type new_size) {
|
||||
__imp.resize (new_size);
|
||||
}
|
||||
|
||||
void resize (size_type new_size, const_reference x) {
|
||||
__imp.resize (new_size, x);
|
||||
}
|
||||
|
||||
reference operator[] (size_type n) {
|
||||
return reference (__imp [n]);
|
||||
}
|
||||
|
||||
const_reference operator[] (size_type n) const {
|
||||
return const_reference (__imp [n]);
|
||||
}
|
||||
|
||||
const_reference at (size_type n) const {
|
||||
return __imp.at (n);
|
||||
}
|
||||
|
||||
reference at (size_type n) {
|
||||
return __imp.at (n);
|
||||
}
|
||||
|
||||
reference front () {
|
||||
return reference (__imp.front ());
|
||||
}
|
||||
|
||||
const_reference front () const {
|
||||
return const_reference (__imp.front ());
|
||||
}
|
||||
|
||||
reference back () {
|
||||
return reference (__imp.back ());
|
||||
}
|
||||
|
||||
const_reference back () const {
|
||||
return const_reference (__imp.back ());
|
||||
}
|
||||
|
||||
void push_front (const_reference x) {
|
||||
__imp.push_front (x);
|
||||
}
|
||||
|
||||
void push_back (const_reference x) {
|
||||
__imp.push_back (x);
|
||||
}
|
||||
|
||||
void pop_front () {
|
||||
__imp.pop_front ();
|
||||
}
|
||||
|
||||
void pop_back () {
|
||||
__imp.pop_back ();
|
||||
}
|
||||
|
||||
iterator insert (iterator pos, const_reference x) {
|
||||
return __imp.insert (pos, x);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template <class InputIterator>
|
||||
void insert (iterator pos, InputIterator first, InputIterator last) {
|
||||
__imp.insert (pos, first, last);
|
||||
}
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
void insert (iterator pos, const_iterator first, const_iterator last) {
|
||||
__imp.insert (pos, first, last);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
|
||||
void insert (iterator pos, size_type n, const_reference x) {
|
||||
__imp.insert (pos, n, x);
|
||||
}
|
||||
|
||||
iterator erase (iterator pos) {
|
||||
return __imp.erase (pos);
|
||||
}
|
||||
|
||||
iterator erase (iterator first, iterator last) {
|
||||
return __imp.erase (first, last);
|
||||
}
|
||||
|
||||
void swap (deque &x) {
|
||||
__imp.swap (x.__imp);
|
||||
}
|
||||
|
||||
void clear () {
|
||||
__imp.clear ();
|
||||
}
|
||||
};
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator== (const deque <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const deque <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return x.size () == y.size () && equal (x.begin (), x.end (), y.begin ());
|
||||
}
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator< (const deque <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const deque <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return lexicographical_compare (x.begin (), x.end (), y.begin (), y.end ());
|
||||
}
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) || !defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
|
||||
template <class _TypeT>
|
||||
inline bool operator!= (const deque <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const deque <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator> (const deque <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const deque <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return y < x;
|
||||
}
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator>= (const deque <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const deque <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return !(x < y);
|
||||
}
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator<= (const deque <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const deque <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return !(y < x);
|
||||
}
|
||||
|
||||
template <class _TypeT>
|
||||
inline void swap (deque <_TypeT*, allocator <_TypeT*> > &a,
|
||||
deque <_TypeT*, allocator <_TypeT*> > &b)
|
||||
{
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
#endif // !defined(_RWSTD_NO_NAMESPACE) || !defined(_RWSTD_NO_PART_SPEC_OVERLOAD)
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif /*__STD_DEQUE_SPEC__*/
|
||||
190
extern/stdcxx/4.2.1/include/exception
vendored
Normal file
190
extern/stdcxx/4.2.1/include/exception
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* exception - declarations for the Standard Library exception class
|
||||
*
|
||||
* $Id: exception 620131 2008-02-09 14:57:25Z 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_EXCEPTION_INCLUDED
|
||||
#define _RWSTD_EXCEPTION_INCLUDED
|
||||
|
||||
#include <rw/_defs.h>
|
||||
#include <rw/_error.h>
|
||||
|
||||
|
||||
#if 0 // def __HP_aCC
|
||||
// HP aCC on HP-UX has <exception.h> whose contents HP prefers to ours
|
||||
// # include </opt/aCC/include/exception.h>
|
||||
# include <exception.h>
|
||||
#else // if defined (__HP_aCC)
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_STD_EXCEPTION) \
|
||||
|| !defined (_RWSTD_NO_RUNTIME_IN_STD)
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NO_STD_EXCEPTION || !_RWSTD_NO_RUNTIME_IN_STD
|
||||
|
||||
|
||||
// 18.6.1
|
||||
class _RWSTD_EXPORT exception
|
||||
{
|
||||
public:
|
||||
// 18.6.1, p2
|
||||
exception () _THROWS (());
|
||||
|
||||
// 18.6.1, p4
|
||||
exception (const exception&) _THROWS (());
|
||||
|
||||
// 18.6.1, p4
|
||||
exception& operator= (const exception&) _THROWS (());
|
||||
|
||||
// 18.6.1, p6
|
||||
virtual ~exception () _THROWS (());
|
||||
|
||||
// 18.6.1, p8
|
||||
virtual const char* what () const _THROWS (());
|
||||
|
||||
#if defined (_MSC_VER)
|
||||
|
||||
private:
|
||||
|
||||
const char *_C_name;
|
||||
int _C_flag;
|
||||
|
||||
#elif defined (__INTEL_COMPILER)
|
||||
|
||||
private:
|
||||
|
||||
const char *_C_name;
|
||||
|
||||
#endif // _MSC_VER
|
||||
};
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_STD_EXCEPTION) \
|
||||
|| !defined (_RWSTD_NO_RUNTIME_IN_STD)
|
||||
|
||||
} // namespace std
|
||||
|
||||
#else // if _RWSTD_NO_STD_EXCEPTION && _RWSTD_NO_RUNTIME_IN_STD
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::exception;
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
|
||||
#endif // _RWSTD_NO_STD_EXCEPTION, _RWSTD_NO_RUNTIME_IN_STD
|
||||
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_STD_BAD_EXCEPTION) \
|
||||
|| !defined (_RWSTD_NO_RUNTIME_IN_STD)
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#endif // _RWSTD_NO_STD_BAD_EXCEPTION || _RWSTD_NO_RUNTIME_IN_STD
|
||||
|
||||
|
||||
// 18.6.2.1
|
||||
class _RWSTD_EXPORT bad_exception: public _STD::exception
|
||||
{
|
||||
public:
|
||||
// 18.6.2.1, p2
|
||||
bad_exception () _THROWS (());
|
||||
|
||||
// 18.6.2.1, p4
|
||||
bad_exception (const bad_exception&) _THROWS (());
|
||||
|
||||
// 18.6.2.1, p4
|
||||
bad_exception& operator= (const bad_exception&) _THROWS (());
|
||||
|
||||
virtual ~bad_exception () _THROWS (());
|
||||
|
||||
// 18.6.2.1, p5
|
||||
virtual const char* what () const _THROWS (());
|
||||
};
|
||||
|
||||
#if !defined (_RWSTD_NO_STD_BAD_EXCEPTION) \
|
||||
|| !defined (_RWSTD_NO_RUNTIME_IN_STD)
|
||||
|
||||
} // namespace std
|
||||
|
||||
#else // if _RWSTD_NO_STD_BAD_EXCEPTION && _RWSTD_NO_RUNTIME_IN_STD
|
||||
|
||||
# ifndef _RWSTD_NO_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
|
||||
using ::bad_exception;
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
# endif // _RWSTD_NO_NAMESPACE
|
||||
|
||||
#endif // _RWSTD_NO_STD_BAD_EXCEPTION, _RWSTD_NO_RUNTIME_IN_STD
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
// 18.6.2.2
|
||||
typedef void (*unexpected_handler) ();
|
||||
|
||||
// 18.6.2.3
|
||||
_RWSTD_EXPORT extern unexpected_handler
|
||||
set_unexpected (unexpected_handler) _THROWS (());
|
||||
|
||||
// 18.6.2.4
|
||||
_RWSTD_EXPORT extern void
|
||||
unexpected () _RWSTD_GNUC_ATTRIBUTE ((__noreturn__));
|
||||
|
||||
// 18.6.3.1
|
||||
typedef void (*terminate_handler) ();
|
||||
|
||||
// 18.6.3.2
|
||||
_RWSTD_EXPORT extern terminate_handler
|
||||
set_terminate (terminate_handler) _THROWS (());
|
||||
|
||||
// 18.6.3.3
|
||||
_RWSTD_EXPORT extern void
|
||||
terminate () _RWSTD_GNUC_ATTRIBUTE ((__noreturn__));
|
||||
|
||||
// 18.6.4
|
||||
_RWSTD_EXPORT extern bool
|
||||
uncaught_exception () _THROWS (());
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // __HP_aCC
|
||||
|
||||
#endif // _RWSTD_EXCEPTION_INCLUDED
|
||||
695
extern/stdcxx/4.2.1/include/fstream
vendored
Normal file
695
extern/stdcxx/4.2.1/include/fstream
vendored
Normal file
@@ -0,0 +1,695 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* fstream -- declarations of the C++ Standard Library file stream classes
|
||||
*
|
||||
* $Id: fstream 638384 2008-03-18 14:27:54Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_FSTREAM_INCLUDED
|
||||
#define _RWSTD_FSTREAM_INCLUDED
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
#include <streambuf>
|
||||
|
||||
#include <loc/_codecvt.h>
|
||||
|
||||
#include <rw/_file.h>
|
||||
#include <rw/_iosbase.h>
|
||||
#include <rw/_iosfwd.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
#ifndef _RWSTD_NO_REDUNDANT_DEFINITIONS
|
||||
# include <istream>
|
||||
# include <ostream>
|
||||
#endif // _RWSTD_NO_REDUNDANT_DEFINITIONS
|
||||
|
||||
|
||||
#ifndef _RWSTD_PBACK_SIZE
|
||||
# define _RWSTD_PBACK_SIZE ((_RWSTD_STREAMSIZE)4)
|
||||
#endif // _RWSTD_PBACK_SIZE
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#ifndef _RWSTD_IOSFWD_INCLUDED
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_filebuf;
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_ifstream;
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_ofstream;
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_fstream;
|
||||
|
||||
typedef basic_filebuf<char> filebuf;
|
||||
typedef basic_ifstream<char> ifstream;
|
||||
typedef basic_ofstream<char> ofstream;
|
||||
typedef basic_fstream<char> fstream;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
typedef basic_filebuf<wchar_t> wfilebuf;
|
||||
typedef basic_ifstream<wchar_t> wifstream;
|
||||
typedef basic_ofstream<wchar_t> wofstream;
|
||||
typedef basic_fstream<wchar_t> wfstream;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_IOSFWD_INCLUDED
|
||||
|
||||
|
||||
_EXPORT
|
||||
template<class _CharT, class _Traits>
|
||||
class basic_filebuf: public basic_streambuf<_CharT, _Traits>
|
||||
{
|
||||
typedef basic_streambuf<_CharT, _Traits> _Streambuf;
|
||||
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef _Traits traits_type;
|
||||
typedef _TYPENAME traits_type::int_type int_type;
|
||||
typedef _TYPENAME traits_type::pos_type pos_type;
|
||||
typedef _TYPENAME traits_type::off_type off_type;
|
||||
|
||||
// 27.8.1.2, p1
|
||||
basic_filebuf ()
|
||||
: _Streambuf(), _C_file (0),
|
||||
_C_cur_pos (pos_type (off_type (-1))),
|
||||
_C_beg_pos (pos_type (off_type (-1))),
|
||||
_C_pbacksize (0) {
|
||||
// call the virtual setbuf defined in this class (but
|
||||
// not an override defined in a class derived from it)
|
||||
basic_filebuf::setbuf (0, _RWSTD_DEFAULT_BUFSIZE);
|
||||
}
|
||||
|
||||
#if defined (_RWSTD_NO_EXT_FILEBUF) \
|
||||
&& !defined (_RWSTD_NO_STATIC_IOSTREAM_INIT) \
|
||||
&& (!defined (__GNUG__) || 2 < __GNUG__ || 96 < __GNUC_MINOR__)
|
||||
|
||||
private:
|
||||
|
||||
// g++ 2.95 error: `std::ios_base::Init' does not declare a template type
|
||||
friend struct ios_base::Init;
|
||||
|
||||
#endif // _RWSTD_NO_EXT_FILEBUF && !_RWSTD_NO_STATIC_IOSTREAM_INIT
|
||||
|
||||
// ctor extensions - associate this with an open file and
|
||||
// optionally set buffer size and caller-allocated buffer
|
||||
// NOTE: passed in buffer will NOT be deallocated
|
||||
_EXPLICIT
|
||||
basic_filebuf (int __fd, char_type* __buf = 0,
|
||||
_RWSTD_STREAMSIZE __bufsz = _RWSTD_DEFAULT_BUFSIZE)
|
||||
: _Streambuf (ios_base::openmode (_RW::__rw_fdmode (__fd))),
|
||||
_C_file (0), _C_cur_pos (), _C_beg_pos (), _C_pbacksize (0) {
|
||||
_C_open (__fd, 0, __buf, __bufsz);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// extension enabled only if the macro stdin is also #defined
|
||||
// i.e., if the header <cstdio> or <stdio.h> has been #included
|
||||
|
||||
# ifdef stdin
|
||||
|
||||
_EXPLICIT
|
||||
basic_filebuf (FILE *__fptr, char_type* __buf = 0,
|
||||
_RWSTD_STREAMSIZE __bufsz = _RWSTD_DEFAULT_BUFSIZE)
|
||||
: _Streambuf (),
|
||||
_C_file (0), _C_cur_pos (), _C_beg_pos (), _C_pbacksize (0) {
|
||||
open (__fptr, __buf, __bufsz);
|
||||
}
|
||||
|
||||
# endif // stdin
|
||||
#endif // _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// 27.8.1.2, p3
|
||||
virtual ~basic_filebuf ();
|
||||
|
||||
// 27.8.1.3, p2 (last optional argument is an extension)
|
||||
basic_filebuf* open (const char*, ios_base::openmode, long = 0666);
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// extensions - associate *this with an open file descriptor
|
||||
// and optionally set buffer size and caller-allocated buffer
|
||||
// NOTE: passed in buffer will NOT be deallocated
|
||||
|
||||
basic_filebuf* open (int __fd, char_type *__buf = 0,
|
||||
_RWSTD_STREAMSIZE __bufsz = _RWSTD_DEFAULT_BUFSIZE) {
|
||||
return _C_open (__fd, 0, __buf, __bufsz);
|
||||
}
|
||||
|
||||
# ifdef stdin
|
||||
|
||||
// extension enabled only if the macro stdin is also #defined
|
||||
// i.e., if the header <cstdio> or <stdio.h> has been #included
|
||||
|
||||
basic_filebuf* open (FILE *__file, char_type *__buf = 0,
|
||||
_RWSTD_STREAMSIZE __bufsz = _RWSTD_DEFAULT_BUFSIZE) {
|
||||
return _C_open (-1, __file, __buf, __bufsz);
|
||||
}
|
||||
|
||||
# endif // stdin
|
||||
|
||||
// extension - return the associated file descriptor
|
||||
int fd () const {
|
||||
return _RW::__rw_fileno (_C_file, this->_C_state);
|
||||
}
|
||||
|
||||
// extension - associate *this with an open file descriptor
|
||||
basic_filebuf* attach (int __fd) {
|
||||
return _C_open (__fd, 0, this->_C_buffer, this->_C_bufsize);
|
||||
}
|
||||
|
||||
// extension - flush and detach from file descriptor without closing it
|
||||
int detach () {
|
||||
const int __fd = fd ();
|
||||
return close (false) ? __fd : -1;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// 27.8.1.3, p6, argument is an extension
|
||||
basic_filebuf* close (bool = true);
|
||||
|
||||
// 27.8.1.3, p1
|
||||
bool is_open () const {
|
||||
return 0 != _C_file;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// 27.8.1.4, p1
|
||||
virtual _RWSTD_STREAMSIZE showmanyc ();
|
||||
|
||||
// 27.8.1.4, p3
|
||||
virtual int_type underflow ();
|
||||
|
||||
// 27.8.1.4, p4 - same as base implementation
|
||||
// virtual int_type uflow ();
|
||||
|
||||
// 27.8.1.4, p8
|
||||
virtual int_type overflow (int_type = traits_type::eof ());
|
||||
|
||||
// 27.8.1.4, p5
|
||||
virtual int_type pbackfail (int_type = traits_type::eof ());
|
||||
|
||||
// 27.8.1.4, p10
|
||||
// setbuf (0, 0) sets unbuffered mode (safe to use at any time)
|
||||
// setbuf (0, N) sets buffered mode with internal buffer of size N
|
||||
// setbuf (b, N) sets buffered mode with user-allocated buffer `b'
|
||||
// of size `N' (user responsible for deallocation)
|
||||
virtual basic_streambuf<char_type, traits_type>*
|
||||
setbuf (char_type*, _RWSTD_STREAMSIZE);
|
||||
|
||||
// 27.8.1.4, p11
|
||||
virtual pos_type
|
||||
seekoff (off_type, ios_base::seekdir,
|
||||
ios_base::openmode = _RW::__rw_in_out);
|
||||
|
||||
// 27.8.1.4, p14
|
||||
virtual pos_type
|
||||
seekpos (pos_type, ios_base::openmode = _RW::__rw_in_out);
|
||||
|
||||
// 27.8.1.4, p16 - in input mode, repopulates buffer from file
|
||||
virtual int sync ();
|
||||
|
||||
// overridden for efficiency
|
||||
virtual _RWSTD_STREAMSIZE
|
||||
xsputn (const char_type*, _RWSTD_STREAMSIZE);
|
||||
|
||||
private:
|
||||
|
||||
basic_filebuf*
|
||||
_C_open (int, void*, char_type*, _RWSTD_STREAMSIZE);
|
||||
|
||||
// count newlines in char sequence to handle CR/LF translation on win32
|
||||
// calculates seek offsets in external representation
|
||||
off_type _C_crlf_extern_count (const char*, const char*) const;
|
||||
|
||||
// calculates seek offsets in internal representation
|
||||
off_type _C_crlf_intern_count (const char_type*, const char_type*) const;
|
||||
|
||||
// write unshift sequence to file (multibyte, state-dependent encondings)
|
||||
bool _C_unshift ();
|
||||
|
||||
void *_C_file; // underlying FILE ptr or file descriptor
|
||||
pos_type _C_cur_pos; // offset/state in file corresponding to
|
||||
// end of buffer, and actual pos in file
|
||||
pos_type _C_beg_pos; // offset/state in file corresponding
|
||||
// to the beginning of buffer
|
||||
_RWSTD_SIZE_T _C_pbacksize; // size of putback area
|
||||
};
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
inline basic_filebuf<_CharT, _Traits>::~basic_filebuf ()
|
||||
{
|
||||
_TRY {
|
||||
close ();
|
||||
}
|
||||
_CATCH (...) {
|
||||
// LWG issue 622: swallow all exceptions
|
||||
}
|
||||
|
||||
if (this->_C_own_buf ())
|
||||
delete [] this->_C_buffer;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
inline _TYPENAME basic_filebuf<_CharT, _Traits>::off_type
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
_C_crlf_extern_count (const char* __start, const char* __finish) const
|
||||
{
|
||||
_RWSTD_ASSERT (__start <= __finish);
|
||||
|
||||
off_type __n = 0;
|
||||
|
||||
#if defined (_RWSTD_NEWLINE_CR_LF) || defined (_RWSTD_NEWLINE_LF_CR)
|
||||
|
||||
// compute the number of newline characters in the external representation
|
||||
if (!(this->_C_state & ios_base::binary)) {
|
||||
typedef char_traits<char> _CTraits;
|
||||
|
||||
while ((__start = _CTraits::find (__start, __finish - __start, '\n'))) {
|
||||
++__start;
|
||||
++__n;
|
||||
}
|
||||
}
|
||||
|
||||
#else // if !defined (_RWSTD_NEWLINE_CR_LF) || ...
|
||||
|
||||
_RWSTD_UNUSED (__start);
|
||||
_RWSTD_UNUSED (__finish);
|
||||
|
||||
#endif // _RWSTD_NEWLINE_CR_LF
|
||||
|
||||
return __n;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
inline _TYPENAME basic_filebuf<_CharT, _Traits>::off_type
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
_C_crlf_intern_count (const char_type* __start,
|
||||
const char_type* __finish) const
|
||||
{
|
||||
_RWSTD_ASSERT (__start <= __finish);
|
||||
|
||||
off_type __n = 0;
|
||||
|
||||
#if defined (_RWSTD_NEWLINE_CR_LF) || defined (_RWSTD_NEWLINE_LF_CR)
|
||||
|
||||
// compute the number of newline characters in the internal representation
|
||||
if (!(this->_C_state & ios_base::binary)) {
|
||||
const char_type __nl =
|
||||
_USE_FACET (ctype<char_type>, this->getloc ()).widen ('\n');
|
||||
|
||||
while ((__start = _Traits::find (__start, __finish - __start, __nl))) {
|
||||
++__start;
|
||||
++__n;
|
||||
}
|
||||
}
|
||||
|
||||
#else // if !defined (_RWSTD_NEWLINE_CR_LF) || ...
|
||||
|
||||
_RWSTD_UNUSED (__start);
|
||||
_RWSTD_UNUSED (__finish);
|
||||
|
||||
#endif // _RWSTD_NEWLINE_CR_LF
|
||||
|
||||
return __n;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
class basic_ifstream: public basic_istream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef _CharT char_type;
|
||||
typedef _Traits traits_type;
|
||||
typedef _TYPENAME traits_type::int_type int_type;
|
||||
typedef _TYPENAME traits_type::pos_type pos_type;
|
||||
typedef _TYPENAME traits_type::off_type off_type;
|
||||
|
||||
// NOTE: the ctors below pass the address of an unitialized
|
||||
// member variable, _C_filebuf, to a base class ctor
|
||||
// the variable will be initialized only *after* the base
|
||||
// class ctor returns
|
||||
|
||||
basic_ifstream ()
|
||||
: basic_istream<char_type, traits_type> (rdbuf ()) { }
|
||||
|
||||
_EXPLICIT
|
||||
basic_ifstream (const char *__name,
|
||||
ios_base::openmode __mode = ios_base::in,
|
||||
long __prot = 0666)
|
||||
: basic_istream<char_type, traits_type> (rdbuf ()) {
|
||||
open (__name, __mode, __prot);
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// extensions - associate this with an open file and set buffer
|
||||
_EXPLICIT
|
||||
basic_ifstream (int __fd, char_type *__buf = 0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE)
|
||||
: basic_istream<char_type, traits_type> (rdbuf ()) {
|
||||
open (__fd, __buf, __n);
|
||||
}
|
||||
|
||||
# ifdef stdin
|
||||
|
||||
_EXPLICIT
|
||||
basic_ifstream (FILE *__fptr, char_type *__buf = 0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE)
|
||||
: basic_istream<char_type, traits_type> (rdbuf ()) {
|
||||
open (__fptr, __buf, __n);
|
||||
}
|
||||
|
||||
# endif // stdin
|
||||
|
||||
#endif // _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// NOTE: the pointer returned from rdbuf() may be different from
|
||||
// the one passed to basic_ios<>::rdbuf (basic_filebuf<>*)
|
||||
|
||||
basic_filebuf<char_type, traits_type>* rdbuf() const {
|
||||
// necessary to help SunPro 5.0/T9
|
||||
typedef basic_ifstream <char_type, traits_type> __self_type;
|
||||
return &_RWSTD_CONST_CAST (__self_type*, this)->_C_filebuf;
|
||||
}
|
||||
|
||||
bool is_open () const {
|
||||
return rdbuf ()->is_open ();
|
||||
}
|
||||
|
||||
void open (const char *__name,
|
||||
ios_base::openmode __mode = ios_base::in,
|
||||
long __prot = 0666) {
|
||||
this->clear (rdbuf ()->open (__name, __mode |= ios_base::in, __prot)
|
||||
? ios_base::goodbit : ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// extensions - associate this with an open file and set buffer
|
||||
void open (int __fd, char_type *__buf=0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE) {
|
||||
this->clear (rdbuf ()->open (__fd, __buf, __n) ?
|
||||
ios_base::goodbit : ios_base::failbit);
|
||||
}
|
||||
|
||||
# ifdef stdin
|
||||
|
||||
void open (FILE *__fptr, char_type *__buf=0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE) {
|
||||
this->clear (rdbuf ()->open (__fptr, __buf, __n) ?
|
||||
ios_base::goodbit : ios_base::failbit);
|
||||
}
|
||||
|
||||
# endif // stdin
|
||||
|
||||
#endif // _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
void close () {
|
||||
if (!rdbuf ()->close ())
|
||||
this->setstate (ios_base::failbit);
|
||||
}
|
||||
|
||||
private:
|
||||
basic_filebuf<char_type, traits_type> _C_filebuf;
|
||||
};
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
class basic_ofstream: public basic_ostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef _CharT char_type;
|
||||
typedef _Traits traits_type;
|
||||
typedef _TYPENAME traits_type::int_type int_type;
|
||||
typedef _TYPENAME traits_type::pos_type pos_type;
|
||||
typedef _TYPENAME traits_type::off_type off_type;
|
||||
|
||||
// NOTE: the ctors below pass the address of an unitialized
|
||||
// member variable, _C_filebuf, to a base class ctor
|
||||
// the variable will be initialized only *after* the base
|
||||
// class ctor returns
|
||||
|
||||
basic_ofstream ()
|
||||
: basic_ostream<char_type, traits_type> (rdbuf ()) { }
|
||||
|
||||
_EXPLICIT basic_ofstream (const char *__name,
|
||||
ios_base::openmode __mode = ios_base::out,
|
||||
long __prot = 0666)
|
||||
: basic_ostream<char_type, traits_type> (rdbuf ()) {
|
||||
open (__name, __mode, __prot);
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// extensions - associate this with an open file and set buffer
|
||||
_EXPLICIT
|
||||
basic_ofstream (int __fd, char_type *__buf = 0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE)
|
||||
: basic_ostream<char_type, traits_type> (rdbuf ()) {
|
||||
open (__fd, __buf, __n);
|
||||
}
|
||||
|
||||
# ifdef stdin
|
||||
|
||||
_EXPLICIT
|
||||
basic_ofstream (FILE *__fptr, char_type *__buf = 0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE)
|
||||
: basic_ostream<char_type, traits_type> (rdbuf ()) {
|
||||
open (__fptr, __buf, __n);
|
||||
}
|
||||
|
||||
# endif // stdin
|
||||
|
||||
#endif // _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// NOTE: the pointer returned from rdbuf() may be different from
|
||||
// the one passed to basic_ios<>::rdbuf (basic_filebuf<>*)
|
||||
|
||||
basic_filebuf<char_type, traits_type>* rdbuf () const {
|
||||
// necessary to help SunPro 5.0/T9
|
||||
typedef basic_ofstream <char_type, traits_type> _SelfT;
|
||||
return &_RWSTD_CONST_CAST (_SelfT*, this)->_C_filebuf;
|
||||
}
|
||||
|
||||
bool is_open () const {
|
||||
return rdbuf ()->is_open ();
|
||||
}
|
||||
|
||||
void open (const char *__name,
|
||||
ios_base::openmode __mode = ios_base::out,
|
||||
long __prot = 0666) {
|
||||
this->clear (rdbuf ()->open (__name, __mode |= ios_base::out, __prot)
|
||||
? ios_base::goodbit : ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// extensions - associate this with an open file and set buffer
|
||||
void open (int __fd, char_type *__buf=0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE) {
|
||||
this->clear (rdbuf ()->open (__fd, __buf, __n) ?
|
||||
ios_base::goodbit : ios_base::failbit);
|
||||
}
|
||||
|
||||
# ifdef stdin
|
||||
|
||||
void open (FILE *__fp, char_type *__buf=0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE) {
|
||||
this->clear (rdbuf ()->open (__fp, __buf, __n) ?
|
||||
ios_base::goodbit : ios_base::failbit);
|
||||
}
|
||||
|
||||
# endif // stdin
|
||||
|
||||
#endif // _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
void close() {
|
||||
if (!rdbuf ()->close ())
|
||||
this->setstate (ios_base::failbit);
|
||||
}
|
||||
|
||||
private:
|
||||
basic_filebuf<char_type, traits_type> _C_filebuf;
|
||||
};
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
class basic_fstream: public basic_iostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef _CharT char_type;
|
||||
typedef _Traits traits_type;
|
||||
typedef _TYPENAME traits_type::int_type int_type;
|
||||
typedef _TYPENAME traits_type::pos_type pos_type;
|
||||
typedef _TYPENAME traits_type::off_type off_type;
|
||||
|
||||
// NOTE: the ctors below pass the address of an unitialized
|
||||
// member variable, _C_filebuf, to a base class ctor
|
||||
// the variable will be initialized only *after* the base
|
||||
// class ctor returns
|
||||
|
||||
basic_fstream ()
|
||||
: basic_iostream<char_type, traits_type>(rdbuf ()) { }
|
||||
|
||||
_EXPLICIT
|
||||
basic_fstream (const char *__name,
|
||||
ios_base::openmode __mode = _RW::__rw_in_out,
|
||||
long __prot = 0666)
|
||||
: basic_iostream<char_type, traits_type>(rdbuf ()) {
|
||||
open (__name, __mode, __prot);
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// extensions - associate this with an open file and set buffer
|
||||
_EXPLICIT
|
||||
basic_fstream (int __fd, char_type *__buf = 0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE)
|
||||
: basic_iostream<char_type, traits_type>(rdbuf ()) {
|
||||
open (__fd, __buf, __n);
|
||||
}
|
||||
|
||||
# ifdef stdin
|
||||
|
||||
_EXPLICIT
|
||||
basic_fstream (FILE *__fptr, char_type *__buf = 0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE)
|
||||
: basic_iostream<char_type, traits_type>(rdbuf ()) {
|
||||
open (__fptr, __buf, __n);
|
||||
}
|
||||
|
||||
# endif // stdin
|
||||
|
||||
#endif // _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// NOTE: the pointer returned from rdbuf() may be different from
|
||||
// the one passed to basic_ios<>::rdbuf (basic_filebuf<>*)
|
||||
|
||||
basic_filebuf<char_type, traits_type>* rdbuf() const {
|
||||
// necessary to help SunPro 5.0/T9
|
||||
typedef basic_fstream <char_type, traits_type> _SelfT;
|
||||
return &_RWSTD_CONST_CAST (_SelfT*, this)->_C_filebuf;
|
||||
}
|
||||
|
||||
bool is_open () const {
|
||||
return rdbuf ()->is_open ();
|
||||
}
|
||||
|
||||
void open (const char *__name,
|
||||
ios_base::openmode __mode = _RW::__rw_in_out,
|
||||
long __prot = 0666) {
|
||||
this->clear (rdbuf ()->open (__name, __mode, __prot)
|
||||
? ios_base::goodbit : ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
// extensions - associate this with an open file and set buffer"
|
||||
void open (int __fd, char_type *__buf=0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE) {
|
||||
this->clear (rdbuf ()->open (__fd, __buf, __n) ?
|
||||
ios_base::goodbit : ios_base::failbit);
|
||||
}
|
||||
|
||||
# ifdef stdin
|
||||
|
||||
void open (FILE *__fptr, char_type *__buf=0,
|
||||
_RWSTD_STREAMSIZE __n = _RWSTD_DEFAULT_BUFSIZE) {
|
||||
this->clear (rdbuf ()->open (__fptr, __buf, __n) ?
|
||||
ios_base::goodbit : ios_base::failbit);
|
||||
}
|
||||
|
||||
# endif // stdin
|
||||
|
||||
#endif // _RWSTD_NO_EXT_FILEBUF
|
||||
|
||||
void close () {
|
||||
if (!rdbuf ()->close ())
|
||||
this->setstate (ios_base::failbit);
|
||||
}
|
||||
|
||||
private:
|
||||
basic_filebuf<char_type, traits_type> _C_filebuf;
|
||||
};
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_BASIC_FILEBUF)
|
||||
# include <fstream.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_BASIC_FILEBUF)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_BASIC_FILEBUF, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
|
||||
basic_filebuf<char, char_traits<char> >);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_BASIC_FILEBUF, _CHAR)
|
||||
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_BASIC_FILEBUF, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
|
||||
basic_filebuf<wchar_t, char_traits<wchar_t> >);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_BASIC_FILEBUF, _WCHAR_T)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_BASIC_FILEBUF)
|
||||
# include <fstream.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_BASIC_FILEBUF)
|
||||
|
||||
|
||||
#endif // _RWSTD_FSTREAM_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/fstream.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/fstream.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* fstream.c
|
||||
*
|
||||
* $Id: fstream.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 <fstream.cc>
|
||||
997
extern/stdcxx/4.2.1/include/fstream.cc
vendored
Normal file
997
extern/stdcxx/4.2.1/include/fstream.cc
vendored
Normal file
@@ -0,0 +1,997 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* fstream.cc - Definition for the Standard Library file streams
|
||||
*
|
||||
* $Id: fstream.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 1997-2008 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>*
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
open (const char *__name, ios_base::openmode __mode, long __prot)
|
||||
{
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
|
||||
// fail if `mode' has invalid bits set or if the file is already open
|
||||
if ((__mode & ~_RWSTD_IOS_OPENMODE_MASK) || is_open ())
|
||||
return 0;
|
||||
|
||||
_C_file = _RW::__rw_fopen (__name, __mode, __prot);
|
||||
|
||||
if (!_C_file)
|
||||
return 0;
|
||||
|
||||
pos_type __pos = pos_type ();
|
||||
|
||||
if (__mode & ios_base::ate) {
|
||||
|
||||
// the end of a file is assumed to be in the initial shift state
|
||||
// this assumption is safe as long as the file has been properly
|
||||
// closed (or unshifted) after the last write operation on it
|
||||
__pos = _RW::__rw_fseek (_C_file, 0, 0, ios_base::end);
|
||||
|
||||
if (-1L == __pos) {
|
||||
_RW::__rw_fclose (_C_file, 0);
|
||||
_C_file = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
_C_beg_pos = _C_cur_pos = __pos;
|
||||
|
||||
this->_C_state &= ~_RWSTD_IOS_OPENMODE_MASK;
|
||||
this->_C_state |= __mode;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>*
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
close (bool __close_file /* = true */)
|
||||
{
|
||||
// close_file is false when close() is called from detach()
|
||||
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
|
||||
if (!is_open ())
|
||||
return 0; // failure
|
||||
|
||||
// close() returns this on success, 0 on failure
|
||||
basic_filebuf *__retval = this;
|
||||
|
||||
_TRY {
|
||||
// avoid expensive call to overflow() unless necessary
|
||||
if (this->pptr () != this->pbase () && this->_C_is_eof (overflow ()))
|
||||
__retval = 0; // failure
|
||||
|
||||
// write out any unshift sequence if necessary
|
||||
// (applies to multibyte, state dependent encodings only)
|
||||
if (__retval && this->_C_out_last () && !_C_unshift ())
|
||||
__retval = 0; // failure
|
||||
}
|
||||
_CATCH (...) {
|
||||
// either overflow() or codecvt::unshift() threw
|
||||
|
||||
if (__close_file) {
|
||||
_RW::__rw_fclose (_C_file, this->_C_state);
|
||||
|
||||
// zero out the file pointer except when detaching fd
|
||||
_C_file = 0;
|
||||
_C_cur_pos = _C_beg_pos = pos_type (off_type (-1));
|
||||
|
||||
}
|
||||
|
||||
// rethrow the caught exception
|
||||
_RETHROW;
|
||||
}
|
||||
|
||||
if (__close_file) {
|
||||
if (_RW::__rw_fclose (_C_file, this->_C_state))
|
||||
__retval = 0;
|
||||
|
||||
// zero out the file pointer except when detaching fd
|
||||
_C_file = 0;
|
||||
_C_cur_pos = _C_beg_pos = pos_type (off_type (-1));
|
||||
}
|
||||
|
||||
return __retval;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
streamsize
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
showmanyc ()
|
||||
{
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
|
||||
if ( !this->_C_is_in () || !is_open ()
|
||||
|| _C_cur_pos == pos_type (off_type (-1)))
|
||||
return -1;
|
||||
|
||||
// start with the number of chars in get area
|
||||
_RWSTD_STREAMSIZE __retval = this->egptr () - this->gptr ();
|
||||
|
||||
// no prob if this fails for non-seekable devices
|
||||
const pos_type __end_pos =
|
||||
_RW::__rw_fseek (_C_file, this->_C_state, 0, ios_base::end);
|
||||
|
||||
if (__end_pos != pos_type (off_type (-1))) {
|
||||
|
||||
// restore position within file only if seek succeeded
|
||||
_RW::__rw_fseek (_C_file, this->_C_state, _C_cur_pos, ios_base::beg);
|
||||
|
||||
typedef _TYPENAME traits_type::state_type _StateT;
|
||||
typedef codecvt<char_type, char, _StateT> _Codecvt;
|
||||
|
||||
const _Codecvt &__cvt = _USE_FACET (_Codecvt, this->getloc ());
|
||||
|
||||
if (__cvt.always_noconv ())
|
||||
__retval += __end_pos - _C_cur_pos;
|
||||
else
|
||||
// make most pessimistic conversion estimate
|
||||
__retval += (__end_pos - _C_cur_pos) / __cvt.max_length ();
|
||||
}
|
||||
|
||||
return __retval > 0 ? __retval : 0;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_TYPENAME basic_filebuf<_CharT, _Traits>::int_type
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
underflow ()
|
||||
{
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
|
||||
this->setp (0, 0); // invalidate put area
|
||||
|
||||
this->_C_out_last (false); // needed by close ()
|
||||
|
||||
if (!this->_C_is_in () || !is_open())
|
||||
return traits_type::eof ();
|
||||
|
||||
char_type* const __to_end = this->_C_buffer + this->_C_bufsize;
|
||||
|
||||
typedef _TYPENAME traits_type::int_type _IntType;
|
||||
|
||||
_IntType __ret = _IntType ();
|
||||
|
||||
// fill the buffer if it's empty
|
||||
|
||||
if (this->gptr () == this->egptr()) { // N.B.: gptr() could be null here
|
||||
|
||||
// determine the maximum possible size of putback area (if any)
|
||||
// make sure putback area isn't too big - try to honor
|
||||
// _RWSTD_PBACK_SIZE if possible, otherwise shrink
|
||||
|
||||
const _RWSTD_SIZE_T __pbackavail = this->_C_putback_avail ();
|
||||
_C_pbacksize = __pbackavail < _RWSTD_PBACK_SIZE ?
|
||||
__pbackavail : _RWSTD_PBACK_SIZE;
|
||||
|
||||
_RWSTD_ASSERT (0 != this->_C_bufsize);
|
||||
|
||||
if (_C_pbacksize == this->_C_bufsize)
|
||||
_C_pbacksize = this->_C_bufsize - 1;
|
||||
|
||||
traits_type::move (this->eback(), this->gptr () - _C_pbacksize,
|
||||
_C_pbacksize);
|
||||
|
||||
// fill the get area from the file, performing code conversion if
|
||||
// necessary
|
||||
|
||||
_RWSTD_STREAMSIZE __nread = 0; // number of bytes read from file
|
||||
|
||||
_C_beg_pos = _C_cur_pos;
|
||||
|
||||
typedef _TYPENAME traits_type::state_type _StateT;
|
||||
typedef codecvt<char_type, char, _StateT> _Codecvt;
|
||||
|
||||
const _Codecvt &__cvt = _USE_FACET (_Codecvt, this->getloc ());
|
||||
|
||||
if (__cvt.always_noconv ()) {
|
||||
// no conversion required
|
||||
__nread = (__to_end - this->_C_buffer) - _C_pbacksize;
|
||||
__nread = _RW::__rw_fread (_C_file, this->_C_state,
|
||||
this->_C_buffer + _C_pbacksize,
|
||||
sizeof (char_type) * __nread);
|
||||
if (__nread < 0)
|
||||
return traits_type::eof (); // error while reading
|
||||
|
||||
this->setg (this->_C_buffer,
|
||||
this->_C_buffer + _C_pbacksize,
|
||||
this->_C_buffer + _C_pbacksize + __nread);
|
||||
|
||||
// adjust the current position in the file,
|
||||
// taking into account CR/LF conversion on windows
|
||||
__nread += _C_crlf_intern_count (this->gptr (),
|
||||
this->gptr () + __nread);
|
||||
}
|
||||
else { // conversion required
|
||||
|
||||
char __xbuf [_RWSTD_DEFAULT_BUFSIZE];
|
||||
char* __from_base = __xbuf;
|
||||
const char* __from_next = 0;
|
||||
char_type* __to_base = this->_C_buffer + _C_pbacksize;
|
||||
char_type* __to_next = __to_base;
|
||||
|
||||
_StateT __state = _C_cur_pos.state ();
|
||||
|
||||
codecvt_base::result __res = codecvt_base::ok;
|
||||
|
||||
const ctype<char_type> &__ctp =
|
||||
_USE_FACET (ctype<char_type>, this->getloc ());
|
||||
|
||||
while (__to_next != __to_end && codecvt_base::error != __res) {
|
||||
|
||||
// read only as many characters as we have positions left in
|
||||
// internal buffer - guarantees we won't read more characters
|
||||
// than we can put into the internal buffer after conversion
|
||||
// and ending file position isn't in the middle of a shift
|
||||
// sequence
|
||||
// N.B.: area between __xbuf and __from_base contains partially
|
||||
// converted sequences left from previous read
|
||||
_RWSTD_STREAMSIZE __n = __to_end - __to_next;
|
||||
if (_RWSTD_DEFAULT_BUFSIZE - (__from_base - __xbuf) < __n)
|
||||
__n = _RWSTD_DEFAULT_BUFSIZE - (__from_base - __xbuf);
|
||||
|
||||
__n = _RW::__rw_fread (_C_file, this->_C_state,
|
||||
__from_base, __n);
|
||||
|
||||
if (0 > __n)
|
||||
return traits_type::eof (); // error while reading
|
||||
|
||||
if (0 == __n)
|
||||
break; // reached eof
|
||||
|
||||
// take into account CR/LF conversion on Win32
|
||||
__nread += __n +
|
||||
_C_crlf_extern_count (__from_base, __from_base + __n);
|
||||
|
||||
// adjust 'n' to hold the number of external chars in buffer
|
||||
__n += __from_base - __xbuf;
|
||||
|
||||
// convert any partially converted sequence from the previous
|
||||
// iteration (possibly empty) plus what we just read in
|
||||
__res = __cvt.in (__state, __xbuf, __xbuf + __n, __from_next,
|
||||
__to_base, __to_end, __to_next);
|
||||
|
||||
switch (__res) {
|
||||
case codecvt_base::ok:
|
||||
// there may be yet unconverted elements at the end
|
||||
// of the source sequence, fall through and treat
|
||||
// as partial (`n' below may be 0)
|
||||
|
||||
case codecvt_base::partial:
|
||||
// compute the length of partially converted sequence
|
||||
__n -= __from_next - __xbuf;
|
||||
|
||||
typedef char_traits<char> CharTraits;
|
||||
|
||||
// copy the sequence to beginning of xbuf
|
||||
CharTraits::move (__xbuf, __from_next, __n);
|
||||
|
||||
// will append external chars to end of the sequence
|
||||
__from_base = __xbuf + __n;
|
||||
break;
|
||||
|
||||
case codecvt_base::noconv:
|
||||
// note that according to lwg issue 19, codecvt<wchar_t,
|
||||
// char>::in() may not return noconv since internT and
|
||||
// externT are not the same type
|
||||
|
||||
// since codecvt<char, char>::always_noconv() is required
|
||||
// to return true, this branch only executes for a user-
|
||||
// defined codecvt<T, T> facet with internT and externT
|
||||
// being the same type
|
||||
|
||||
// FIXME: do not widen external buffer just memcpy it
|
||||
// to internal buffer (externT == internT)
|
||||
__ctp.widen (__xbuf, __xbuf + __n, __to_base);
|
||||
__to_next = __to_base + __n;
|
||||
break;
|
||||
|
||||
case codecvt_base::error:
|
||||
// failed to convert part of the buffer
|
||||
// retain the part that has been successfully
|
||||
// converted, and disregard the rest
|
||||
__ret = traits_type::eof ();
|
||||
break;
|
||||
|
||||
default:
|
||||
// bad return value from codecvt
|
||||
return traits_type::eof ();
|
||||
}
|
||||
__to_base = __to_next; // continue at end of converted seq
|
||||
}
|
||||
|
||||
_C_cur_pos.state (__state);
|
||||
|
||||
this->setg (this->_C_buffer, this->_C_buffer + _C_pbacksize,
|
||||
__to_next);
|
||||
} // end conversion block
|
||||
|
||||
if (__nread == 0)
|
||||
return traits_type::eof ();
|
||||
|
||||
_C_cur_pos += __nread;
|
||||
}
|
||||
|
||||
return traits_type::eq_int_type (__ret, _IntType ()) ?
|
||||
traits_type::to_int_type (*this->gptr ()) : __ret;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_TYPENAME basic_filebuf<_CharT, _Traits>::int_type
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
overflow (int_type __c /* = eof () */)
|
||||
{
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
|
||||
if (!this->_C_is_out () || !is_open ())
|
||||
return traits_type::eof ();
|
||||
|
||||
this->setg (0, 0, 0); // invalidate the get area
|
||||
|
||||
const bool __unbuf = this->_C_is_unbuffered ();
|
||||
|
||||
const char_type __c_to_char = traits_type::to_char_type (__c);
|
||||
|
||||
if (this->pptr () == 0 && !__unbuf) {
|
||||
// put area not valid yet - just need to initialize it
|
||||
this->setp (this->_C_buffer, this->_C_buf_end ());
|
||||
}
|
||||
else if ( this->pptr () == this->epptr ()
|
||||
|| this->_C_is_eof (__c)
|
||||
|| __unbuf) {
|
||||
|
||||
const char_type* __buf;
|
||||
_RWSTD_STREAMSIZE __nchars;
|
||||
|
||||
if (__unbuf) {
|
||||
if (this->_C_is_eof (__c)){
|
||||
__buf = 0;
|
||||
__nchars = 0;
|
||||
}
|
||||
else {
|
||||
__buf = &__c_to_char;
|
||||
__nchars = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// call xsputn() with a special value to have it flush
|
||||
// the controlled sequence to the file
|
||||
__buf = _RWSTD_REINTERPRET_CAST (char_type*, this);
|
||||
__nchars = this->pptr () - this->pbase ();
|
||||
}
|
||||
|
||||
// typedef helps HP aCC 3.27
|
||||
typedef basic_filebuf _FileBuf;
|
||||
|
||||
if (__nchars != _FileBuf::xsputn (__buf, __nchars))
|
||||
return traits_type::eof (); // error while writing
|
||||
}
|
||||
|
||||
// now that there's room in the buffer, call sputc() recursively
|
||||
// to actually place the character in the buffer (unless we're
|
||||
// in unbuffered mode because we just wrote it out)
|
||||
if (!this->_C_is_eof (__c) && !__unbuf)
|
||||
this->sputc (__c_to_char);
|
||||
|
||||
this->_C_out_last (true); // needed by close ()
|
||||
|
||||
return traits_type::not_eof (__c);
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
_RWSTD_STREAMSIZE
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
xsputn (const char_type* __buf, _RWSTD_STREAMSIZE __nchars)
|
||||
{
|
||||
_RWSTD_ASSERT (0 != __buf || 0 == __nchars);
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
|
||||
if (0 == __nchars)
|
||||
return 0; // not an error
|
||||
|
||||
if (__nchars < 0 || !this->_C_is_out () || !is_open ())
|
||||
return -1; // error
|
||||
|
||||
if (0 == this->pptr () && !this->_C_is_unbuffered ())
|
||||
// put area not valid yet - just need to initialize it
|
||||
this->setp (this->_C_buffer, this->_C_buf_end ());
|
||||
|
||||
const _RWSTD_STREAMSIZE __navail = this->epptr () - this->pptr ();
|
||||
|
||||
const char_type* const __special =
|
||||
_RWSTD_REINTERPRET_CAST (char_type*, this);
|
||||
|
||||
if (__buf == __special) {
|
||||
__buf = this->pbase ();
|
||||
}
|
||||
else if (__nchars <= __navail) {
|
||||
// the amount of available space is big enough
|
||||
|
||||
// append the contents of the buffer to the controlled sequence
|
||||
traits_type::copy (this->pptr (), __buf, __nchars);
|
||||
|
||||
this->pbump (__nchars);
|
||||
|
||||
return __nchars;
|
||||
}
|
||||
else {
|
||||
// call self recursively to flush the controlled sequence first
|
||||
const _RWSTD_STREAMSIZE __nwrite = this->pptr () - this->pbase ();
|
||||
|
||||
// typedef helps HP aCC 3.27
|
||||
typedef basic_filebuf _FileBuf;
|
||||
|
||||
// return -1 on error to flush the controlled sequence
|
||||
if (__nwrite != _FileBuf::xsputn (__special, __nwrite))
|
||||
return -1;
|
||||
}
|
||||
|
||||
// flush buffer to file, performing code conversion if necessary
|
||||
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
_RWSTD_ASSERT (this->_C_is_out ());
|
||||
_RWSTD_ASSERT (is_open ());
|
||||
|
||||
const char_type* const __end = __buf + __nchars;
|
||||
|
||||
typedef _TYPENAME traits_type::state_type _StateT;
|
||||
|
||||
_RWSTD_STREAMSIZE __nwrote = 0; // num chars to write
|
||||
_StateT __state = _C_cur_pos.state (); // state of stream
|
||||
|
||||
_C_beg_pos = _C_cur_pos;
|
||||
|
||||
typedef codecvt<char_type, char, _StateT> _Codecvt;
|
||||
|
||||
const _Codecvt &__cvt = _USE_FACET (_Codecvt, this->getloc ());
|
||||
|
||||
if (__cvt.always_noconv ()) {
|
||||
|
||||
// no conversion
|
||||
|
||||
__nwrote = __end - __buf;
|
||||
|
||||
const _RWSTD_STREAMSIZE __nbytes = sizeof (char_type) * __nwrote;
|
||||
|
||||
if (__nbytes != _RW::__rw_fwrite (_C_file, this->_C_state,
|
||||
__buf, __nbytes))
|
||||
return -1; // error while writing
|
||||
}
|
||||
else {
|
||||
|
||||
// perform codeset conversion in chunks to avoid dynamic
|
||||
// memory allocation
|
||||
|
||||
char __xbuf [_RWSTD_DEFAULT_BUFSIZE];
|
||||
char* __xbuf_end = __xbuf + sizeof __xbuf;
|
||||
char* __to_next = 0;
|
||||
const char_type* __from_next = 0;
|
||||
|
||||
for (const char_type* __base = __buf; __from_next != __end;
|
||||
__base = __from_next) {
|
||||
|
||||
// avoid using const codecvt_base::result here
|
||||
// to prevent HP aCC 3.27 errors
|
||||
const int __res =
|
||||
__cvt.out (__state, __base, __end, __from_next,
|
||||
__xbuf, __xbuf_end, __to_next);
|
||||
|
||||
_RWSTD_STREAMSIZE __nbytes =
|
||||
sizeof (char_type) * (__end - __base);
|
||||
|
||||
switch (__res) {
|
||||
case codecvt_base::error:
|
||||
// write out the sequence successfully converted up
|
||||
// to the point of the error in the internal sequence
|
||||
// and fail
|
||||
_RW::__rw_fwrite (_C_file, this->_C_state, __base, __nbytes);
|
||||
return traits_type::eof ();
|
||||
|
||||
case codecvt_base::noconv:
|
||||
// write the entire sequence
|
||||
if (__nbytes != _RW::__rw_fwrite (_C_file, this->_C_state,
|
||||
__base, __nbytes))
|
||||
return traits_type::eof ();
|
||||
|
||||
__nwrote += __end - __base
|
||||
+ _C_crlf_intern_count (__base, __end);
|
||||
|
||||
__from_next = __end; // effectively 'break'
|
||||
break;
|
||||
|
||||
default:
|
||||
_RWSTD_ASSERT ( codecvt_base::ok == __res
|
||||
|| codecvt_base::partial == __res);
|
||||
|
||||
// partial conversion will result if there isn't enough
|
||||
// space in the conversion buffer to hold the converted
|
||||
// sequence, but we're O.K. since we'll be passing any
|
||||
// remaining unconverted characters (starting at
|
||||
// __from_next) in the next iteration
|
||||
|
||||
__nbytes = __to_next - __xbuf;
|
||||
|
||||
if (__nbytes != _RW::__rw_fwrite (_C_file, this->_C_state,
|
||||
__xbuf, __nbytes))
|
||||
return -1;
|
||||
|
||||
__nwrote += __nbytes
|
||||
+ _C_crlf_extern_count (__xbuf, __to_next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// adjust the current position in the file
|
||||
_C_cur_pos += __nwrote;
|
||||
_C_cur_pos.state (__state);
|
||||
|
||||
// reset the put area
|
||||
if (!this->_C_is_unbuffered ())
|
||||
this->setp (this->_C_buffer, this->_C_buf_end ());
|
||||
|
||||
this->_C_out_last (true); // needed by close ()
|
||||
|
||||
// return the number of characters (not bytes) in the buffer
|
||||
// successfully written to the file
|
||||
return __nchars;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_TYPENAME basic_filebuf<_CharT, _Traits>::int_type
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
pbackfail (int_type __c)
|
||||
{
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
|
||||
if (!is_open ())
|
||||
return traits_type::eof ();
|
||||
|
||||
// we could get here if gptr = eback or if __c != *(gptr-1)
|
||||
if (!this->_C_putback_avail ()) {
|
||||
// try to make a putback area available
|
||||
|
||||
if (this->seekoff (-1, ios_base::cur) == pos_type (off_type (-1)))
|
||||
return traits_type::eof ();
|
||||
|
||||
if (this->_C_is_eof (underflow ()))
|
||||
return traits_type::eof ();
|
||||
|
||||
this->gbump (1);
|
||||
}
|
||||
|
||||
if (traits_type::eq (traits_type::to_char_type (__c), *(this->gptr () - 1))
|
||||
|| this->_C_is_eof (__c)) {
|
||||
// "put back" original value
|
||||
this->gbump (-1);
|
||||
return traits_type::not_eof (__c);
|
||||
}
|
||||
else if (this->_C_is_out ()) {
|
||||
// overwrite existing value with new value
|
||||
this->gbump (-1);
|
||||
*this->gptr () = traits_type::to_char_type (__c);
|
||||
return __c;
|
||||
}
|
||||
else
|
||||
return traits_type::eof ();
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
basic_streambuf<_CharT, _Traits>*
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
setbuf (char_type *__buf, streamsize __ssize)
|
||||
{
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
|
||||
if (__ssize < 0)
|
||||
return 0;
|
||||
|
||||
const _RWSTD_SIZE_T __bufsize =
|
||||
_RWSTD_STATIC_CAST (_RWSTD_SIZE_T, __ssize);
|
||||
|
||||
// sync the buffer to the external file so it can be deallocated
|
||||
if ((this->gptr () || this->pptr ()) && is_open () && sync () != 0)
|
||||
return 0;
|
||||
|
||||
bool __reset = true;
|
||||
|
||||
if (0 < __bufsize) {
|
||||
|
||||
if (!__buf && (this->_C_bufsize < __bufsize || !this->_C_buffer)) {
|
||||
// if `buf' is 0 and the requested size is greater than
|
||||
// the size of the object's buffer, or of the object's
|
||||
// buffer is 0, try to allocate a new buffer of the
|
||||
// specified size
|
||||
__buf = new char_type [__bufsize];
|
||||
|
||||
// delete old buffer if the object owns it
|
||||
if (this->_C_own_buf ())
|
||||
delete [] this->_C_buffer;
|
||||
|
||||
// take ownership of the newly allocated buffer
|
||||
this->_C_own_buf (true);
|
||||
}
|
||||
else if (!__buf && __bufsize <= this->_C_bufsize) {
|
||||
// if `buf' is 0 and the requested size is less than
|
||||
// the size of the object's buffer, simply reuse the
|
||||
// object's buffer
|
||||
|
||||
__buf = this->_C_buffer;
|
||||
__reset = false;
|
||||
}
|
||||
else if (__buf && __buf != this->_C_buffer) {
|
||||
// if `buf' is non-0 and different from the existing
|
||||
// buffer, use it
|
||||
|
||||
// delete old buffer if the object owns it
|
||||
if (this->_C_own_buf ())
|
||||
delete [] this->_C_buffer;
|
||||
|
||||
// the object does not own of the new buffer
|
||||
this->_C_own_buf (false);
|
||||
}
|
||||
|
||||
this->_C_buffer = __buf;
|
||||
this->_C_bufsize = __bufsize;
|
||||
this->_C_set_unbuffered (false);
|
||||
}
|
||||
else {
|
||||
// unbuffer this stream object
|
||||
|
||||
// character buffer is preserved (used as get area only),
|
||||
// streambuf object unbuffered for writing
|
||||
|
||||
// to put a streambuf object into an unbuffered mode (see 27.8.1.4,
|
||||
// p10) and affect the size of the get area, setbuf() should first
|
||||
// be called with the desired (non-zero) size and then again with
|
||||
// both arguments being 0
|
||||
this->_C_set_unbuffered (true);
|
||||
}
|
||||
|
||||
if (__reset) {
|
||||
this->setg (0, 0, 0);
|
||||
this->setp (0, 0);
|
||||
}
|
||||
|
||||
// a character buffer of nonzero size must exist even in unbuffered mode
|
||||
_RWSTD_ASSERT (0 != this->_C_buffer);
|
||||
_RWSTD_ASSERT (0 != this->_C_bufsize);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// 27.8.1.4, p 11
|
||||
template<class _CharT, class _Traits>
|
||||
_TYPENAME basic_filebuf<_CharT, _Traits>::pos_type
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
seekoff (off_type __off, ios_base::seekdir __way, ios_base::openmode)
|
||||
{
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
|
||||
if (!is_open ())
|
||||
return pos_type (off_type (-1));
|
||||
|
||||
typedef _TYPENAME traits_type::state_type _StateT;
|
||||
typedef codecvt<char_type, char, _StateT> _Codecvt;
|
||||
|
||||
const int __width = _USE_FACET (_Codecvt, this->getloc ()).encoding ();
|
||||
|
||||
// offset must be zero with state-dependent encoding
|
||||
if (0 != __off && __width <= 0)
|
||||
return pos_type (off_type (-1));
|
||||
|
||||
// sync the buffer... (this also invalidates the get/put area)
|
||||
if (sync () != 0)
|
||||
return pos_type (off_type (-1));
|
||||
|
||||
// ...and, if last operation was output, append an unshift sequence
|
||||
if (this->_C_out_last ())
|
||||
_C_unshift ();
|
||||
|
||||
if (__width > 1)
|
||||
__off *= __width;
|
||||
|
||||
// perform the seek and save the result
|
||||
pos_type __pos = _RW::__rw_fseek (_C_file, this->_C_state, __off, __way);
|
||||
|
||||
if (__pos != pos_type (off_type (-1))) {
|
||||
|
||||
// preserve the current state if not changing position
|
||||
// (only matters for state-dependent encodings for which
|
||||
// the offset is required and guaranteed to be 0)
|
||||
if (__way == ios_base::cur)
|
||||
__pos.state (_C_cur_pos.state ());
|
||||
|
||||
_C_beg_pos = _C_cur_pos = __pos;
|
||||
}
|
||||
|
||||
this->_C_out_last (false); // needed by close()
|
||||
|
||||
return __pos;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_TYPENAME basic_filebuf<_CharT, _Traits>::pos_type
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
seekpos (pos_type __pos, ios_base::openmode)
|
||||
{
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
|
||||
if (!is_open ())
|
||||
return pos_type (off_type (-1));
|
||||
|
||||
// flush the output area if it exists
|
||||
if (this->pptr () != 0) {
|
||||
if (this->_C_is_eof (this->overflow (traits_type::eof ())))
|
||||
return pos_type (off_type (-1));
|
||||
}
|
||||
|
||||
if ( _RW::__rw_fseek (_C_file, this->_C_state, __pos, ios_base::beg)
|
||||
== pos_type (off_type (-1)))
|
||||
return pos_type (off_type (-1));
|
||||
|
||||
_C_cur_pos = _C_beg_pos = __pos;
|
||||
|
||||
this->setg (0, 0, 0);
|
||||
this->setp (0, 0);
|
||||
|
||||
this->_C_out_last (false); // needed by close()
|
||||
|
||||
return __pos;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
int
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
sync ()
|
||||
{
|
||||
_RWSTD_ASSERT (this->_C_is_valid ());
|
||||
|
||||
// put area active
|
||||
if (this->pptr () != 0) {
|
||||
// flush the buffer to the file
|
||||
if (this->_C_is_eof (overflow (traits_type::eof ())))
|
||||
return -1;
|
||||
|
||||
if (this->_C_state & _RWSTD_IOS_STDIO)
|
||||
_RW::__rw_fflush (_C_file, this->_C_state);
|
||||
}
|
||||
|
||||
// get area active
|
||||
if (this->gptr () != 0) {
|
||||
|
||||
// pbacksize may need to be adjusted if it's greater than
|
||||
// the available putback area (e.g., after calling putback()
|
||||
// at the end of the buffer)
|
||||
const _RWSTD_SIZE_T __pbackavail = this->_C_putback_avail ();
|
||||
if (__pbackavail < _C_pbacksize)
|
||||
_C_pbacksize = __pbackavail;
|
||||
|
||||
_RWSTD_ASSERT (0 != this->_C_bufsize);
|
||||
|
||||
if (_C_pbacksize == this->_C_bufsize)
|
||||
_C_pbacksize = this->_C_bufsize - 1;
|
||||
|
||||
typedef _TYPENAME traits_type::state_type _StateT;
|
||||
typedef codecvt<char_type, char, _StateT> _Codecvt;
|
||||
|
||||
const _Codecvt &__cvt = _USE_FACET (_Codecvt, this->getloc ());
|
||||
int __width = __cvt.encoding ();
|
||||
|
||||
if (__width > 0) {
|
||||
// get the number of chars consumed in the buffer
|
||||
const off_type __consumed =
|
||||
this->gptr () - this->eback () - _C_pbacksize;
|
||||
|
||||
// constant width conversion:
|
||||
// adjust the current position/state in the file,
|
||||
// taking into account CR/LF conversion on Win32
|
||||
_C_cur_pos = _C_beg_pos;
|
||||
_C_cur_pos += (__width * __consumed)
|
||||
+ _C_crlf_intern_count (this->eback () + _C_pbacksize,
|
||||
this->gptr());
|
||||
}
|
||||
else {
|
||||
// This gets a bit tricky here because we don't know the external
|
||||
// file position corresponding to the position in the
|
||||
// internal buffer. To figure this out, we'll use the known
|
||||
// file position/state corresponding to the start of the buffer
|
||||
// (which we have carefully saved in _C_beg_pos) and
|
||||
// convert the characters up to the current position in the
|
||||
// buffer, counting how many external chars result. We can
|
||||
// then use the offset from _C_beg_pos and the state
|
||||
// returned from codecvt::out() to construct the current file
|
||||
// position
|
||||
|
||||
off_type __ext_chars = 0; // converted external chars
|
||||
|
||||
char __xbuf [_RWSTD_DEFAULT_BUFSIZE];
|
||||
char* __xbuf_end = __xbuf + sizeof __xbuf;
|
||||
char* __to_next = 0;
|
||||
const char_type* __from_next = 0;
|
||||
const char_type* __from_end = this->gptr ();
|
||||
_StateT __state = _C_beg_pos.state ();
|
||||
const char_type* __base = this->eback () + _C_pbacksize;
|
||||
|
||||
while (__from_next != __from_end) {
|
||||
const int __res =
|
||||
__cvt.out (__state, __base, __from_end, __from_next,
|
||||
__xbuf, __xbuf_end, __to_next);
|
||||
|
||||
switch (__res) {
|
||||
case codecvt_base::error:
|
||||
return -1;
|
||||
|
||||
case codecvt_base::noconv:
|
||||
__ext_chars += __from_end - __base
|
||||
+ _C_crlf_intern_count (__base, __from_end);
|
||||
__from_next = __from_end; // break out of the loop
|
||||
break;
|
||||
|
||||
default: // __res = ok or partial
|
||||
// take into account CR/LF conversion on Win32
|
||||
__ext_chars += __to_next - __xbuf
|
||||
+ _C_crlf_extern_count (__xbuf, __to_next);
|
||||
}
|
||||
// repeat with next chunk
|
||||
__base = __from_next;
|
||||
}
|
||||
|
||||
_C_cur_pos = _C_beg_pos;
|
||||
_C_cur_pos += __ext_chars;
|
||||
_C_cur_pos.state (__state);
|
||||
}
|
||||
|
||||
// seek within the external file to the position
|
||||
// corresponding to the future beginning of the buffer
|
||||
const off_type __off =
|
||||
_RW::__rw_fseek (_C_file, this->_C_state,
|
||||
_C_cur_pos, ios_base::beg);
|
||||
|
||||
if (-1L == __off)
|
||||
return -1;
|
||||
|
||||
traits_type::move (this->eback (), this->gptr () - _C_pbacksize,
|
||||
_C_pbacksize);
|
||||
|
||||
this->setg (this->eback (), this->eback () + _C_pbacksize,
|
||||
this->eback () + _C_pbacksize);
|
||||
}
|
||||
|
||||
_C_beg_pos = _C_cur_pos;
|
||||
|
||||
this->setp (0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>*
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
_C_open (int __fd, void *__file, char_type *__buf, streamsize __n)
|
||||
{
|
||||
if (is_open () || !__file && -1 == __fd || !setbuf (__buf, __n))
|
||||
return 0;
|
||||
|
||||
if (__file) {
|
||||
_RWSTD_ASSERT (-1 == __fd);
|
||||
|
||||
_C_file = __file;
|
||||
|
||||
this->_C_state |= this->_C_stdio;
|
||||
}
|
||||
else {
|
||||
_RWSTD_ASSERT (!__file);
|
||||
|
||||
_C_file = _RW::__rw_fdopen (__fd);
|
||||
|
||||
if (!_C_file)
|
||||
return 0;
|
||||
|
||||
this->_C_state &= ~this->_C_stdio;
|
||||
}
|
||||
|
||||
this->_C_state |= _RW::__rw_fmode (_C_file, this->_C_state);
|
||||
|
||||
this->setg (0, 0, 0);
|
||||
this->setp (0, 0);
|
||||
|
||||
_C_cur_pos = _C_beg_pos = pos_type ();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// write out an unshift sequence if not in initial shift state
|
||||
template<class _CharT, class _Traits>
|
||||
bool
|
||||
basic_filebuf<_CharT, _Traits>::
|
||||
_C_unshift ()
|
||||
{
|
||||
typedef _TYPENAME traits_type::state_type _StateT;
|
||||
typedef codecvt<char_type, char, _StateT> _Codecvt;
|
||||
|
||||
const _Codecvt &__cvt = _USE_FACET (_Codecvt, this->getloc ());
|
||||
|
||||
// unshifting isn't necessary if encoding isn't state dependent
|
||||
// or if the state is equivalent to initial state (determined
|
||||
// by codecvt::unshift())
|
||||
if (__cvt.encoding () >= 0)
|
||||
return true;
|
||||
|
||||
// buf to hold unshift sequence - assumes that the shift
|
||||
// sequence will be less than 64 chars (we can't safely
|
||||
// use dynamic allocation because this function could be
|
||||
// called as a result of memory allocation exception)
|
||||
|
||||
char __useq [64];
|
||||
char* __useq_end = 0;
|
||||
|
||||
_StateT __state = _C_cur_pos.state ();
|
||||
|
||||
const int __res =
|
||||
__cvt.unshift (__state, __useq, __useq + sizeof __useq, __useq_end);
|
||||
|
||||
const _RWSTD_STREAMSIZE __nbytes = __useq_end - __useq;
|
||||
|
||||
// in the unlikely event that the buffer isn't big enough, assert
|
||||
_RWSTD_ASSERT (__res != codecvt_base::partial);
|
||||
|
||||
if (__res == codecvt_base::error)
|
||||
return false;
|
||||
|
||||
if (__res == codecvt_base::noconv)
|
||||
return true;
|
||||
|
||||
const off_type __nwrote =
|
||||
_RW::__rw_fwrite (_C_file, this->_C_state, __useq, __nbytes);
|
||||
|
||||
if (__nwrote < 0)
|
||||
return false;
|
||||
|
||||
_C_cur_pos += __nwrote; // CR/LF conversion not an issue here
|
||||
|
||||
return __nwrote == __nbytes;
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
777
extern/stdcxx/4.2.1/include/functional
vendored
Normal file
777
extern/stdcxx/4.2.1/include/functional
vendored
Normal file
@@ -0,0 +1,777 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* functional - global template functions
|
||||
*
|
||||
* $Id: functional 550991 2007-06-26 23:58:07Z sebor $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* 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_FUNCTIONAL_INCLUDED
|
||||
#define _RWSTD_FUNCTIONAL_INCLUDED
|
||||
|
||||
|
||||
#include <rw/_funcbase.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
// 20.3.2 - Arithmetic operations
|
||||
|
||||
// 20.3.2, p2
|
||||
template <class _TypeT>
|
||||
struct plus : binary_function<_TypeT, _TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x + __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.2, p3
|
||||
template <class _TypeT>
|
||||
struct minus : binary_function<_TypeT, _TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x - __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.2, p4
|
||||
template <class _TypeT>
|
||||
struct multiplies : binary_function<_TypeT, _TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x * __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.2, p5
|
||||
template <class _TypeT>
|
||||
struct divides : binary_function<_TypeT, _TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x / __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.2, p6
|
||||
template <class _TypeT>
|
||||
struct modulus : binary_function<_TypeT, _TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x % __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.2, p7
|
||||
template <class _TypeT>
|
||||
struct negate : unary_function<_TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const argument_type &__x) const {
|
||||
return -__x;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.3 - Comparisons
|
||||
|
||||
|
||||
// 20.3.3, p2
|
||||
template <class _TypeT>
|
||||
struct equal_to : binary_function<_TypeT, _TypeT, bool>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, bool);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x == __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.3, p3
|
||||
template <class _TypeT>
|
||||
struct not_equal_to : binary_function<_TypeT, _TypeT, bool>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, bool);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x != __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.3, p4
|
||||
template <class _TypeT>
|
||||
struct greater : binary_function<_TypeT, _TypeT, bool>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, bool);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x > __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.3, p5 - defined in <rw/_funcbase.h>
|
||||
template <class _TypeT>
|
||||
struct less;
|
||||
|
||||
|
||||
// 20.3.3, p6
|
||||
template <class _TypeT>
|
||||
struct greater_equal : binary_function<_TypeT, _TypeT, bool>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, bool);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x >= __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.3, p7
|
||||
template <class _TypeT>
|
||||
struct less_equal : binary_function<_TypeT, _TypeT, bool>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, bool);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x <= __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.4 - Logical operations
|
||||
|
||||
// 20.3.4, p2
|
||||
template <class _TypeT>
|
||||
struct logical_and : binary_function<_TypeT, _TypeT, bool>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, bool);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x && __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.4, p3
|
||||
template <class _TypeT>
|
||||
struct logical_or : binary_function<_TypeT, _TypeT, bool>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, bool);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x || __y;
|
||||
}
|
||||
};
|
||||
|
||||
// 20.3.4, p4
|
||||
template <class _TypeT>
|
||||
struct logical_not : unary_function<_TypeT, bool>
|
||||
{
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_TypeT, bool);
|
||||
|
||||
result_type operator() (const _TypeT &__x) const {
|
||||
return !__x;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.5 - Negators
|
||||
|
||||
// 20.3.5, p2
|
||||
template <class _Predicate>
|
||||
class unary_negate
|
||||
: public unary_function<_TYPENAME _Predicate::argument_type, bool>
|
||||
{
|
||||
_Predicate _C_pred;
|
||||
public:
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_TYPENAME _Predicate::argument_type, bool);
|
||||
|
||||
_EXPLICIT unary_negate (const _Predicate &__pred) : _C_pred (__pred) { }
|
||||
|
||||
result_type operator() (const argument_type &__x) const {
|
||||
return !_C_pred (__x);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.5, p3
|
||||
template <class _Predicate>
|
||||
inline unary_negate<_Predicate> not1 (const _Predicate &__pred)
|
||||
{
|
||||
return unary_negate<_Predicate>(__pred);
|
||||
}
|
||||
|
||||
|
||||
// 20.3.5, p4
|
||||
template <class _Predicate>
|
||||
class binary_negate
|
||||
: public binary_function<_TYPENAME _Predicate::first_argument_type,
|
||||
_TYPENAME _Predicate::second_argument_type, bool>
|
||||
{
|
||||
_Predicate _C_pred;
|
||||
public:
|
||||
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TYPENAME _Predicate::first_argument_type,
|
||||
_TYPENAME _Predicate::second_argument_type,
|
||||
bool);
|
||||
|
||||
_EXPLICIT binary_negate (const _Predicate &__pred) : _C_pred (__pred) { }
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return !_C_pred (__x, __y);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.5, p5
|
||||
template <class _Predicate>
|
||||
inline binary_negate<_Predicate> not2 (const _Predicate &__pred)
|
||||
{
|
||||
return binary_negate<_Predicate>(__pred);
|
||||
}
|
||||
|
||||
|
||||
// 20.3.6 - Binders
|
||||
|
||||
// 20.3.6.1
|
||||
template <class _Operation>
|
||||
class binder1st
|
||||
: public unary_function<_TYPENAME _Operation::second_argument_type,
|
||||
_TYPENAME _Operation::result_type>
|
||||
{
|
||||
protected:
|
||||
_Operation op;
|
||||
_TYPENAME _Operation::first_argument_type value;
|
||||
public:
|
||||
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_TYPENAME _Operation::second_argument_type,
|
||||
_TYPENAME _Operation::result_type);
|
||||
|
||||
binder1st (const _Operation &__oper,
|
||||
const _TYPENAME _Operation::first_argument_type &__x)
|
||||
: op (__oper), value (__x) { }
|
||||
|
||||
result_type
|
||||
operator() (const argument_type &__y) const {
|
||||
return op (value, __y);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.6.2
|
||||
template <class _Operation, class _TypeT>
|
||||
inline binder1st<_Operation>
|
||||
bind1st (const _Operation &__oper, const _TypeT &__x)
|
||||
{
|
||||
typedef _TYPENAME _Operation::first_argument_type first_argument_type;
|
||||
|
||||
return binder1st<_Operation>(__oper, first_argument_type (__x));
|
||||
}
|
||||
|
||||
|
||||
// 20.3.6.3
|
||||
template <class _Operation>
|
||||
class binder2nd
|
||||
: public unary_function<_TYPENAME _Operation::first_argument_type,
|
||||
_TYPENAME _Operation::result_type>
|
||||
{
|
||||
protected:
|
||||
_Operation op;
|
||||
_TYPENAME _Operation::second_argument_type value;
|
||||
public:
|
||||
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_TYPENAME _Operation::first_argument_type,
|
||||
_TYPENAME _Operation::result_type);
|
||||
|
||||
binder2nd (const _Operation &__oper,
|
||||
const _TYPENAME _Operation::second_argument_type &__y)
|
||||
: op (__oper), value (__y) { }
|
||||
|
||||
result_type
|
||||
operator() (const argument_type &__x) const {
|
||||
return op (__x, value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 20.3.6.4
|
||||
template <class _Operation, class _TypeT>
|
||||
inline binder2nd<_Operation>
|
||||
bind2nd (const _Operation &__oper, const _TypeT &__x)
|
||||
{
|
||||
typedef _TYPENAME _Operation::second_argument_type second_argument_type;
|
||||
return binder2nd<_Operation>(__oper, second_argument_type (__x));
|
||||
}
|
||||
|
||||
|
||||
// 20.3.7 - Adaptors for pointers to functions
|
||||
|
||||
// 20.3.7, p2
|
||||
template <class _Arg, class _Result>
|
||||
struct pointer_to_unary_function : unary_function<_Arg, _Result>
|
||||
{
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_Arg, _Result);
|
||||
|
||||
_EXPLICIT pointer_to_unary_function (result_type (*__fun)(argument_type))
|
||||
: _C_fn (__fun) {}
|
||||
|
||||
result_type operator() (argument_type __x) const {
|
||||
return _C_fn (__x);
|
||||
}
|
||||
|
||||
private:
|
||||
result_type (*_C_fn)(argument_type);
|
||||
};
|
||||
|
||||
|
||||
// 20.3.7, p3
|
||||
template <class _Arg, class _Result>
|
||||
inline pointer_to_unary_function<_Arg, _Result>
|
||||
ptr_fun (_Result (*__fun)(_Arg))
|
||||
{
|
||||
return pointer_to_unary_function<_Arg, _Result>(__fun);
|
||||
}
|
||||
|
||||
|
||||
// 20.3.7, p4
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct pointer_to_binary_function
|
||||
: binary_function<_Arg1, _Arg2, _Result>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_Arg1, _Arg2, _Result);
|
||||
|
||||
_EXPLICIT
|
||||
pointer_to_binary_function (result_type (*__fun)(first_argument_type,
|
||||
second_argument_type))
|
||||
: _C_fn (__fun) { }
|
||||
|
||||
result_type operator() (first_argument_type __x,
|
||||
second_argument_type __y) const {
|
||||
return _C_fn (__x, __y);
|
||||
}
|
||||
|
||||
private:
|
||||
result_type (*_C_fn)(first_argument_type, second_argument_type);
|
||||
};
|
||||
|
||||
|
||||
// 20.3.7, p5
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
inline pointer_to_binary_function<_Arg1, _Arg2, _Result>
|
||||
ptr_fun (_Result (*__fun)(_Arg1, _Arg2))
|
||||
{
|
||||
return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__fun);
|
||||
}
|
||||
|
||||
|
||||
// 20.3.8 - Adaptors for pointers to members
|
||||
|
||||
// 20.3.8, p2 - adaptor for a non-const member function taking no arguments
|
||||
// operating on a pointer to a non-const object
|
||||
template <class _Result, class _TypeT>
|
||||
struct mem_fun_t: unary_function<_TypeT*, _Result>
|
||||
{
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_TypeT*, _Result);
|
||||
|
||||
_EXPLICIT mem_fun_t (result_type (_TypeT::*__fun)()) : _C_fn (__fun) { }
|
||||
|
||||
result_type operator() (argument_type __x) const {
|
||||
return (__x->*_C_fn)();
|
||||
}
|
||||
|
||||
private:
|
||||
result_type (_TypeT::*_C_fn)();
|
||||
};
|
||||
|
||||
|
||||
// 20.3.8, p3 - adaptor for a non-const member function taking one argument
|
||||
// operating on a pointer to a non-const object
|
||||
template <class _Result, class _TypeT, class _Arg>
|
||||
struct mem_fun1_t: binary_function<_TypeT*, _Arg, _Result>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT*, _Arg, _Result);
|
||||
|
||||
_EXPLICIT
|
||||
mem_fun1_t (result_type (_TypeT::*__fun)(second_argument_type))
|
||||
: _C_fn (__fun) { }
|
||||
|
||||
result_type operator() (first_argument_type __x,
|
||||
second_argument_type __y) const {
|
||||
return (__x->*_C_fn)(__y);
|
||||
}
|
||||
|
||||
private:
|
||||
result_type (_TypeT::*_C_fn)(second_argument_type);
|
||||
};
|
||||
|
||||
|
||||
// 20.3.8, p4
|
||||
template <class _Result, class _TypeT>
|
||||
inline mem_fun_t<_Result, _TypeT> mem_fun (_Result (_TypeT::*__fun)())
|
||||
{
|
||||
return mem_fun_t<_Result, _TypeT>(__fun);
|
||||
}
|
||||
|
||||
|
||||
template <class _Result, class _TypeT, class _Arg>
|
||||
inline mem_fun1_t<_Result, _TypeT, _Arg>
|
||||
mem_fun (_Result (_TypeT::*__fun)(_Arg))
|
||||
{
|
||||
return mem_fun1_t<_Result, _TypeT, _Arg>(__fun);
|
||||
}
|
||||
|
||||
|
||||
// 20.3.8, p5 - adaptor for a non-const member function taking no arguments
|
||||
// operating on a non-const object
|
||||
template <class _Result, class _TypeT>
|
||||
struct mem_fun_ref_t: unary_function<_TypeT, _Result>
|
||||
{
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_TypeT, _Result);
|
||||
|
||||
_EXPLICIT mem_fun_ref_t (result_type (_TypeT::*__fun)()) : _C_fn (__fun) { }
|
||||
|
||||
result_type operator() (argument_type &__x) const {
|
||||
return (__x.*_C_fn)();
|
||||
}
|
||||
|
||||
private:
|
||||
result_type (_TypeT::*_C_fn)();
|
||||
};
|
||||
|
||||
|
||||
// 20.3.8, p6 - adaptor for a non-const member function taking one argument
|
||||
// operating on a non-const object
|
||||
template <class _Result, class _TypeT, class _Arg>
|
||||
struct mem_fun1_ref_t : binary_function<_TypeT, _Arg, _Result>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _Arg, _Result);
|
||||
|
||||
_EXPLICIT
|
||||
mem_fun1_ref_t (result_type (_TypeT::*__fun)(second_argument_type))
|
||||
: _C_fn (__fun) { }
|
||||
|
||||
result_type operator() (first_argument_type &__x,
|
||||
second_argument_type __y) const {
|
||||
return (__x.*_C_fn)(__y);
|
||||
}
|
||||
|
||||
private:
|
||||
result_type (_TypeT::*_C_fn)(second_argument_type);
|
||||
};
|
||||
|
||||
|
||||
// 20.3.8, p7
|
||||
template <class _Result, class _TypeT>
|
||||
inline mem_fun_ref_t<_Result, _TypeT>
|
||||
mem_fun_ref(_Result (_TypeT::*__fun)())
|
||||
{
|
||||
return mem_fun_ref_t<_Result, _TypeT>(__fun);
|
||||
}
|
||||
|
||||
|
||||
template <class _Result, class _TypeT, class _Arg>
|
||||
inline mem_fun1_ref_t<_Result, _TypeT, _Arg>
|
||||
mem_fun_ref(_Result (_TypeT::*__fun)(_Arg))
|
||||
{
|
||||
return mem_fun1_ref_t<_Result, _TypeT, _Arg> (__fun);
|
||||
}
|
||||
|
||||
|
||||
// 20.3.8, p8 - adaptor for a const member function taking no arguments
|
||||
// operating on a const object
|
||||
template <class _Result, class _TypeT>
|
||||
struct const_mem_fun_t: unary_function<const _TypeT*, _Result>
|
||||
{
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (const _TypeT*, _Result);
|
||||
|
||||
_EXPLICIT const_mem_fun_t (result_type (_TypeT::*__fun)() const)
|
||||
: _C_fn (__fun) { }
|
||||
|
||||
result_type operator() (argument_type __x) const {
|
||||
return (__x->*_C_fn)();
|
||||
}
|
||||
|
||||
private:
|
||||
result_type (_TypeT::*_C_fn)() const;
|
||||
};
|
||||
|
||||
|
||||
// 20.3.8, p9 - adaptor for a const member function taking one argument
|
||||
// operating on a const object
|
||||
template <class _Result, class _TypeT, class _Arg>
|
||||
struct const_mem_fun1_t: binary_function<const _TypeT*, _Arg, _Result>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (const _TypeT*, _Arg, _Result);
|
||||
|
||||
_EXPLICIT
|
||||
const_mem_fun1_t (result_type (_TypeT::*__fun)(second_argument_type) const)
|
||||
: _C_fn (__fun) { }
|
||||
|
||||
result_type operator() (first_argument_type __x,
|
||||
second_argument_type __y) const {
|
||||
return (__x->*_C_fn)(__y);
|
||||
}
|
||||
|
||||
private:
|
||||
result_type (_TypeT::*_C_fn)(second_argument_type) const;
|
||||
};
|
||||
|
||||
|
||||
// 20.3.8, p10
|
||||
template <class _Result, class _TypeT>
|
||||
inline const_mem_fun_t<_Result, _TypeT>
|
||||
mem_fun (_Result (_TypeT::*__fun)() const)
|
||||
{
|
||||
return const_mem_fun_t<_Result, _TypeT>(__fun);
|
||||
}
|
||||
|
||||
|
||||
template <class _Result, class _TypeT, class _Arg>
|
||||
inline const_mem_fun1_t<_Result, _TypeT, _Arg>
|
||||
mem_fun (_Result (_TypeT::*__fun)(_Arg) const)
|
||||
{
|
||||
return const_mem_fun1_t<_Result, _TypeT, _Arg>(__fun);
|
||||
}
|
||||
|
||||
|
||||
// 20.3.8, p11 - adaptor for a const member function taking no arguments
|
||||
// operating on a const reference to an object
|
||||
template <class _Result, class _TypeT>
|
||||
struct const_mem_fun_ref_t: unary_function<_TypeT, _Result>
|
||||
{
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_TypeT, _Result);
|
||||
|
||||
_EXPLICIT const_mem_fun_ref_t (result_type (_TypeT::*__fun)() const)
|
||||
: _C_fn (__fun) { }
|
||||
|
||||
result_type operator() (const argument_type &__x) const {
|
||||
return (__x.*_C_fn)();
|
||||
}
|
||||
|
||||
private:
|
||||
result_type (_TypeT::*_C_fn)() const;
|
||||
};
|
||||
|
||||
|
||||
// 20.3.8, p12 - adaptor for a const member function taking a single argument
|
||||
// operating on a const reference to an object
|
||||
template <class _Result, class _TypeT, class _Arg>
|
||||
struct const_mem_fun1_ref_t : binary_function<_TypeT, _Arg, _Result>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _Arg, _Result);
|
||||
|
||||
_EXPLICIT
|
||||
const_mem_fun1_ref_t
|
||||
(result_type (_TypeT::*__fun)(second_argument_type) const)
|
||||
: _C_fn (__fun) { }
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
second_argument_type __y) const {
|
||||
return (__x.*_C_fn)(__y);
|
||||
}
|
||||
|
||||
private:
|
||||
result_type (_TypeT::*_C_fn)(second_argument_type) const;
|
||||
};
|
||||
|
||||
|
||||
// 20.3.8, p13
|
||||
template <class _Result, class _TypeT>
|
||||
inline const_mem_fun_ref_t<_Result, _TypeT>
|
||||
mem_fun_ref (_Result (_TypeT::*__fun)() const)
|
||||
{
|
||||
return const_mem_fun_ref_t<_Result, _TypeT>(__fun);
|
||||
}
|
||||
|
||||
|
||||
template <class _Result, class _TypeT, class _Arg>
|
||||
inline const_mem_fun1_ref_t<_Result, _TypeT, _Arg>
|
||||
mem_fun_ref (_Result (_TypeT::*__fun)(_Arg) const)
|
||||
{
|
||||
return const_mem_fun1_ref_t<_Result, _TypeT, _Arg>(__fun);
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
|
||||
// extension: returns the argument
|
||||
template <class _TypeT>
|
||||
struct identity : _STD::unary_function<_TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const argument_type &__val) const {
|
||||
return __val;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// extension: returns the result of applying the unary plus operator to arg
|
||||
template <class _TypeT>
|
||||
struct unary_plus : _STD::unary_function<_TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const argument_type &__val) const {
|
||||
return +__val;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// extension: returns the bitwise complement of the argument
|
||||
template <class _TypeT>
|
||||
struct bitwise_complement : _STD::unary_function<_TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_UNARY_FUNCTION_TYPES (_TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const argument_type &__val) const {
|
||||
return ~__val;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// extension: returns the bitwise or of the two arguments
|
||||
template <class _TypeT>
|
||||
struct bitwise_or : _STD::binary_function<_TypeT, _TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x | __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// extension: returns the bitwise and of the two arguments
|
||||
template <class _TypeT>
|
||||
struct bitwise_and : _STD::binary_function<_TypeT, _TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x & __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// extension: returns the exclusive or (XOR) of the two arguments
|
||||
template <class _TypeT>
|
||||
struct exclusive_or : _STD::binary_function<_TypeT, _TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x ^ __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// extension: returns the left argument shifted left by the right argument
|
||||
template <class _TypeT>
|
||||
struct shift_left : _STD::binary_function<_TypeT, _TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x << __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// extension: returns the left argument shifted right by the right argument
|
||||
template <class _TypeT>
|
||||
struct shift_right : _STD::binary_function<_TypeT, _TypeT, _TypeT>
|
||||
{
|
||||
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, _TypeT);
|
||||
|
||||
result_type operator() (const first_argument_type &__x,
|
||||
const second_argument_type &__y) const {
|
||||
return __x >> __y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
#undef _RWSTD_UNARY_FUNCTION_TYPES
|
||||
#undef _RWSTD_BINARY_FUNCTION_TYPES
|
||||
|
||||
|
||||
#endif // _RWSTD_FUNCTIONAL_INCLUDED
|
||||
236
extern/stdcxx/4.2.1/include/iomanip
vendored
Normal file
236
extern/stdcxx/4.2.1/include/iomanip
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* iomanip - Declarations of iostream manipulators
|
||||
*
|
||||
* $Id: iomanip 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-2008 Rogue Wave Software, Inc.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_IOMANIP_INCLUDED
|
||||
#define _RWSTD_IOMANIP_INCLUDED
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
#include <rw/_iosbase.h>
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
|
||||
// resetiosflags implementation
|
||||
struct __rw_resetiosflags
|
||||
{
|
||||
void operator() (_STD::ios_base &__strm,
|
||||
_STD::ios_base::fmtflags __mask) const {
|
||||
__strm.setf (_STD::ios_base::fmtflags (0), __mask);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// setiosflags implementation
|
||||
struct __rw_setiosflags
|
||||
{
|
||||
void operator() (_STD::ios_base &__strm,
|
||||
_STD::ios_base::fmtflags __mask) const {
|
||||
__strm.setf (__mask);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// setbase implementation
|
||||
struct __rw_setbase
|
||||
{
|
||||
void operator() (_STD::ios_base &__strm, int __base) const {
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_SETBASE
|
||||
|
||||
if (__base < 0 || __base > 36)
|
||||
__base = 0;
|
||||
|
||||
#else // if defined (_RWSTD_NO_EXT_SETBASE)
|
||||
|
||||
switch (__base) {
|
||||
case 0: case 8: case 10: case 16: break;
|
||||
|
||||
# ifndef _RWSTD_NO_EXT_BIN_IO
|
||||
|
||||
case 2: break;
|
||||
|
||||
# endif // _RWSTD_NO_EXT_BIN_IO
|
||||
|
||||
default: __base = 0;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_EXT_SETBASE
|
||||
|
||||
const unsigned __ifl =
|
||||
__strm.flags () & ~_STD::ios_base::basefield
|
||||
& ~( _RWSTD_STATIC_CAST (unsigned, _RWSTD_IOS_BASEMASK)
|
||||
<< _RWSTD_IOS_BASEOFF)
|
||||
| __base << _RWSTD_IOS_BASEOFF;
|
||||
|
||||
__strm.flags (_STD::ios_base::fmtflags (__ifl));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// setfill implementation
|
||||
template <class _CharT>
|
||||
struct __rw_setfill
|
||||
{
|
||||
template <class _Traits>
|
||||
void operator() (_STD::basic_ios<_CharT, _Traits> &__strm,
|
||||
_CharT __ch) const {
|
||||
__strm.fill (__ch);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// setprecision implementation
|
||||
struct __rw_setprecision
|
||||
{
|
||||
void operator() (_STD::ios_base &__strm, int __prec) const {
|
||||
__strm.precision (_RWSTD_STATIC_CAST (_RWSTD_STREAMSIZE, __prec));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// setw implementation
|
||||
struct __rw_setw
|
||||
{
|
||||
void operator() (_STD::ios_base &__strm, int __width) const {
|
||||
__strm.width (_RWSTD_STATIC_CAST (_RWSTD_STREAMSIZE, __width));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
// manipulator implementation
|
||||
template <class _Functor, class _TypeT>
|
||||
struct __rw_smanip
|
||||
{
|
||||
_EXPLICIT
|
||||
__rw_smanip (_TypeT __arg)
|
||||
: _C_fun (), _C_arg (__arg) { /* empty */ }
|
||||
|
||||
__rw_smanip (_Functor __fun, _TypeT __arg)
|
||||
: _C_fun (__fun), _C_arg (__arg) { /* empty */ }
|
||||
|
||||
_Functor _C_fun;
|
||||
_TypeT _C_arg;
|
||||
};
|
||||
|
||||
|
||||
// 27.6.3, p3
|
||||
inline __rw_smanip<_RW::__rw_resetiosflags, ios_base::fmtflags>
|
||||
resetiosflags (ios_base::fmtflags __mask)
|
||||
{
|
||||
return __rw_smanip<_RW::__rw_resetiosflags, ios_base::fmtflags>(__mask);
|
||||
}
|
||||
|
||||
|
||||
// 27.6.3, p4
|
||||
inline __rw_smanip<_RW::__rw_setiosflags, ios_base::fmtflags>
|
||||
setiosflags (ios_base::fmtflags __mask)
|
||||
{
|
||||
return __rw_smanip<_RW::__rw_setiosflags, ios_base::fmtflags>(__mask);
|
||||
}
|
||||
|
||||
|
||||
// 27.6.3, p5
|
||||
inline __rw_smanip<_RW::__rw_setbase, int>
|
||||
setbase (int __base)
|
||||
{
|
||||
return __rw_smanip<_RW::__rw_setbase, int>(__base);
|
||||
}
|
||||
|
||||
|
||||
// 27.6.3, p6
|
||||
template <class _CharT>
|
||||
inline __rw_smanip<_RW::__rw_setfill<_CharT>, _CharT>
|
||||
setfill (_CharT __ch)
|
||||
{
|
||||
return __rw_smanip<_RW::__rw_setfill<_CharT>, _CharT>(__ch);
|
||||
}
|
||||
|
||||
|
||||
// 27.6.3, p7
|
||||
inline __rw_smanip<_RW::__rw_setprecision, int>
|
||||
setprecision (int __prec)
|
||||
{
|
||||
return __rw_smanip<_RW::__rw_setprecision, int>(__prec);
|
||||
}
|
||||
|
||||
|
||||
// 27.6.3, p8
|
||||
inline __rw_smanip<_RW::__rw_setw, int>
|
||||
setw (int __width)
|
||||
{
|
||||
return __rw_smanip<_RW::__rw_setw, int>(__width);
|
||||
}
|
||||
|
||||
|
||||
// implementation of manipulator extractor
|
||||
template <class _CharT, class _Traits, class _Functor, class _TypeT>
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
operator>> (basic_istream<_CharT, _Traits> &__strm,
|
||||
const __rw_smanip<_Functor, _TypeT> &__man)
|
||||
{
|
||||
_TRY {
|
||||
__man._C_fun (__strm, __man._C_arg);
|
||||
}
|
||||
_CATCH (...) {
|
||||
__strm.setstate (ios_base::badbit);
|
||||
}
|
||||
|
||||
return __strm;
|
||||
}
|
||||
|
||||
|
||||
// implementation of manipulator inserter
|
||||
template <class _CharT, class _Traits, class _Functor, class _TypeT>
|
||||
inline basic_ostream<_CharT, _Traits>&
|
||||
operator<< (basic_ostream<_CharT, _Traits> &__strm,
|
||||
const __rw_smanip<_Functor, _TypeT> &__man)
|
||||
{
|
||||
_TRY {
|
||||
__man._C_fun (__strm, __man._C_arg);
|
||||
}
|
||||
_CATCH (...) {
|
||||
__strm.setstate (ios_base::badbit);
|
||||
}
|
||||
|
||||
return __strm;
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_IOMANIP_INCLUDED
|
||||
224
extern/stdcxx/4.2.1/include/ios
vendored
Normal file
224
extern/stdcxx/4.2.1/include/ios
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* ios - definition of the class template basic_ios
|
||||
*
|
||||
* $Id: ios 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_IOS_INCLUDED
|
||||
#define _RWSTD_IOS_INCLUDED
|
||||
|
||||
|
||||
#include <iosfwd> // required by 27.4
|
||||
|
||||
#include <rw/_basic_ios.h> // for basic_ios, ios_base
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
// 27.4.1, p1
|
||||
typedef _RWSTD_STREAMOFF streamoff;
|
||||
|
||||
// 27.4.1, p2
|
||||
typedef _RWSTD_STREAMSIZE streamsize;
|
||||
|
||||
|
||||
// 27.4.5.1 - fmtflags manipulators
|
||||
|
||||
// 27.4.5.1, p25
|
||||
inline ios_base& unitbuf (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::unitbuf), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p27
|
||||
inline ios_base& nounitbuf (ios_base &__strm)
|
||||
{
|
||||
return __strm.unsetf (ios_base::unitbuf), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p1
|
||||
inline ios_base& boolalpha (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::boolalpha), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p3
|
||||
inline ios_base& noboolalpha (ios_base &__strm)
|
||||
{
|
||||
return __strm.unsetf (ios_base::boolalpha), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p5
|
||||
inline ios_base& showbase (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::showbase), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p7
|
||||
inline ios_base& noshowbase (ios_base &__strm)
|
||||
{
|
||||
return __strm.unsetf (ios_base::showbase), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p9
|
||||
inline ios_base& showpoint (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::showpoint), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p11
|
||||
inline ios_base& noshowpoint (ios_base &__strm)
|
||||
{
|
||||
return __strm.unsetf (ios_base::showpoint), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p13
|
||||
inline ios_base& showpos (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::showpos), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p15
|
||||
inline ios_base& noshowpos (ios_base &__strm)
|
||||
{
|
||||
return __strm.unsetf (ios_base::showpos), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p17
|
||||
inline ios_base& skipws (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::skipws), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p19
|
||||
inline ios_base& noskipws (ios_base &__strm)
|
||||
{
|
||||
return __strm.unsetf (ios_base::skipws), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p21
|
||||
inline ios_base& uppercase (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::uppercase), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.1, p23
|
||||
inline ios_base& nouppercase (ios_base &__strm)
|
||||
{
|
||||
return __strm.unsetf (ios_base::uppercase), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.2 - adjustfield manipulators
|
||||
|
||||
// 27.4.5.2, p1
|
||||
inline ios_base& internal (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::internal, ios_base::adjustfield), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.2, p3
|
||||
inline ios_base& left (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::left, ios_base::adjustfield), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.2, p5
|
||||
inline ios_base& right (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::right, ios_base::adjustfield), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.3 - basefield manipulators
|
||||
|
||||
// 27.4.5.3, p1
|
||||
inline ios_base& dec (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::dec, ios_base::basefield), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.3, p3
|
||||
inline ios_base& hex (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::hex, ios_base::basefield), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.3, p5
|
||||
inline ios_base& oct (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::oct, ios_base::basefield), __strm;
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_BIN_IO
|
||||
|
||||
// extension
|
||||
inline ios_base& bin (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::bin, ios_base::basefield), __strm;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_EXT_BIN_IO
|
||||
|
||||
|
||||
// 27.4.5.4 - floatfield manipulators
|
||||
|
||||
// 27.4.5.4, p1
|
||||
inline ios_base& fixed (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::fixed, ios_base::floatfield), __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.4.5.4, p3
|
||||
inline ios_base& scientific (ios_base &__strm)
|
||||
{
|
||||
return __strm.setf (ios_base::scientific, ios_base::floatfield), __strm;
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_IOS_INCLUDED
|
||||
210
extern/stdcxx/4.2.1/include/iosfwd
vendored
Normal file
210
extern/stdcxx/4.2.1/include/iosfwd
vendored
Normal file
@@ -0,0 +1,210 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* iosfwd - forward declarations for the iostreams
|
||||
*
|
||||
* $Id: iosfwd 590052 2007-10-30 12:44:14Z 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_IOSFWD_INCLUDED
|
||||
#define _RWSTD_IOSFWD_INCLUDED
|
||||
|
||||
#include <rw/_iosfwd.h>
|
||||
#include <rw/_mbstate.h> // for _RWSTD_MBSTATE_T
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
class allocator;
|
||||
|
||||
|
||||
#ifndef _RWSTD_RW_BASIC_IOS_H_INCLUDED
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_ios;
|
||||
|
||||
typedef basic_ios<char> ios;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
typedef basic_ios<wchar_t> wios;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_RW_BASIC_IOS_H_INCLUDED
|
||||
|
||||
|
||||
#ifndef _RWSTD_STREAMBUF_INCLUDED
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_streambuf;
|
||||
|
||||
typedef basic_streambuf<char> streambuf;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
typedef basic_streambuf<wchar_t> wstreambuf;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_STREAMBUF_INCLUDED
|
||||
|
||||
|
||||
#ifndef _RWSTD_ISTREAM_INCLUDED
|
||||
|
||||
// 27.2, p4
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_istream;
|
||||
|
||||
// 27.2, p6
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_iostream;
|
||||
|
||||
|
||||
typedef basic_istream<char> istream;
|
||||
typedef basic_iostream<char> iostream;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
typedef basic_istream<wchar_t> wistream;
|
||||
typedef basic_iostream<wchar_t> wiostream;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_ISTREAM_INCLUDED
|
||||
|
||||
|
||||
#ifndef _RWSTD_OSTREAM_INCLUDED
|
||||
|
||||
// 27.2, p5
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_ostream;
|
||||
|
||||
typedef basic_ostream<char, char_traits<char> > ostream;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
typedef basic_ostream<wchar_t, char_traits<wchar_t> > wostream;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_OSTREAM_INCLUDED
|
||||
|
||||
|
||||
#ifndef _RWSTD_SSTREAM_INCLUDED
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT,
|
||||
class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class basic_stringbuf;
|
||||
|
||||
template <class _CharT,
|
||||
class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class basic_istringstream;
|
||||
|
||||
template <class _CharT,
|
||||
class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class basic_ostringstream;
|
||||
|
||||
template <class _CharT,
|
||||
class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class basic_stringstream;
|
||||
|
||||
typedef basic_stringbuf<char> stringbuf;
|
||||
typedef basic_istringstream<char> istringstream;
|
||||
typedef basic_ostringstream<char> ostringstream;
|
||||
typedef basic_stringstream<char> stringstream;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
typedef basic_stringbuf<wchar_t> wstringbuf;
|
||||
typedef basic_istringstream<wchar_t> wistringstream;
|
||||
typedef basic_ostringstream<wchar_t> wostringstream;
|
||||
typedef basic_stringstream<wchar_t> wstringstream;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_SSTREAM_INCLUDED
|
||||
|
||||
|
||||
#ifndef _RWSTD_FSTREAM_INCLUDED
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_filebuf;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_ifstream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_ofstream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_fstream;
|
||||
|
||||
typedef basic_filebuf<char> filebuf;
|
||||
typedef basic_ifstream<char> ifstream;
|
||||
typedef basic_ofstream<char> ofstream;
|
||||
typedef basic_fstream<char> fstream;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
typedef basic_filebuf<wchar_t> wfilebuf;
|
||||
typedef basic_ifstream<wchar_t> wifstream;
|
||||
typedef basic_ofstream<wchar_t> wofstream;
|
||||
typedef basic_fstream<wchar_t> wfstream;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_FSTREAM_INCLUDED
|
||||
|
||||
|
||||
#ifndef _RWSTD_RW_IOITER_H_INCLUDED
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
struct ostreambuf_iterator;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
struct istreambuf_iterator;
|
||||
|
||||
#endif // _RWSTD_RW_IOITER_H_INCLUDED
|
||||
|
||||
|
||||
// 27.2, p8
|
||||
template <class _StateT>
|
||||
class fpos;
|
||||
|
||||
// 27.2, p9 - identical to std::fpos<char_traits<char>::state_type>
|
||||
// and std::fpos<char_traits<wchar_t>::state_type>, respectively
|
||||
typedef fpos<_RWSTD_MBSTATE_T> streampos;
|
||||
typedef fpos<_RWSTD_MBSTATE_T> wstreampos;
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_IOSFWD_INCLUDED
|
||||
71
extern/stdcxx/4.2.1/include/iostream
vendored
Normal file
71
extern/stdcxx/4.2.1/include/iostream
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* iostream - iostream declarations
|
||||
*
|
||||
* $Id: iostream 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_IOSTREAM_INCLUDED
|
||||
#define _RWSTD_IOSTREAM_INCLUDED
|
||||
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_STATIC_IOSTREAM_INIT
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
// static stream initializer object defined in every translation unit
|
||||
// that (directly or otherwise) #includes this header (except the one
|
||||
// that defines iostream objects to prevent undesirable dependencies)
|
||||
static _STD::ios_base::Init __rw_stream_initializer;
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
#endif // _RWSTD_NO_STATIC_IOSTREAM_INIT
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
_RWSTD_EXPORT extern istream _RWSTD_IOSTREAM_OBJECT (cin);
|
||||
_RWSTD_EXPORT extern ostream _RWSTD_IOSTREAM_OBJECT (cout);
|
||||
_RWSTD_EXPORT extern ostream _RWSTD_IOSTREAM_OBJECT (cerr);
|
||||
_RWSTD_EXPORT extern ostream _RWSTD_IOSTREAM_OBJECT (clog);
|
||||
|
||||
#ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
_RWSTD_EXPORT extern wistream _RWSTD_IOSTREAM_OBJECT (wcin);
|
||||
_RWSTD_EXPORT extern wostream _RWSTD_IOSTREAM_OBJECT (wcout);
|
||||
_RWSTD_EXPORT extern wostream _RWSTD_IOSTREAM_OBJECT (wcerr);
|
||||
_RWSTD_EXPORT extern wostream _RWSTD_IOSTREAM_OBJECT (wclog);
|
||||
|
||||
#endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _RWSTD_IOSTREAM_INCLUDED
|
||||
625
extern/stdcxx/4.2.1/include/istream
vendored
Normal file
625
extern/stdcxx/4.2.1/include/istream
vendored
Normal file
@@ -0,0 +1,625 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* istream - Declarations for the Standard Library istreams
|
||||
*
|
||||
* $Id: istream 638384 2008-03-18 14:27:54Z 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_ISTREAM_INCLUDED
|
||||
#define _RWSTD_ISTREAM_INCLUDED
|
||||
|
||||
#if __GNUG__ >= 3
|
||||
# pragma GCC system_header
|
||||
#endif // gcc >= 3
|
||||
|
||||
#ifndef _RWSTD_NO_REDUNDANT_DEFINITIONS
|
||||
# include <ostream>
|
||||
#endif // _RWSTD_NO_REDUNDANT_DEFINITIONS
|
||||
|
||||
#include <loc/_num_get.h>
|
||||
#include <loc/_num_put.h>
|
||||
|
||||
#include <rw/_basic_ios.h>
|
||||
#include <rw/_mutex.h>
|
||||
#include <rw/_traits.h>
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits, class _NativeType>
|
||||
_STD::basic_istream<_CharT, _Traits>&
|
||||
__rw_extract (_STD::basic_istream<_CharT, _Traits>&, _NativeType&);
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_EXT_NUM_GET
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _STD::basic_istream<_CharT, _Traits>&
|
||||
__rw_extract (_STD::basic_istream<_CharT, _Traits> &__strm,
|
||||
short &__val)
|
||||
{
|
||||
long __tmp = __val;
|
||||
__rw_extract (__strm, __tmp);
|
||||
|
||||
_STD::ios_base::iostate __err = _STD::ios_base::goodbit;
|
||||
__val = __rw_check_overflow_short (__tmp, __strm.flags (), __err);
|
||||
|
||||
if (_STD::ios_base::goodbit != __err)
|
||||
__strm.setstate (__err);
|
||||
|
||||
return __strm;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _STD::basic_istream<_CharT, _Traits>&
|
||||
__rw_extract (_STD::basic_istream<_CharT, _Traits> &__strm,
|
||||
int &__val)
|
||||
{
|
||||
long __tmp = __val;
|
||||
__rw_extract (__strm, __tmp);
|
||||
|
||||
_STD::ios_base::iostate __err = _STD::ios_base::goodbit;
|
||||
__val = __rw_check_overflow_int (__tmp, __strm.flags (), __err);
|
||||
|
||||
if (_STD::ios_base::goodbit != __err)
|
||||
__strm.setstate (__err);
|
||||
|
||||
return __strm;
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_EXT_NUM_GET
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#ifndef _RWSTD_IOSFWD_INCLUDED
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_istream;
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class basic_iostream;
|
||||
|
||||
typedef basic_istream<char> istream;
|
||||
typedef basic_iostream<char> iostream;
|
||||
|
||||
# ifndef _RWSTD_NO_WCHAR_T
|
||||
|
||||
typedef basic_istream<wchar_t> wistream;
|
||||
typedef basic_iostream<wchar_t> wiostream;
|
||||
|
||||
# endif // _RWSTD_NO_WCHAR_T
|
||||
#endif // _RWSTD_IOSFWD_INCLUDED
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_istream: virtual public basic_ios<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef _CharT char_type;
|
||||
typedef _Traits traits_type;
|
||||
typedef _TYPENAME traits_type::int_type int_type;
|
||||
typedef _TYPENAME traits_type::pos_type pos_type;
|
||||
typedef _TYPENAME traits_type::off_type off_type;
|
||||
|
||||
// 27.6.1.1.1, p1
|
||||
_EXPLICIT basic_istream (basic_streambuf<char_type, traits_type> *__sb)
|
||||
: _C_gcount (0) {
|
||||
this->init (__sb);
|
||||
}
|
||||
|
||||
// called from sentry's ctor to prepare stream before input
|
||||
basic_istream&
|
||||
_C_ipfx (bool, ios_base::iostate = ios_base::eofbit | ios_base::failbit);
|
||||
|
||||
#ifdef _RWSTD_NO_NESTED_CLASS_ACCESS
|
||||
|
||||
// allow access to ios_base::_C_bufmutex() if the resolution
|
||||
// of cwg issue 45 is not yet implemented
|
||||
struct sentry;
|
||||
friend struct sentry;
|
||||
|
||||
#endif // _RWSTD_NO_NESTED_CLASS_ACCESS
|
||||
|
||||
// 27.6.1.1.2
|
||||
struct sentry: _RW::__rw_guard {
|
||||
|
||||
// 27.6.1.1.2, p2 - assumes 0 != __strm.rdbuf ()
|
||||
_EXPLICIT sentry (basic_istream &__strm, bool __noskipws = false)
|
||||
: _RW::__rw_guard (__strm._C_bufmutex ()),
|
||||
_C_ok (__strm._C_ipfx (__noskipws).good ()) { /* no-op */ }
|
||||
|
||||
// 27.6.1.1.2, p8
|
||||
operator bool () const {
|
||||
return _C_ok;
|
||||
}
|
||||
|
||||
private:
|
||||
bool _C_ok;
|
||||
|
||||
sentry (const sentry&); // (normally) not defined
|
||||
void operator= (const sentry&); // (normally) not defined
|
||||
};
|
||||
|
||||
// 27.6.1.2.3, p1, lwg issue 60
|
||||
basic_istream& operator>> (basic_istream& (*__pf)(basic_istream&)) {
|
||||
return (*__pf)(*this);
|
||||
}
|
||||
|
||||
// 27.6.1.2.3, p2, lwg issue 60
|
||||
basic_istream& operator>>(basic_ios<char_type, traits_type>& (*__pf)
|
||||
(basic_ios<char_type, traits_type>&)) {
|
||||
return (*__pf)(*this), *this;
|
||||
}
|
||||
|
||||
// 27.6.1.2.3, p4, lwg issue 60
|
||||
basic_istream& operator>> (ios_base& (*__pf)(ios_base&)) {
|
||||
return (*__pf)(*this), *this;
|
||||
}
|
||||
|
||||
|
||||
// 27.6.1.2.2 - Arithmetic Extractors
|
||||
|
||||
#ifndef _RWSTD_NO_NATIVE_BOOL
|
||||
|
||||
basic_istream& operator>> (bool &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_NATIVE_BOOL
|
||||
|
||||
basic_istream& operator>>(short &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
basic_istream& operator>>(unsigned short &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
basic_istream& operator>>(int &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
basic_istream& operator>>(unsigned int &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
basic_istream& operator>>(long &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
basic_istream& operator>>(unsigned long &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
basic_istream& operator>>(float &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
basic_istream& operator>>(double &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
basic_istream& operator>>(long double &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
#ifdef _RWSTD_LONG_LONG
|
||||
|
||||
basic_istream& operator>>(_RWSTD_LONG_LONG &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
basic_istream& operator>>(unsigned _RWSTD_LONG_LONG &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_LONG_LONG
|
||||
|
||||
basic_istream& operator>>(void* &__val) {
|
||||
return _RW::__rw_extract (*this, __val);
|
||||
}
|
||||
|
||||
// 27.6.1.2.3, p13
|
||||
basic_istream& operator>>(basic_streambuf<char_type, traits_type>*);
|
||||
|
||||
// 27.6.1.3 - Unformatted input functions
|
||||
|
||||
// 27.6.1.3, p3
|
||||
int_type get ();
|
||||
|
||||
// 27.6.1.3, p5
|
||||
basic_istream& get (char_type&);
|
||||
|
||||
// 27.6.1.3, p7: extract at most n - 1 chars, delim not extracted
|
||||
// always null-terminate, fail if no char extracted
|
||||
basic_istream& get (char_type*, streamsize, char_type);
|
||||
|
||||
// 27.6.1.3, p9: extract at most n - 1 chars
|
||||
// always null-terminate, fail if no char extracted
|
||||
basic_istream& get (char_type *__s, streamsize __n) {
|
||||
return get (__s, __n, this->widen ('\n'));
|
||||
}
|
||||
|
||||
// 27.6.1.3, p12: extract up to but not including delim or eof
|
||||
basic_istream&
|
||||
get (basic_streambuf<char_type, traits_type>& __sb, char_type __delim) {
|
||||
return _C_get (__sb, traits_type::to_int_type (__delim));
|
||||
}
|
||||
|
||||
// 27.6.1.3, p15
|
||||
basic_istream& get (basic_streambuf<char_type, traits_type>& __sb) {
|
||||
return get (__sb, this->widen ('\n'));
|
||||
}
|
||||
|
||||
// 27.6.1.3, p16: extract at most n - 1, delim extracted but not stored
|
||||
// fail if either 0 or n - 1 chars have been extracted
|
||||
basic_istream& getline (char_type*, streamsize, char_type);
|
||||
|
||||
// 27.6.1.3, p23
|
||||
basic_istream& getline (char_type *__s, streamsize __n) {
|
||||
return getline (__s, __n, this->widen ('\n'));
|
||||
}
|
||||
|
||||
// 27.6.1.3, p24: extract at most n including delim
|
||||
basic_istream& ignore (streamsize __n = 1,
|
||||
int_type __delim = traits_type::eof ()) {
|
||||
// using extension - passing null pointer to ignore input
|
||||
return read (0, __n, __delim, _C_eatdelim | _C_eatnull);
|
||||
}
|
||||
|
||||
// extension
|
||||
basic_istream& read (char_type*, streamsize, int_type, int);
|
||||
|
||||
// 27.6.1.3, p28: extract at most n, fail on eof
|
||||
basic_istream& read (char_type*, streamsize);
|
||||
|
||||
// 27.6.1.3, p30: extract at most min (rdbuf()->in_avail(), n))
|
||||
streamsize readsome (char_type*, streamsize);
|
||||
|
||||
// 27.6.1.3, p27
|
||||
int_type peek ();
|
||||
|
||||
// 27.6.1.3, p37
|
||||
pos_type tellg ();
|
||||
|
||||
// 27.6.1.3, p38
|
||||
basic_istream& seekg (pos_type);
|
||||
|
||||
// 27.6.1.3, p40
|
||||
basic_istream& seekg (off_type, ios_base::seekdir);
|
||||
|
||||
// 27.6.1.3, p36
|
||||
int sync ();
|
||||
|
||||
// 27.6.1.3, p32
|
||||
basic_istream& putback (char_type);
|
||||
|
||||
// 27.6.1.3, p34
|
||||
basic_istream& unget ();
|
||||
|
||||
// 27.6.1.3, p2
|
||||
streamsize gcount () const {
|
||||
return _C_gcount;
|
||||
}
|
||||
|
||||
// flags used by read() extension, _C_ipfx(), and _C_unsafe_get()
|
||||
enum {
|
||||
_C_nullterm = 0x01, // null-terminate input
|
||||
_C_wsterm = 0x02, // terminate input on whitespace
|
||||
_C_skipws = 0x04, // skip leading whitespace
|
||||
_C_eatdelim = 0x08, // extract delimiter
|
||||
_C_faileof = 0x10, // set ios_base::failbit on eof
|
||||
_C_failend = 0x20, // set ios_base::failbit on end of buffer
|
||||
_C_failnoi = 0x40, // set ios_base::failbit on no input
|
||||
_C_eatnull = 0x80 // extract null char
|
||||
};
|
||||
|
||||
// does not construct a sentry, does not affect gcount()
|
||||
// extracts character unless it is equal to __delim
|
||||
int_type _C_unsafe_get (streamsize* = 0,
|
||||
int_type = traits_type::eof (),
|
||||
int = 0);
|
||||
|
||||
private:
|
||||
|
||||
basic_istream& _C_get (basic_streambuf<char_type, traits_type>&, int_type);
|
||||
|
||||
streamsize _C_gcount; // number of chars extracted
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
inline _TYPENAME basic_istream<_CharT, _Traits>::int_type
|
||||
basic_istream<_CharT, _Traits>::
|
||||
get ()
|
||||
{
|
||||
const sentry __ipfx (*this, true /* noskipws */);
|
||||
|
||||
if (__ipfx)
|
||||
return _C_unsafe_get (&_C_gcount, traits_type::eof (),
|
||||
_C_faileof | _C_eatnull);
|
||||
|
||||
return traits_type::eof ();
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::
|
||||
get (char_type &__ch)
|
||||
{
|
||||
const int_type __c = get ();
|
||||
|
||||
if (!traits_type::eq_int_type (__c, traits_type::eof ()))
|
||||
traits_type::assign (__ch, traits_type::to_char_type (__c));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::seekg (pos_type __pos)
|
||||
{
|
||||
_RWSTD_ASSERT (0 != this->rdbuf ());
|
||||
|
||||
if (!this->fail ()) {
|
||||
_RWSTD_MT_GUARD (this->_C_bufmutex ());
|
||||
|
||||
// 27.6.1.3, p 38 requires that pubseekpos be called with
|
||||
// a single argument; the implemented behavior follows
|
||||
// the proposed resolution of lwg issue 136
|
||||
if (-1 == this->rdbuf ()->pubseekpos (__pos, ios_base::in))
|
||||
this->setstate (ios_base::failbit); // lwg issue 129
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::seekg (off_type __off, ios_base::seekdir __dir)
|
||||
{
|
||||
_RWSTD_ASSERT (0 != this->rdbuf ());
|
||||
|
||||
if (!this->fail ()) {
|
||||
_RWSTD_MT_GUARD (this->_C_bufmutex ());
|
||||
|
||||
// 27.6.1.3, p 40 requires that pubseekoff be called with
|
||||
// two arguments; the implemented behavior follows
|
||||
// the proposed resolution of lwg issue 136
|
||||
if (-1 == this->rdbuf ()->pubseekoff (__off, __dir, ios_base::in))
|
||||
this->setstate (ios_base::failbit); // lwg issue 129
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::
|
||||
operator>>(basic_streambuf<char_type, traits_type> *__sb)
|
||||
{
|
||||
// lwg issue 60: this is not a formatted input member function
|
||||
if (__sb)
|
||||
return _C_get (*__sb, traits_type::eof ());
|
||||
|
||||
this->setstate (ios_base::failbit);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
inline _TYPENAME basic_istream<_CharT, _Traits>::int_type
|
||||
basic_istream<_CharT, _Traits>::peek ()
|
||||
{
|
||||
_RWSTD_ASSERT (0 != this->rdbuf ());
|
||||
|
||||
const sentry __ipfx (*this, true /* noskipws */);
|
||||
|
||||
int_type __c = traits_type::eof ();
|
||||
|
||||
if (__ipfx) {
|
||||
_TRY {
|
||||
__c = this->rdbuf ()->sgetc ();
|
||||
}
|
||||
_CATCH (...) {
|
||||
this->setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
}
|
||||
|
||||
if (traits_type::eq_int_type (__c, traits_type::eof ()))
|
||||
this->setstate (ios_base::eofbit);
|
||||
|
||||
return __c;
|
||||
}
|
||||
|
||||
|
||||
// 27.6.1.2.3, p10
|
||||
template <class _Traits>
|
||||
inline basic_istream<char, _Traits>&
|
||||
operator>> (basic_istream<char, _Traits> &__strm, unsigned char &__c)
|
||||
{
|
||||
return __strm >> _RWSTD_REINTERPRET_CAST (char&, __c);
|
||||
}
|
||||
|
||||
template <class _Traits>
|
||||
inline basic_istream<char, _Traits>&
|
||||
operator>> (basic_istream<char, _Traits> &__strm, signed char &__c)
|
||||
{
|
||||
return __strm >> _RWSTD_REINTERPRET_CAST (char&, __c);
|
||||
}
|
||||
|
||||
|
||||
// 27.6.1.2.3, p6
|
||||
template <class _Traits>
|
||||
inline basic_istream<char, _Traits>&
|
||||
operator>> (basic_istream<char, _Traits> &__strm, unsigned char *__s)
|
||||
{
|
||||
return __strm >> _RWSTD_REINTERPRET_CAST (char*, __s);
|
||||
}
|
||||
|
||||
|
||||
template <class _Traits>
|
||||
inline basic_istream<char, _Traits>&
|
||||
operator>> (basic_istream<char, _Traits> &__strm, signed char *__s)
|
||||
{
|
||||
return __strm >> _RWSTD_REINTERPRET_CAST (char*, __s);
|
||||
}
|
||||
|
||||
|
||||
// 27.6.1.2.3, p10
|
||||
template<class _CharT, class _Traits>
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
operator>> (basic_istream<_CharT, _Traits> &__strm, _CharT &__c)
|
||||
{
|
||||
// read the first non-space char, set failbit if none read
|
||||
__strm.read (&__c, 1, _Traits::eof (),
|
||||
__strm._C_skipws | __strm._C_failnoi | __strm._C_eatnull);
|
||||
return __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.6.1.2.3, p6
|
||||
template<class _CharT, class _Traits>
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
operator>> (basic_istream<_CharT, _Traits> &__strm, _CharT *__s)
|
||||
{
|
||||
_RWSTD_ASSERT (0 != __s);
|
||||
|
||||
// store at most this many chars including terminating null
|
||||
const streamsize __maxlen = __strm.width () ?
|
||||
__strm.width () : streamsize (_RWSTD_LONG_MAX - 1);
|
||||
|
||||
// read at most __maxlen non-space chars up to the first whitespace
|
||||
__strm.read (__s, __maxlen, _Traits::to_int_type (__strm.widen ('\n')),
|
||||
__strm._C_nullterm | __strm._C_wsterm
|
||||
| __strm._C_skipws | __strm._C_failnoi);
|
||||
|
||||
__strm.width (0);
|
||||
|
||||
return __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.6.1.4, p1
|
||||
template<class _CharT, class _Traits>
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
ws (basic_istream<_CharT, _Traits> &__strm)
|
||||
{
|
||||
// construct a sentry to flush tied stream (if any) and lock
|
||||
const _TYPENAME basic_istream<_CharT, _Traits>::sentry
|
||||
__ipfx (__strm, true /* noskipws */);
|
||||
|
||||
// if sentry is okay, skip whitespace and set eofbit
|
||||
// but not failbit if end-of-file is encountered
|
||||
if (__ipfx) {
|
||||
_TRY {
|
||||
__strm._C_ipfx (false, ios_base::eofbit);
|
||||
}
|
||||
_CATCH (...) {
|
||||
__strm.setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
}
|
||||
|
||||
return __strm;
|
||||
}
|
||||
|
||||
|
||||
// 27.6.1.5
|
||||
template<class _CharT, class _Traits /* = char_traits<_CharT> */>
|
||||
class basic_iostream
|
||||
: public basic_istream<_CharT, _Traits>,
|
||||
public basic_ostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
|
||||
// prevent ambiguity between types defined in the bases
|
||||
typedef _CharT char_type;
|
||||
typedef _Traits traits_type;
|
||||
typedef _TYPENAME traits_type::int_type int_type;
|
||||
typedef _TYPENAME traits_type::pos_type pos_type;
|
||||
typedef _TYPENAME traits_type::off_type off_type;
|
||||
|
||||
_EXPLICIT basic_iostream (basic_streambuf<_CharT, _Traits> *__sb)
|
||||
: basic_istream<_CharT, _Traits>(__sb),
|
||||
basic_ostream<_CharT, _Traits>(__sb)
|
||||
{ /* 27.6.1.5.1, p1 */ }
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_BASIC_ISTREAM)
|
||||
// implementation file included here instead of at the end
|
||||
// of the header to work around a IBM VAC++ 7.0 bug #448
|
||||
# include <istream.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_BASIC_ISTREAM)
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _CHAR)
|
||||
|
||||
_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
|
||||
basic_istream<char, char_traits<char> >);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _CHAR)
|
||||
|
||||
#if _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _WCHAR_T)
|
||||
|
||||
_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
|
||||
basic_istream<wchar_t, char_traits<wchar_t> >);
|
||||
|
||||
#endif // _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _WCHAR_T)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#if _RWSTD_DEFINE_TEMPLATE_LAST (_BASIC_ISTREAM)
|
||||
# include <istream.cc>
|
||||
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_BASIC_ISTREAM)
|
||||
|
||||
|
||||
#ifndef _RWSTD_STRING_EXTRACTORS_INCLUDED
|
||||
# define _RWSTD_INCLUDE_STRING_EXTRACTORS
|
||||
# include <rw/_stringio.h>
|
||||
#endif // _RWSTD_STRING_EXTRACTORS_INCLUDED
|
||||
|
||||
|
||||
#endif // _RWSTD_ISTREAM_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/istream.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/istream.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* istream.c
|
||||
*
|
||||
* $Id: istream.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 <istream.cc>
|
||||
804
extern/stdcxx/4.2.1/include/istream.cc
vendored
Normal file
804
extern/stdcxx/4.2.1/include/istream.cc
vendored
Normal file
@@ -0,0 +1,804 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* istream.cc - definitions of basic_istream members
|
||||
*
|
||||
* $Id: istream.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-2006 Rogue Wave Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <class _CharT, class _Traits, class _NativeType>
|
||||
_STD::basic_istream<_CharT, _Traits>&
|
||||
__rw_extract (_STD::basic_istream<_CharT, _Traits> &__strm,
|
||||
_NativeType &__val)
|
||||
{
|
||||
_RWSTD_ASSERT (0 != __strm.rdbuf ());
|
||||
|
||||
typedef _STD::istreambuf_iterator<_CharT, _Traits> _Iter;
|
||||
typedef _STD::num_get<_CharT, _Iter> _NumGet;
|
||||
|
||||
_STD::ios_base::iostate __err = _STD::ios_base::goodbit;
|
||||
|
||||
// eat leading whitespace, catching exceptions from sentry
|
||||
const _TYPENAME _STD::basic_istream<_CharT, _Traits>::sentry
|
||||
__ipfx (__strm /* , noskipws = false */);
|
||||
|
||||
if (__ipfx) {
|
||||
_TRY {
|
||||
_STD_USE_FACET (_NumGet, __strm.getloc ())
|
||||
.get (_Iter (__strm), _Iter (), __strm, __err, __val);
|
||||
}
|
||||
_CATCH (...) {
|
||||
__strm.setstate (__strm.badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
}
|
||||
|
||||
if (_STD::ios_base::goodbit != __err)
|
||||
__strm.setstate (__err);
|
||||
|
||||
return __strm;
|
||||
}
|
||||
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::
|
||||
_C_ipfx (bool __noskipws, ios_base::iostate __errbits)
|
||||
{
|
||||
// extension - zero out irrespective of state so that gcount()
|
||||
// called after any failed extraction (even formatted) reports 0
|
||||
// and always count _all_ extracted characters
|
||||
|
||||
if (ios_base::goodbit != this->rdstate ()) {
|
||||
this->setstate (ios_base::failbit);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ios_base::iostate __state = ios_base::goodbit;
|
||||
|
||||
_TRY {
|
||||
if (this->tie ())
|
||||
this->tie ()->flush ();
|
||||
|
||||
if ( ios_base::eofbit == __errbits // passed by std::ws
|
||||
|| !__noskipws && this->flags () & ios_base::skipws) {
|
||||
|
||||
// skip over leading whitespace
|
||||
|
||||
basic_streambuf<char_type, traits_type>* const __rdbuf =
|
||||
this->rdbuf ();
|
||||
|
||||
_RWSTD_ASSERT (0 != __rdbuf);
|
||||
|
||||
const ctype<char_type> &__ctp =
|
||||
_USE_FACET (ctype<char_type>, this->getloc ());
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
const char_type* const __gptr = __rdbuf->gptr ();
|
||||
const char_type* const __egptr = __rdbuf->egptr ();
|
||||
|
||||
if (__gptr < __egptr) {
|
||||
|
||||
// scan the sequence for the first non-whitespace char
|
||||
const streamsize __nskip =
|
||||
__ctp.scan_not (__ctp.space, __gptr, __egptr)
|
||||
- __gptr;
|
||||
|
||||
__rdbuf->gbump (__nskip);
|
||||
|
||||
if (__nskip < __egptr - __gptr)
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
||||
const int_type __c (__rdbuf->sgetc ());
|
||||
|
||||
if (traits_type::eq_int_type (__c, traits_type::eof ())) {
|
||||
__state = __errbits;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!__ctp.is (__ctp.space,
|
||||
traits_type::to_char_type (__c)))
|
||||
break;
|
||||
|
||||
__rdbuf->sbumpc ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_CATCH (...) {
|
||||
this->setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
|
||||
if (__state)
|
||||
this->setstate (__state);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_TYPENAME basic_istream<_CharT, _Traits>::int_type
|
||||
basic_istream<_CharT, _Traits>::
|
||||
_C_unsafe_get (streamsize *__cnt /* = 0 */,
|
||||
int_type __delim /* = eof() */,
|
||||
int __flags /* = 0 */)
|
||||
{
|
||||
_RWSTD_ASSERT (0 != this->rdbuf ());
|
||||
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
|
||||
// initialize in case sgetc() below throws
|
||||
int_type __c (traits_type::eof ());
|
||||
|
||||
_TRY {
|
||||
|
||||
// get next char without extracting
|
||||
__c = this->rdbuf ()->sgetc ();
|
||||
|
||||
// extract delimiter or eos only if asked to
|
||||
// extract whitespace only if it doesn't terminate input
|
||||
if (traits_type::eq_int_type (__c, traits_type::eof ()))
|
||||
__err = ios_base::eofbit
|
||||
| (__flags & _C_faileof ? this->failbit : this->goodbit);
|
||||
else if ( ( _C_eatdelim & __flags
|
||||
|| !traits_type::eq_int_type (__c, __delim))
|
||||
&& ( _C_eatnull & __flags
|
||||
|| !traits_type::eq (traits_type::to_char_type (__c),
|
||||
char_type ()))
|
||||
&& ( !(_C_wsterm & __flags)
|
||||
|| !_USE_FACET (ctype<char_type>, this->getloc ())
|
||||
.is (ctype_base::space,
|
||||
traits_type::to_char_type (__c)))) {
|
||||
if (traits_type::eq_int_type (this->rdbuf ()->sbumpc (),
|
||||
traits_type::eof ()))
|
||||
__err = ios_base::failbit;
|
||||
else if (__cnt)
|
||||
++*__cnt; // increment number of extracted chars
|
||||
}
|
||||
}
|
||||
_CATCH (...) {
|
||||
this->setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
|
||||
if (__err)
|
||||
this->setstate (__err);
|
||||
|
||||
return __c;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::
|
||||
_C_get (basic_streambuf<char_type, traits_type> &__sb, int_type __delim)
|
||||
{
|
||||
_RWSTD_ASSERT (0 != this->rdbuf ());
|
||||
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
|
||||
const sentry __ipfx (*this, true /* noskipws */);
|
||||
|
||||
if (__ipfx) {
|
||||
|
||||
_C_gcount = 0;
|
||||
|
||||
_TRY {
|
||||
for ( ; ; ) {
|
||||
int_type __c (this->rdbuf ()->sgetc ());
|
||||
|
||||
if (traits_type::eq_int_type (__c, traits_type::eof ())) {
|
||||
__err = ios_base::eofbit;
|
||||
break;
|
||||
}
|
||||
|
||||
if (traits_type::eq_int_type (__c, __delim))
|
||||
break;
|
||||
|
||||
_TRY {
|
||||
__c = __sb.sputc (traits_type::to_char_type (__c));
|
||||
}
|
||||
_CATCH (...) {
|
||||
|
||||
// indicate to the outer catch block the the
|
||||
// exception rethrown from the call to setstate()
|
||||
// below should be propagated without setting
|
||||
// badbit (whose purpose is to indicates the
|
||||
// "badness" of *this, not some other object)
|
||||
__err = ios_base::failbit | _RW::__rw_rethrow;
|
||||
|
||||
// set failbit and rethrow if failbit is set in
|
||||
// exceptions() despite 27.6.1.3, p12, bullet 4
|
||||
this->setstate (__err);
|
||||
break;
|
||||
}
|
||||
|
||||
if (traits_type::eq_int_type (__c, traits_type::eof ())) {
|
||||
__err = ios_base::failbit;
|
||||
break;
|
||||
}
|
||||
|
||||
++_C_gcount;
|
||||
this->rdbuf ()->sbumpc ();
|
||||
}
|
||||
}
|
||||
_CATCH (...) {
|
||||
// will rethrow if `err' is set since the caught exception
|
||||
// is the one thrown during output and rethrown by setstate()
|
||||
// in the nested catch block above
|
||||
if (ios_base::goodbit == __err)
|
||||
__err = ios_base::badbit;
|
||||
|
||||
this->setstate (__err | _RW::__rw_rethrow);
|
||||
}
|
||||
}
|
||||
|
||||
// 27.6.1.3, p13
|
||||
if (!gcount ())
|
||||
__err |= ios_base::failbit;
|
||||
|
||||
if (__err)
|
||||
this->setstate (__err);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::
|
||||
read (char_type *__s, streamsize __n, int_type __delim, int __flags)
|
||||
{
|
||||
// if __s is 0 function doesn't store characters (used by ignore)
|
||||
|
||||
_RWSTD_ASSERT (0 <= __n);
|
||||
_RWSTD_ASSERT (0 != this->rdbuf ());
|
||||
|
||||
const char_type __eos = char_type ();
|
||||
|
||||
const bool __getline = (_C_failend | _C_nullterm)
|
||||
== ((_C_failend | _C_nullterm) & __flags);
|
||||
|
||||
// "clear" buffer if reading a null-terminated string
|
||||
// follows the proposed resolution of lwg issue 243
|
||||
if (__getline)
|
||||
traits_type::assign (*__s, __eos);
|
||||
|
||||
// read and getline are unformatted (noskipws), others are formatted
|
||||
const sentry __ipfx (*this, !(_C_skipws & __flags));
|
||||
|
||||
// 27.6.1.2.1, p1 and 27.6.1.3, p1: proceed iff sentry is okay
|
||||
if (__ipfx) {
|
||||
|
||||
_C_gcount = 0;
|
||||
|
||||
// read at most n - 1 characters when null-terminating
|
||||
while (__n) {
|
||||
|
||||
// handle 27.6.1.3, p17 and p18
|
||||
if (0 == --__n && _C_nullterm & __flags) {
|
||||
if (!__getline)
|
||||
break;
|
||||
|
||||
const int_type __c (this->rdbuf ()->sgetc ());
|
||||
|
||||
if ( !traits_type::eq_int_type (__c, traits_type::eof ())
|
||||
&& !traits_type::eq_int_type (__c, __delim))
|
||||
break;
|
||||
|
||||
__flags &= ~_C_failend; // prevent failbit from being set
|
||||
|
||||
// will break out in the check below...
|
||||
}
|
||||
|
||||
// get (possibly extract) next char
|
||||
const int_type __c (_C_unsafe_get (&_C_gcount, __delim, __flags));
|
||||
|
||||
// eof or delimiter may terminate input
|
||||
if ( traits_type::eq_int_type (__c, traits_type::eof())
|
||||
|| traits_type::eq_int_type (__c, __delim))
|
||||
break;
|
||||
|
||||
const char_type __ch = traits_type::to_char_type (__c);
|
||||
|
||||
// space or eos char may terminate input
|
||||
if ( !(_C_eatnull & __flags) && traits_type::eq (__ch, __eos)
|
||||
|| _C_wsterm & __flags
|
||||
&& _USE_FACET (ctype<char_type>, this->getloc ())
|
||||
.is (ctype_base::space, __ch))
|
||||
break;
|
||||
|
||||
// ignore input if __s is null
|
||||
if (__s)
|
||||
traits_type::assign (*__s++, __ch);
|
||||
}
|
||||
|
||||
if (_C_nullterm & __flags && __s)
|
||||
traits_type::assign (*__s, __eos);
|
||||
}
|
||||
|
||||
// fail if no chars extracted or if end of buffer has been reached
|
||||
if ( _C_failnoi & __flags && !gcount ()
|
||||
|| _C_failend & __flags && !__n)
|
||||
this->setstate (ios_base::failbit);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// 27.6.1.3, p28
|
||||
template<class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::
|
||||
read (char_type *__s, streamsize __n)
|
||||
{
|
||||
_RWSTD_ASSERT (0 <= __n);
|
||||
_RWSTD_ASSERT (0 != this->rdbuf ());
|
||||
|
||||
// 27.6.1.3, p28: sets ios_base::failbit if !this->good()
|
||||
const sentry __ipfx (*this, true /* noskipws */);
|
||||
|
||||
// 27.6.1.2.1, p1 and 27.6.1.3, p1: proceed iff sentry is okay
|
||||
if (__ipfx) {
|
||||
|
||||
_C_gcount = 0;
|
||||
|
||||
streamsize __nread = 0;
|
||||
|
||||
_TRY {
|
||||
__nread = this->rdbuf ()->sgetn (__s, __n);
|
||||
|
||||
if (__nread >= 0)
|
||||
_C_gcount = __nread;
|
||||
}
|
||||
_CATCH (...) {
|
||||
this->setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
|
||||
if (__n != __nread)
|
||||
this->setstate (ios_base::eofbit | ios_base::failbit);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
streamsize
|
||||
basic_istream<_CharT, _Traits>::
|
||||
readsome (char_type *__s, streamsize __n)
|
||||
{
|
||||
_RWSTD_ASSERT (0 != __s);
|
||||
_RWSTD_ASSERT (0 <= __n);
|
||||
_RWSTD_ASSERT (0 != this->rdbuf());
|
||||
|
||||
const sentry __ipfx (*this, true /* noskipws */);
|
||||
|
||||
if (__ipfx) {
|
||||
|
||||
_C_gcount = 0;
|
||||
|
||||
streamsize __nread = 0;
|
||||
|
||||
_TRY {
|
||||
|
||||
const streamsize __in_avail = this->rdbuf ()->in_avail ();
|
||||
|
||||
if (!__in_avail)
|
||||
return 0;
|
||||
|
||||
if (__n > __in_avail)
|
||||
__n = __in_avail;
|
||||
|
||||
// the call to sgetn() below is required to return >= 0
|
||||
__nread = __n >= 0 ? this->rdbuf ()->sgetn (__s, __n) : -1;
|
||||
|
||||
if (__nread >= 0)
|
||||
_C_gcount = __nread;
|
||||
}
|
||||
_CATCH (...) {
|
||||
this->setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
|
||||
if (__nread < 0) {
|
||||
this->setstate (ios_base::eofbit);
|
||||
__nread = 0;
|
||||
}
|
||||
|
||||
return __nread;
|
||||
}
|
||||
else
|
||||
this->setstate (ios_base::failbit);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_TYPENAME basic_istream<_CharT, _Traits>::pos_type
|
||||
basic_istream<_CharT, _Traits>::
|
||||
tellg ()
|
||||
{
|
||||
_RWSTD_ASSERT (0 != this->rdbuf ());
|
||||
|
||||
const sentry __ipfx (*this, true /* noskipws */);
|
||||
|
||||
if (__ipfx && !this->fail ()) {
|
||||
|
||||
_TRY {
|
||||
return this->rdbuf ()->pubseekoff (0, ios_base::cur, ios_base::in);
|
||||
}
|
||||
_CATCH (...) {
|
||||
this->setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
}
|
||||
|
||||
return off_type (-1);
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::
|
||||
putback (char_type __c)
|
||||
{
|
||||
const sentry __ipfx (*this, true /* noskipws */);
|
||||
|
||||
if (__ipfx) {
|
||||
|
||||
if (this->rdbuf ()) {
|
||||
_TRY {
|
||||
if (!traits_type::eq_int_type (this->rdbuf ()->sputbackc (__c),
|
||||
traits_type::eof ()))
|
||||
return *this;
|
||||
}
|
||||
_CATCH (...) {
|
||||
this->setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
}
|
||||
|
||||
this->setstate (ios_base::badbit);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::
|
||||
unget ()
|
||||
{
|
||||
const sentry __ipfx (*this, true /* noskipws */);
|
||||
|
||||
if (__ipfx) {
|
||||
|
||||
if (this->rdbuf ()) {
|
||||
|
||||
_TRY {
|
||||
|
||||
if (!traits_type::eq_int_type (this->rdbuf ()->sungetc (),
|
||||
traits_type::eof ()))
|
||||
return *this;
|
||||
}
|
||||
_CATCH (...) {
|
||||
this->setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
}
|
||||
|
||||
this->setstate (ios_base::badbit);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
int
|
||||
basic_istream<_CharT, _Traits>::
|
||||
sync ()
|
||||
{
|
||||
const sentry __ipfx (*this, true /* noskipws */);
|
||||
|
||||
if (__ipfx && this->rdbuf ()) {
|
||||
|
||||
_TRY {
|
||||
if (-1 != this->rdbuf ()->pubsync ())
|
||||
return 0;
|
||||
}
|
||||
_CATCH (...) {
|
||||
this->setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
|
||||
this->setstate (ios_base::badbit);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::
|
||||
get (char_type *__s, streamsize __n, char_type __delim)
|
||||
{
|
||||
_RWSTD_ASSERT (0 != this->rdbuf ());
|
||||
|
||||
if (0 < __n) {
|
||||
// lwg issue 243: store the NUL character before
|
||||
// constructing the sentry object in case it throws
|
||||
traits_type::assign (__s [0], char_type ());
|
||||
}
|
||||
|
||||
const sentry __ipfx (*this, true /* noskipws */);
|
||||
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
|
||||
if (__ipfx) {
|
||||
|
||||
_C_gcount = 0;
|
||||
|
||||
_TRY {
|
||||
|
||||
basic_streambuf<char_type, traits_type>* const __rdbuf =
|
||||
this->rdbuf ();
|
||||
|
||||
for ( ; __n > 1; ) {
|
||||
|
||||
streamsize __navail =
|
||||
streamsize (__rdbuf->egptr () - __rdbuf->gptr ());
|
||||
|
||||
if (__n - 1 < __navail)
|
||||
__navail = __n - 1;
|
||||
|
||||
if (__navail) {
|
||||
|
||||
char_type* const __gptr = __rdbuf->gptr ();
|
||||
|
||||
const char_type* const __pdelim =
|
||||
traits_type::find (__gptr, __navail, __delim);
|
||||
|
||||
if (__pdelim) {
|
||||
__navail = streamsize (__pdelim - __gptr);
|
||||
|
||||
if (!__navail)
|
||||
break;
|
||||
}
|
||||
|
||||
traits_type::copy (__s + _C_gcount, __gptr, __navail);
|
||||
|
||||
__rdbuf->gbump (__navail);
|
||||
|
||||
_C_gcount += __navail;
|
||||
__n -= __navail;
|
||||
}
|
||||
else {
|
||||
|
||||
const int_type __c (__rdbuf->sgetc ());
|
||||
|
||||
if (traits_type::eq_int_type (__c, traits_type::eof ())) {
|
||||
__err = ios_base::eofbit;
|
||||
break;
|
||||
}
|
||||
|
||||
const char_type __ch = traits_type::to_char_type (__c);
|
||||
|
||||
if (traits_type::eq (__ch, __delim))
|
||||
break;
|
||||
|
||||
traits_type::assign (__s [_C_gcount++], __ch);
|
||||
--__n;
|
||||
|
||||
__rdbuf->sbumpc ();
|
||||
}
|
||||
}
|
||||
|
||||
traits_type::assign (__s [_C_gcount], char_type ());
|
||||
|
||||
if (!_C_gcount)
|
||||
__err |= ios_base::failbit;
|
||||
}
|
||||
_CATCH (...) {
|
||||
this->setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
}
|
||||
|
||||
if (ios_base::goodbit != __err)
|
||||
this->setstate (__err);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::
|
||||
getline (char_type *__line, streamsize __size, char_type __delim)
|
||||
{
|
||||
_RWSTD_ASSERT (__size >= 0);
|
||||
_RWSTD_ASSERT (!__size || __line);
|
||||
_RWSTD_ASSERT (0 != this->rdbuf ());
|
||||
|
||||
char_type __dummy;
|
||||
|
||||
if (0 < __size) {
|
||||
// lwg issue 243: store the NUL character before
|
||||
// constructing the sentry object in case it throws
|
||||
traits_type::assign (__line [0], char_type ());
|
||||
}
|
||||
else {
|
||||
// use a dummy buffer to avoid having to check size
|
||||
// again below, and prevent undefined behavior when
|
||||
// size is negative
|
||||
__line = &__dummy;
|
||||
__size = 0;
|
||||
}
|
||||
|
||||
const sentry __ipfx (*this, true /* noskipws */);
|
||||
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
|
||||
if (__ipfx) {
|
||||
|
||||
_C_gcount = 0;
|
||||
|
||||
basic_streambuf<char_type, traits_type>* const __rdbuf =
|
||||
this->rdbuf ();
|
||||
|
||||
_TRY {
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
const char_type* const __gptr = __rdbuf->gptr ();
|
||||
const char_type* const __egptr = __rdbuf->egptr ();
|
||||
|
||||
// compute the lesser of the number of characters in the
|
||||
// stream buffer and the size of the destination buffer
|
||||
streamsize __navail = __egptr - __gptr;
|
||||
if (__size < __navail)
|
||||
__navail = __size;
|
||||
|
||||
if (__navail) {
|
||||
|
||||
// find the delimiter in the sequence if it exists
|
||||
const char_type* const __pdel =
|
||||
traits_type::find (__gptr, __navail, __delim);
|
||||
|
||||
if (__pdel) {
|
||||
__navail = __pdel - __gptr + 1;
|
||||
__size -= __navail - 1;
|
||||
}
|
||||
else if (__size == __navail)
|
||||
__size -= --__navail;
|
||||
else
|
||||
__size -= __navail;
|
||||
|
||||
// copy including delimiter, if any
|
||||
// (delimiter will be overwritten below)
|
||||
traits_type::copy (__line + _C_gcount, __gptr, __navail);
|
||||
|
||||
_C_gcount += __navail;
|
||||
|
||||
// advance gptr()
|
||||
__rdbuf->gbump (__navail);
|
||||
|
||||
if (__pdel) {
|
||||
traits_type::assign (__line [_C_gcount - 1],
|
||||
char_type ());
|
||||
break;
|
||||
}
|
||||
|
||||
if (2 > __size && __egptr - __gptr != __navail) {
|
||||
traits_type::assign (__line [_C_gcount], char_type ());
|
||||
__err = ios_base::failbit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
// no data in buffer, trigger underflow()
|
||||
// note that streambuf may be unbuffered
|
||||
const int_type __c (__rdbuf->sgetc ());
|
||||
|
||||
if (traits_type::eq_int_type (__c, traits_type::eof ())) {
|
||||
traits_type::assign (__line [_C_gcount], char_type ());
|
||||
__err = ios_base::eofbit;
|
||||
break;
|
||||
}
|
||||
|
||||
const char_type __ch = traits_type::to_char_type (__c);
|
||||
if (traits_type::eq (__ch, __delim)) {
|
||||
traits_type::assign (__line [_C_gcount], char_type ());
|
||||
__rdbuf->sbumpc ();
|
||||
_C_gcount++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (2 > __size) {
|
||||
traits_type::assign (__line [_C_gcount], char_type ());
|
||||
__err = ios_base::failbit;
|
||||
break;
|
||||
}
|
||||
|
||||
traits_type::assign (__line [_C_gcount], __ch);
|
||||
--__size;
|
||||
|
||||
__rdbuf->sbumpc ();
|
||||
|
||||
// increment gcount only _after_ sbumpc() but _before_
|
||||
// the subsequent call to sgetc() to correctly reflect
|
||||
// the number of extracted characters in the presence
|
||||
// of exceptions thrown from streambuf virtuals
|
||||
++_C_gcount;
|
||||
}
|
||||
}
|
||||
}
|
||||
_CATCH (...) {
|
||||
this->setstate (ios_base::badbit | _RW::__rw_rethrow);
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == _C_gcount)
|
||||
__err |= ios_base::failbit;
|
||||
|
||||
if (__err)
|
||||
this->setstate (__err);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_UNDEFINED_TEMPLATES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>::sentry::
|
||||
sentry (const sentry&)
|
||||
: _RW::__rw_guard (0)
|
||||
{
|
||||
_RWSTD_ASSERT (!"not callable");
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_istream<_CharT, _Traits>::sentry::
|
||||
operator= (const sentry&)
|
||||
{
|
||||
_RWSTD_ASSERT (!"not callable");
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_UNDEFINED_TEMPLATES
|
||||
|
||||
|
||||
} // namespace std
|
||||
42
extern/stdcxx/4.2.1/include/iterator
vendored
Normal file
42
extern/stdcxx/4.2.1/include/iterator
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* iterator - Definitions of the C++ Standard Library Iterator Library
|
||||
*
|
||||
* $Id: iterator 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_ITERATOR_INCLUDED
|
||||
#define _RWSTD_ITERATOR_INCLUDED
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
#include <rw/_traits.h> // for char_traits
|
||||
#include <rw/_ioiter.h> // for streambuf iterators
|
||||
#include <rw/_iterator.h> // for iterators
|
||||
#include <rw/_streamiter.h> // for stream iterators
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
#endif // _RWSTD_ITERATOR_INCLUDED
|
||||
559
extern/stdcxx/4.2.1/include/limits
vendored
Normal file
559
extern/stdcxx/4.2.1/include/limits
vendored
Normal file
@@ -0,0 +1,559 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* <limits> - definitions of the numeric_limits template and specializations
|
||||
*
|
||||
* $Id: limits 584981 2007-10-16 00:16:04Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <rw/_defs.h>
|
||||
|
||||
|
||||
// quiet NAN (QNAN) supported?
|
||||
#ifndef _RWSTD_NO_QUIET_NAN
|
||||
# define _RWSTD_HAS_QUIET_NAN true
|
||||
#else // if defined (_RWSTD_NO_QUIET_NAN)
|
||||
# define _RWSTD_HAS_QUIET_NAN false
|
||||
#endif // _RWSTD_NO_QUIET_NAN
|
||||
|
||||
|
||||
// does integer arithmetic trap?
|
||||
#ifndef _RWSTD_NO_INT_TRAPS
|
||||
# define _RWSTD_INT_TRAPS true
|
||||
#else // if defined (_RWSTD_NO_INT_TRAPS)
|
||||
# define _RWSTD_INT_TRAPS false
|
||||
#endif // _RWSTD_NO_INT_TRAPS
|
||||
|
||||
// does floating point arithmetic (such as 0.0/0.0) trap?
|
||||
#ifndef _RWSTD_NO_DBL_TRAPS
|
||||
# define _RWSTD_FLT_TRAPS true
|
||||
# define _RWSTD_DBL_TRAPS true
|
||||
# define _RWSTD_LDBL_TRAPS true
|
||||
#else // if defined (_RWSTD_NO_DBL_TRAPS)
|
||||
// invalid operations return QNAN
|
||||
# define _RWSTD_FLT_TRAPS false
|
||||
# define _RWSTD_DBL_TRAPS false
|
||||
# define _RWSTD_LDBL_TRAPS false
|
||||
#endif // _RWSTD_NO_DBL_TRAPS
|
||||
|
||||
|
||||
#ifndef _RWSTD_FLT_HAS_DENORM
|
||||
# define _RWSTD_FLT_HAS_DENORM false
|
||||
#endif // _RWSTD_FLT_HAS_DENORM
|
||||
|
||||
#ifndef _RWSTD_DBL_HAS_DENORM
|
||||
# define _RWSTD_DBL_HAS_DENORM false
|
||||
#endif // _RWSTD_DBL_HAS_DENORM
|
||||
|
||||
#ifndef _RWSTD_LDBL_HAS_DENORM
|
||||
# define _RWSTD_LDBL_HAS_DENORM false
|
||||
#endif // _RWSTD_LDBL_HAS_DENORM
|
||||
|
||||
#ifndef _RWSTD_HAS_DENORM_LOSS
|
||||
# define _RWSTD_HAS_DENORM_LOSS false
|
||||
#endif // _RWSTD_HAS_DENORM_LOSS
|
||||
|
||||
#ifndef _RWSTD_HAS_INFINITY
|
||||
# define _RWSTD_HAS_INFINITY true
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _RWSTD_IS_IEC559
|
||||
// assume conforming environment unless autodetected otherwise
|
||||
// or unless overridden in <rw/_config.h>
|
||||
# define _RWSTD_IS_IEC559 true
|
||||
#endif // _RWSTD_IS_IEC559
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (__rw) {
|
||||
|
||||
#ifndef _RWSTD_NO_OBJECT_MANGLING
|
||||
|
||||
extern "C" {
|
||||
|
||||
#else // if defined (_RWSTD_NO_OBJECT_MANGLING)
|
||||
|
||||
extern "C++" {
|
||||
|
||||
#endif // _RWSTD_NO_OBJECT_MANGLING
|
||||
|
||||
|
||||
_RWSTD_EXPORT extern const float __rw_flt_infinity;
|
||||
_RWSTD_EXPORT extern const double __rw_dbl_infinity;
|
||||
|
||||
_RWSTD_EXPORT extern const float __rw_flt_qNaN;
|
||||
_RWSTD_EXPORT extern const double __rw_dbl_qNaN;
|
||||
|
||||
_RWSTD_EXPORT extern const float __rw_flt_sNaN;
|
||||
_RWSTD_EXPORT extern const double __rw_dbl_sNaN;
|
||||
|
||||
_RWSTD_EXPORT extern const float __rw_flt_denorm_min;
|
||||
_RWSTD_EXPORT extern const double __rw_dbl_denorm_min;
|
||||
|
||||
#ifndef _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
_RWSTD_EXPORT extern const long double __rw_ldbl_infinity;
|
||||
_RWSTD_EXPORT extern const long double __rw_ldbl_qNaN;
|
||||
_RWSTD_EXPORT extern const long double __rw_ldbl_sNaN;
|
||||
_RWSTD_EXPORT extern const long double __rw_ldbl_denorm_min;
|
||||
|
||||
#endif // _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
|
||||
} // extern "C"/"C++"
|
||||
|
||||
} // namespace __rw
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_SIGNALING_NAN
|
||||
# define _RWSTD_HAS_SIG_NAN true
|
||||
#else
|
||||
# define _RWSTD_HAS_SIG_NAN false
|
||||
#endif // _RWSTD_NO_SIGNALING_NAN
|
||||
|
||||
|
||||
#undef _RWSTD_CLASS_BEGIN
|
||||
#undef _RWSTD_CLASS_END
|
||||
#undef _RWSTD_TYPEDEF
|
||||
#undef _RWSTD_STATIC
|
||||
#undef _RWSTD_STATIC_FUN
|
||||
|
||||
|
||||
#ifndef _RWSTD_DEFINE_EXPORTS
|
||||
|
||||
// declarations - expanded in every translation unit
|
||||
// that #includes <limits>
|
||||
|
||||
# define _RWSTD_CLASS_BEGIN(name) \
|
||||
_RWSTD_SPECIALIZED_CLASS struct _RWSTD_EXPORT name {
|
||||
# define _RWSTD_CLASS_END };
|
||||
# define _RWSTD_TYPEDEF(def) typedef def;
|
||||
# define _RWSTD_STATIC(ignore, type, name, value) \
|
||||
_RWSTD_STATIC_CONST (type, name = value)
|
||||
# define _RWSTD_STATIC_FUN(type, name, value) \
|
||||
static type name () _THROWS (()) { return value; }
|
||||
|
||||
#else // defined (_RWSTD_DEFINE_EXPORTS)
|
||||
|
||||
// definitions - expanded in a single translation unit that defines
|
||||
// static const data members outside of each numeric_limits<> specialization
|
||||
|
||||
# define _RWSTD_CLASS_BEGIN(ignore)
|
||||
# define _RWSTD_CLASS_END
|
||||
# define _RWSTD_TYPEDEF(ignore)
|
||||
# define _RWSTD_STATIC(limtype, type, name, value) \
|
||||
_RWSTD_DEFINE_STATIC_CONST (const type numeric_limits<limtype>::name)
|
||||
# define _RWSTD_STATIC_FUN(ign1, ign2, ign3)
|
||||
|
||||
#endif // _RWSTD_DEFINE_EXPORTS
|
||||
|
||||
|
||||
// 18.2.1.2, p6 - 7
|
||||
#define _RWSTD_DIGITS(type, min, max) \
|
||||
(1 == (max) ? 1 : (_RWSTD_CHAR_BIT * int (sizeof (type)) - int ((min) != 0)))
|
||||
|
||||
// 18.2.1.2, p9
|
||||
#define _RWSTD_DIGITS10(digits) (((digits) * 301) / 1000)
|
||||
|
||||
|
||||
#undef _RWSTD_LIMITS_BODY
|
||||
|
||||
#define _RWSTD_LIMITS_BODY(type, cpfx) \
|
||||
_RWSTD_STATIC (type, bool, is_specialized, true); \
|
||||
\
|
||||
_RWSTD_STATIC_FUN (type, (min), (type)(cpfx##_MIN)) \
|
||||
_RWSTD_STATIC_FUN (type, (max), (type)(cpfx##_MAX)) \
|
||||
\
|
||||
_RWSTD_STATIC (type, bool, is_signed, cpfx##_MIN != 0); \
|
||||
_RWSTD_STATIC (type, bool, is_integer, true); \
|
||||
_RWSTD_STATIC (type, bool, is_exact, true); \
|
||||
\
|
||||
_RWSTD_STATIC (type, int, digits, \
|
||||
_RWSTD_DIGITS (type, cpfx##_MIN, cpfx##_MAX)); \
|
||||
\
|
||||
/* spelled out to work around a bug in IBM xlC 5.0 */ \
|
||||
_RWSTD_STATIC (type, int, digits10, \
|
||||
_RWSTD_DIGITS10 (_RWSTD_DIGITS (type, cpfx##_MIN, \
|
||||
cpfx##_MAX))); \
|
||||
\
|
||||
_RWSTD_STATIC (type, int, radix, 2); \
|
||||
\
|
||||
_RWSTD_STATIC_FUN (type, epsilon, 0) \
|
||||
_RWSTD_STATIC_FUN (type, round_error, 0) \
|
||||
\
|
||||
_RWSTD_STATIC (type, int, min_exponent, 0); \
|
||||
_RWSTD_STATIC (type, int, min_exponent10, 0); \
|
||||
_RWSTD_STATIC (type, int, max_exponent, 0); \
|
||||
_RWSTD_STATIC (type, int, max_exponent10, 0); \
|
||||
\
|
||||
_RWSTD_STATIC (type, bool, has_infinity, false); \
|
||||
_RWSTD_STATIC (type, bool, has_quiet_NaN, false); \
|
||||
_RWSTD_STATIC (type, bool, has_signaling_NaN, false); \
|
||||
_RWSTD_STATIC (type, float_denorm_style, has_denorm, denorm_absent); \
|
||||
_RWSTD_STATIC (type, bool, has_denorm_loss, false); \
|
||||
\
|
||||
_RWSTD_STATIC_FUN (type, infinity, 0) \
|
||||
_RWSTD_STATIC_FUN (type, quiet_NaN, 0) \
|
||||
_RWSTD_STATIC_FUN (type, signaling_NaN, 0) \
|
||||
_RWSTD_STATIC_FUN (type, denorm_min, 0) \
|
||||
\
|
||||
_RWSTD_STATIC (type, bool, is_iec559, false); \
|
||||
_RWSTD_STATIC (type, bool, is_bounded, true); \
|
||||
_RWSTD_STATIC (type, bool, is_modulo, 1 != cpfx##_MAX); \
|
||||
\
|
||||
_RWSTD_STATIC (type, bool, traps, _RWSTD_INT_TRAPS); \
|
||||
_RWSTD_STATIC (type, bool, tinyness_before, false); \
|
||||
_RWSTD_STATIC (type, float_round_style, round_style, round_toward_zero);
|
||||
|
||||
|
||||
#undef _RWSTD_SPECIALIZE_LIMITS
|
||||
|
||||
#if !defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) \
|
||||
|| defined (_RWSTD_NO_EXT_CV_QUALIFIED_LIMITS)
|
||||
# define _RWSTD_SPECIALIZE_LIMITS(T, cpfx) \
|
||||
_RWSTD_CLASS_BEGIN (numeric_limits<T>) \
|
||||
_RWSTD_LIMITS_BODY (T, cpfx) \
|
||||
_RWSTD_CLASS_END
|
||||
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||
// define specializations for all cv-qualified types
|
||||
# define _RWSTD_SPECIALIZE_LIMITS(T, cpfx) \
|
||||
_RWSTD_CLASS_BEGIN (numeric_limits<T>) \
|
||||
_RWSTD_LIMITS_BODY (T, cpfx) \
|
||||
_RWSTD_CLASS_END \
|
||||
_RWSTD_CLASS_BEGIN (numeric_limits<const T>: numeric_limits<T>) \
|
||||
_RWSTD_CLASS_END \
|
||||
_RWSTD_CLASS_BEGIN (numeric_limits<volatile T>: numeric_limits<T>) \
|
||||
_RWSTD_CLASS_END \
|
||||
_RWSTD_CLASS_BEGIN (numeric_limits<const volatile T>: numeric_limits<T>) \
|
||||
_RWSTD_CLASS_END
|
||||
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
|
||||
|
||||
|
||||
#ifndef _RWSTD_LIMITS_PRIMARY_TEMPLATE_DEFINED
|
||||
# define _RWSTD_LIMITS_PRIMARY_TEMPLATE_DEFINED
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
enum float_round_style
|
||||
{
|
||||
round_indeterminate = -1,
|
||||
round_toward_zero = 0,
|
||||
round_to_nearest = 1,
|
||||
round_toward_infinity = 2,
|
||||
round_toward_neg_infinity = 3
|
||||
};
|
||||
|
||||
#ifdef _RWSTD_FLT_ROUNDS
|
||||
# define _RWSTD_ROUND_STYLE \
|
||||
0 == _RWSTD_FLT_ROUNDS ? round_toward_zero \
|
||||
: 1 == _RWSTD_FLT_ROUNDS ? round_to_nearest \
|
||||
: 2 == _RWSTD_FLT_ROUNDS ? round_toward_infinity \
|
||||
: 3 == _RWSTD_FLT_ROUNDS ? round_toward_neg_infinity \
|
||||
: round_indeterminate
|
||||
#else // if !defined (_RWSTD_FLT_ROUNDS)
|
||||
# define _RWSTD_ROUND_STYLE round_indeterminate
|
||||
#endif // _RWSTD_FLT_ROUNDS
|
||||
|
||||
|
||||
enum float_denorm_style
|
||||
{
|
||||
denorm_indeterminate = -1,
|
||||
denorm_absent = 0,
|
||||
denorm_present = 1
|
||||
};
|
||||
|
||||
template <class _TypeT>
|
||||
struct numeric_limits
|
||||
{
|
||||
// static consts below must be initialized in class so that
|
||||
// they can be used where const expressions are required (such
|
||||
// as in template parameters)
|
||||
|
||||
_RWSTD_STATIC_CONST (bool, is_specialized = false);
|
||||
|
||||
static _TypeT (min)() _THROWS (()) { return _TypeT (); }
|
||||
static _TypeT (max)() _THROWS (()) { return _TypeT (); }
|
||||
|
||||
_RWSTD_STATIC_CONST (int, digits = 0);
|
||||
_RWSTD_STATIC_CONST (int, digits10 = 0);
|
||||
|
||||
_RWSTD_STATIC_CONST (bool, is_signed = false);
|
||||
_RWSTD_STATIC_CONST (bool, is_integer = false);
|
||||
_RWSTD_STATIC_CONST (bool, is_exact = false);
|
||||
|
||||
_RWSTD_STATIC_CONST (int, radix = 0);
|
||||
|
||||
static _TypeT epsilon () _THROWS (()) { return _TypeT (); }
|
||||
static _TypeT round_error () _THROWS (()) { return _TypeT (); }
|
||||
|
||||
_RWSTD_STATIC_CONST (int, min_exponent = 0);
|
||||
_RWSTD_STATIC_CONST (int, min_exponent10 = 0);
|
||||
_RWSTD_STATIC_CONST (int, max_exponent = 0);
|
||||
_RWSTD_STATIC_CONST (int, max_exponent10 = 0);
|
||||
|
||||
_RWSTD_STATIC_CONST (bool, has_infinity = false);
|
||||
_RWSTD_STATIC_CONST (bool, has_quiet_NaN = false);
|
||||
_RWSTD_STATIC_CONST (bool, has_signaling_NaN = false);
|
||||
_RWSTD_STATIC_CONST (float_denorm_style, has_denorm = denorm_absent);
|
||||
_RWSTD_STATIC_CONST (bool, has_denorm_loss = false);
|
||||
|
||||
static _TypeT infinity () _THROWS (()) { return _TypeT (); }
|
||||
static _TypeT quiet_NaN () _THROWS (()) { return _TypeT (); }
|
||||
static _TypeT signaling_NaN () _THROWS (()) { return _TypeT (); }
|
||||
static _TypeT denorm_min () _THROWS (()) { return _TypeT (); }
|
||||
|
||||
_RWSTD_STATIC_CONST (bool, is_iec559 = false);
|
||||
_RWSTD_STATIC_CONST (bool, is_bounded = false);
|
||||
_RWSTD_STATIC_CONST (bool, is_modulo = false);
|
||||
_RWSTD_STATIC_CONST (bool, traps = false);
|
||||
_RWSTD_STATIC_CONST (bool, tinyness_before = false);
|
||||
_RWSTD_STATIC_CONST (float_round_style, round_style = round_toward_zero);
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif // _RWSTD_LIMITS_PRIMARY_TEMPLATE_DEFINED
|
||||
|
||||
|
||||
#ifndef _RWSTD_LIMITS_INCLUDED
|
||||
#define _RWSTD_LIMITS_INCLUDED
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
_RWSTD_CLASS_BEGIN (numeric_limits<float>)
|
||||
|
||||
_RWSTD_STATIC (float, bool, is_specialized, true);
|
||||
|
||||
_RWSTD_STATIC_FUN (float, (min), _RWSTD_FLT_MIN)
|
||||
_RWSTD_STATIC_FUN (float, (max), _RWSTD_FLT_MAX)
|
||||
|
||||
_RWSTD_STATIC (float, int, digits, _RWSTD_FLT_MANT_DIG);
|
||||
_RWSTD_STATIC (float, int, digits10, _RWSTD_FLT_DIG);
|
||||
|
||||
_RWSTD_STATIC (float, bool, is_signed, true);
|
||||
_RWSTD_STATIC (float, bool, is_integer, false);
|
||||
_RWSTD_STATIC (float, bool, is_exact, false);
|
||||
_RWSTD_STATIC (float, int, radix, _RWSTD_FLT_RADIX);
|
||||
|
||||
_RWSTD_STATIC_FUN (float, epsilon, _RWSTD_FLT_EPSILON)
|
||||
_RWSTD_STATIC_FUN (float, round_error, 0.5f)
|
||||
|
||||
_RWSTD_STATIC (float, int, min_exponent, _RWSTD_FLT_MIN_EXP);
|
||||
_RWSTD_STATIC (float, int, min_exponent10, _RWSTD_FLT_MIN_10_EXP);
|
||||
_RWSTD_STATIC (float, int, max_exponent, _RWSTD_FLT_MAX_EXP);
|
||||
_RWSTD_STATIC (float, int, max_exponent10, _RWSTD_FLT_MAX_10_EXP);
|
||||
|
||||
_RWSTD_STATIC (float, bool, has_infinity, _RWSTD_HAS_INFINITY);
|
||||
_RWSTD_STATIC (float, bool, has_quiet_NaN, _RWSTD_HAS_QUIET_NAN);
|
||||
_RWSTD_STATIC (float, bool, has_signaling_NaN, _RWSTD_HAS_SIG_NAN);
|
||||
_RWSTD_STATIC (float, float_denorm_style, has_denorm,
|
||||
float_denorm_style (_RWSTD_FLT_HAS_DENORM));
|
||||
_RWSTD_STATIC (float, bool, has_denorm_loss, _RWSTD_HAS_DENORM_LOSS);
|
||||
|
||||
_RWSTD_STATIC_FUN (float, infinity, _RW::__rw_flt_infinity)
|
||||
_RWSTD_STATIC_FUN (float, quiet_NaN, _RW::__rw_flt_qNaN)
|
||||
_RWSTD_STATIC_FUN (float, signaling_NaN, _RW::__rw_flt_sNaN)
|
||||
_RWSTD_STATIC_FUN (float, denorm_min, _RW::__rw_flt_denorm_min)
|
||||
|
||||
_RWSTD_STATIC (float, bool, is_iec559, _RWSTD_IS_IEC559);
|
||||
_RWSTD_STATIC (float, bool, is_bounded, true);
|
||||
_RWSTD_STATIC (float, bool, is_modulo, false);
|
||||
|
||||
_RWSTD_STATIC (float, bool, traps, _RWSTD_FLT_TRAPS);
|
||||
_RWSTD_STATIC (float, bool, tinyness_before, false);
|
||||
|
||||
_RWSTD_STATIC (float, float_round_style, round_style, _RWSTD_ROUND_STYLE);
|
||||
|
||||
_RWSTD_CLASS_END // numeric_limits<float>
|
||||
|
||||
|
||||
_RWSTD_CLASS_BEGIN (numeric_limits<double>)
|
||||
|
||||
_RWSTD_STATIC (double, bool, is_specialized, true);
|
||||
|
||||
_RWSTD_STATIC_FUN (double, (min), _RWSTD_DBL_MIN)
|
||||
_RWSTD_STATIC_FUN (double, (max), _RWSTD_DBL_MAX)
|
||||
|
||||
_RWSTD_STATIC (double, int, digits, _RWSTD_DBL_MANT_DIG);
|
||||
_RWSTD_STATIC (double, int, digits10, _RWSTD_DBL_DIG);
|
||||
|
||||
_RWSTD_STATIC (double, bool, is_signed, true);
|
||||
_RWSTD_STATIC (double, bool, is_integer, false);
|
||||
_RWSTD_STATIC (double, bool, is_exact, false);
|
||||
_RWSTD_STATIC (double, int, radix, _RWSTD_FLT_RADIX);
|
||||
|
||||
_RWSTD_STATIC_FUN (double, epsilon, _RWSTD_DBL_EPSILON)
|
||||
_RWSTD_STATIC_FUN (double, round_error, 0.5)
|
||||
|
||||
_RWSTD_STATIC (double, int, min_exponent, _RWSTD_DBL_MIN_EXP);
|
||||
_RWSTD_STATIC (double, int, min_exponent10, _RWSTD_DBL_MIN_10_EXP);
|
||||
_RWSTD_STATIC (double, int, max_exponent, _RWSTD_DBL_MAX_EXP);
|
||||
_RWSTD_STATIC (double, int, max_exponent10, _RWSTD_DBL_MAX_10_EXP);
|
||||
|
||||
_RWSTD_STATIC (double, bool, has_infinity, _RWSTD_HAS_INFINITY);
|
||||
_RWSTD_STATIC (double, bool, has_quiet_NaN, _RWSTD_HAS_QUIET_NAN);
|
||||
_RWSTD_STATIC (double, bool, has_signaling_NaN, _RWSTD_HAS_SIG_NAN);
|
||||
_RWSTD_STATIC (double, float_denorm_style, has_denorm,
|
||||
float_denorm_style (_RWSTD_DBL_HAS_DENORM));
|
||||
_RWSTD_STATIC (double, bool, has_denorm_loss, _RWSTD_HAS_DENORM_LOSS);
|
||||
|
||||
_RWSTD_STATIC_FUN (double, infinity, _RW::__rw_dbl_infinity)
|
||||
_RWSTD_STATIC_FUN (double, quiet_NaN, _RW::__rw_dbl_qNaN)
|
||||
_RWSTD_STATIC_FUN (double, signaling_NaN, _RW::__rw_dbl_sNaN)
|
||||
_RWSTD_STATIC_FUN (double, denorm_min, _RW::__rw_dbl_denorm_min)
|
||||
|
||||
_RWSTD_STATIC (double, bool, is_iec559, _RWSTD_IS_IEC559);
|
||||
_RWSTD_STATIC (double, bool, is_bounded, true);
|
||||
_RWSTD_STATIC (double, bool, is_modulo, false);
|
||||
|
||||
_RWSTD_STATIC (double, bool, traps, _RWSTD_DBL_TRAPS);
|
||||
_RWSTD_STATIC (double, bool, tinyness_before, false);
|
||||
|
||||
_RWSTD_STATIC (double, float_round_style, round_style, _RWSTD_ROUND_STYLE);
|
||||
|
||||
_RWSTD_CLASS_END // numeric_limits<double>
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
_RWSTD_CLASS_BEGIN (numeric_limits<long double>)
|
||||
|
||||
_RWSTD_STATIC (long double, bool, is_specialized, true);
|
||||
|
||||
_RWSTD_STATIC_FUN (long double, (min), _RWSTD_LDBL_MIN)
|
||||
_RWSTD_STATIC_FUN (long double, (max), _RWSTD_LDBL_MAX)
|
||||
|
||||
_RWSTD_STATIC (long double, int, digits, _RWSTD_LDBL_MANT_DIG);
|
||||
_RWSTD_STATIC (long double, int, digits10, _RWSTD_LDBL_DIG);
|
||||
|
||||
_RWSTD_STATIC (long double, bool, is_signed, true);
|
||||
_RWSTD_STATIC (long double, bool, is_integer, false);
|
||||
_RWSTD_STATIC (long double, bool, is_exact, false);
|
||||
_RWSTD_STATIC (long double, int, radix, _RWSTD_FLT_RADIX);
|
||||
|
||||
_RWSTD_STATIC_FUN (long double, epsilon, _RWSTD_LDBL_EPSILON)
|
||||
_RWSTD_STATIC_FUN (long double, round_error, 0.5L)
|
||||
|
||||
_RWSTD_STATIC (long double, int, min_exponent, _RWSTD_LDBL_MIN_EXP);
|
||||
_RWSTD_STATIC (long double, int, min_exponent10, _RWSTD_LDBL_MIN_10_EXP);
|
||||
_RWSTD_STATIC (long double, int, max_exponent, _RWSTD_LDBL_MAX_EXP);
|
||||
_RWSTD_STATIC (long double, int, max_exponent10, _RWSTD_LDBL_MAX_10_EXP);
|
||||
|
||||
_RWSTD_STATIC (long double, bool, has_infinity, _RWSTD_HAS_INFINITY);
|
||||
_RWSTD_STATIC (long double, bool, has_quiet_NaN, _RWSTD_HAS_QUIET_NAN);
|
||||
_RWSTD_STATIC (long double, bool, has_signaling_NaN, _RWSTD_HAS_SIG_NAN);
|
||||
_RWSTD_STATIC (long double, float_denorm_style, has_denorm,
|
||||
float_denorm_style (_RWSTD_LDBL_HAS_DENORM));
|
||||
_RWSTD_STATIC (long double, bool, has_denorm_loss, _RWSTD_HAS_DENORM_LOSS);
|
||||
|
||||
_RWSTD_STATIC_FUN (long double, infinity, _RW::__rw_ldbl_infinity)
|
||||
_RWSTD_STATIC_FUN (long double, quiet_NaN, _RW::__rw_ldbl_qNaN)
|
||||
_RWSTD_STATIC_FUN (long double, signaling_NaN, _RW::__rw_ldbl_sNaN)
|
||||
_RWSTD_STATIC_FUN (long double, denorm_min, _RW::__rw_ldbl_denorm_min)
|
||||
|
||||
_RWSTD_STATIC (long double, bool, is_iec559, _RWSTD_IS_IEC559);
|
||||
_RWSTD_STATIC (long double, bool, is_bounded, true);
|
||||
_RWSTD_STATIC (long double, bool, is_modulo, false);
|
||||
|
||||
_RWSTD_STATIC (long double, bool, traps, _RWSTD_LDBL_TRAPS);
|
||||
_RWSTD_STATIC (long double, bool, tinyness_before, false);
|
||||
|
||||
_RWSTD_STATIC (long double, float_round_style, round_style,
|
||||
_RWSTD_ROUND_STYLE);
|
||||
|
||||
_RWSTD_CLASS_END // numeric_limits<long double>
|
||||
|
||||
#endif // _RWSTD_NO_LONG_DOUBLE
|
||||
|
||||
|
||||
// define numeric_limits<> integral specializations
|
||||
_RWSTD_SPECIALIZE_LIMITS (char, _RWSTD_CHAR)
|
||||
_RWSTD_SPECIALIZE_LIMITS (unsigned char, _RWSTD_UCHAR)
|
||||
_RWSTD_SPECIALIZE_LIMITS (signed char, _RWSTD_SCHAR)
|
||||
_RWSTD_SPECIALIZE_LIMITS (short int, _RWSTD_SHRT)
|
||||
_RWSTD_SPECIALIZE_LIMITS (unsigned short, _RWSTD_USHRT)
|
||||
_RWSTD_SPECIALIZE_LIMITS (int, _RWSTD_INT)
|
||||
_RWSTD_SPECIALIZE_LIMITS (unsigned int, _RWSTD_UINT)
|
||||
_RWSTD_SPECIALIZE_LIMITS (long int, _RWSTD_LONG)
|
||||
_RWSTD_SPECIALIZE_LIMITS (unsigned long int, _RWSTD_ULONG)
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_WCHAR_T
|
||||
# ifndef _RWSTD_NO_NATIVE_WCHAR_T
|
||||
|
||||
_RWSTD_SPECIALIZE_LIMITS (wchar_t, _RWSTD_WCHAR)
|
||||
|
||||
# endif // _RWSTD_NO_NATIVE_WCHAR_T
|
||||
#endif // _RWSTD_NO_WCHAR_T
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_BOOL
|
||||
# ifndef _RWSTD_NO_NATIVE_BOOL
|
||||
|
||||
_RWSTD_SPECIALIZE_LIMITS (bool, _RWSTD_BOOL)
|
||||
|
||||
# endif // _RWSTD_NO_NATIVE_BOOL
|
||||
#endif // _RWSTD_NO_BOOL
|
||||
|
||||
|
||||
#ifdef _RWSTD_LONG_LONG
|
||||
|
||||
_RWSTD_SPECIALIZE_LIMITS (_RWSTD_LONG_LONG, _RWSTD_LLONG)
|
||||
_RWSTD_SPECIALIZE_LIMITS (unsigned _RWSTD_LONG_LONG, _RWSTD_ULLONG)
|
||||
|
||||
#endif // _RWSTD_LONG_LONG
|
||||
|
||||
|
||||
#ifndef _RWSTD_LIMITS_PARTIAL_SPEC_DEFINED
|
||||
# define _RWSTD_LIMITS_PARTIAL_SPEC_DEFINED
|
||||
|
||||
# ifndef _RWSTD_NO_EXT_CV_QUALIFIED_LIMITS
|
||||
# ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
||||
|
||||
template <class _TypeT>
|
||||
struct numeric_limits<const _TypeT>: numeric_limits<_TypeT> { };
|
||||
|
||||
template <class _TypeT>
|
||||
struct numeric_limits<volatile _TypeT>: numeric_limits<_TypeT> { };
|
||||
|
||||
template <class _TypeT>
|
||||
struct numeric_limits<const volatile _TypeT>: numeric_limits<_TypeT> { };
|
||||
|
||||
# endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
|
||||
# endif // _RWSTD_NO_EXT_CV_QUALIFIED_LIMITS
|
||||
#endif // _RWSTD_LIMITS_PARTIAL_SPEC_DEFINED
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_IMPLICIT_INCLUSION
|
||||
# include <limits.cc>
|
||||
#endif
|
||||
|
||||
#endif // _RWSTD_LIMITS_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/limits.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/limits.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* limits.c
|
||||
*
|
||||
* $Id: limits.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 <limits.cc>
|
||||
104
extern/stdcxx/4.2.1/include/limits.cc
vendored
Normal file
104
extern/stdcxx/4.2.1/include/limits.cc
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* limits.cc - definitions of numeric_limits static data members
|
||||
*
|
||||
* $Id: limits.cc 550991 2007-06-26 23:58:07Z 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
#if !defined (_RWSTD_NO_STATIC_CONST_MEMBER_INIT) \
|
||||
&& !defined (_RWSTD_DEFINE_EXPORTS)
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::is_specialized;
|
||||
|
||||
template <class _TypeT>
|
||||
const int numeric_limits<_TypeT>::digits;
|
||||
|
||||
template <class _TypeT>
|
||||
const int numeric_limits<_TypeT>::digits10;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::is_signed;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::is_integer;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::is_exact;
|
||||
|
||||
template <class _TypeT>
|
||||
const int numeric_limits<_TypeT>::radix;
|
||||
|
||||
template <class _TypeT>
|
||||
const int numeric_limits<_TypeT>::min_exponent;
|
||||
|
||||
template <class _TypeT>
|
||||
const int numeric_limits<_TypeT>::min_exponent10;
|
||||
|
||||
template <class _TypeT>
|
||||
const int numeric_limits<_TypeT>::max_exponent;
|
||||
|
||||
template <class _TypeT>
|
||||
const int numeric_limits<_TypeT>::max_exponent10;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::has_infinity;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::has_quiet_NaN;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::has_signaling_NaN;
|
||||
|
||||
template <class _TypeT>
|
||||
const float_denorm_style numeric_limits<_TypeT>::has_denorm;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::has_denorm_loss;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::is_iec559;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::is_bounded;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::is_modulo;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::traps;
|
||||
|
||||
template <class _TypeT>
|
||||
const bool numeric_limits<_TypeT>::tinyness_before;
|
||||
|
||||
template <class _TypeT>
|
||||
const float_round_style numeric_limits<_TypeT>::round_style;
|
||||
|
||||
#endif // !_RWSTD_NO_STATIC_CONST_MEMBER_INIT && !_RWSTD_DEFINE_EXPORTS
|
||||
|
||||
|
||||
} // namespace std
|
||||
850
extern/stdcxx/4.2.1/include/list
vendored
Normal file
850
extern/stdcxx/4.2.1/include/list
vendored
Normal file
@@ -0,0 +1,850 @@
|
||||
// -*- C++ -*-
|
||||
/***************************************************************************
|
||||
*
|
||||
* <list> - definition of the C++ Standard Library list class template
|
||||
*
|
||||
* $Id: list 588724 2007-10-26 17:56:46Z 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.
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RWSTD_LIST_INCLUDED
|
||||
#define _RWSTD_LIST_INCLUDED
|
||||
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <rw/_algobase.h>
|
||||
#include <rw/_iterator.h>
|
||||
#include <rw/_select.h>
|
||||
#include <rw/_defs.h>
|
||||
#include <rw/_error.h>
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
template <class _TypeT>
|
||||
struct __rw_list_node
|
||||
{
|
||||
__rw_list_node* _C_next; // pointer to next node
|
||||
__rw_list_node* _C_prev; // pointer to previous node
|
||||
_TypeT _C_data; // client data
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT, class _Pointer, class _Reference>
|
||||
class __rw_list_iter
|
||||
: public iterator <bidirectional_iterator_tag,
|
||||
_TypeT, _DiffT, _Pointer, _Reference>
|
||||
{
|
||||
typedef iterator <bidirectional_iterator_tag,
|
||||
_TypeT, _DiffT, _Pointer, _Reference>
|
||||
_C_iter_base;
|
||||
|
||||
public:
|
||||
|
||||
typedef _TYPENAME _C_iter_base::value_type value_type;
|
||||
typedef _TYPENAME _C_iter_base::difference_type difference_type;
|
||||
typedef _TYPENAME _C_iter_base::pointer pointer;
|
||||
typedef _TYPENAME _C_iter_base::reference reference;
|
||||
|
||||
// const_pointer and const_reference must be explicity typedef'ed to
|
||||
// const value_type* and const value_type& since we don't know if
|
||||
// _Pointer and _Reference are const types (they aren't if this isn't
|
||||
// a const iterator)
|
||||
typedef const value_type* const_pointer;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
typedef bidirectional_iterator_tag iterator_category;
|
||||
|
||||
typedef __rw_list_iter <value_type, difference_type,
|
||||
value_type*, value_type&> _C_mutable_iter;
|
||||
|
||||
typedef __rw_list_node<value_type>* _C_link_type;
|
||||
|
||||
__rw_list_iter () { }
|
||||
|
||||
__rw_list_iter (const _C_link_type& __rhs)
|
||||
: _C_node (__rhs) { }
|
||||
|
||||
// no copy ctor other than the one below defined; will use
|
||||
// a compiler generated one if __rw_list_iter != _C_mutable_iter
|
||||
__rw_list_iter (const _C_mutable_iter &__rhs)
|
||||
: _C_node (__rhs._C_node) { }
|
||||
|
||||
__rw_list_iter& operator++ () {
|
||||
_C_node = (_C_link_type)((*_C_node)._C_next);
|
||||
return *this;
|
||||
}
|
||||
|
||||
__rw_list_iter& operator-- () {
|
||||
_C_node = (_C_link_type)((*_C_node)._C_prev);
|
||||
return *this;
|
||||
}
|
||||
|
||||
__rw_list_iter operator++ (int) {
|
||||
__rw_list_iter __tmp = *this;
|
||||
return ++*this, __tmp;
|
||||
}
|
||||
|
||||
__rw_list_iter operator-- (int) {
|
||||
__rw_list_iter __tmp = *this;
|
||||
return --*this, __tmp;
|
||||
}
|
||||
|
||||
reference operator* () const {
|
||||
return (*_C_node)._C_data;
|
||||
}
|
||||
|
||||
_RWSTD_OPERATOR_ARROW (pointer operator-> () const);
|
||||
|
||||
difference_type operator- (const __rw_list_iter&) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool operator== (const __rw_list_iter& __iter) const {
|
||||
return _C_node == __iter._C_node;
|
||||
}
|
||||
|
||||
bool operator!= (const __rw_list_iter& __iter) const {
|
||||
return !(*this == __iter);
|
||||
}
|
||||
|
||||
// private:
|
||||
|
||||
_C_link_type _C_node;
|
||||
};
|
||||
|
||||
|
||||
#undef _ITER_NODE
|
||||
#define _ITER_NODE(it) (_ITER_BASE (it)._C_node)
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT, class _Ptr1, class _Ref1,
|
||||
class _Ptr2, class _Ref2>
|
||||
inline bool
|
||||
operator== (const __rw_list_iter<_TypeT, _DiffT, _Ptr1, _Ref1> &__x,
|
||||
const __rw_list_iter<_TypeT, _DiffT, _Ptr2, _Ref2> &__y)
|
||||
|
||||
{
|
||||
return __x._C_node == __y._C_node;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _DiffT, class _Ptr1, class _Ref1,
|
||||
class _Ptr2, class _Ref2>
|
||||
inline bool
|
||||
operator!= (const __rw_list_iter<_TypeT, _DiffT, _Ptr1, _Ref1> &__x,
|
||||
const __rw_list_iter<_TypeT, _DiffT, _Ptr2, _Ref2> &__y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
|
||||
_EXPORT
|
||||
template <class _TypeT, class _Allocator = allocator<_TypeT> >
|
||||
class list : private _Allocator
|
||||
{
|
||||
public:
|
||||
|
||||
typedef _TypeT value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef _TYPENAME allocator_type::reference reference;
|
||||
typedef _TYPENAME allocator_type::const_reference const_reference;
|
||||
typedef _TYPENAME allocator_type::size_type size_type;
|
||||
typedef _TYPENAME allocator_type::difference_type difference_type;
|
||||
typedef _TYPENAME allocator_type::pointer pointer;
|
||||
typedef _TYPENAME allocator_type::const_pointer const_pointer;
|
||||
typedef __rw_list_node<value_type> _C_list_node;
|
||||
typedef _C_list_node* _C_link_type;
|
||||
|
||||
typedef _RWSTD_REBIND (allocator_type, _C_list_node) _C_node_alloc_type;
|
||||
typedef _RWSTD_ALLOC_TYPE (allocator_type, value_type) _C_value_alloc_type;
|
||||
|
||||
|
||||
typedef __rw_list_iter<value_type, difference_type, pointer, reference>
|
||||
_C_list_iter;
|
||||
|
||||
typedef __rw_list_iter<value_type, difference_type, const_pointer,
|
||||
const_reference>
|
||||
_C_list_citer;
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_DEBUG_ITER
|
||||
|
||||
typedef _RW::__rw_debug_iter <list,_C_list_iter, _C_list_iter>
|
||||
iterator;
|
||||
|
||||
typedef _RW::__rw_debug_iter <list,_C_list_citer, _C_list_iter>
|
||||
const_iterator;
|
||||
|
||||
|
||||
iterator _C_make_iter (const _C_link_type &__node) {
|
||||
return iterator (*this, _C_list_iter (__node));
|
||||
}
|
||||
|
||||
const_iterator _C_make_iter (const _C_link_type &__node) const {
|
||||
return const_iterator (*this, _C_list_citer (__node));
|
||||
}
|
||||
|
||||
#else // if defined (_RWSTD_NO_DEBUG_ITER)
|
||||
|
||||
typedef _C_list_iter iterator;
|
||||
typedef _C_list_citer const_iterator;
|
||||
|
||||
iterator _C_make_iter (const _C_link_type &__node) {
|
||||
return iterator (__node);
|
||||
}
|
||||
|
||||
const_iterator _C_make_iter (const _C_link_type &__node) const {
|
||||
return const_iterator (__node);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_DEBUG_ITER
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||
|
||||
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _STD::reverse_iterator<iterator> reverse_iterator;
|
||||
|
||||
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||
|
||||
typedef std::reverse_iterator<const_iterator,
|
||||
bidirectional_iterator_tag, value_type,
|
||||
const_reference, const_pointer, difference_type>
|
||||
const_reverse_iterator;
|
||||
|
||||
typedef std::reverse_iterator<iterator,
|
||||
bidirectional_iterator_tag, value_type,
|
||||
reference, pointer, difference_type>
|
||||
reverse_iterator;
|
||||
|
||||
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
|
||||
|
||||
protected:
|
||||
|
||||
#ifndef _RWSTD_NO_LIST_NODE_BUFFER
|
||||
|
||||
// Node buffer data structure
|
||||
struct _C_nodebuf {
|
||||
typedef _RWSTD_REBIND (allocator_type, _C_nodebuf) _C_alloc_type;
|
||||
typedef _TYPENAME _C_alloc_type::pointer _C_pointer;
|
||||
|
||||
_C_pointer _C_next_buf;
|
||||
size_type _C_bufsize;
|
||||
_C_link_type _C_buffer;
|
||||
};
|
||||
|
||||
typedef _TYPENAME _C_nodebuf::_C_alloc_type _C_buf_alloc_type;
|
||||
typedef _TYPENAME _C_nodebuf::_C_pointer _C_buf_pointer;
|
||||
|
||||
void _C_add_buffer (bool);
|
||||
void _C_free_buffers ();
|
||||
|
||||
_C_buf_pointer _C_buflist;
|
||||
_C_link_type _C_free_list;
|
||||
|
||||
#endif // _RWSTD_USE_LIST_NODE_BUFFER
|
||||
|
||||
|
||||
_C_link_type _C_next_avail;
|
||||
_C_link_type _C_last;
|
||||
_C_link_type _C_node;
|
||||
size_type _C_length;
|
||||
|
||||
|
||||
|
||||
// Macros used later in node buffer management
|
||||
#if !defined (_RWSTD_NO_LIST_NODE_BUFFER)
|
||||
|
||||
# define _RWSTD_NODE_BUFFER_INIT(blist,flist) \
|
||||
_C_buflist (blist), _C_free_list (flist),
|
||||
|
||||
# define _RWSTD_NODE_LIST_FREE() \
|
||||
_C_free_buffers ()
|
||||
|
||||
# define _RWSTD_NODE_LIST_SWAP(other) \
|
||||
_STD::swap (_C_buflist, other._C_buflist); \
|
||||
_STD::swap (_C_free_list, other._C_free_list)
|
||||
|
||||
# define _RWSTD_LIST_INSERT_RANGE(b,e,v) \
|
||||
_TRY { \
|
||||
insert (b, e, v); \
|
||||
} _CATCH (...) { \
|
||||
_RWSTD_NODE_LIST_FREE(); \
|
||||
_RETHROW; \
|
||||
} typedef void __dummy_t
|
||||
|
||||
_C_link_type _C_get_node (bool __empty_list = false) {
|
||||
if (_C_free_list) {
|
||||
_C_link_type __tmp = _C_free_list;
|
||||
_C_free_list = _C_free_list->_C_next;
|
||||
return __tmp;
|
||||
}
|
||||
if (_C_next_avail == _C_last)
|
||||
_C_add_buffer (__empty_list);
|
||||
return _C_next_avail++;
|
||||
}
|
||||
|
||||
void _C_put_node (_C_link_type __link) {
|
||||
__link->_C_next = _C_free_list;
|
||||
_C_free_list = __link;
|
||||
}
|
||||
|
||||
#else // defined (_RWSTD_NO_LIST_NODE_BUFFER)
|
||||
|
||||
# define _RWSTD_NODE_BUFFER_INIT(ignore0,ignore1)
|
||||
# define _RWSTD_NODE_LIST_FREE()
|
||||
# define _RWSTD_NODE_LIST_SWAP(ignore)
|
||||
|
||||
# define _RWSTD_LIST_INSERT_RANGE(b,e,v) \
|
||||
insert (b,e,v)
|
||||
|
||||
_C_link_type _C_get_node (bool = false) {
|
||||
return _C_node_alloc_type (*this).allocate (1, (void*)_C_last);
|
||||
}
|
||||
|
||||
void _C_put_node (_C_link_type __link) {
|
||||
_C_node_alloc_type (*this).deallocate (__link, 1);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_LIST_NODE_BUFFER
|
||||
|
||||
# define _RWSTD_LIST_SAFE_INSERT_RANGE(__it, __first, __last) \
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it); \
|
||||
_RWSTD_ASSERT_RANGE (__first, __last); \
|
||||
\
|
||||
if (!(__first == __last)) { \
|
||||
iterator __start = __it; \
|
||||
\
|
||||
_TRY { \
|
||||
__start = insert (__it, *__first); \
|
||||
\
|
||||
while (!(++__first == __last)) \
|
||||
insert (__it, *__first); \
|
||||
} _CATCH (...) { \
|
||||
erase (__start, __it); \
|
||||
_RETHROW; \
|
||||
} \
|
||||
} typedef void __dummy_t
|
||||
|
||||
|
||||
// here and only here is _C_node initialized
|
||||
void _C_init (bool __empty_list = false) {
|
||||
_C_node = _C_get_node (__empty_list);
|
||||
|
||||
(*_C_node)._C_next = _C_node;
|
||||
(*_C_node)._C_prev = _C_node;
|
||||
}
|
||||
|
||||
void _C_init (size_type __n, const value_type& __val) {
|
||||
_C_init();
|
||||
_RWSTD_LIST_INSERT_RANGE (begin (), __n, __val);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
_EXPLICIT
|
||||
list (const allocator_type& __alloc = allocator_type ())
|
||||
: allocator_type (__alloc), _RWSTD_NODE_BUFFER_INIT(0,0)
|
||||
_C_next_avail (0), _C_last (0), _C_node (0), _C_length (0) {
|
||||
_C_init (true);
|
||||
}
|
||||
|
||||
_EXPLICIT
|
||||
list (size_type __n,
|
||||
const_reference __x = value_type (),
|
||||
const allocator_type &__alloc = allocator_type ())
|
||||
: allocator_type (__alloc), _RWSTD_NODE_BUFFER_INIT(0,0)
|
||||
_C_next_avail (0), _C_last (0), _C_node (0), _C_length (0) {
|
||||
_C_init (__n, __x);
|
||||
}
|
||||
|
||||
template<class _InputIterator>
|
||||
void _C_init (_InputIterator __first, _InputIterator __last, void*) {
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
_C_init();
|
||||
_RWSTD_LIST_INSERT_RANGE (begin (), __first, __last);
|
||||
}
|
||||
|
||||
template<class _InputIterator>
|
||||
void _C_init (_InputIterator __first, _InputIterator __last, int) {
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
_C_init (__first, __last);
|
||||
}
|
||||
|
||||
template<class _InputIterator>
|
||||
list (_InputIterator __first, _InputIterator __last,
|
||||
const allocator_type& __alloc = allocator_type ())
|
||||
: allocator_type (__alloc), _RWSTD_NODE_BUFFER_INIT(0,0)
|
||||
_C_next_avail (0), _C_last (0), _C_node (0), _C_length (0) {
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
_C_init (__first, __last, _RWSTD_DISPATCH (_InputIterator));
|
||||
}
|
||||
|
||||
list (const list &__rhs)
|
||||
: allocator_type(__rhs.get_allocator()), _RWSTD_NODE_BUFFER_INIT(0,0)
|
||||
_C_next_avail (0), _C_last (0), _C_node (0), _C_length (0) {
|
||||
_C_init();
|
||||
_RWSTD_LIST_INSERT_RANGE (begin (), __rhs.begin (), __rhs.end ());
|
||||
}
|
||||
|
||||
~list ();
|
||||
|
||||
list& operator= (const list&);
|
||||
|
||||
template<class _InputIterator>
|
||||
void assign (_InputIterator __first, _InputIterator __last) {
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
|
||||
clear ();
|
||||
_C_insert (begin (), __first, __last,
|
||||
_RWSTD_DISPATCH (_InputIterator));
|
||||
}
|
||||
|
||||
void assign (size_type __n, const_reference __val) {
|
||||
clear ();
|
||||
insert (begin (), __n, __val);
|
||||
}
|
||||
|
||||
allocator_type get_allocator () const {
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator begin () {
|
||||
return _C_make_iter ((*_C_node)._C_next);
|
||||
}
|
||||
|
||||
const_iterator begin () const {
|
||||
return _C_make_iter ((*_C_node)._C_next);
|
||||
}
|
||||
|
||||
iterator end () {
|
||||
return _C_make_iter (_C_node);
|
||||
}
|
||||
|
||||
const_iterator end () const {
|
||||
return _C_make_iter (_C_node);
|
||||
}
|
||||
|
||||
reverse_iterator rbegin () {
|
||||
return reverse_iterator (end ());
|
||||
}
|
||||
|
||||
const_reverse_iterator rbegin () const {
|
||||
return const_reverse_iterator (end ());
|
||||
}
|
||||
|
||||
reverse_iterator rend () {
|
||||
return reverse_iterator (begin ());
|
||||
}
|
||||
|
||||
const_reverse_iterator rend () const {
|
||||
return const_reverse_iterator (begin ());
|
||||
}
|
||||
|
||||
bool empty () const {
|
||||
return 0 == size ();
|
||||
}
|
||||
|
||||
size_type size () const {
|
||||
return _C_length;
|
||||
}
|
||||
|
||||
size_type max_size () const {
|
||||
return _C_node_alloc_type (*this).max_size ();
|
||||
}
|
||||
|
||||
void resize (size_type, value_type);
|
||||
|
||||
void resize (size_type __n) {
|
||||
resize (__n, value_type ());
|
||||
}
|
||||
|
||||
reference front () {
|
||||
_RWSTD_ASSERT (!empty ());
|
||||
return *begin ();
|
||||
}
|
||||
|
||||
const_reference front () const {
|
||||
_RWSTD_ASSERT (!empty ());
|
||||
return *begin ();
|
||||
}
|
||||
|
||||
reference back () {
|
||||
_RWSTD_ASSERT (!empty ());
|
||||
return *--end ();
|
||||
}
|
||||
|
||||
const_reference back () const {
|
||||
_RWSTD_ASSERT (!empty ());
|
||||
return *--end ();
|
||||
}
|
||||
|
||||
void push_front (const_reference __x) {
|
||||
insert (begin (), __x);
|
||||
_RWSTD_ASSERT (!empty ());
|
||||
}
|
||||
|
||||
void push_back (const_reference __x) {
|
||||
insert (end (), __x);
|
||||
_RWSTD_ASSERT (!empty ());
|
||||
}
|
||||
|
||||
void pop_front () {
|
||||
_RWSTD_ASSERT (!empty ());
|
||||
erase (begin ());
|
||||
}
|
||||
|
||||
void pop_back () {
|
||||
_RWSTD_ASSERT (!empty ());
|
||||
erase (--end ());
|
||||
}
|
||||
|
||||
iterator insert (iterator __it, const_reference __x);
|
||||
|
||||
// handles nonintegral types
|
||||
template<class _InputIterator>
|
||||
void _C_insert (const iterator &__it,
|
||||
_InputIterator __first, _InputIterator __last, void*) {
|
||||
|
||||
_RWSTD_LIST_SAFE_INSERT_RANGE (__it, __first, __last);
|
||||
}
|
||||
|
||||
// handles integral types
|
||||
template<class _InputIterator>
|
||||
void _C_insert (const iterator &__it,
|
||||
_InputIterator __first, _InputIterator __last, int) {
|
||||
_C_insert (__it, size_type (__first), const_reference (__last));
|
||||
}
|
||||
|
||||
template<class _InputIterator>
|
||||
void insert (iterator __it,
|
||||
_InputIterator __first, _InputIterator __last) {
|
||||
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it);
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
|
||||
// calling insert on a list specialized on an integral type
|
||||
// may lead to ambiguities if the actual function arguments do not
|
||||
// exactly match those of the non-templatized function (below)
|
||||
// the dispatch mechanism determines whether the arguments
|
||||
// really are iterators or whether they are just integral types
|
||||
// and calls the appropriate implementation function
|
||||
_C_insert (__it, __first, __last, _RWSTD_DISPATCH (_InputIterator));
|
||||
}
|
||||
|
||||
void insert (iterator __it, size_type __n, const_reference __val) {
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it);
|
||||
|
||||
_C_insert (__it, __n, __val);
|
||||
}
|
||||
|
||||
iterator erase (iterator);
|
||||
|
||||
iterator erase (iterator, iterator);
|
||||
|
||||
void swap (list&);
|
||||
|
||||
void clear () {
|
||||
erase (begin (), end ());
|
||||
}
|
||||
|
||||
#if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
|
||||
friend void swap (list& __lhs, list& __rhs) {
|
||||
__lhs.swap (__rhs);
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
void _C_transfer (iterator, iterator, iterator, list&);
|
||||
|
||||
void _C_advance (iterator &__it, difference_type __n,
|
||||
const iterator &__end) {
|
||||
while (__n-- && !(__it == __end))
|
||||
++__it;
|
||||
}
|
||||
|
||||
// uses transfer_node to merge in list by transfering nodes to list
|
||||
void _C_adjacent_merge (iterator, iterator, iterator);
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
// uses transfer_node to merge in list by transfering nodes to list
|
||||
template<class _Compare>
|
||||
void _C_adjacent_merge (iterator, iterator, iterator, _Compare);
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
void _C_adjacent_merge (iterator, iterator, iterator,
|
||||
bool (*)(const_reference, const_reference));
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
void _C_insert (iterator __it, size_type __n, const_reference __x) {
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it);
|
||||
|
||||
if (__n) {
|
||||
iterator __start = __it;
|
||||
|
||||
_TRY {
|
||||
__start = insert (__it, __x);
|
||||
|
||||
while (--__n)
|
||||
insert (__it, __x);
|
||||
} _CATCH (...) {
|
||||
erase (__start, __it);
|
||||
_RETHROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// 23.2.2.4, p4
|
||||
void splice (iterator, list&);
|
||||
|
||||
// 23.2.2.4, p7
|
||||
void splice (iterator, list&, iterator);
|
||||
|
||||
// 23.2.2.4, p11
|
||||
void splice (iterator, list&, iterator, iterator);
|
||||
|
||||
void remove (const_reference);
|
||||
|
||||
void unique ();
|
||||
|
||||
void merge (list&);
|
||||
|
||||
void reverse ();
|
||||
|
||||
void sort ();
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template<class _Predicate>
|
||||
void remove_if (_Predicate);
|
||||
|
||||
template<class _BinaryPredicate>
|
||||
void unique (_BinaryPredicate);
|
||||
|
||||
template<class _Compare>
|
||||
void merge (list &__x, _Compare);
|
||||
|
||||
template<class _Compare>
|
||||
void sort (_Compare);
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
void remove_if (bool (*)(const_reference));
|
||||
|
||||
void unique (bool (*)(const_reference, const_reference));
|
||||
|
||||
void merge (list &__x, bool (*)(const_reference, const_reference));
|
||||
|
||||
void sort (bool (*)(const_reference, const_reference));
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
};
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator== (const list<_TypeT, _Allocator>& __x,
|
||||
const list<_TypeT, _Allocator>& __y)
|
||||
{
|
||||
return __x.size () == __y.size ()
|
||||
&& equal (__x.begin (), __x.end (), __y.begin ());
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator< (const list<_TypeT, _Allocator>& __x,
|
||||
const list<_TypeT, _Allocator>& __y)
|
||||
{
|
||||
return lexicographical_compare (__x.begin (), __x.end (),
|
||||
__y.begin (), __y.end ());
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator!= (const list<_TypeT, _Allocator>& __x,
|
||||
const list<_TypeT, _Allocator>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator<= (const list<_TypeT, _Allocator>& __x,
|
||||
const list<_TypeT, _Allocator>& __y)
|
||||
{
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator> (const list<_TypeT, _Allocator>& __x,
|
||||
const list<_TypeT, _Allocator>& __y)
|
||||
{
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline bool
|
||||
operator>= (const list<_TypeT, _Allocator>& __x,
|
||||
const list<_TypeT, _Allocator>& __y)
|
||||
{
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_PART_SPEC_OVERLOAD
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline void swap (list<_TypeT, _Allocator>& __x,
|
||||
list<_TypeT, _Allocator>& __y)
|
||||
{
|
||||
__x.swap (__y);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_PART_SPEC_OVERLOAD
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline _TYPENAME list<_TypeT, _Allocator>::iterator
|
||||
list<_TypeT, _Allocator>::insert (iterator __it, const_reference __x)
|
||||
{
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it);
|
||||
|
||||
// create temporary allocator for non-conforming compilers
|
||||
// which need to use allocator_interface
|
||||
_C_link_type __tmp = _C_get_node (false);
|
||||
|
||||
_TRY {
|
||||
_RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this,
|
||||
construct (_RWSTD_VALUE_ALLOC
|
||||
(_C_value_alloc_type, *this,
|
||||
address ((*__tmp)._C_data)), __x));
|
||||
}
|
||||
_CATCH (...) {
|
||||
_C_put_node (__tmp);
|
||||
_RETHROW;
|
||||
}
|
||||
|
||||
(*__tmp)._C_next = _ITER_NODE (__it);
|
||||
(*__tmp)._C_prev = (*_ITER_NODE (__it))._C_prev;
|
||||
|
||||
(*(_C_link_type ((*_ITER_NODE (__it))._C_prev)))._C_next = __tmp;
|
||||
|
||||
(*_ITER_NODE (__it))._C_prev = __tmp;
|
||||
|
||||
++_C_length;
|
||||
|
||||
return _C_make_iter (__tmp);
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline _TYPENAME list<_TypeT, _Allocator>::iterator
|
||||
list<_TypeT, _Allocator>::erase (iterator __it)
|
||||
{
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it);
|
||||
|
||||
if (__it == end ())
|
||||
return end ();
|
||||
|
||||
iterator __tmp =
|
||||
_C_make_iter (_C_link_type ((*_ITER_NODE (__it))._C_next));
|
||||
|
||||
(*(_C_link_type ((*_ITER_NODE (__it))._C_prev)))._C_next =
|
||||
(*_ITER_NODE (__it))._C_next;
|
||||
(*(_C_link_type ((*_ITER_NODE (__it))._C_next)))._C_prev =
|
||||
(*_ITER_NODE (__it))._C_prev;
|
||||
|
||||
--_C_length;
|
||||
|
||||
_RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this,
|
||||
destroy (_RWSTD_VALUE_ALLOC (_C_value_alloc_type,
|
||||
*this, address ((*_ITER_NODE (__it))._C_data))));
|
||||
_C_put_node (_ITER_NODE (__it));
|
||||
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
inline void
|
||||
list<_TypeT, _Allocator>::swap (list &__x)
|
||||
{
|
||||
if (get_allocator () == __x.get_allocator ()) {
|
||||
_STD::swap (_C_node, __x._C_node);
|
||||
_STD::swap (_C_length, __x._C_length);
|
||||
|
||||
_RWSTD_NODE_LIST_SWAP(__x);
|
||||
|
||||
_STD::swap (_C_next_avail, __x._C_next_avail);
|
||||
_STD::swap (_C_last, __x._C_last);
|
||||
}
|
||||
else {
|
||||
list __tmp (*this);
|
||||
*this = __x;
|
||||
__x = __tmp;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_IMPLICIT_INCLUSION
|
||||
# include <list.cc>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_STL_SPECIALIZATION
|
||||
# include "list_spec.h"
|
||||
#endif // _RWSTD_NO_STL_SPECIALIZATION
|
||||
|
||||
|
||||
#endif //_RWSTD_LIST_INCLUDED
|
||||
29
extern/stdcxx/4.2.1/include/list.c
vendored
Normal file
29
extern/stdcxx/4.2.1/include/list.c
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* list.c
|
||||
*
|
||||
* $Id: list.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 <list.cc>
|
||||
626
extern/stdcxx/4.2.1/include/list.cc
vendored
Normal file
626
extern/stdcxx/4.2.1/include/list.cc
vendored
Normal file
@@ -0,0 +1,626 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* list.cc - Non-nline list definitions for the Standard Library
|
||||
*
|
||||
* $Id: list.cc 596318 2007-11-19 14:57:10Z faridz $
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* 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 _TypeT, class _Allocator>
|
||||
list<_TypeT, _Allocator>::
|
||||
~list ()
|
||||
{
|
||||
if (_C_node) {
|
||||
clear ();
|
||||
_C_put_node (_C_node);
|
||||
_RWSTD_NODE_LIST_FREE ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
_TYPENAME list<_TypeT, _Allocator>::iterator
|
||||
list<_TypeT, _Allocator>::erase (iterator __first, iterator __last)
|
||||
{
|
||||
_RWSTD_ASSERT_RANGE (begin (), __first);
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
|
||||
while (!(__first == __last)) {
|
||||
__first = erase (__first);
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_LIST_NODE_BUFFER)
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::_C_add_buffer (bool __is_list_empty)
|
||||
{
|
||||
// empty list gets one node
|
||||
_RWSTD_SIZE_T __next_buffer_size = 1;
|
||||
if(!__is_list_empty) {
|
||||
if ((void*)_C_buflist) {
|
||||
__next_buffer_size =
|
||||
_RWSTD_NEW_CAPACITY (list, this, _C_buflist->_C_bufsize);
|
||||
}
|
||||
else {
|
||||
__next_buffer_size = _RWSTD_NEW_CAPACITY (list, this, 0);
|
||||
}
|
||||
}
|
||||
_C_buf_pointer __tmp =
|
||||
_C_buf_alloc_type (*this).allocate (1, (void*)_C_buflist);
|
||||
|
||||
_TRY {
|
||||
__tmp->_C_buffer =
|
||||
_C_node_alloc_type (*this).allocate (__next_buffer_size,
|
||||
(void*)_C_last);
|
||||
}
|
||||
_CATCH (...) {
|
||||
_C_buf_alloc_type (*this).deallocate (__tmp, 1);
|
||||
_RETHROW;
|
||||
}
|
||||
|
||||
__tmp->_C_next_buf = _C_buflist;
|
||||
__tmp->_C_bufsize = __next_buffer_size;
|
||||
|
||||
_C_buflist = __tmp;
|
||||
_C_next_avail = _C_buflist->_C_buffer;
|
||||
_C_last = _C_next_avail + __next_buffer_size;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::_C_free_buffers ()
|
||||
{
|
||||
while ((void*)_C_buflist) {
|
||||
_C_buf_pointer __tmp = _C_buflist;
|
||||
_C_buflist = _C_buflist->_C_next_buf;
|
||||
_C_node_alloc_type (*this).deallocate (__tmp->_C_buffer,
|
||||
__tmp->_C_bufsize);
|
||||
_C_buf_alloc_type (*this).deallocate (__tmp, 1);
|
||||
}
|
||||
_C_free_list = 0;
|
||||
_C_next_avail = 0;
|
||||
_C_last = 0;
|
||||
}
|
||||
|
||||
#endif // defined (_RWSTD_NO_LIST_NODE_BUFFER)
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::_C_transfer (iterator __it, iterator __first,
|
||||
iterator __last, list& __x)
|
||||
{
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it);
|
||||
_RWSTD_ASSERT_RANGE (__first, __last);
|
||||
|
||||
if (this == &__x) {
|
||||
(*(_C_link_type ((*_ITER_NODE (__last))._C_prev)))._C_next =
|
||||
_ITER_NODE (__it);
|
||||
(*(_C_link_type ((*_ITER_NODE (__first))._C_prev)))._C_next =
|
||||
_ITER_NODE (__last);
|
||||
(*(_C_link_type ((*_ITER_NODE (__it))._C_prev)))._C_next =
|
||||
_ITER_NODE (__first);
|
||||
|
||||
_C_link_type __tmp = _C_link_type ((*_ITER_NODE (__it))._C_prev);
|
||||
|
||||
(*_ITER_NODE (__it))._C_prev = (*_ITER_NODE (__last))._C_prev;
|
||||
(*_ITER_NODE (__last))._C_prev = (*_ITER_NODE (__first))._C_prev;
|
||||
(*_ITER_NODE (__first))._C_prev = __tmp;
|
||||
}
|
||||
else {
|
||||
insert (__it, __first, __last);
|
||||
__x.erase (__first, __last);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::resize (size_type __size, _TypeT __val)
|
||||
{
|
||||
if (__size > size ())
|
||||
insert (end (), __size - size (), __val);
|
||||
else if (__size < size ()) {
|
||||
iterator __tmp = begin ();
|
||||
advance (__tmp, __size);
|
||||
erase (__tmp, end ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
list<_TypeT, _Allocator>&
|
||||
list<_TypeT, _Allocator>::operator= (const list<_TypeT, _Allocator>& __rhs)
|
||||
{
|
||||
if (this != &__rhs) {
|
||||
iterator __first1 = begin ();
|
||||
iterator __last1 = end ();
|
||||
const_iterator __first2 = __rhs.begin ();
|
||||
const_iterator __last2 = __rhs.end ();
|
||||
|
||||
for ( ; !(__first1 == __last1) && !(__first2 == __last2);
|
||||
++__first1, ++__first2)
|
||||
*__first1 = *__first2;
|
||||
|
||||
if (__first2 == __last2)
|
||||
erase (__first1, __last1);
|
||||
else
|
||||
insert (__last1, __first2, __last2);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::splice (iterator __it, list &__x)
|
||||
{
|
||||
// assert 23.2.2.4, p3
|
||||
_RWSTD_ASSERT (&__x != this);
|
||||
_RWSTD_ASSERT_RANGE (begin (), __it);
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_LIST_NODE_BUFFER)
|
||||
// linear complexity
|
||||
insert (__it, __x.begin (), __x.end ());
|
||||
__x.clear ();
|
||||
#else
|
||||
if (get_allocator () == __x.get_allocator ()) {
|
||||
|
||||
// constant complexity
|
||||
|
||||
// relink `it' and the head of `x'
|
||||
(*(_C_link_type ((*_ITER_NODE (__it))._C_prev)))._C_next =
|
||||
__x._C_node->_C_next;
|
||||
|
||||
__x._C_node->_C_next->_C_prev = (*_ITER_NODE (__it))._C_prev;
|
||||
(*_ITER_NODE (__it))._C_prev = __x._C_node->_C_prev;
|
||||
__x._C_node->_C_prev->_C_next = _ITER_NODE (__it);
|
||||
|
||||
// empty out `x'
|
||||
__x._C_node->_C_next =
|
||||
__x._C_node->_C_prev = __x._C_node;
|
||||
|
||||
// adjust sizes
|
||||
_C_length += __x._C_length;
|
||||
__x._C_length = 0;
|
||||
}
|
||||
else {
|
||||
// linear complexity
|
||||
insert (__it, __x.begin (), __x.end ());
|
||||
__x.clear ();
|
||||
}
|
||||
#endif // _RWSTD_NO_LIST_NODE_BUFFER
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::splice (iterator __i, list &__x, iterator __j)
|
||||
{
|
||||
_RWSTD_ASSERT_RANGE (begin (), __i);
|
||||
_RWSTD_ASSERT_RANGE (__x.begin (), __j);
|
||||
|
||||
if ( !(__x.end () == __j)
|
||||
&& !(__i == __j) && !(__i == ++iterator (__j))) {
|
||||
|
||||
#if !defined (_RWSTD_NO_LIST_NODE_BUFFER)
|
||||
// linear complexity
|
||||
insert (__i, *__j);
|
||||
__x.erase (__j);
|
||||
#else
|
||||
if (get_allocator () == __x.get_allocator ()) {
|
||||
|
||||
// constant complexity
|
||||
|
||||
// relink `i' and `j'
|
||||
(*(_C_link_type ((*_ITER_NODE (__i))._C_prev)))._C_next =
|
||||
_ITER_NODE (__j);
|
||||
|
||||
// save position before `i'
|
||||
_C_link_type __tmp = (*_ITER_NODE (__i))._C_prev;
|
||||
|
||||
(*_ITER_NODE (__i))._C_prev = _ITER_NODE (__j);
|
||||
(*_ITER_NODE (__j))._C_prev->_C_next = (*_ITER_NODE (__j))._C_next;
|
||||
(*_ITER_NODE (__j))._C_next->_C_prev = (*_ITER_NODE (__j))._C_prev;
|
||||
|
||||
(*_ITER_NODE (__j))._C_next = _ITER_NODE (__i);
|
||||
(*_ITER_NODE (__j))._C_prev = __tmp;
|
||||
|
||||
// adjust sizes
|
||||
++_C_length;
|
||||
--__x._C_length;
|
||||
}
|
||||
else {
|
||||
// linear complexity
|
||||
insert (__i, *__j);
|
||||
__x.erase (__j);
|
||||
}
|
||||
#endif // _RWSTD_NO_LIST_NODE_BUFFER
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::
|
||||
splice (iterator __i, list &__x, iterator __j, iterator __k)
|
||||
{
|
||||
_RWSTD_ASSERT_RANGE (begin (), __i);
|
||||
_RWSTD_ASSERT_RANGE (__x.begin (), __j);
|
||||
_RWSTD_ASSERT_RANGE (__j, __k);
|
||||
|
||||
// 23.2.2.4, p12 - check undefined behavior
|
||||
_RWSTD_ASSERT (&__x != this || __i != __j && __i != __k);
|
||||
|
||||
if (__j == __k)
|
||||
return;
|
||||
|
||||
#if !defined (_RWSTD_NO_LIST_NODE_BUFFER)
|
||||
insert (__i, __j, __k);
|
||||
__x.erase (__j, __k);
|
||||
#else
|
||||
if (get_allocator () == __x.get_allocator ()) {
|
||||
|
||||
# ifdef _RWSTDDEBUG
|
||||
|
||||
for (iterator __it = __j; __it != __k; ++__it) {
|
||||
// 23.2.2.4, p12 - check undefined behavior (linear time)
|
||||
_RWSTD_ASSERT (&__x != this || __i != __j);
|
||||
|
||||
++_C_length;
|
||||
--__x._C_length;
|
||||
}
|
||||
|
||||
# else // if !defined (_RWSTDDEBUG)
|
||||
|
||||
if (&__x != this) {
|
||||
// adjust sizes first
|
||||
for (iterator __it = __j; __it != __k; ++__it) {
|
||||
++_C_length;
|
||||
--__x._C_length;
|
||||
}
|
||||
}
|
||||
|
||||
# endif // _RWSTDDEBUG
|
||||
|
||||
(*(_C_link_type ((*_ITER_NODE (__k))._C_prev)))._C_next =
|
||||
_ITER_NODE (__i);
|
||||
(*(_C_link_type ((*_ITER_NODE (__j))._C_prev)))._C_next =
|
||||
_ITER_NODE (__k);
|
||||
(*(_C_link_type ((*_ITER_NODE (__i))._C_prev)))._C_next =
|
||||
_ITER_NODE (__j);
|
||||
|
||||
_C_link_type __tmp = _C_link_type ((*_ITER_NODE (__i))._C_prev);
|
||||
|
||||
(*_ITER_NODE (__i))._C_prev = (*_ITER_NODE (__k))._C_prev;
|
||||
(*_ITER_NODE (__k))._C_prev = (*_ITER_NODE (__j))._C_prev;
|
||||
(*_ITER_NODE (__j))._C_prev = __tmp;
|
||||
}
|
||||
else {
|
||||
insert (__i, __j, __k);
|
||||
__x.erase (__j, __k);
|
||||
}
|
||||
#endif // _RWSTD_NO_LIST_NODE_BUFFER
|
||||
}
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::remove (const_reference __val)
|
||||
{
|
||||
for (iterator __first = begin (), __last = end (); !(__first == __last); ) {
|
||||
iterator __next = __first;
|
||||
++__next;
|
||||
if (*__first == __val)
|
||||
erase (__first);
|
||||
__first = __next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::unique ()
|
||||
{
|
||||
iterator __first = begin ();
|
||||
iterator __last = end ();
|
||||
|
||||
if (__first == __last)
|
||||
return;
|
||||
|
||||
iterator __next = __first;
|
||||
|
||||
while (!(++__next == __last)) {
|
||||
if (*__first == *__next)
|
||||
erase (__next);
|
||||
else
|
||||
__first = __next;
|
||||
__next = __first;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::merge (list<_TypeT, _Allocator>& __x)
|
||||
{
|
||||
if (&__x == this)
|
||||
return;
|
||||
iterator __first1 = begin ();
|
||||
iterator __last1 = end ();
|
||||
iterator __first2 = __x.begin ();
|
||||
iterator __last2 = __x.end ();
|
||||
|
||||
while (!(__first1 == __last1) && !(__first2 == __last2)) {
|
||||
if (*__first2 < *__first1) {
|
||||
iterator __next = __first2;
|
||||
_C_transfer (__first1, __first2, ++__next, __x);
|
||||
__first2 = __next;
|
||||
}
|
||||
else
|
||||
++__first1;
|
||||
}
|
||||
|
||||
if (!(__first2 == __last2))
|
||||
_C_transfer (__last1, __first2, __last2, __x);
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::reverse ()
|
||||
{
|
||||
if (size () < 2)
|
||||
return;
|
||||
|
||||
for (iterator __first = ++begin (); !(__first == end ()); ) {
|
||||
iterator __tmp = __first;
|
||||
_C_transfer (begin (), __tmp, ++__first, *this);
|
||||
}
|
||||
}
|
||||
|
||||
// sorts list by moving nodes within list; preserves iterators pointing to
|
||||
// elements of the list.
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::sort ()
|
||||
{
|
||||
for (size_type __n = 1; __n < size (); __n *= 2) {
|
||||
iterator __i1 = begin (),
|
||||
__i2 = begin (),
|
||||
__i3 = begin ();
|
||||
|
||||
_C_advance (__i2, (difference_type)__n, end ());
|
||||
_C_advance (__i3, (difference_type)(2 * __n), end ());
|
||||
|
||||
for (size_type __m = 0;
|
||||
__m < (size () + (2 * __n)) / (__n * 2); __m++) {
|
||||
|
||||
if (!(__i1 == end ()) && !(__i2 == end ())) {
|
||||
_C_adjacent_merge (__i1, __i2, __i3);
|
||||
__i1 = __i2 = __i3;
|
||||
_C_advance (__i2, (difference_type) __n, end ());
|
||||
_C_advance (__i3, (difference_type) 2 * __n, end ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::
|
||||
_C_adjacent_merge (iterator __first1, iterator __last1, iterator __last2)
|
||||
{
|
||||
difference_type __n = _DISTANCE (__first1, __last1, difference_type);
|
||||
|
||||
for (iterator __first2 = __last1; __n >= 0 && !(__first2 == __last2); ) {
|
||||
if (*__first2 < *__first1) {
|
||||
iterator __next = __first2;
|
||||
_C_transfer (__first1, __first2, ++__next, *this);
|
||||
__first2 = __next;
|
||||
}
|
||||
else {
|
||||
++__first1;
|
||||
--__n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
template<class _Compare>
|
||||
void list<_TypeT, _Allocator>::
|
||||
_C_adjacent_merge (iterator __first1, iterator __last1, iterator __last2,
|
||||
_Compare __cmp)
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::
|
||||
_C_adjacent_merge (iterator __first1, iterator __last1, iterator __last2,
|
||||
bool (*__cmp)(const_reference, const_reference))
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
{
|
||||
difference_type __n = _DISTANCE (__first1, __last1, difference_type);
|
||||
|
||||
for (iterator __first2 = __last1; __n >= 0 && !(__first2 == __last2); ) {
|
||||
if (__cmp (*__first2, *__first1)) {
|
||||
iterator __next = __first2;
|
||||
_C_transfer (__first1, __first2, ++__next, *this);
|
||||
__first2 = __next;
|
||||
}
|
||||
else {
|
||||
++__first1;
|
||||
--__n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template<class _TypeT, class _Allocator>
|
||||
template<class _Predicate>
|
||||
void list<_TypeT, _Allocator>::remove_if (_Predicate __pred)
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
template<class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::remove_if (bool (*__pred)(const_reference))
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
{
|
||||
iterator __first = begin ();
|
||||
iterator __last = end ();
|
||||
|
||||
while (!(__first == __last)) {
|
||||
iterator __next = __first;
|
||||
++__next;
|
||||
if (__pred (*__first))
|
||||
erase (__first);
|
||||
__first = __next;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template<class _TypeT, class _Allocator>
|
||||
template<class _BinaryPredicate>
|
||||
void list<_TypeT, _Allocator>::unique (_BinaryPredicate __pred)
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
template<class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::
|
||||
unique (bool (*__pred)(const_reference, const_reference))
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
{
|
||||
iterator __first = begin ();
|
||||
iterator __last = end ();
|
||||
|
||||
if (__first == __last)
|
||||
return;
|
||||
|
||||
iterator __next = __first;
|
||||
while (!(++__next == __last)) {
|
||||
if (__pred (*__first, *__next))
|
||||
erase (__next);
|
||||
else
|
||||
__first = __next;
|
||||
__next = __first;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template<class _TypeT, class _Allocator>
|
||||
template<class _Compare>
|
||||
void list<_TypeT, _Allocator>::
|
||||
merge (list<_TypeT, _Allocator>& __x, _Compare __cmp)
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
template<class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::
|
||||
merge (list<_TypeT, _Allocator>& __x,
|
||||
bool (*__cmp)(const_reference, const_reference))
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
{
|
||||
if (&__x == this)
|
||||
return;
|
||||
iterator __first1 = begin ();
|
||||
iterator __last1 = end ();
|
||||
iterator __first2 = __x.begin ();
|
||||
iterator __last2 = __x.end ();
|
||||
|
||||
while (!(__first1 == __last1) && !(__first2 == __last2)) {
|
||||
if (__cmp (*__first2, *__first1)) {
|
||||
iterator __next = __first2;
|
||||
_C_transfer (__first1, __first2, ++__next, __x);
|
||||
__first2 = __next;
|
||||
}
|
||||
else
|
||||
++__first1;
|
||||
}
|
||||
|
||||
if (!(__first2 == __last2))
|
||||
_C_transfer (__last1, __first2, __last2, __x);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
template<class _Compare>
|
||||
void list<_TypeT, _Allocator>::sort (_Compare __cmp)
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
template <class _TypeT, class _Allocator>
|
||||
void list<_TypeT, _Allocator>::
|
||||
sort (bool (*__cmp)(const_reference, const_reference))
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
{
|
||||
for (size_type __n = 1; __n < size (); __n *= 2) {
|
||||
|
||||
iterator __it1 = begin (),
|
||||
__it2 = begin (),
|
||||
__it3 = begin ();
|
||||
|
||||
_C_advance (__it2, __n, end ());
|
||||
_C_advance (__it3, 2 * __n, end ());
|
||||
|
||||
for (size_type __m = 0;
|
||||
__m != (size () + (2 * __n)) / (__n * 2); ++__m) {
|
||||
|
||||
if (!(__it1 == end ()) && !(__it2 == end ())) {
|
||||
_C_adjacent_merge (__it1, __it2, __it3, __cmp);
|
||||
__it1 = __it3;
|
||||
__it2 = __it3;
|
||||
_C_advance (__it2, __n, end ());
|
||||
_C_advance (__it3, 2 * __n, end ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace std
|
||||
573
extern/stdcxx/4.2.1/include/list_spec.h
vendored
Normal file
573
extern/stdcxx/4.2.1/include/list_spec.h
vendored
Normal file
@@ -0,0 +1,573 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef __STD_LIST_SPEC__
|
||||
#define __STD_LIST_SPEC__
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* list_spec.h - list <_TypeT*> partial specialization
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* 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 <rw/_defs.h>
|
||||
|
||||
|
||||
#ifndef __STD_LIST__
|
||||
# include <list>
|
||||
#endif // __STD_LIST__
|
||||
|
||||
|
||||
_RWSTD_NAMESPACE (std) {
|
||||
|
||||
|
||||
template class list <void*, allocator <void*> >;
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
class list <_TypeT*, allocator <_TypeT*> >
|
||||
{
|
||||
typedef allocator <_TypeT*> _Allocator;
|
||||
typedef _RWSTD_REBIND (_Allocator, void*) __imp_alloc_type;
|
||||
typedef list <void*, __imp_alloc_type> __imp_type;
|
||||
typedef _TYPENAME __imp_type::iterator __imp_iterator;
|
||||
typedef _TYPENAME __imp_type::const_iterator __imp_const_iterator;
|
||||
|
||||
__imp_type __imp;
|
||||
|
||||
public:
|
||||
|
||||
typedef _TypeT* value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
|
||||
typedef _TYPENAME allocator_type::reference reference;
|
||||
typedef _TYPENAME allocator_type::const_reference const_reference;
|
||||
typedef _TYPENAME allocator_type::pointer pointer;
|
||||
typedef _TYPENAME allocator_type::const_pointer const_pointer;
|
||||
typedef _TYPENAME allocator_type::size_type size_type;
|
||||
typedef _TYPENAME allocator_type::difference_type difference_type;
|
||||
|
||||
protected:
|
||||
|
||||
typedef _STD::iterator <bidirectional_iterator_tag, value_type,
|
||||
difference_type, pointer, reference> __it;
|
||||
typedef _STD::iterator <bidirectional_iterator_tag, value_type,
|
||||
difference_type, const_pointer, const_reference> __cit;
|
||||
|
||||
public:
|
||||
|
||||
class const_iterator;
|
||||
|
||||
class iterator : public __it
|
||||
{
|
||||
typedef _TYPENAME __imp_type::iterator __imp_iter;
|
||||
|
||||
__imp_iter __imp;
|
||||
|
||||
friend class list<_TypeT, allocator <_TypeT> >;
|
||||
friend class const_iterator;
|
||||
|
||||
// implicit conversions from and to implementation-specific iterator
|
||||
// used only internally
|
||||
iterator (const __imp_iter &imp)
|
||||
: __imp (imp) {}
|
||||
|
||||
operator __imp_iter () {
|
||||
return __imp;
|
||||
}
|
||||
|
||||
public:
|
||||
iterator () {}
|
||||
|
||||
bool operator== (const iterator& x) const {
|
||||
return __imp == x.__imp;
|
||||
}
|
||||
|
||||
bool operator!= (const iterator& x) const {
|
||||
return !(*this == x);
|
||||
}
|
||||
|
||||
__iterator_base::reference operator* () const {
|
||||
return __iterator_base::reference (*__imp);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_NONCLASS_ARROW_RETURN
|
||||
|
||||
__iterator_base::pointer operator-> () const {
|
||||
return __iterator_base::pointer (&*__imp);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_NONCLASS_ARROW_RETURN
|
||||
|
||||
|
||||
iterator& operator++ () {
|
||||
++__imp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator operator++ (int) {
|
||||
iterator tmp = *this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator& operator-- () {
|
||||
--__imp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator operator-- (int) {
|
||||
iterator tmp = *this;
|
||||
--*this;
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class const_iterator : public __cit
|
||||
{
|
||||
typedef _TYPENAME __imp_type::const_iterator __imp_iter;
|
||||
|
||||
__imp_iter __imp;
|
||||
|
||||
friend class list<_TypeT,allocator<_TypeT> >;
|
||||
|
||||
const_iterator (const __imp_iter &imp)
|
||||
: __imp (imp) { }
|
||||
|
||||
public:
|
||||
|
||||
const_iterator () { }
|
||||
|
||||
const_iterator (const iterator &x)
|
||||
: __imp (x.__imp) { }
|
||||
|
||||
bool operator== (const const_iterator& x) const {
|
||||
return __imp == x.__imp;
|
||||
}
|
||||
|
||||
bool operator!= (const const_iterator &x) const {
|
||||
return !(*this == x);
|
||||
}
|
||||
|
||||
const_reference operator* () const {
|
||||
return const_reference (*__imp);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_NONCLASS_ARROW_RETURN
|
||||
|
||||
const_pointer operator-> () const {
|
||||
return const_pointer (&*__imp);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_NONCLASS_ARROW_RETURN
|
||||
|
||||
|
||||
const_iterator& operator++ () {
|
||||
++__imp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_iterator operator++ (int) {
|
||||
const_iterator tmp = *this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const_iterator& operator-- () {
|
||||
--__imp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_iterator operator-- (int) {
|
||||
const_iterator tmp = *this;
|
||||
--*this;
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||
|
||||
typedef _STD::reverse_iterator <const_iterator> const_reverse_iterator;
|
||||
typedef _STD::reverse_iterator <iterator> reverse_iterator;
|
||||
|
||||
#else
|
||||
|
||||
typedef __reverse_bi_iterator <const_iterator,
|
||||
bidirectional_iterator_tag, value_type,
|
||||
const_reference, const_pointer, difference_type>
|
||||
const_reverse_iterator;
|
||||
typedef __reverse_bi_iterator <iterator,
|
||||
bidirectional_iterator_tag, value_type,
|
||||
reference, pointer, difference_type>
|
||||
reverse_iterator;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
_EXPLICIT list (const _Allocator &alloc _RWSTD_DEFAULT_ARG (_Allocator()))
|
||||
: __imp (alloc) { }
|
||||
|
||||
_EXPLICIT list (size_type n,
|
||||
const_reference x _RWSTD_DEFAULT_ARG (value_type ()),
|
||||
const _Allocator &alloc _RWSTD_DEFAULT_ARG (_Allocator ()))
|
||||
: __imp (n, x, alloc) { }
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
|
||||
|
||||
list ()
|
||||
: __imp () { }
|
||||
|
||||
list (size_type n, const_reference x)
|
||||
: __imp (n, x) { }
|
||||
|
||||
#endif // _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template<class InputIterator>
|
||||
list (InputIterator first, InputIterator last,
|
||||
const _Allocator& alloc _RWSTD_DEFAULT_ARG (_Allocator ()))
|
||||
: __imp (first, last, alloc) { }
|
||||
|
||||
list (const_iterator first, const_iterator last,
|
||||
const _Allocator& alloc _RWSTD_DEFAULT_ARG (_Allocator ()))
|
||||
: __imp (first, last, alloc) { }
|
||||
|
||||
|
||||
#ifdef _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
|
||||
|
||||
list (const_iterator first, const_iterator last)
|
||||
: __imp (first, last) { }
|
||||
|
||||
#endif // _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
|
||||
list (const list& x)
|
||||
: __imp (x.__imp)
|
||||
{ }
|
||||
|
||||
list& operator= (const list& x) {
|
||||
__imp = x.__imp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template <class InputIterator>
|
||||
void assign (InputIterator first, InputIterator last) {
|
||||
__imp.assign (first, last);
|
||||
}
|
||||
|
||||
#else // defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
void assign (const_iterator first, const_iterator last) {
|
||||
__imp.assign (first, last);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
|
||||
void assign (size_type n, const_reference x) {
|
||||
__imp.assign (n, x);
|
||||
}
|
||||
|
||||
allocator_type get_allocator () const {
|
||||
return allocator_type (__imp.get_allocator ());
|
||||
}
|
||||
|
||||
iterator begin () {
|
||||
return __imp.begin ();
|
||||
}
|
||||
|
||||
const_iterator begin () const {
|
||||
return __imp.begin ();
|
||||
}
|
||||
|
||||
iterator end () {
|
||||
return __imp.end ();
|
||||
}
|
||||
|
||||
const_iterator end () const {
|
||||
return __imp.end ();
|
||||
}
|
||||
|
||||
reverse_iterator rbegin () {
|
||||
return reverse_iterator (end ());
|
||||
}
|
||||
|
||||
const_reverse_iterator rbegin () const {
|
||||
return const_reverse_iterator (end ());
|
||||
}
|
||||
|
||||
reverse_iterator rend () {
|
||||
return reverse_iterator (begin ());
|
||||
}
|
||||
|
||||
const_reverse_iterator rend () const {
|
||||
return const_reverse_iterator (begin ());
|
||||
}
|
||||
|
||||
bool empty () const {
|
||||
return __imp.empty ();
|
||||
}
|
||||
|
||||
size_type size () const {
|
||||
return __imp.size ();
|
||||
}
|
||||
|
||||
size_type max_size () const {
|
||||
return __imp.max_size ();
|
||||
}
|
||||
|
||||
void resize (size_type new_size) {
|
||||
__imp.resize (new_size);
|
||||
}
|
||||
|
||||
void resize (size_type new_size, const_reference x) {
|
||||
__imp.resize (new_size, x);
|
||||
}
|
||||
|
||||
reference front () {
|
||||
return reference (__imp.front ());
|
||||
}
|
||||
|
||||
const_reference front () const {
|
||||
return const_reference (__imp.front ());
|
||||
}
|
||||
|
||||
reference back () {
|
||||
return reference (__imp.back ());
|
||||
}
|
||||
|
||||
const_reference back () const {
|
||||
return const_reference (__imp.back ());
|
||||
}
|
||||
|
||||
void push_front (const_reference x) {
|
||||
__imp.push_front (x);
|
||||
}
|
||||
|
||||
void push_back (const_reference x) {
|
||||
__imp.push_back (x);
|
||||
}
|
||||
|
||||
void pop_front () {
|
||||
__imp.pop_front ();
|
||||
}
|
||||
|
||||
void pop_back () {
|
||||
__imp.pop_back ();
|
||||
}
|
||||
|
||||
iterator insert (iterator pos, const_reference x) {
|
||||
return __imp.insert (pos, x);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template <class InputIterator>
|
||||
void insert (iterator pos, InputIterator first, InputIterator last) {
|
||||
__imp.insert (pos, first, last);
|
||||
}
|
||||
|
||||
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
|
||||
|
||||
void insert (iterator pos, const_iterator first, const_iterator last) {
|
||||
__imp.insert (pos, first, last);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
|
||||
void insert (iterator pos, size_type n, const_reference x) {
|
||||
__imp.insert (pos, n, x);
|
||||
}
|
||||
|
||||
iterator erase (iterator pos) {
|
||||
return __imp.erase (pos);
|
||||
}
|
||||
|
||||
iterator erase (iterator first, iterator last) {
|
||||
return __imp.erase (first, last);
|
||||
}
|
||||
|
||||
void swap (list &x) {
|
||||
__imp.swap (x.__imp);
|
||||
}
|
||||
|
||||
void clear () {
|
||||
__imp.clear ();
|
||||
}
|
||||
|
||||
void splice (iterator pos, list &x) {
|
||||
__imp.splice (pos, x.__imp);
|
||||
}
|
||||
|
||||
void splice (iterator pos, list &x, iterator i) {
|
||||
__imp.splice (pos, x.__imp, i);
|
||||
}
|
||||
|
||||
void splice (iterator pos, list &x, iterator first, iterator last) {
|
||||
__imp.splice (pos, x.__imp, first, last);
|
||||
}
|
||||
|
||||
void remove (const_reference x) {
|
||||
__imp.remove (x);
|
||||
}
|
||||
|
||||
void unique () {
|
||||
__imp.unique ();
|
||||
}
|
||||
|
||||
void merge (list &x) {
|
||||
__imp.merge (x.__imp);
|
||||
}
|
||||
|
||||
void reverse () {
|
||||
__imp.reverse ();
|
||||
}
|
||||
|
||||
void sort () {
|
||||
__imp.sort ();
|
||||
}
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
template <class Predicate>
|
||||
void remove_if (Predicate pred) {
|
||||
__imp.remove_if (pred);
|
||||
}
|
||||
|
||||
template <class BinaryPredicate>
|
||||
void unique (BinaryPredicate pred) {
|
||||
__imp.unique (pred);
|
||||
}
|
||||
|
||||
template <class _Compare>
|
||||
void merge (list &x, _Compare comp) {
|
||||
__imp.merge (x, comp);
|
||||
}
|
||||
|
||||
template <class _Compare>
|
||||
void sort (_Compare comp) {
|
||||
__imp.sort (comp);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
||||
|
||||
|
||||
#ifndef _RWSTD_NO_EXT_ALLOC_SIZE
|
||||
|
||||
size_type allocation_size () const {
|
||||
return __imp.allocation_size ();
|
||||
}
|
||||
|
||||
size_type allocation_size (size_type new_size) {
|
||||
return __imp.allocation_size (new_size);
|
||||
}
|
||||
|
||||
#endif // _RWSTD_NO_EXT_ALLOC_SIZE
|
||||
};
|
||||
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator== (const list <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const list <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return x.size () == y.size () && equal (x.begin (), x.end (), y.begin ());
|
||||
}
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator< (const list <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const list <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return lexicographical_compare (x.begin (), x.end (), y.begin (), y.end ());
|
||||
}
|
||||
|
||||
|
||||
#if !defined (_RWSTD_NO_NAMESPACE) || !defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator!= (const list <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const list <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator> (const list <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const list <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return y < x;
|
||||
}
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator>= (const list <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const list <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return !(x < y);
|
||||
}
|
||||
|
||||
template <class _TypeT>
|
||||
inline bool operator<= (const list <_TypeT*, allocator <_TypeT*> > &x,
|
||||
const list <_TypeT*, allocator <_TypeT*> > &y)
|
||||
{
|
||||
return !(y < x);
|
||||
}
|
||||
|
||||
template <class _TypeT>
|
||||
inline void swap (list <_TypeT*, allocator <_TypeT*> > &a,
|
||||
list <_TypeT*, allocator <_TypeT*> > &b)
|
||||
{
|
||||
a.swap (b);
|
||||
}
|
||||
|
||||
#endif // !defined(_RWSTD_NO_NAMESPACE) || !defined(_RWSTD_NO_PART_SPEC_OVERLOAD)
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif /*__STD_LIST_SPEC__*/
|
||||
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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user