Removed STLPort from repository - it's available as part of NDK for several years already

This commit is contained in:
pelya
2013-10-17 20:55:06 +03:00
parent 123508a07a
commit a649500382
388 changed files with 0 additions and 92168 deletions

View File

@@ -1,18 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := stlport
ifneq ($(CRYSTAX_TOOLCHAIN)$(NDK_R5_TOOLCHAIN),)
LOCAL_CPP_EXTENSION := .cpp
LOCAL_SRC_FILES := dummy.c
else
LOCAL_C_INCLUDES := $(LOCAL_PATH)/stlport $(LOCAL_PATH)/src
LOCAL_CFLAGS := -O3
LOCAL_CPP_EXTENSION := .cpp
LOCAL_SRC_FILES := $(addprefix src/,$(notdir $(wildcard $(LOCAL_PATH)/src/*.cpp $(LOCAL_PATH)/src/*.c)))
endif
include $(BUILD_STATIC_LIBRARY)

View File

@@ -1,171 +0,0 @@
**********************************************************************
* INSTALL file for STLport 5.0 *
* *
**********************************************************************
STLport is a full ANSI C++ Standard library.
This distribution contains STLport sources only, no binaries.
To use STLport iostreams, locale and complex numbers, you have to build STLport
library from sources in "build/lib" directory and link your programs with it.
Starting with 5.0 the 'wrapper' mode is not supported anymore. You cannot use native
compiler iostreams implementation with STLport STL (see doc/FAQ for explanations).
Now you have to choose between STLport iostreams or no iostreams.
==== Unpacking and installing STLport ==========
1) Unpack STLport archive to a directory accessible during compilation.
NOTE: DO NOT overwrite header files coming with the compiler, even if you made
a backup - this won't work! Most probably, you've already unpacked the archive before
reading this file though ;)
2) Make sure "stlport" directory of this distribution comes before compiler's one
in your include paths when you compile the project.
Note: for SunPro CC 5.0 and higher, there used to be special directory "stlport/SC5"
this is now obsolete, please make sure you do not use it anymore.
3) Make sure you do not rename this "stlport" subdirectory -
that may result in compilation errors.
NOTE: Your compiler should be recognized by STLport source code with no configuring.
Please edit appropriate configuration header for your compiler
directly if you have to make compiler-specific configuration changes
(see stlport/config).
4) Go to "build/lib" subdirectory. It contains various makefiles for different
compilers and 'make' utilities (GNU Make and Microsoft's nmake supported).
If you are not able to find makefile for your particular
compiler, please use one that looks most similar to your make engine to
create your own.
Verify you can do command line compiles. IDE users may have to do something
special, like add environment variables (for Microsoft) or install
additional compiler components (for Metrowerks), before they can use their
command line compilers (see doc/README.xxxx for additionnal inrformation).
IMPORTANT:
If you DO NOT plan to use STLport iostreams and/or locale implementation but just
the STL, you do not have to build the library.
If you have decided to disable STLport iostreams and locale using _STLP_NO_IOSTREAMS
configuration macro in stlport/stl/config/user_config.h, you may stop reading here.
==== Building STLport iostreams library ==========
Below are step-by-step instructions to build STLport streams library. This is a general
build process description, for a more detailed one check README files in the doc folder:
5) Using appropriate makefile, do
make -f <compiler name>.mak clean
make -f <compiler name>.mak install
to build the STLport libraries. Makefiles are set up to build several different
flavors - debug/nondebug, static/dynamic versions. But not all flavors will be build
by default. See build/lib/README and build/lib/README.options for other make tagets.
Note: your "make" program may have different name, like "nmake" for Visual C++.
Examples :
1. If you are building STLport for just one compiler, you may do something like that
(DOS syntax for Visual C++ below):
nmake /fnmake-vc6.mak clean
nmake /fnmake-vc6.mak install
2. If you plan to build STLport with multiple compilers, use "make -f" :
make -f gcc.mak clean install
make -f sunpro.mak clean install
Note: 'install' target work slightly different than usual - it installs libraries into
<STLport root dir>/lib and bin catalog, NOT IN SYSTEM CATALOG. You can do the system
install by just copying stlport and lib folder to the destination of your choise. For
example on UNIX-like platforms this can be done with the following commands:
su
tar cf - stlport | (cd /usr/local/include; tar xf -)
chmod -R a+r /usr/local/include/stlport
chown -R root:root /usr/local/include/stlport
(cd lib; tar cf - --exclude=CVS --exclude=.cvsignore .) | (cd /usr/local/lib; tar xf -)
chown -R root:root /usr/local/lib/libstlport*
exit
Note: System install is optional, most of compilers/linkers support searching for includes
and libs throught out the whole filesystem, just check your documentation on how to achieve
this.
If you use cross-compiler, you can find libraries in the <STLport root dir>/lib/<target platform>
catalog.
6) If build fails, you may choose to :
- try fixing the build ;)
- wait until somebody else will submit corresponding changes to be incorporated in next STLport
release/snapshot.
In case you do patch STLport, please submit your patches to
https://sourceforge.net/tracker/?atid=766246&group_id=146814&func=browse
==== Linking your application with STLport library ==========
7) Check the build:
Example:
- under Linux and other Unixes:
cd build/test/unit
make -f <compiler name>.mak install
../../../bin/stl_unit_test
../../../bin-g/stl_unit_test
- under Windows:
cd build\test\unit
nmake /fnmake-<compiler name>.mak install
cd ..\..\..\bin
stl_unit_test_r50
stl_unit_test_d50
stl_unit_test_stld50
8) Supply the "lib" subdirectory to the library search path and add desired
library to the list of libraries to link with.
Examples (imagine you have mytest.cpp in the same directory as this file is):
With GCC : g++ -pthread -I./stlport mytest.cpp -L./lib/ -lstlport
With DEC CC : cxx -I./stlport mytest.cpp -L./lib/ -lstlport
With SUN CC : CC -mt -I./stlport mytest.cpp -L./lib/ -lstlport
.....
[ Visual C++ specific ] For (embedded) VC++, you do not have to specify
"stlport_XXX.lib" explicitly, as it is being choosen and forced to link
automatically by "#pragma"'s in compiler config file in
stlport/config/stl_msvc.h. Appropriate version is being selected based on
/MD[d] vs /MT[d] options and _STLP_DEBUG setting. All you have to do is
to set library search path for the linker.
Example :
cl.exe /I.\stlport mytest.cpp /link /libpath:.\lib /MD
9) If you linked your application with shared STLport library (.so or .dll), please
make your .so or .dll can be found by the dynamic linker.
Under Windows, the paths searched depend on the particular flavor, see the MSDN
documentation for LoadLibrary at http://msdn.microsoft.com. Easiest ways are to
either modify the PATH environment variable or copy all .dll's next to the
executable.
Under Linux, the environment variable LD_LIBRARY_PATH can be adjusted to point
to the dir containing. See the manpage for ld.so for more info.
10) STLport builds only multithreaded libraries, so your application should be compiled
as multithreaded, too. Use -pthread (or -pthreads on Solaris) option for GCC, -mt for SunPro,
/MT for VC, and so on. Sometimes you should define _REENTRANT or something else, depends
upon platform/compiler. See compiler's and linker's options on command line when you build
unit tests (build/test/unit) for reference. The last is useful for ANY platform (special
attention for Windows users).
11) Don't hesitate to read READMEs (doc/README*, build/lib/README*, build/test/unit/README*)
and doc/FAQ.
12) Have fun!

View File

@@ -1,64 +0,0 @@
**********************************************************************
* README file for STLport 5.0 *
* *
**********************************************************************
This directory contains the STLport-5.0 release.
What's inside :
README - this file
INSTALL - installation instructions
bin - installation directory for STLport unit tests;
it may contain more subdirs, if you use
crosscompilation
build/lib - build directory for STLport library (if you use
STLport iostreams and/or locale only)
build/test/unit - build directory for regression (unit) tests
build/test/eh - build directory for exception handling tests
stlport - main STLport include directory
src - source for iostreams implementation and other parts
that aren't pure template code
lib - installation directory for STLport library (if you
use STLport iostreams and/or locale only);
it may contain more subdirs, if you use
crosscompilation
test/unit - unit (regression) tests
test/eh - exception handling test using STLport iostreams
etc - miscellanous files (ChangeLog, TODO, scripts, etc.)
GETTING STLPORT
To download the latest version of STLport, please be sure to visit
https://sourceforge.net/project/showfiles.php?group_id=146814
LEGALESE
This software is being distributed under the following terms:
*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996-1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999-2003
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
**********************************************************************

View File

@@ -1,97 +0,0 @@
URL: http://sourceforge.net/projects/stlport
Version: 5.1.4
License: notice
License File: LICENSE
Description:
This is STLport version 5.1.4, retrieved on Jan 17th 2008. See
http://www.stlport.org
Local Modifications:
Fixed some compiler warnings.
Added support for Android.
Added #define options to allow using a subset of iostreams without
requiring STLport to be built as a library.
Changed the following files:
_alloc.h:
Option to use simple node allocator so we don't need
out-of-line functions built.
_cstdlib.h:
#if out the C library functions not present on Android.
_cwchar.h:
#if out wide character types not defined by Android headers.
_iostream.c:
Fix warning about ambiguous expression order.
_num_put.c:
Fix warning about ambiguous expression order.
_range_errors.c:
Tweak #ifs to more precisely specify when not to use
externally defined range error functions so we don't
need out-of-lines compiled separately.
c_locale.h:
Don't #include broken Android wchar.h. Used the BSD _Locale_*
definitions as Android uses a BSD derived ctype.h.
char_traits.h:
Define streamoff type for Android.
_android.h:
Android platform configuration defines.
_gcc.h:
Option to prevent uncaught_exception and unexpected_exception
being out-of-lined.
_system.h:
Added Android platform.
cstring:
#if out missing C library functions on Android.
Added support for Symbian, based on Marco Jez's port:
http://marcoplusplus.blogspot.com/
This patch will be in the official STLPort from release 5.1.5 on.
Detailed changes:
num_get_float.cpp:
modified the #define for unsigned int64 so that it handles the Symbian case.
_system.h:
added defines to include the correct config files for Symbian.
features.h:
added a define guard around _STLP_WIN32 to avoid setting it when cross
compiling.
stl_gcce.h:
config file for gcce and armcc, taken as-is from the Symbian port.
stl_winscw.h:
config file for winscw, taken as-is from the Symbian port.
stl_symbian.h:
Symbian platform configuration defines. Added some defines to avoid building
the library (the last define is new, see below):
_STLP_USE_NO_EXTERN_RANGE_ERRORS
_STLP_USE_SIMPLE_NODE_ALLOC
_STLP_DONT_THROW_RANGE_ERRORS
_STLP_EXPOSE_GLOBALS_IMPLEMENTATION
_STLP_USE_NEWALLOC
_STLP_INLINE_EXCEPTION_CLASS
_exception.h:
used the new STLP_INLINE_EXCEPTION_CLASS define to avoid having missing
symbols if we don't compile as a library.

View File

@@ -1,45 +0,0 @@
URL: http://sourceforge.net/projects/stlport
Version: 5.1.4
License: notice
License File: LICENSE
Description:
This is STLport version 5.1.4, retrieved on Jan 17th 2008. See
http://www.stlport.org
This has been further modified by Gears svn revision 3384.
Further modifications from that to support iostreams.
Local Modifications:
build/lib/android.mak:
Added Makefile to build STLport using the Android NDK.
stlport/stl/_limits.h:
Add OS_ANDROID to list of platforms where numeric_limits<long long>
works without workaround.
stlport/stl/config/_android.h:
Turn off RTTI support, use __node_alloc as we're building an
out-of-line library which includes it. Allow EXTERN_RANGE_ERRORS.
Adjust the paths for native headers. Define operator new.
stlport/stl/config/_gcc.h:
Remove patch to stop dragging in exception support.
src/c_locale.h:
Include stl/_mbstate_t.h on all platforms as this should have
been dragged in - on OS_ANDROID some other header is not being
implicitly used and pulling it in itself.
src/num_put_float.cpp:
Define USE_SPRINTF_INSTEAD for OS_ANDROID as many of the
floating point to string conversion functions are missing.
src/ctype.cpp:
OS_ANDROID also doesn't understand alpha & (lower | upper)
src/_stdio_file.h:
Added OS_ANDROID accessor for the underlying file descriptor in FILE.
src/num_get_float.cpp:
Define uint32/uint64 on OS_ANDROID.

View File

@@ -1 +0,0 @@

View File

@@ -1,2 +0,0 @@
obj
core

View File

@@ -1,823 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
// WARNING: This is an internal header file, included by other C++
// standard library headers. You should not attempt to use this header
// file directly.
#ifndef _STLP_STDIO_FILE_H
#define _STLP_STDIO_FILE_H
// This file provides a low-level interface between the internal
// representation of struct FILE, from the C stdio library, and
// the C++ I/O library. The C++ I/O library views a FILE object as
// a collection of three pointers: the beginning of the buffer, the
// current read/write position, and the end of the buffer.
// The interface:
// - char* _FILE_[IO]_begin(const FILE *__f);
// Returns a pointer to the beginning of the buffer.
// - char* _FILE_[IO]_next(const FILE *__f);
// Returns the current read/write position within the buffer.
// - char* _FILE_[IO]_end(const FILE *__f);
// Returns a pointer immediately past the end of the buffer.
// - char* _FILE_[IO]_avail(const FILE *__f);
// Returns the number of characters remaining in the buffer, i.e.
// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f).
// - char& _FILE_[IO]_preincr(FILE *__f)
// Increments the current read/write position by 1, returning the
// character at the old position.
// - char& _FILE_[IO]_postincr(FILE *__f)
// Increments the current read/write position by 1, returning the
// character at the old position.
// - char& _FILE_[IO]_predecr(FILE *__f)
// Decrements the current read/write position by 1, returning the
// character at the old position.
// - char& _FILE_[IO]_postdecr(FILE *__f)
// Decrements the current read/write position by 1, returning the
// character at the old position.
// - void _FILE_[IO]_bump(FILE *__f, int __n)
// Increments the current read/write position by __n.
// - void _FILE_[IO]_set(FILE *__f, char* __begin, char* __next, char* __end);
// Sets the beginning of the bufer to __begin, the current read/write
// position to __next, and the buffer's past-the-end pointer to __end.
// If any of those pointers is null, then all of them must be null.
// Each function comes in two versions, one for a FILE used as an input
// buffer and one for a FILE used as an output buffer. In some stdio
// implementations the two functions are identical, but in others they are
// not.
#ifndef _STLP_CSTDIO
# include <cstdio>
#endif
#ifndef _STLP_CSTDDEF
# include <cstddef>
#endif
#if defined(__MSL__) && !defined(N_PLAT_NLM)
# include <unix.h> // get the definition of fileno
#endif
_STLP_BEGIN_NAMESPACE
//----------------------------------------------------------------------
// Implementation for eMbedded Visual C++ 3.0 and 4.2 (.NET)
#if defined (_STLP_WCE)
inline int _FILE_fd(const FILE *__f) { return (int)::_fileno((FILE*)__f); }
# undef _STLP_FILE_I_O_IDENTICAL
// Implementation for the IRIX C library.
// Solaris interface looks to be identical.
#elif !defined(_STLP_USE_GLIBC) && \
( defined(__sgi) || \
( defined(__sun) && ! defined (_LP64) ) || \
defined (__osf__) || defined(__DECCXX) || \
(defined (_STLP_MSVC) && !defined (_STLP_WCE_EVC3)) || \
defined (__ICL) || defined (__MINGW32__) || defined(__DJGPP) || defined (_AIX) || defined (_CRAY))
#if defined (_STLP_MSVC) || defined (__ICL) || defined (__MINGW32__) || defined(__DJGPP)
typedef char* _File_ptr_type;
#else
typedef unsigned char* _File_ptr_type;
#endif
inline int _FILE_fd(const FILE *__f) { return __f->_file; }
inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->_base; }
inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->_ptr; }
inline char* _FILE_I_end(const FILE *__f)
{ return (char*) __f->_ptr + __f->_cnt; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->_cnt; }
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->_cnt; return *(char*) (++__f->_ptr); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->_cnt; return *(char*) (__f->_ptr++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->_cnt; return *(char*) (--__f->_ptr); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->_cnt; return *(char*) (__f->_ptr--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->_ptr += __n; __f->_cnt -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) {
__f->_base = (_File_ptr_type) __begin;
__f->_ptr = (_File_ptr_type) __next;
__f->_cnt = __end - __next;
}
# define _STLP_FILE_I_O_IDENTICAL 1
#elif defined(__EMX__)
inline int _FILE_fd(const FILE* __f) { return __f->_handle; }
inline char* _FILE_I_begin(const FILE* __f) { return (char*) __f->_buffer; }
inline char* _FILE_I_next(const FILE* __f) { return (char*) __f->_ptr; }
inline char* _FILE_I_end(const FILE* __f) { return (char *) __f->_ptr + __f->_rcount; }
inline ptrdiff_t _FILE_I_avail(const FILE* __f) { return __f->_rcount; }
inline char& _FILE_I_preincr(FILE* __f) { --__f->_rcount; return *(char*) (++__f->_ptr); }
inline char& _FILE_I_postincr(FILE* __f) { --__f->_rcount; return *(char*) (__f->_ptr++); }
inline char& _FILE_I_predecr(FILE* __f) { ++__f->_rcount; return *(char*) (--__f->_ptr); }
inline char& _FILE_I_postdecr(FILE* __f) { ++__f->_rcount; return *(char*) (__f->_ptr--); }
inline void _FILE_I_bump(FILE* __f, int __n) { __f->_ptr += __n; __f->_rcount -= __n; }
inline void _FILE_I_set(FILE* __f, char* __begin, char* __next, char* __end) {
__f->_buffer = __begin;
__f->_ptr = __next;
__f->_rcount = __end - __next;
}
inline char* _FILE_O_begin(const FILE* __f) { return (char*) __f->_buffer; }
inline char* _FILE_O_next(const FILE* __f) { return (char*) __f->_ptr; }
inline char* _FILE_O_end(const FILE* __f) { return (char*) __f->_ptr + __f->_wcount; }
inline ptrdiff_t _FILE_O_avail(const FILE* __f) { return __f->_wcount; }
inline char& _FILE_O_preincr(FILE* __f) { --__f->_wcount; return *(char*) (++__f->_ptr); }
inline char& _FILE_O_postincr(FILE* __f) { --__f->_wcount; return *(char*) (__f->_ptr++); }
inline char& _FILE_O_predecr(FILE* __f) { ++__f->_wcount; return *(char*) (--__f->_ptr); }
inline char& _FILE_O_postdecr(FILE* __f) { ++__f->_wcount; return *(char*) (__f->_ptr--); }
inline void _FILE_O_bump(FILE* __f, int __n) { __f->_ptr += __n; __f->_wcount -= __n; }
inline void _FILE_O_set(FILE* __f, char* __begin, char* __next, char* __end) {
__f->_buffer = __begin;
__f->_ptr = __next;
__f->_wcount = __end - __next;
}
# undef _STLP_FILE_I_O_IDENTICAL
# elif defined(_STLP_SCO_OPENSERVER) || defined(__NCR_SVR)
typedef unsigned char* _File_ptr_type;
inline int _FILE_fd(const FILE *__f) { return __f->__file; }
inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->__base; }
inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->__ptr; }
inline char* _FILE_I_end(const FILE *__f)
{ return (char*) __f->__ptr + __f->__cnt; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->__cnt; }
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->__cnt; return *(char*) (++__f->__ptr); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->__cnt; return *(char*) (__f->__ptr++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->__cnt; return *(char*) (--__f->__ptr); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->__cnt; return *(char*) (__f->__ptr--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->__ptr += __n; __f->__cnt -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) {
__f->__base = (_File_ptr_type) __begin;
__f->__ptr = (_File_ptr_type) __next;
__f->__cnt = __end - __next;
}
# define _STLP_FILE_I_O_IDENTICAL 1
# elif defined(__sun) && defined( _LP64)
typedef long _File_ptr_type;
inline int _FILE_fd(const FILE *__f) { return (int) __f->__pad[2]; }
inline char* _FILE_I_begin(const FILE *__f) { return (char*)
__f->__pad[1]; }
inline char* _FILE_I_next(const FILE *__f) { return (char*)
__f->__pad[0]; }
inline char* _FILE_I_end(const FILE *__f)
{ return (char*) __f->__pad[0] + __f->__pad[3]; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->__pad[3]; }
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->__pad[3]; return *(char*) (++__f->__pad[0]); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->__pad[3]; return *(char*) (__f->__pad[0]++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->__pad[3]; return *(char*) (--__f->__pad[0]); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->__pad[3]; return *(char*) (__f->__pad[0]--); }
inline void _FILE_I_bump(FILE *__f, long __n)
{ __f->__pad[0] += __n; __f->__pad[3] -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char*
__end) {
__f->__pad[1] = (_File_ptr_type) __begin;
__f->__pad[0] = (_File_ptr_type) __next;
__f->__pad[3] = __end - __next;
}
# define _STLP_FILE_I_O_IDENTICAL
#elif defined (__CYGWIN__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \
|| defined(__amigaos__) || ( defined(__GNUC__) && defined(__APPLE__) )
inline int _FILE_fd(const FILE *__f) { return __f->_file; }
inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->_bf._base; }
inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->_p; }
inline char* _FILE_I_end(const FILE *__f)
{ return (char*) __f->_p + __f->_r; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->_r; }
#if ( defined(__GNUC__) && defined(__APPLE__) )
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->_r; return *(char*) (++__f->_p); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->_r; return *(char*) (__f->_p++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->_r; return *(char*) (--__f->_p); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->_r; return *(char*) (__f->_p--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->_p += __n; __f->_r -= __n; }
#else
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->_r; --__f->_bf._size; return *(char*) (++__f->_p); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->_r; --__f->_bf._size; return *(char*) (__f->_p++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->_r; ++ __f->_bf._size; return *(char*) (--__f->_p); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->_r; ++__f->_bf._size; return *(char*) (__f->_p--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->_p += __n; __f->_bf._size+=__n; __f->_r -= __n; }
#endif
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) {
__f->_bf._base = (unsigned char*) __begin;
__f->_p = (unsigned char*) __next;
__f->_r = __f->_bf._size = __end - __next;
}
inline char* _FILE_O_begin(const FILE *__f) { return (char*) __f->_bf._base; }
inline char* _FILE_O_next(const FILE *__f) { return (char*) __f->_p; }
inline char* _FILE_O_end(const FILE *__f)
{ return (char*) __f->_p + __f->_w; }
inline ptrdiff_t _FILE_O_avail(const FILE *__f) { return __f->_w; }
#if ( defined(__GNUC__) && defined(__APPLE__) )
inline char& _FILE_O_preincr(FILE *__f)
{ --__f->_w; return *(char*) (++__f->_p); }
inline char& _FILE_O_postincr(FILE *__f)
{ --__f->_w; return *(char*) (__f->_p++); }
inline char& _FILE_O_predecr(FILE *__f)
{ ++__f->_w; return *(char*) (--__f->_p); }
inline char& _FILE_O_postdecr(FILE *__f)
{ ++__f->_w; return *(char*) (__f->_p--); }
inline void _FILE_O_bump(FILE *__f, int __n)
{ __f->_p += __n; __f->_w -= __n; }
#else
inline char& _FILE_O_preincr(FILE *__f)
{ --__f->_w; --__f->_bf._size; return *(char*) (++__f->_p); }
inline char& _FILE_O_postincr(FILE *__f)
{ --__f->_w; --__f->_bf._size; return *(char*) (__f->_p++); }
inline char& _FILE_O_predecr(FILE *__f)
{ ++__f->_w; ++__f->_bf._size; return *(char*) (--__f->_p); }
inline char& _FILE_O_postdecr(FILE *__f)
{ ++__f->_w; ++__f->_bf._size; return *(char*) (__f->_p--); }
inline void _FILE_O_bump(FILE *__f, int __n)
{ __f->_p += __n; __f->_bf._size+=__n; __f->_w -= __n; }
#endif
inline void _FILE_O_set(FILE *__f, char* __begin, char* __next, char* __end) {
__f->_bf._base = (unsigned char*) __begin;
__f->_p = (unsigned char*) __next;
__f->_w = __f->_bf._size = __end - __next;
}
# undef _STLP_FILE_I_O_IDENTICAL
#elif defined(_STLP_USE_UCLIBC) /* should be before _STLP_USE_GLIBC */
inline int _FILE_fd(const FILE *__f) { return fileno(__CONST_CAST(FILE *,__f)); }
#elif defined(ANDROID) /* should be before _STLP_USE_GLIBC */
inline int _FILE_fd(const FILE *__f) { return __f->_file; }
#elif defined(_STLP_USE_GLIBC)
inline int _FILE_fd(const FILE *__f) { return __f->_fileno; }
inline char* _FILE_I_begin(const FILE *__f) { return __f->_IO_read_base; }
inline char* _FILE_I_next(const FILE *__f) { return __f->_IO_read_ptr; }
inline char* _FILE_I_end(const FILE *__f) { return __f->_IO_read_end; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f)
{ return __f->_IO_read_end - __f->_IO_read_ptr; }
inline char& _FILE_I_preincr(FILE *__f) { return *++__f->_IO_read_ptr; }
inline char& _FILE_I_postincr(FILE *__f) { return *__f->_IO_read_ptr++; }
inline char& _FILE_I_predecr(FILE *__f) { return *--__f->_IO_read_ptr; }
inline char& _FILE_I_postdecr(FILE *__f) { return *__f->_IO_read_ptr--; }
inline void _FILE_I_bump(FILE *__f, int __n) { __f->_IO_read_ptr += __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) {
__f->_IO_read_base = __begin;
__f->_IO_read_ptr = __next;
__f->_IO_read_end = __end;
}
inline char* _FILE_O_begin(const FILE *__f) { return __f->_IO_write_base; }
inline char* _FILE_O_next(const FILE *__f) { return __f->_IO_write_ptr; }
inline char* _FILE_O_end(const FILE *__f) { return __f->_IO_write_end; }
inline ptrdiff_t _FILE_O_avail(const FILE *__f)
{ return __f->_IO_write_end - __f->_IO_write_ptr; }
inline char& _FILE_O_preincr(FILE *__f) { return *++__f->_IO_write_ptr; }
inline char& _FILE_O_postincr(FILE *__f) { return *__f->_IO_write_ptr++; }
inline char& _FILE_O_predecr(FILE *__f) { return *--__f->_IO_write_ptr; }
inline char& _FILE_O_postdecr(FILE *__f) { return *__f->_IO_write_ptr--; }
inline void _FILE_O_bump(FILE *__f, int __n) { __f->_IO_write_ptr += __n; }
inline void _FILE_O_set(FILE *__f, char* __begin, char* __next, char* __end) {
__f->_IO_write_base = __begin;
__f->_IO_write_ptr = __next;
__f->_IO_write_end = __end;
}
#elif defined(__hpux) /* && defined(__hppa) && defined(__HP_aCC)) */
#ifndef _INCLUDE_HPUX_SOURCE
extern "C" unsigned char *__bufendtab[];
# undef _bufend
# define _bufend(__p) \
(*(((__p)->__flag & _IOEXT) ? &(((_FILEX *)(__p))->__bufendp) \
: &(__bufendtab[(__p) - __iob])))
# define _bufsiz(__p) (_bufend(__p) - (__p)->__base)
#endif /* _INCLUDE_HPUX_SOURCE */
#if defined(_STLP_HPACC_BROKEN_BUFEND)
# undef _bufend
# define _bufend(__p) \
(*(((__p)->__flag & _IOEXT) ? &((__REINTERPRET_CAST(_FILEX*,(__p)))->__bufendp) \
: &(__bufendtab[__REINTERPRET_CAST(FILE*,(__p)) - __iob])))
#endif
inline int _FILE_fd(const FILE *__f) { return fileno(__CONST_CAST(FILE *,__f)); }
inline char* _FILE_I_begin(const FILE *__f) { return (__REINTERPRET_CAST(char*, __f->__base)); }
inline char* _FILE_I_next(const FILE *__f) { return (__REINTERPRET_CAST(char*, __f->__ptr)); }
inline char* _FILE_I_end(const FILE *__f) { return (__REINTERPRET_CAST(char*, __f->__ptr +__f->__cnt)); }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->__cnt; }
inline char& _FILE_I_preincr(FILE *__f) { --__f->__cnt; return *__REINTERPRET_CAST(char*, ++__f->__ptr); }
inline char& _FILE_I_postincr(FILE *__f) { --__f->__cnt; return *__REINTERPRET_CAST(char*, __f->__ptr++); }
inline char& _FILE_I_predecr(FILE *__f) { ++__f->__cnt; return *__REINTERPRET_CAST(char*,--__f->__ptr); }
inline char& _FILE_I_postdecr(FILE *__f) { ++__f->__cnt; return *__REINTERPRET_CAST(char*,__f->__ptr--); }
inline void _FILE_I_bump(FILE *__f, int __n) { __f->__cnt -= __n; __f->__ptr += __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) {
# if defined(__hpux)
if( (unsigned long) (__f - &__iob[0]) > _NFILE)
__f->__flag |= _IOEXT; // used by stdio's _bufend macro and goodness knows what else...
# endif
__f->__cnt = __end - __next;
__f->__base = __REINTERPRET_CAST(unsigned char*, __begin);
__f->__ptr = __REINTERPRET_CAST(unsigned char*, __next);
_bufend(__f) = __REINTERPRET_CAST(unsigned char*, __end);
}
// For HPUX stdio, input and output FILE manipulation is identical.
# define _STLP_FILE_I_O_IDENTICAL
#elif defined (__BORLANDC__)
typedef unsigned char* _File_ptr_type;
inline int _FILE_fd(const FILE *__f) { return __f->fd; }
inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->buffer;
}
inline char* _FILE_I_next(const FILE *__f)
{ return (char*)__f->curp; }
inline char* _FILE_I_end(const FILE *__f)
{ return (char*) __f->curp + __f->level; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->level; }
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->level; return *(char*) (++__f->curp); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->level; return *(char*) (__f->curp++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->level; return *(char*) (--__f->curp); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->level; return *(char*) (__f->curp--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->curp += __n; __f->level -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) {
__f->buffer = (_File_ptr_type) __begin;
__f->curp = (_File_ptr_type) __next;
__f->level = __end - __next;
}
# define _STLP_FILE_I_O_IDENTICAL
#elif defined( __MWERKS__ )
// using MWERKS-specific defines here to detect other OS targets
// dwa: I'm not sure they provide fileno for all OS's, but this should
// work for Win32 and WinCE
#ifndef N_PLAT_NLM
// Hmm, at least for Novell NetWare __dest_os == __mac_os true too..
// May be both __dest_os and __mac_os defined and empty? - ptr
# if __dest_os == __mac_os
inline int _FILE_fd(const FILE *__f) { return ::fileno(__CONST_CAST(FILE*, __f)); }
# else
inline int _FILE_fd(const FILE *__f) { return ::_fileno(__CONST_CAST(FILE*, __f)); }
# endif // __dest_os == __mac_os
// Returns a pointer to the beginning of the buffer.
inline char* _FILE_I_begin(const FILE *__f) { return __REINTERPRET_CAST(char*, __f->buffer); }
// Returns the current read/write position within the buffer.
inline char* _FILE_I_next(const FILE *__f) { return __REINTERPRET_CAST(char*, __f->buffer_ptr); }
// Returns a pointer immediately past the end of the buffer.
inline char* _FILE_I_end(const FILE *__f) { return __REINTERPRET_CAST(char*, __f->buffer_ptr + __f->buffer_len); }
// Returns the number of characters remaining in the buffer, i.e.
// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f).
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->buffer_len; }
// Increments the current read/write position by 1, returning the
// character at the old position.
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->buffer_len; return *(char*) (++__f->buffer_ptr); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->buffer_len; return *(char*) (__f->buffer_ptr++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->buffer_len; return *(char*) (--__f->buffer_ptr); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->buffer_len; return *(char*) (__f->buffer_ptr--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->buffer_ptr += __n; __f->buffer_len -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) {
__f->buffer = __REINTERPRET_CAST(unsigned char*, __begin);
__f->buffer_ptr = __REINTERPRET_CAST(unsigned char*, __next);
__f->buffer_len = __end - __next;
__f->buffer_size = __end - __begin;
}
#else // N_PLAT_NLM - ptr
inline int _FILE_fd(const FILE *__f) { return __f->_file; }
inline char* _FILE_I_begin(const FILE *__f) { return __REINTERPRET_CAST(char*, __f->_base); }
// Returns the current read/write position within the buffer.
inline char* _FILE_I_next(const FILE *__f) { return __REINTERPRET_CAST(char*, __f->_ptr); }
// Returns a pointer immediately past the end of the buffer.
inline char* _FILE_I_end(const FILE *__f) { return __REINTERPRET_CAST(char*, __f->_ptr + __f->_avail); }
// Returns the number of characters remaining in the buffer, i.e.
// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f).
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->_avail; }
// Increments the current read/write position by 1, returning the
// character at the old position.
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->_avail; return *(char*) (++__f->_ptr); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->_avail; return *(char*) (__f->_ptr++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->_avail; return *(char*) (--__f->_ptr); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->_avail; return *(char*) (__f->_ptr--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->_ptr += __n; __f->_avail -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) {
__f->_base = __REINTERPRET_CAST(unsigned char*, __begin);
__f->_ptr = __REINTERPRET_CAST(unsigned char*, __next);
__f->_avail = __end - __next;
}
#endif // N_PLAT_NLM
# define _STLP_FILE_I_O_IDENTICAL
#elif defined(__DMC__)
inline int _FILE_fd(const FILE *__f) { return __f->_file; }
// Returns a pointer to the beginning of the buffer.
inline char* _FILE_I_begin(const FILE *__f) { return __f->_base; }
// Returns the current read/write position within the buffer.
inline char* _FILE_I_next(const FILE *__f) { return __f->_ptr; }
// Returns a pointer immediately past the end of the buffer.
inline char* _FILE_I_end(const FILE *__f) { return __f->_ptr + __f->_cnt; }
// Returns the number of characters remaining in the buffer, i.e.
// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f).
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->_cnt; }
// Increments the current read/write position by 1, returning the
// character at the NEW position.
inline char& _FILE_I_preincr(FILE *__f) { --__f->_cnt; return *(++__f->_ptr); }
// Increments the current read/write position by 1, returning the
// character at the old position.
inline char& _FILE_I_postincr(FILE *__f) { --__f->_cnt; return *(__f->_ptr++); }
// Decrements the current read/write position by 1, returning the
// character at the NEW position.
inline char& _FILE_I_predecr(FILE *__f) { ++__f->_cnt; return *(--__f->_ptr); }
// Decrements the current read/write position by 1, returning the
// character at the old position.
inline char& _FILE_I_postdecr(FILE *__f) { ++__f->_cnt; return *(__f->_ptr--); }
// Increments the current read/write position by __n.
inline void _FILE_I_bump(FILE *__f, int __n) { __f->_cnt -= __n; __f->_ptr += __n; }
// Sets the beginning of the bufer to __begin, the current read/write
// position to __next, and the buffer's past-the-end pointer to __end.
// If any of those pointers is null, then all of them must be null.
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end)
{
__f->_base = __begin;
__f->_ptr = __next;
__f->_cnt = __end - __next;
__f->_bufsiz = __end - __begin;
}
# define _STLP_FILE_I_O_IDENTICAL
#elif defined(__MRC__) || defined(__SC__) //*TY 02/24/2000 - added support for MPW
inline int _FILE_fd(const FILE *__f) { return __f->_file; }
// Returns a pointer to the beginning of the buffer.
inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->_base; }
// Returns the current read/write position within the buffer.
inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->_ptr; }
// Returns a pointer immediately past the end of the buffer.
inline char* _FILE_I_end(const FILE *__f) { return (char*)__f->_end; }
// Returns the number of characters remaining in the buffer, i.e.
// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f).
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->_cnt; }
// Increments the current read/write position by 1, returning the
// character at the NEW position.
inline char& _FILE_I_preincr(FILE *__f) { --__f->_cnt; return*(char*) (++__f->_ptr); }
// Increments the current read/write position by 1, returning the
// character at the old position.
inline char& _FILE_I_postincr(FILE *__f) { --__f->_cnt; return*(char*) (__f->_ptr++); }
// Decrements the current read/write position by 1, returning the
// character at the NEW position.
inline char& _FILE_I_predecr(FILE *__f) { ++__f->_cnt; return*(char*) (--__f->_ptr); }
// Decrements the current read/write position by 1, returning the
// character at the old position.
inline char& _FILE_I_postdecr(FILE *__f) { ++__f->_cnt; return*(char*) (__f->_ptr--); }
// Increments the current read/write position by __n.
inline void _FILE_I_bump(FILE *__f, int __n) { __f->_cnt -= __n; __f->_ptr += __n; }
// Sets the beginning of the bufer to __begin, the current read/write
// position to __next, and the buffer's past-the-end pointer to __end.
// If any of those pointers is null, then all of them must be null.
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end)
{
__f->_base = (unsigned char*)__begin;
__f->_ptr = (unsigned char*)__next;
__f->_end = (unsigned char*)__end;
__f->_cnt = __end - __next;
__f->_size = __end - __begin;
}
# define _STLP_FILE_I_O_IDENTICAL
#elif defined (__MVS__)
typedef unsigned char* _File_ptr_type;
inline int _FILE_fd(const FILE *__f) { return fileno(__CONST_CAST(FILE
*,__f)); }
inline char* _FILE_I_begin(const FILE *__f) { return (char*)
__f->__fp->__bufPtr; }
inline char* _FILE_I_next(const FILE *__f) { return (char*)
__f->__fp->__bufPtr; }
inline char* _FILE_I_end(const FILE *__f)
{ return (char*) __f->__fp->__bufPtr + __f->__fp->__countIn; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return
__f->__fp->__countIn; }
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->__fp->__countIn; return *(char*) (++__f->__fp->__bufPtr); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->__fp->__countIn; return *(char*) (__f->__fp->__bufPtr++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->__fp->__countIn; return *(char*) (--__f->__fp->__bufPtr); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->__fp->__countIn; return *(char*) (__f->__fp->__bufPtr--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->__fp->__bufPtr += __n; __f->__fp->__countIn -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char*
__end) {
// __f->_base = (_File_ptr_type) __begin;
if(__f->__fp) {
__f->__fp->__bufPtr = (_File_ptr_type) __next;
__f->__fp->__countIn = __end - __next;
}
}
inline char* _FILE_O_begin(const FILE *__f) { return (char*)__f->__fp->__bufPtr;}
inline char* _FILE_O_next(const FILE *__f) { return (char*) __f->__fp->__bufPtr;}
inline char* _FILE_O_end(const FILE *__f) { return (char*) __f->__fp->__bufPtr + __f->__fp->__countOut; }
inline ptrdiff_t _FILE_O_avail(const FILE *__f) { return __f->__fp->__countOut; }
inline char& _FILE_O_preincr(FILE *__f)
{ --__f->__fp->__countOut; return *(char*) (++__f->__fp->__bufPtr); }
inline char& _FILE_O_postincr(FILE *__f)
{ --__f->__fp->__countOut; return *(char*) (__f->__fp->__bufPtr++); }
inline char& _FILE_O_predecr(FILE *__f)
{ ++__f->__fp->__countOut; return *(char*) (--__f->__fp->__bufPtr); }
inline char& _FILE_O_postdecr(FILE *__f)
{ ++__f->__fp->__countOut; return *(char*) (__f->__fp->__bufPtr--); }
inline void _FILE_O_bump(FILE *__f, int __n)
{ __f->__fp->__bufPtr += __n; __f->__fp->__countOut -= __n; }
inline void _FILE_O_set(FILE *__f, char* __begin, char* __next, char*
__end) {
// __f->_base = (_File_ptr_type) __begin;
if(__f->__fp) {
__f->__fp->__bufPtr = (_File_ptr_type) __next;
__f->__fp->__countOut = __end - __next;
}
}
#elif defined(__QNXNTO__)
inline int _FILE_fd(const FILE *__f) { return __f->_handle;
}
inline char* _FILE_I_begin(const FILE *__f) { return
(char*) __f->_base; }
inline char* _FILE_I_next(const FILE *__f) { return
(char*) __f->_ptr; }
inline char* _FILE_I_end(const FILE *__f)
{ return (char*) __f->_ptr + __f->_cnt; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return
__f->_cnt; }
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->_cnt; return *(char*) (++__f->_ptr); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->_cnt; return *(char*) (__f->_ptr++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->_cnt; return *(char*) (--__f->_ptr); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->_cnt; return *(char*) (__f->_ptr--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->_ptr += __n; __f->_cnt -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char*
__next, char*
__end) {
__f->_base = (unsigned char*) __begin;
__f->_ptr = (unsigned char*) __next;
__f->_cnt = __end - __next;
}
# define _STLP_FILE_I_O_IDENTICAL
#elif defined(__WATCOMC__) // Nikolaev
inline int _FILE_fd (const FILE *__f) { return __f->_handle;}
inline char* _FILE_I_begin (const FILE *__f) { return __REINTERPRET_CAST(char*, __f->_link); }
inline char* _FILE_I_next (const FILE *__f) { return __REINTERPRET_CAST(char*, __f->_ptr); }
inline char* _FILE_I_end (const FILE *__f) { return __REINTERPRET_CAST(char*, __f->_ptr + __f->_cnt); }
inline ptrdiff_t _FILE_I_avail (const FILE *__f) { return __f->_cnt; }
inline char& _FILE_I_preincr(FILE *__f)
{
--__f->_cnt;
return *__REINTERPRET_CAST(char*, ++__f->_ptr);
}
inline char& _FILE_I_postincr(FILE *__f)
{
--__f->_cnt;
return *__REINTERPRET_CAST(char*, __f->_ptr++);
}
inline char& _FILE_I_predecr(FILE *__f)
{
++__f->_cnt;
return *__REINTERPRET_CAST(char*, --__f->_ptr);
}
inline char& _FILE_I_postdecr(FILE *__f)
{
++__f->_cnt;
return *__REINTERPRET_CAST(char*, __f->_ptr--);
}
inline void _FILE_I_bump(FILE *__f, int __n)
{
__f->_ptr += __n;
__f->_cnt -= __n;
}
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end)
{
__f->_link = __REINTERPRET_CAST(__stream_link*, __begin);
__f->_ptr = __REINTERPRET_CAST(unsigned char*, __next);
__f->_cnt = __end - __next;
}
# define _STLP_FILE_I_O_IDENTICAL
#elif defined (__Lynx__)
// the prototypes are taken from LynxOS patch for STLport 4.0
inline int _FILE_fd(const FILE *__f) { return __f->_fd; }
inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->_base; }
inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->_ptr; }
inline char* _FILE_I_end(const FILE *__f)
{ return (char*) __f->_ptr + __f->_cnt; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->_cnt; }
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->_cnt; return *(char*) (++__f->_ptr); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->_cnt; return *(char*) (__f->_ptr++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->_cnt; return *(char*) (--__f->_ptr); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->_cnt; return *(char*) (__f->_ptr--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->_ptr += __n; __f->_cnt -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) {
__f->_base = __begin;
__f->_ptr = __next;
__f->_cnt = __end - __next;
}
# define _STLP_FILE_I_O_IDENTICAL
#else /* A C library that we don't have an implementation for. */
# error The C++ I/O library is not configured for this compiler
#endif
// For most stdio's , input and output FILE manipulation is identical.
# ifdef _STLP_FILE_I_O_IDENTICAL
inline char* _FILE_O_begin(const FILE *__f) { return _FILE_I_begin(__f); }
inline char* _FILE_O_next(const FILE *__f) { return _FILE_I_next(__f); }
inline char* _FILE_O_end(const FILE *__f) { return _FILE_I_end(__f); }
inline ptrdiff_t _FILE_O_avail(const FILE *__f) { return _FILE_I_avail(__f); }
inline char& _FILE_O_preincr(FILE *__f) { return _FILE_I_preincr(__f); }
inline char& _FILE_O_postincr(FILE *__f) { return _FILE_I_postincr(__f); }
inline char& _FILE_O_predecr(FILE *__f) { return _FILE_I_predecr(__f); }
inline char& _FILE_O_postdecr(FILE *__f) { return _FILE_I_postdecr(__f); }
inline void _FILE_O_bump(FILE *__f, int __n) { _FILE_I_bump(__f, __n); }
inline void _FILE_O_set(FILE *__f, char* __begin, char* __next, char* __end)
{ _FILE_I_set(__f, __begin, __next, __end); }
# endif
_STLP_END_NAMESPACE
#endif /* _STLP_STDIO_FILE_H */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,42 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef ACQUIRE_RELEASE_H
#define ACQUIRE_RELEASE_H
#include "c_locale.h"
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
_Locale_ctype* _STLP_CALL __acquire_ctype(const char* name, _Locale_name_hint* hint);
_Locale_numeric* _STLP_CALL __acquire_numeric(const char* name, _Locale_name_hint* hint);
_Locale_collate* _STLP_CALL __acquire_collate(const char* name, _Locale_name_hint* hint);
_Locale_monetary* _STLP_CALL __acquire_monetary(const char* name, _Locale_name_hint* hint);
_Locale_messages* _STLP_CALL __acquire_messages(const char* name, _Locale_name_hint* hint);
void _STLP_CALL __release_ctype(_Locale_ctype* cat);
void _STLP_CALL __release_numeric(_Locale_numeric* cat);
void _STLP_CALL __release_collate(_Locale_collate* cat);
void _STLP_CALL __release_monetary(_Locale_monetary* cat);
void _STLP_CALL __release_messages(_Locale_messages* cat);
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
#endif /* ACQUIRE_RELEASE_H */

View File

@@ -1,21 +0,0 @@
#ifndef ALIGNED_BUFFER_H
#define ALIGNED_BUFFER_H
_STLP_BEGIN_NAMESPACE
// this is for fake initialization
template<class T>
union _Stl_aligned_buffer {
char buf[sizeof(T)];
struct { double a; double b; } padding;
T* operator&() {
return __REINTERPRET_CAST(T*, this);
}
T const* operator&() const {
return __REINTERPRET_CAST(T const*, this);
}
};
_STLP_END_NAMESPACE
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,156 +0,0 @@
/*
* Copyright (c) 1998
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <bitset>
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
// ------------------------------------------------------------
// Lookup tables for find and count operations.
size_t _Bs_G::_S_count(const unsigned char *__first,
const unsigned char *__last)
{
static unsigned char _bit_count[256] = {
0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */
2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */
2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */
4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */
2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */
3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */
4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */
3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */
2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */
4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */
3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */
5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */
4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */
2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */
3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */
4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */
2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */
4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */
4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */
6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */
3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */
4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */
5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */
5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */
4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */
6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */
2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */
4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */
3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */
3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */
4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */
5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */
2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */
4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */
4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */
6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */
4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */
5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */
6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */
4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */
3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */
5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */
4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */
6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */
5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */
4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */
5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */
6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */
4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */
6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */
6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */
8 /* 255 */
};
size_t __result(0);
while ( __first < __last ) {
__result += _bit_count[*(__first++)];
}
return __result;
}
unsigned char _Bs_G::_S_first_one(unsigned char __byte)
{
static unsigned char _first_one[256] = {
0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */
0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */
1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */
0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */
2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */
0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */
1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */
0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */
3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */
0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */
1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */
0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */
2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */
0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */
1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */
0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */
4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */
0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */
1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */
0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */
2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */
0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */
1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */
0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */
3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */
0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */
1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */
0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */
2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */
0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */
1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */
0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */
5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */
0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */
1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */
0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */
2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */
0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */
1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */
0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */
3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */
0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */
1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */
0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */
2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */
0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */
1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */
0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */
4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */
0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */
1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */
0, /* 255 */
};
return _first_one[__byte];
}
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE

View File

@@ -1,71 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <stdlib.h>
#include <limits.h>
#include "c_locale.h"
#if defined (_STLP_REAL_LOCALE_IMPLEMENTED)
# if defined (WIN32) || defined (_WIN32)
# include "c_locale_win32/c_locale_win32.c"
# elif defined (_STLP_USE_GLIBC) && ! defined (__CYGWIN__)
# if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2))
# include "c_locale_glibc/c_locale_glibc2.c"
/* # define _STLP_GLIBC_LOCALE_2 */ /* glibc 1.90 and newer */
/* # include "c_locale_glibc/c_locale_glibc.c" */
# else
# include "c_locale_glibc/c_locale_glibc.c"
# endif
# elif defined __ISCPP__
# include "c_locale_is/c_locale_is.cpp"
# endif
#else /* !_STLP_REAL_LOCALE_IMPLEMENTED */
# include "c_locale_dummy/c_locale_dummy.c"
#endif
#if defined(N_PLAT_NLM)
int wcslen( const wchar_t *_wc )
{ return unilen( (const unicode *)_wc ); }
int wcscmp( const wchar_t *_wc1, const wchar_t *_wc2 )
{ return unicmp( (const unicode *)_wc1, (const unicode *)_wc2 ); }
int wcsncmp( const wchar_t *_wc1, const wchar_t *_wc2, size_t n )
{ return unicmp( (const unicode *)_wc1, (const unicode *)_wc2, n ); }
wchar_t *wcsstr( const wchar_t *_wc1, const wchar_t *_wc2 )
{ return (wchar_t *)unistr( (const unicode *)_wc1, (const unicode *)_wc2 ); }
wchar_t *wcschr( const wchar_t *_wc1, wchar_t _wc2 )
{ return (wchar_t *)unichr((const unicode_t *)_wc1, (unicode_t)_wc2 ); }
wchar_t *wcsrchr( const wchar_t *_wc1, wchar_t _wc2 )
{ return (wchar_t *)unirchr((const unicode_t *)_wc1, (unicode_t)_wc2 ); }
wchar_t *wcscpy( wchar_t *_wc1, const wchar_t *_wc2 )
{ return (wchar_t *)unicpy((unicode_t *)_wc1, (const unicode_t *)_wc2 ); }
wchar_t *wcsncpy( wchar_t *_wc1, const wchar_t *_wc2, size_t n )
{ return (wchar_t *)unincpy((unicode_t *)_wc1, (const unicode_t *)_wc2, n ); }
wchar_t *wcspbrk( const wchar_t *_wc, const wchar_t *_wc2 )
{ return (wchar_t *)unipbrk( (const unicode *)_wc, (const unicode *)_wc2 ); }
#endif

View File

@@ -1,458 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/*
* It is impossible to write the C++ locale library in terms of locales
* as defined in the C standard. Instead, we write the C++ locale and I/O
* library in terms of a low level C-like interface. This file defines
* that interface.
*
* The low-level locale interface can't be written portably; there
* must be a version of it for each platform that the C++ library
* is ported to. On many systems this interface may be a thin wrapper
* for existing functionality.
*/
#ifndef _STLP_C_LOCALE_IMPL_H
#define _STLP_C_LOCALE_IMPL_H
#include "stlport_prefix.h"
#include <stl/c_locale.h>
#ifdef _STLP_REAL_LOCALE_IMPLEMENTED
# if defined (_STLP_USE_GLIBC) && !defined (__CYGWIN__)
# include <nl_types.h>
# endif
#endif
/*
* A number: the maximum length of a simple locale name.
* (i.e. a name like like en_US, as opposed to a name like
* en_US/de_AT/de_AT/es_MX/en_US/en_US) */
#define _Locale_MAX_SIMPLE_NAME 256
/*
* Maximum length of a composite locale.
*/
#define _Locale_MAX_COMPOSITE_NAME 6*(_Locale_MAX_SIMPLE_NAME+3)
#ifdef __cplusplus
extern "C" {
#endif
/*
* Typedefs:
*/
#if (defined (__GNUC__) && !defined (__MINGW32__)) || defined (_KCC) || defined (__ICC)
typedef unsigned short int _Locale_mask_t;
#else
typedef unsigned int _Locale_mask_t;
#endif
/* Function called during STLport library load phase. Might contain any
* code necessary to the platform localization layer.
*/
void _Locale_init();
/* Function called during STLport library unload. Might contain any
* code necessary to the platform localization layer.
*/
void _Locale_final();
/* Create a category of the locale with the given name.
*
* The char* argument is a simple (not a composite) locale name, which may
* neither be an empty string nor a null pointer.
*
* These functions return NULL to indicate failure.
*
* Note These functions return a void* instead of the appropriate
* _Locale_* struct because they are used with __acquire_category which
* requires that all functions have the same signature.
*/
void * _Locale_ctype_create(const char *, struct _Locale_name_hint*);
void * _Locale_numeric_create(const char *, struct _Locale_name_hint*);
void * _Locale_time_create(const char *, struct _Locale_name_hint*);
void * _Locale_collate_create(const char *, struct _Locale_name_hint*);
void * _Locale_monetary_create(const char *, struct _Locale_name_hint*);
void * _Locale_messages_create(const char *, struct _Locale_name_hint*);
/* Release a category of a locale
*
* These functions are used to release a category acquired with the
* according _Locale_*_create() functions.
*
* Note: For the same reasons as for the *_create functions, these
* take void* instead of the correct types so that they can be used
* with __release_category.
*/
void _Locale_ctype_destroy(void *);
void _Locale_numeric_destroy(void *);
void _Locale_time_destroy(void *);
void _Locale_collate_destroy(void *);
void _Locale_monetary_destroy(void *);
void _Locale_messages_destroy(void *);
/*
* Returns the name of the user's default locale in each
* category, as a null-terminated string. A NULL value
* means the default "C" locale.
*/
const char * _Locale_ctype_default(char * __buf);
const char * _Locale_numeric_default(char * __buf);
const char * _Locale_time_default(char * __buf);
const char * _Locale_collate_default(char * __buf);
const char * _Locale_monetary_default(char * __buf);
const char * _Locale_messages_default(char * __buf);
/* Retrieve the name of the given category
*
* __buf points to a buffer that can hold at least _Locale_MAX_SIMPLE_NAME
* characters. These functions store the name, as a null-terminated
* string, in __buf.
* TODO: can this fail? How is that signalled then?
*/
char const* _Locale_ctype_name(const void *, char* __buf);
char const* _Locale_numeric_name(const void *, char* __buf);
char const* _Locale_time_name(const void *, char* __buf);
char const* _Locale_collate_name(const void *, char* __buf);
char const* _Locale_monetary_name(const void *, char* __buf);
char const* _Locale_messages_name(const void *, char* __buf);
/*
* cname is a (possibly composite) locale name---i.e. a name that can
* be passed to setlocale. __buf points to an array large enough to
* store at least _Locale_MAX_SIMPLE_NAME characters, and each of these
* functions extracts the name of a single category, stores it in buf
* as a null-terminated string, and returns buf.
*/
char const* _Locale_extract_ctype_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);
char const* _Locale_extract_numeric_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);
char const* _Locale_extract_time_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);
char const* _Locale_extract_collate_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);
char const* _Locale_extract_monetary_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);
char const* _Locale_extract_messages_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);
/*
* The inputs to this function are six null-terminated strings: the
* names of a locale's six categories. Locale names for non-standard
* categories are taken from __DefaultName.
* __buf is a pointer to an array large enough to store at least
* _Locale_MAX_COMPOSITE_NAME characters.
* This function constructs a (possibly composite) name describing the
* locale as a whole, stores that name in buf as a null-terminated
* string, and returns buf.
*/
char const* _Locale_compose_name(char *__buf,
const char *__Ctype, const char *__Numeric,
const char *__Time, const char *__Collate,
const char *__Monetary, const char *__Messages,
const char *__DefaultName);
/* Funstions to improve locale creation process. For some locale API (Win32)
* you need to find a locale identification from the name which can be a
* rather expensive operation especially if you do so for all facets of a
* locale. Those functions can be used to extract from a API dependent facet
* struct the information necessary to skip this lookup process for other
* facets creation. If not supported those function should return NULL.
*/
struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype*);
struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric*);
struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time*);
struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate*);
struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary*);
struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages*);
/*
* FUNCTIONS THAT USE CTYPE
*/
/*
* Narrow character functions:
*/
/*
* Returns a pointer to the beginning of the ctype table. The table is
* at least 257 bytes long; if p is the pointer returned by this
* function, then p[c] is valid if c is EOF or if p is any value of
* type unsigned char.
*/
const _Locale_mask_t * _Locale_ctype_table(struct _Locale_ctype *);
/*
* c is either EOF, or an unsigned char value.
*/
int _Locale_toupper(struct _Locale_ctype *, int);
int _Locale_tolower(struct _Locale_ctype *, int);
# ifndef _STLP_NO_WCHAR_T
/*
* Wide character functions:
*/
_Locale_mask_t _Locale_wchar_ctype(struct _Locale_ctype *, wint_t,
_Locale_mask_t);
wint_t _Locale_wchar_tolower(struct _Locale_ctype *, wint_t);
wint_t _Locale_wchar_toupper(struct _Locale_ctype *, wint_t);
# endif
# if !defined ( _STLP_NO_MBSTATE_T )
#include <stl/_mbstate_t.h>
/*
* Multibyte functions:
*/
int _Locale_mb_cur_max (struct _Locale_ctype *);
/*
* Returns the number of bytes of the longest allowed multibyte
* character in the current encoding.
*/
int _Locale_mb_cur_min (struct _Locale_ctype *);
/*
* Returns the number of bytes of the shortest allowed multibyte
* character in the current encoding.
*/
int _Locale_is_stateless (struct _Locale_ctype *);
/*
* Returns 1 if the current multibyte encoding is stateless
* and does not require the use of an mbstate_t value.
*/
# ifndef _STLP_NO_WCHAR_T
wint_t _Locale_btowc(struct _Locale_ctype *, int);
int _Locale_wctob(struct _Locale_ctype *, wint_t);
/*
* Just like btowc and wctob, from 4.6.5.1 of the C standard, Normative
* Addendum 1. (And just like widen/narrow, from clause 22 of the C++
* standard.)
*/
size_t _Locale_mbtowc(struct _Locale_ctype *,
wchar_t *,
const char *, size_t,
mbstate_t *);
/*
* Almost identical to mbrtowc, from 4.6.5.3.2 of NA1. The only
* important difference is that mbrtowc treats null wide characters
* as special, and we don't. Specifically: examines the characters
* in [from, from + n), extracts a single wide character, and stores
* it in *to. Modifies shift_state if appropriate. The return value,
* which is always positive, is the number of characters extracted from
* the input sequence. Return value is (size_t) -1 if there was an
* encoding error in the input sequence, and (size_t) -2 if
* [from, from + n) is correct but not complete. None of the pointer
* arguments may be null pointers.
*/
size_t _Locale_wctomb(struct _Locale_ctype *,
char *, size_t,
const wchar_t,
mbstate_t *);
/*
* Again, very similar to wcrtomb. The differences are that (1) it
* doesn't treat null characters as special; and (2) it stores at most
* n characters. Converts c to a multibyte sequence, stores that
* sequence in the array 'to', and returns the length of the sequence.
* Modifies shift_state if appropriate. The return value is (size_t) -1
* if c is not a valid wide character, and (size_t) -2 if the length of
* the multibyte character sequence is greater than n.
*/
# endif
size_t _Locale_unshift(struct _Locale_ctype *,
mbstate_t *,
char *, size_t, char **);
/*
* Inserts whatever characters are necessary to restore st to an
* initial shift state. Sets *next to buf + m, where m is the number
* of characters inserted. (0 <= m <= n.) Returns m to indicate
* success, (size_t) -1 to indicate error, (size_t) -2 to indicate
* partial success (more than n characters needed). For success or partial
* success, sets *next to buf + m.
*/
# endif /* _STLP_NO_MBSTATE_T */
/*
* FUNCTIONS THAT USE COLLATE
*/
int _Locale_strcmp(struct _Locale_collate *,
const char *, size_t,
const char *, size_t);
# ifndef _STLP_NO_WCHAR_T
int _Locale_strwcmp(struct _Locale_collate *,
const wchar_t *, size_t,
const wchar_t *, size_t);
# endif
/*
* Compares the two sequences [s1, s1 + n1) and [s2, s2 + n2). Neither
* sequence is assumed to be null-terminated, and null characters
* aren't special. If the two sequences are the same up through
* min(n1, n2), then the sequence that compares less is whichever one
* is shorter.
*/
size_t _Locale_strxfrm(struct _Locale_collate *,
char *, size_t,
const char *, size_t);
# ifndef _STLP_NO_WCHAR_T
size_t _Locale_strwxfrm(struct _Locale_collate *,
wchar_t *, size_t,
const wchar_t *, size_t);
# endif
/*
* Creates a transformed version of the string [s2, s2 + n2). The
* string may contain embedded null characters; nulls aren't special.
* The transformed string begins at s1, and contains at most n1
* characters. The return value is the length of the transformed
* string. If the return value is greater than n1 then this is an
* error condition: it indicates that there wasn't enough space. In
* that case, the contents of [s1, s1 + n1) is unspecified.
*/
/*
* FUNCTIONS THAT USE NUMERIC
*/
/*
* Equivalent to the first three fields in struct lconv. (C standard,
* section 7.4.)
*/
char _Locale_decimal_point(struct _Locale_numeric *);
char _Locale_thousands_sep(struct _Locale_numeric *);
const char * _Locale_grouping(struct _Locale_numeric *);
/*
* Return "true" and "false" in English locales, and something
* appropriate in non-English locales.
*/
const char * _Locale_true(struct _Locale_numeric *);
const char * _Locale_false(struct _Locale_numeric *);
/*
* FUNCTIONS THAT USE MONETARY
*/
/*
* Return the obvious fields of struct lconv.
*/
const char * _Locale_int_curr_symbol(struct _Locale_monetary *);
const char * _Locale_currency_symbol(struct _Locale_monetary *);
char _Locale_mon_decimal_point(struct _Locale_monetary *);
char _Locale_mon_thousands_sep(struct _Locale_monetary *);
const char * _Locale_mon_grouping(struct _Locale_monetary *);
const char * _Locale_positive_sign(struct _Locale_monetary *);
const char * _Locale_negative_sign(struct _Locale_monetary *);
char _Locale_int_frac_digits(struct _Locale_monetary *);
char _Locale_frac_digits(struct _Locale_monetary *);
int _Locale_p_cs_precedes(struct _Locale_monetary *);
int _Locale_p_sep_by_space(struct _Locale_monetary *);
int _Locale_p_sign_posn(struct _Locale_monetary *);
int _Locale_n_cs_precedes(struct _Locale_monetary *);
int _Locale_n_sep_by_space(struct _Locale_monetary *);
int _Locale_n_sign_posn(struct _Locale_monetary *);
/*
* FUNCTIONS THAT USE TIME
*/
/*
* month is in the range [0, 12).
*/
const char * _Locale_full_monthname(struct _Locale_time *, int);
const char * _Locale_abbrev_monthname(struct _Locale_time *, int);
/*
* day is in the range [0, 7). Sunday is 0.
*/
const char * _Locale_full_dayofweek(struct _Locale_time *, int);
const char * _Locale_abbrev_dayofweek(struct _Locale_time *, int);
const char * _Locale_d_t_fmt(struct _Locale_time *);
const char * _Locale_d_fmt(struct _Locale_time *);
const char * _Locale_t_fmt(struct _Locale_time *);
const char * _Locale_long_d_t_fmt(struct _Locale_time*);
const char * _Locale_long_d_fmt(struct _Locale_time*);
const char * _Locale_am_str(struct _Locale_time *);
const char * _Locale_pm_str(struct _Locale_time *);
const char * _Locale_t_fmt_ampm(struct _Locale_time *);
/*
* FUNCTIONS THAT USE MESSAGES
*/
# ifdef _STLP_REAL_LOCALE_IMPLEMENTED
# if defined (WIN32) || defined (_WIN32)
typedef int nl_catd_type;
# elif defined (_STLP_USE_GLIBC) && !defined (__CYGWIN__)
typedef nl_catd nl_catd_type;
# else
typedef int nl_catd_type;
# endif
# else
typedef int nl_catd_type;
# endif /* _STLP_REAL_LOCALE_IMPLEMENTED */
/*
* Very similar to catopen, except that it uses the given message
* category to determine which catalog to open.
*/
nl_catd_type _Locale_catopen(struct _Locale_messages*, const char*);
/* Complementary to _Locale_catopen.
* The catalog must be a value that was returned by a previous call
* to _Locale_catopen.
*/
void _Locale_catclose(struct _Locale_messages*, nl_catd_type);
/*
* Returns a string, identified by a set index and a message index,
* from an opened message catalog. Returns the supplied default if
* no such string exists.
*/
const char * _Locale_catgets(struct _Locale_messages *, nl_catd_type,
int, int,const char *);
#ifdef __cplusplus
}
#endif
#endif /* _STLP_C_LOCALE_IMPL_H */

View File

@@ -1,274 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* This is a "stub" implementation of the "c_locale.h" interface,
intended for operating systems where we have not yet written
a real implementation. A C++ library using this stub implementation
is still standard-conforming, since the C++ standard does not require
that any locales other than "C" be supported.
*/
/* Framework functions */
void _Locale_init()
{}
void _Locale_final()
{}
void *_Locale_ctype_create(const char * __DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
void *_Locale_numeric_create(const char * __DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
void *_Locale_time_create(const char * __DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
void *_Locale_collate_create(const char *__DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
void *_Locale_monetary_create(const char * __DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
void *_Locale_messages_create(const char *__DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
const char *_Locale_ctype_default(char* __DUMMY_PAR) { return 0; }
const char *_Locale_numeric_default(char * __DUMMY_PAR) { return 0; }
const char *_Locale_time_default(char* __DUMMY_PAR) { return 0; }
const char *_Locale_collate_default(char* __DUMMY_PAR) { return 0; }
const char *_Locale_monetary_default(char* __DUMMY_PAR) { return 0; }
const char *_Locale_messages_default(char* __DUMMY_PAR) { return 0; }
char const* _Locale_ctype_name(const void* __DUMMY_PAR1, char* __DUMMY_PAR)
{ return 0; }
char const* _Locale_numeric_name(const void* __DUMMY_PAR1, char* __DUMMY_PAR)
{ return 0; }
char const* _Locale_time_name(const void* __DUMMY_PAR1, char* __DUMMY_PAR)
{ return 0; }
char const* _Locale_collate_name(const void* __DUMMY_PAR1, char* __DUMMY_PAR)
{ return 0; }
char const* _Locale_monetary_name(const void* __DUMMY_PAR1, char* __DUMMY_PAR)
{ return 0; }
char const* _Locale_messages_name(const void* __DUMMY_PAR1, char* __DUMMY_PAR)
{ return 0; }
void _Locale_ctype_destroy(void* __DUMMY_PAR) {}
void _Locale_numeric_destroy(void* __DUMMY_PAR) {}
void _Locale_time_destroy(void* __DUMMY_PAR) {}
void _Locale_collate_destroy(void* __DUMMY_PAR) {}
void _Locale_monetary_destroy(void* __DUMMY_PAR) {}
void _Locale_messages_destroy(void* __DUMMY_PAR) {}
char const* _Locale_extract_ctype_name(const char* __DUMMY_PAR1, char* __DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
char const* _Locale_extract_numeric_name(const char*__DUMMY_PAR1, char* __DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
char const* _Locale_extract_time_name(const char*__DUMMY_PAR1, char* __DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
char const* _Locale_extract_collate_name(const char*__DUMMY_PAR1, char* __DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
char const* _Locale_extract_monetary_name(const char*__DUMMY_PAR1, char* __DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
char const* _Locale_extract_messages_name(const char*__DUMMY_PAR1, char* __DUMMY_PAR, struct _Locale_name_hint* hint)
{ return 0; }
char const* _Locale_compose_name(char*__DUMMY_PAR1, const char*__DUMMY_PAR2, const char*__DUMMY_PAR3,
const char*__DUMMY_PAR4,
const char*__DUMMY_PAR5, const char*__DUMMY_PAR6, const char*__DUMMY_PAR7, const char*__DUMMY_PAR8)
{ return 0; }
struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype)
{ return 0; }
struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric)
{ return 0; }
struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time)
{ return 0; }
struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate)
{ return 0; }
struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary)
{ return 0; }
struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages)
{ return 0; }
/* ctype */
const _Locale_mask_t* _Locale_ctype_table(struct _Locale_ctype* __DUMMY_PAR)
{ return 0; }
int _Locale_toupper(struct _Locale_ctype*__DUMMY_PAR1, int __DUMMY_PAR) { return 0; }
int _Locale_tolower(struct _Locale_ctype*__DUMMY_PAR1, int __DUMMY_PAR) { return 0; }
# ifndef _STLP_NO_WCHAR_T
_Locale_mask_t _Locale_wchar_ctype(struct _Locale_ctype*__DUMMY_PAR1, wint_t __DUMMY_PAR2, _Locale_mask_t __DUMMY_PAR3)
{ return 0; }
wint_t _Locale_wchar_tolower(struct _Locale_ctype*__DUMMY_PAR1, wint_t __DUMMY_PAR)
{ return 0; }
wint_t _Locale_wchar_toupper(struct _Locale_ctype*__DUMMY_PAR1, wint_t __DUMMY_PAR)
{ return 0; }
# endif
# ifndef _STLP_NO_MBSTATE_T
int _Locale_mb_cur_max (struct _Locale_ctype * __DUMMY_PAR) { return 0; }
int _Locale_mb_cur_min (struct _Locale_ctype * __DUMMY_PAR) { return 0; }
int _Locale_is_stateless (struct _Locale_ctype * __DUMMY_PAR) { return 1; }
#ifndef _STLP_NO_WCHAR_T
wint_t _Locale_btowc(struct _Locale_ctype * __DUMMY_PAR1, int __DUMMY_PAR) { return 0; }
int _Locale_wctob(struct _Locale_ctype * __DUMMY_PAR2, wint_t __DUMMY_PAR) { return 0; }
size_t _Locale_mbtowc(struct _Locale_ctype *__DUMMY_PAR1,
wchar_t *__DUMMY_PAR2,
const char *__DUMMY_PAR3, size_t __DUMMY_PAR4,
mbstate_t *__DUMMY_PAR5)
{ return (size_t) -1; }
size_t _Locale_wctomb(struct _Locale_ctype *__DUMMY_PAR1,
char *__DUMMY_PAR2, size_t __DUMMY_PAR3,
const wchar_t __DUMMY_PAR4,
mbstate_t *__DUMMY_PAR5)
{ return (size_t) -1; }
# endif
size_t _Locale_unshift(struct _Locale_ctype *__DUMMY_PAR1,
mbstate_t *__DUMMY_PAR2,
char *__DUMMY_PAR3, size_t __DUMMY_PAR4, char ** __DUMMY_PAR5)
{ return (size_t) -1; }
# endif /* _STLP_NO_MBSTATE_T */
/* Collate */
int _Locale_strcmp(struct _Locale_collate* __DUMMY_PAR1,
const char* __DUMMY_PAR2, size_t __DUMMY_PAR3, const char* __DUMMY_PAR4,
size_t __DUMMY_PAR5)
{ return 0; }
# ifndef _STLP_NO_WCHAR_T
int _Locale_strwcmp(struct _Locale_collate* __DUMMY_PAR1,
const wchar_t* __DUMMY_PAR2, size_t __DUMMY_PAR3,
const wchar_t* __DUMMY_PAR4, size_t __DUMMY_PAR5)
{ return 0; }
# endif
size_t _Locale_strxfrm(struct _Locale_collate* __DUMMY_PAR1,
char* __DUMMY_PAR2, size_t __DUMMY_PAR3,
const char* __DUMMY_PAR4, size_t __DUMMY_PAR5)
{ return 0; }
# ifndef _STLP_NO_WCHAR_T
size_t _Locale_strwxfrm(struct _Locale_collate* __DUMMY_PAR1,
wchar_t* __DUMMY_PAR2, size_t __DUMMY_PAR3,
const wchar_t* __DUMMY_PAR4, size_t __DUMMY_PAR5)
{ return 0; }
# endif
/* Numeric */
char _Locale_decimal_point(struct _Locale_numeric* __DUMMY_PAR) { return '.'; }
char _Locale_thousands_sep(struct _Locale_numeric* __DUMMY_PAR) { return ','; }
const char* _Locale_grouping(struct _Locale_numeric * __DUMMY_PAR)
{ return ""; }
const char * _Locale_true(struct _Locale_numeric * __DUMMY_PAR) { return 0; }
const char * _Locale_false(struct _Locale_numeric * __DUMMY_PAR) { return 0; }
/* Monetary */
const char* _Locale_int_curr_symbol(struct _Locale_monetary * __DUMMY_PAR)
{ return 0; }
const char* _Locale_currency_symbol(struct _Locale_monetary * __DUMMY_PAR)
{ return 0; }
char _Locale_mon_decimal_point(struct _Locale_monetary * __DUMMY_PAR)
{ return '.'; }
char _Locale_mon_thousands_sep(struct _Locale_monetary * __DUMMY_PAR)
{ return ','; }
const char* _Locale_mon_grouping(struct _Locale_monetary * __DUMMY_PAR)
{ return ""; }
const char* _Locale_positive_sign(struct _Locale_monetary * __DUMMY_PAR)
{ return ""; }
const char* _Locale_negative_sign(struct _Locale_monetary * __DUMMY_PAR)
{ return ""; }
char _Locale_int_frac_digits(struct _Locale_monetary * __DUMMY_PAR)
{ return CHAR_MAX; }
char _Locale_frac_digits(struct _Locale_monetary * __DUMMY_PAR)
{ return CHAR_MAX; }
int _Locale_p_cs_precedes(struct _Locale_monetary * __DUMMY_PAR)
{ return CHAR_MAX; }
int _Locale_p_sep_by_space(struct _Locale_monetary * __DUMMY_PAR)
{ return CHAR_MAX; }
int _Locale_p_sign_posn(struct _Locale_monetary * __DUMMY_PAR)
{ return CHAR_MAX; }
int _Locale_n_cs_precedes(struct _Locale_monetary * __DUMMY_PAR)
{ return CHAR_MAX; }
int _Locale_n_sep_by_space(struct _Locale_monetary * __DUMMY_PAR)
{ return CHAR_MAX; }
int _Locale_n_sign_posn(struct _Locale_monetary * __DUMMY_PAR)
{ return CHAR_MAX; }
/* Time */
const char * _Locale_full_monthname(struct _Locale_time * __DUMMY_PAR1, int __DUMMY_PAR2)
{ return 0; }
const char * _Locale_abbrev_monthname(struct _Locale_time * __DUMMY_PAR1, int __DUMMY_PAR2)
{ return 0; }
const char * _Locale_full_dayofweek(struct _Locale_time * __DUMMY_PAR1, int __DUMMY_PAR2)
{ return 0; }
const char * _Locale_abbrev_dayofweek(struct _Locale_time * __DUMMY_PAR1, int __DUMMY_PAR2)
{ return 0; }
const char* _Locale_d_t_fmt(struct _Locale_time* __DUMMY_PAR) { return 0; }
const char* _Locale_d_fmt(struct _Locale_time* __DUMMY_PAR) { return 0; }
const char* _Locale_t_fmt(struct _Locale_time* __DUMMY_PAR) { return 0; }
const char* _Locale_long_d_t_fmt(struct _Locale_time* __DUMMY_PAR){ return 0; }
const char* _Locale_long_d_fmt(struct _Locale_time* __DUMMY_PAR) { return 0; }
const char* _Locale_am_str(struct _Locale_time* __DUMMY_PAR) { return 0; }
const char* _Locale_pm_str(struct _Locale_time* __DUMMY_PAR) { return 0; }
const char* _Locale_t_fmt_ampm(struct _Locale_time* __DUMMY_PAR) { return 0; }
/* Messages */
nl_catd_type _Locale_catopen(struct _Locale_messages* __DUMMY_PAR1, const char* __DUMMY_PAR)
{ return -1; }
void _Locale_catclose(struct _Locale_messages* __DUMMY_PAR1, nl_catd_type __DUMMY_PAR) {}
const char* _Locale_catgets(struct _Locale_messages* __DUMMY_PAR1, nl_catd_type __DUMMY_PAR2,
int __DUMMY_PAR3, int __DUMMY_PAR4,
const char *dfault)
{ return dfault; }

View File

@@ -1,831 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* 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. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef _POSIX_MAPPED_FILES
# include <sys/mman.h>
#endif
#include <stl/c_locale.h>
#include <limits.h>
#include <wctype.h>
/* #include <libc-lock.h> */
#include <locale.h>
#include <argz.h>
#include "gcc_localeinfo.h"
wint_t btowc(int c);
int wctob (wint_t c);
size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
size_t mbrlen (const char* s, size_t n, mbstate_t *ps);
#include <nl_types.h>
void _Locale_init()
{}
void _Locale_final()
{}
typedef struct _Locale_ctype {
const struct locale_data* gcc_data;
const int* __tolower;
const int* __toupper;
_Locale_mask_t* __class;
} L_ctype_t;
typedef struct _Locale_numeric {
const struct locale_data* gcc_data;
} L_numeric_t;
typedef struct _Locale_time {
const struct locale_data* gcc_data;
} L_time_t;
typedef struct _Locale_collate {
const struct locale_data* gcc_data;
} L_collate_t;
typedef struct _Locale_monetary {
const struct locale_data* gcc_data;
} L_monetary_t;
typedef struct _Locale_messages {
const struct locale_data* gcc_data;
} L_messages_t;
struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype)
{ return 0; }
struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric)
{ return 0; }
struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time)
{ return 0; }
struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate)
{ return 0; }
struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary)
{ return 0; }
struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages)
{ return 0; }
static char const*
_Locale_extract_name ( const char *cname, char *into, int category )
{
int i = 0;
const char * end;
if ( cname[0] != '/' )
return strcpy(into, cname); /* simple locale name */
for ( i = 0; i <= category; i ++ ) {
while ( *cname != '\0' && *cname != '/' )
cname++;
if ( *cname == '\0' )
return into;
cname++;
}
if ( *cname == '\0' )
return into;
end = cname;
while ( *end != '\0' && *end != '/' )
end++;
strncpy ( into, cname, end - cname );
into [ end - cname ] = '\0';
return into;
}
char const* _Locale_name(const struct locale_data* gcc_data,
char* buf)
{
if (!(gcc_data && gcc_data->name)) return 0;
strncpy(buf, gcc_data->name, _Locale_MAX_SIMPLE_NAME);
buf [ _Locale_MAX_SIMPLE_NAME - 1 ] = '\0';
return buf;
}
/* calls _nl_find_locale which is a function internal to the glibc
locale implementation that loads locale data in from the data
files. The locale_data struct has information for all categories.
In the following implementation we use a locale_data struct for
each category for simplicity, though there is an obvious waste in
doing that. */
const struct locale_data *
_Find_locale (char *locale_path, size_t locale_path_len,
int category, char **name)
{
return __nl_find_locale(locale_path, locale_path_len, category, name);
}
static void
_Remove_locale (int locale, struct locale_data *data)
{
/* this should eventually call _nl_remove_locale() in glibc 2.1 */
/* _nl_remove_locale( locale, data ); */
}
/* couldn't find where LOCALE_PATH was defined in glibc,
but this is the directory it is defined to -JGS */
#define __LOCALE_PATH "/usr/share/locale"
const struct locale_data*
_Category_create(const char * name, int category)
{
/* JGS, where should this path come from? */
char* locpath_var;
char* locale_path = NULL;
size_t locale_path_len = 0;
locpath_var = __secure_getenv("LOCPATH");
if (locpath_var != NULL && locpath_var[0] != '\0')
if (argz_create_sep (locpath_var, ':',
&locale_path, &locale_path_len) != 0)
return NULL;
if (argz_add_sep (&locale_path, &locale_path_len, __LOCALE_PATH, ':') != 0)
return NULL;
return _Find_locale(locale_path, locale_path_len,
category, (char**)&name);
}
static const char* get_default_locale(char* buf) {
char* lang = getenv("LANG");
if (lang == NULL || lang[0] == '\0') {
buf[0] = '\0';
return NULL;
}
else {
strcpy(buf, lang);
return buf;
}
}
const char* _Locale_ctype_default(char* buf) {
char fullname[_Locale_MAX_COMPOSITE_NAME];
if (get_default_locale(fullname) == NULL)
return NULL;
else
return _Locale_extract_ctype_name(fullname, buf, 0);
}
const char* _Locale_numeric_default(char* buf) {
char fullname[_Locale_MAX_COMPOSITE_NAME];
if (get_default_locale(fullname) == NULL)
return NULL;
else
return _Locale_extract_numeric_name(fullname, buf, 0);
}
const char* _Locale_time_default(char* buf) {
char fullname[_Locale_MAX_COMPOSITE_NAME];
if (get_default_locale(fullname) == NULL)
return NULL;
else
return _Locale_extract_time_name(fullname, buf, 0);
}
const char* _Locale_collate_default(char* buf) {
char fullname[_Locale_MAX_COMPOSITE_NAME];
if (get_default_locale(fullname) == NULL)
return NULL;
else
return _Locale_extract_collate_name(fullname, buf, 0);
}
const char* _Locale_monetary_default(char* buf) {
char fullname[_Locale_MAX_COMPOSITE_NAME];
if (get_default_locale(fullname) == NULL)
return NULL;
else
return _Locale_extract_monetary_name(fullname, buf, 0);
}
const char* _Locale_messages_default(char* buf) {
char fullname[_Locale_MAX_COMPOSITE_NAME];
if (get_default_locale(fullname) == NULL)
return NULL;
else
return _Locale_extract_messages_name(fullname, buf, 0);
}
/****** Numeric Category ******/
void*
_Locale_numeric_create(const char * name, struct _Locale_name_hint* hint) {
L_numeric_t* lnum = (L_numeric_t*)malloc(sizeof(L_numeric_t));
lnum->gcc_data = _Category_create(name, LC_NUMERIC);
return (void*)lnum;
}
char const* _Locale_numeric_name(const void* lnum,
char* buf) {
return _Locale_name(((struct _Locale_ctype*)lnum)->gcc_data, buf);
}
void _Locale_numeric_destroy(void* lnum)
{
_Remove_locale(LC_NUMERIC, (struct locale_data *)((struct _Locale_ctype*)lnum)->gcc_data);
free(lnum);
}
char const* _Locale_extract_numeric_name(const char* cname, char* buf, struct _Locale_name_hint* hint)
{
return _Locale_extract_name(cname, buf, LC_NUMERIC);
}
char _Locale_decimal_point(struct _Locale_numeric* lnum)
{
return lnum->gcc_data->values[_NL_ITEM_INDEX(DECIMAL_POINT)].string[0];
}
char _Locale_thousands_sep(struct _Locale_numeric* lnum)
{
return lnum->gcc_data->values[_NL_ITEM_INDEX(THOUSANDS_SEP)].string[0];
}
const char* _Locale_grouping(struct _Locale_numeric * lnum)
{
return lnum->gcc_data->values[_NL_ITEM_INDEX(GROUPING)].string;
}
/* JGS: gcc/linux does not provide true/false names in their
* locale data files
*/
static const char* __true_name = "true";
static const char* __false_name = "false";
const char * _Locale_true(struct _Locale_numeric *l)
{ return __true_name; }
const char * _Locale_false(struct _Locale_numeric *l)
{ return __false_name; }
/****** Monetary Category ******/
void* _Locale_monetary_create(const char* name, struct _Locale_name_hint* hint) {
L_monetary_t* lmon = (L_monetary_t*)malloc(sizeof(L_monetary_t));
lmon->gcc_data = _Category_create(name, LC_MONETARY);
return lmon;
}
char const* _Locale_monetary_name(const void* lmon,
char* buf) {
return _Locale_name(((struct _Locale_monetary*)lmon)->gcc_data, buf);
}
void _Locale_monetary_destroy(void*lmon) {
_Remove_locale(LC_MONETARY, (struct locale_data *)((struct _Locale_monetary*)lmon)->gcc_data);
free(lmon);
}
char const* _Locale_extract_monetary_name(const char* cname, char* buf, struct _Locale_name_hint* hint) {
return _Locale_extract_name(cname, buf, LC_MONETARY);
}
const char* _Locale_int_curr_symbol(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(INT_CURR_SYMBOL)].string;
}
const char* _Locale_currency_symbol(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(CURRENCY_SYMBOL)].string;
}
char _Locale_mon_decimal_point(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(MON_DECIMAL_POINT)].string[0];
}
char _Locale_mon_thousands_sep(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(MON_THOUSANDS_SEP)].string[0];
}
const char* _Locale_mon_grouping(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(MON_GROUPING)].string;
}
const char* _Locale_positive_sign(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(POSITIVE_SIGN)].string;
}
const char* _Locale_negative_sign(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(NEGATIVE_SIGN)].string;
}
char _Locale_int_frac_digits(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(INT_FRAC_DIGITS)].string[0];
}
char _Locale_frac_digits(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(FRAC_DIGITS)].string[0];
}
int _Locale_p_cs_precedes(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(P_CS_PRECEDES)].word;
}
int _Locale_p_sep_by_space(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(P_SEP_BY_SPACE)].word;
}
int _Locale_p_sign_posn(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(P_SIGN_POSN)].word;
}
int _Locale_n_cs_precedes(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(N_CS_PRECEDES)].word;
}
int _Locale_n_sep_by_space(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(N_SEP_BY_SPACE)].word;
}
int _Locale_n_sign_posn(struct _Locale_monetary* lmon) {
return lmon->gcc_data->values[_NL_ITEM_INDEX(N_SIGN_POSN)].word;
}
/****** Time Category ******/
void* _Locale_time_create(const char * name, struct _Locale_name_hint* hint) {
L_time_t* ltime = (L_time_t*)malloc(sizeof(L_time_t));
ltime->gcc_data = _Category_create(name, LC_TIME);
return ltime;
}
char const* _Locale_time_name(const void* ltime,
char* buf) {
return _Locale_name(((struct _Locale_time*)ltime)->gcc_data, buf);
}
char const* _Locale_extract_time_name(const char* cname, char* buf, struct _Locale_name_hint* hint) {
return _Locale_extract_name(cname, buf, LC_TIME);
}
void _Locale_time_destroy(void* ltime) {
_Remove_locale(LC_TIME, (struct locale_data *)((struct _Locale_time*)ltime)->gcc_data);
free(ltime);
}
const char * _Locale_full_monthname(struct _Locale_time *ltime, int month) {
const char **names = (const char **)&(ltime->gcc_data->values[_NL_ITEM_INDEX(MON_1)]);
return names[month];
}
const char * _Locale_abbrev_monthname(struct _Locale_time *ltime, int month) {
const char **names = (const char **)&(ltime->gcc_data->values[_NL_ITEM_INDEX(ABMON_1)]);
return names[month];
}
const char * _Locale_full_dayofweek(struct _Locale_time *ltime, int day) {
const char **names = (const char **)&(ltime->gcc_data->values[_NL_ITEM_INDEX(DAY_1)]);
return names[day];
}
const char * _Locale_abbrev_dayofweek(struct _Locale_time *ltime, int day) {
const char **names = (const char **)&(ltime->gcc_data->values[_NL_ITEM_INDEX(ABDAY_1)]);
return names[day];
}
const char* _Locale_d_t_fmt(struct _Locale_time* ltime) {
return ltime->gcc_data->values[_NL_ITEM_INDEX(D_T_FMT)].string;
}
const char* _Locale_long_d_t_fmt(struct _Locale_time* ltime) {
return ltime->gcc_data->values[_NL_ITEM_INDEX(D_T_FMT)].string;
}
const char* _Locale_d_fmt(struct _Locale_time* ltime)
{
return ltime->gcc_data->values[_NL_ITEM_INDEX(D_FMT)].string;
}
const char* _Locale_long_d_fmt(struct _Locale_time* ltime)
{
return ltime->gcc_data->values[_NL_ITEM_INDEX(D_FMT)].string;
}
const char* _Locale_t_fmt(struct _Locale_time* ltime) {
return ltime->gcc_data->values[_NL_ITEM_INDEX(T_FMT)].string;
}
const char* _Locale_am_str(struct _Locale_time* ltime) {
return ltime->gcc_data->values[_NL_ITEM_INDEX(AM_STR)].string;
}
const char* _Locale_pm_str(struct _Locale_time* ltime) {
return ltime->gcc_data->values[_NL_ITEM_INDEX(PM_STR)].string;
}
const char* _Locale_t_fmt_ampm(struct _Locale_time* ltime)
{
return ltime->gcc_data->values[_NL_ITEM_INDEX(T_FMT_AMPM)].string;
}
/****** Messages Category ******/
void* _Locale_messages_create(const char * name, struct _Locale_name_hint* hint) {
L_messages_t* lmsg = (L_messages_t*)malloc(sizeof(L_messages_t));
lmsg->gcc_data = _Category_create(name, LC_MESSAGES);
return lmsg;
}
char const* _Locale_messages_name(const void* lmsg, char* buf) {
return _Locale_name(((struct _Locale_messages*)lmsg)->gcc_data, buf);
}
void _Locale_messages_destroy(void* lmsg) {
_Remove_locale(LC_MESSAGES, (struct locale_data *)((struct _Locale_messages*)lmsg)->gcc_data);
free(lmsg);
}
char const* _Locale_extract_messages_name(const char* cname, char* buf, struct _Locale_name_hint* hint) {
return _Locale_extract_name(cname, buf, LC_MESSAGES);
}
/*
Could not find support for locale specific messages in glibc
Also, this C locale interface should use a typedef for the catalog
instead of just an int. Currently I'm casting a void* (nl_catd)
back and forth to and int.
-JGS
*/
int _Locale_catopen(struct _Locale_messages*l, const char* cat_name) {
return (int)catopen(cat_name, 0); /* JGS, don't know about the flag */
}
void _Locale_catclose(struct _Locale_messages*l, int catalog) {
catclose((nl_catd)catalog);
}
const char* _Locale_catgets(struct _Locale_messages*l, int catalog,
int set_num, int msg_num,
const char *dfault){
return catgets((nl_catd)catalog, set_num, msg_num, dfault);
}
/****** ctype Category ******/
/*
gcc uses a different set of masks for wide characters than for
normal characters. However, the C++ standard requires there
to be only one set of masks for both. Therefore we must
translate the mask values from the wide characters to the
mask values for the normal characters. -JGS
*/
static _Locale_mask_t _Map_wchar_mask_to_char_mask(wctype_t m) {
_Locale_mask_t ret = 0;
if (m & _ISwcntrl) ret |= _Locale_CNTRL;
if (m & _ISwupper) ret |= _Locale_UPPER;
if (m & _ISwlower) ret |= _Locale_LOWER;
if (m & _ISwdigit) ret |= _Locale_DIGIT;
if (m & _ISwxdigit) ret |= _Locale_XDIGIT;
if (m & _ISwpunct) ret |= _Locale_PUNCT;
if (m & _ISwspace) ret |= _Locale_SPACE;
if (m & _ISwprint) ret |= _Locale_PRINT;
if (m & _ISwalpha) ret |= _Locale_ALPHA;
return ret;
}
void* _Locale_ctype_create(const char * name, struct _Locale_name_hint* hint) {
const union locale_data_value *ctypes;
L_ctype_t* lctype;
lctype = (L_ctype_t*)malloc(sizeof(L_ctype_t));
lctype->gcc_data = _Category_create(name, LC_CTYPE);
ctypes = lctype->gcc_data->values;
lctype->__class = (_Locale_mask_t *)
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_CLASS)] .string) + 128;
#ifdef _STLP_GLIBC_LOCALE_2
lctype->__tolower = (const int *)
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOLOWER)].string) + 128;
lctype->__toupper = (const int *)
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOUPPER)].string) + 128;
#else
# if BYTE_ORDER == BIG_ENDIAN
lctype->__tolower = (const int *)
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOLOWER_EB)].string) + 128;
lctype->__toupper = (const int *)
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOUPPER_EB)].string) + 128;
# elif BYTE_ORDER == LITTLE_ENDIAN
lctype->__tolower = (const int *)
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOLOWER_EL)].string) + 128;
lctype->__toupper = (const int *)
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOUPPER_EL)].string) + 128;
# else
# error bizarre byte order
# endif
#endif /* _STLP_GLIBC_LOCALE_2 */
return lctype;
}
char const* _Locale_ctype_name(const void* lctype,
char* buf) {
return _Locale_name(((struct _Locale_ctype*)lctype)->gcc_data, buf);
}
void _Locale_ctype_destroy(void* lctype) {
_Remove_locale(LC_CTYPE, (struct locale_data *)((struct _Locale_ctype*)lctype)->gcc_data);
free(lctype);
}
char const* _Locale_extract_ctype_name(const char* cname, char* buf, struct _Locale_name_hint* hint) {
return _Locale_extract_name(cname, buf, LC_CTYPE);
}
const _Locale_mask_t* _Locale_ctype_table(struct _Locale_ctype* lctype) {
return lctype->__class;
}
int _Locale_toupper(struct _Locale_ctype* lctype, int c) {
return lctype->__toupper[c];
}
int _Locale_tolower(struct _Locale_ctype* lctype, int c) {
return lctype->__tolower[c];
}
/* Wide Character Functions */
static inline size_t
cname_lookup (wint_t wc, const struct locale_data* loc)
{
#ifdef _STLP_GLIBC_LOCALE_2
printf( "******** Fix me: %s:%d", __FILE__, __LINE__ );
return ~((size_t) 0);
#else
unsigned int *__nl_ctype_names;
unsigned int hash_size, hash_layers;
size_t result, cnt;
# if BYTE_ORDER == BIG_ENDIAN
__nl_ctype_names = (unsigned int*)loc->values[_NL_ITEM_INDEX(_NL_CTYPE_NAMES_EB)].string;
# elif BYTE_ORDER == LITTLE_ENDIAN
__nl_ctype_names = (unsigned int*)loc->values[_NL_ITEM_INDEX(_NL_CTYPE_NAMES_EL)].string;
# else
# error bizarre byte order
# endif
hash_size = loc->values[_NL_ITEM_INDEX(_NL_CTYPE_HASH_SIZE)].word;
hash_layers = loc->values[_NL_ITEM_INDEX(_NL_CTYPE_HASH_LAYERS)].word;
result = wc % hash_size;
for (cnt = 0; cnt < hash_layers; ++cnt) {
if (__nl_ctype_names[result] == wc)
break;
result += hash_size;
}
return cnt < hash_layers ? result : ~((size_t) 0);
#endif
}
_Locale_mask_t _Locale_wchar_ctype(struct _Locale_ctype* loc, wint_t wc,
_Locale_mask_t which_bits) {
const struct locale_data* locale = loc->gcc_data;
const unsigned int *class32_b;
size_t idx;
idx = cname_lookup (wc, locale);
if (idx == ~((size_t) 0))
return 0;
class32_b = (u_int32_t *)
locale->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS32)].string;
return _Map_wchar_mask_to_char_mask( class32_b[idx] ) & which_bits;
}
wint_t
__towctrans_ld (wint_t wc, wctrans_t desc, const struct locale_data* locale)
{
size_t idx;
idx = cname_lookup (wc, locale);
if (idx == ~((size_t) 0))
/* Character is not known. Default action is to simply return it. */
return wc;
return (wint_t) desc[idx];
}
wint_t _Locale_wchar_tolower(struct _Locale_ctype* locale, wint_t wc) {
return __towctrans_ld (wc, (const unsigned int *)locale->__tolower, locale->gcc_data);
}
wint_t _Locale_wchar_toupper(struct _Locale_ctype* locale, wint_t wc) {
return __towctrans_ld (wc, (const unsigned int *)locale->__toupper, locale->gcc_data);
}
int _Locale_mb_cur_max (struct _Locale_ctype *lctype) {
return lctype->gcc_data->values[_NL_ITEM_INDEX(_NL_CTYPE_MB_CUR_MAX)].word;
}
int _Locale_mb_cur_min (struct _Locale_ctype *l) {
return 1; /* JGS just a guess */
}
int _Locale_is_stateless (struct _Locale_ctype *l) { return 1; }
wint_t _Locale_btowc(struct _Locale_ctype *l, int c) {
return btowc(c);
}
/*
glibc currently doesn't support locale dependent conversion,
which affects the following functions. When it does, then
these functions will need to change. Hopeully, the
just the calls to the glibc functions will need to be
replaced.
-JGS
*/
int _Locale_wctob(struct _Locale_ctype *l, wint_t c) {
return wctob(c);
}
size_t _Locale_mbtowc(struct _Locale_ctype *l,
wchar_t *to,
const char *from, size_t n,
mbstate_t *shift_state)
{
int ret;
if (to)
ret = mbrtowc(to, from, n, shift_state);
else
ret = mbrlen(from, n, shift_state);
return ret;
}
size_t _Locale_wctomb(struct _Locale_ctype *l,
char *to, size_t n,
const wchar_t c,
mbstate_t *shift_state)
{
char buf [MB_LEN_MAX];
int ret;
char* mb = buf;
ret = wcrtomb(mb, c, shift_state);
if (ret > n)
return (size_t)-2;
else if (ret <= 0)
return ret;
n = ret;
while (n--)
*to++ = *mb++;
return ret;
}
size_t _Locale_unshift(struct _Locale_ctype *l,
mbstate_t * st,
char *buf, size_t n, char **next) {
*next = buf; /* JGS stateless, so don't need to do anything? */
return 0;
}
/****** Collate Category ******/
void* _Locale_collate_create(const char * name, struct _Locale_name_hint* hint) {
L_collate_t* lcollate = (L_collate_t*)malloc(sizeof(L_collate_t));
lcollate->gcc_data = _Category_create(name, LC_COLLATE);
return lcollate;
}
char const* _Locale_collate_name(const void* lcollate, char* buf) {
return _Locale_name(((struct _Locale_collate*)lcollate)->gcc_data, buf);
}
void _Locale_collate_destroy(void* lcollate) {
_Remove_locale(LC_COLLATE, (struct locale_data *)((struct _Locale_collate*)lcollate)->gcc_data);
free(lcollate);
}
char const* _Locale_extract_collate_name(const char* cname, char* buf, struct _Locale_name_hint* hint) {
return _Locale_extract_name(cname, buf, LC_COLLATE);
}
/* copied from the IRIX version -JGS */
char const* _Locale_compose_name(char* buf,
const char* ctype, const char* numeric,
const char* time, const char* collate,
const char* monetary, const char* messages,
const char *default_name)
{
(void) default_name;
if ( !strcmp ( ctype, numeric ) &&
!strcmp ( ctype, time ) &&
!strcmp ( ctype, collate ) &&
!strcmp ( ctype, monetary ) &&
!strcmp ( ctype, messages ) )
return strcpy ( buf, ctype );
strcpy ( buf, "/" );
strcat ( buf, ctype );
strcat ( buf, "/" );
strcat ( buf, numeric );
strcat ( buf, "/" );
strcat ( buf, time );
strcat ( buf, "/" );
strcat ( buf, collate );
strcat ( buf, "/" );
strcat ( buf, monetary );
strcat ( buf, "/" );
strcat ( buf, messages );
return buf;
}
/*
glibc doesn't have a locale specific strcmp
This doesn't ignore null chars the way it should
*/
int
_Locale_strcmp(struct _Locale_collate * l,
const char *s1, size_t n1,
const char *s2, size_t n2)
{
int ret;
int minN = n1 < n2 ? n1 : n2;
ret = strncmp(s1, s2, minN);
if (ret == 0) {
if (n1 < n2) return -1;
else if (n1 > n2) return 1;
else return 0;
} else
return ret;
}
int _Locale_strwcmp(struct _Locale_collate*l,
const wchar_t*s1, size_t n1,
const wchar_t*s2, size_t n2)
{
int ret;
int minN = n1 < n2 ? n1 : n2;
ret = wcsncmp(s1, s2, minN);
if (ret == 0) {
if (n1 < n2) return -1;
else if (n1 > n2) return 1;
else return 0;
} else
return ret;
}
size_t _Locale_strxfrm(struct _Locale_collate *lcollate,
char *dest, size_t dest_n,
const char *src, size_t src_n )
{
if (src_n == 0)
{
if (dest != NULL) dest[0] = 0;
return 0;
}
const char *real_src;
char *buf = NULL;
if (src[src_n] != 0) {
buf = malloc(src_n + 1);
strncpy(buf, src, src_n);
buf[src_n] = 0;
real_src = buf;
}
else
real_src = src;
size_t result = strxfrm(dest, real_src, dest_n);
if (buf != NULL) free(buf);
return result;
}
# ifndef _STLP_NO_WCHAR_T
size_t _Locale_strwxfrm(struct _Locale_collate *lcollate,
wchar_t *dest, size_t dest_n,
const wchar_t *src, size_t src_n)
{
if (src_n == 0)
{
if (dest != NULL) dest[0] = 0;
return 0;
}
const wchar_t *real_src;
wchar_t *buf = NULL;
if (src[src_n] != 0) {
buf = malloc((src_n + 1) * sizeof(wchar_t));
wcsncpy(buf, src, src_n);
buf[src_n] = 0;
real_src = buf;
}
else
real_src = src;
size_t result = wcsxfrm(dest, real_src, dest_n, (__c_locale)__loc);
if (buf != NULL) free(buf);
return result;
}
#endif

View File

@@ -1,727 +0,0 @@
#include <locale.h>
#include <langinfo.h>
#include <stl/c_locale.h>
#include <stdio.h>
#include <wctype.h>
#include <string.h>
#include <stdint.h>
/* Structure describing locale data in core for a category. */
/* GLIBC internal, see <glibc catalog>/locale/localeinfo.h */
#if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ > 2))
/* GLIBC 2.3.x */
struct locale_data
{
const char *name;
const char *filedata; /* Region mapping the file data. */
off_t filesize; /* Size of the file (and the region). */
enum /* Flavor of storage used for those. */
{
ld_malloced, /* Both are malloc'd. */
ld_mapped, /* name is malloc'd, filedata mmap'd */
ld_archive /* Both point into mmap'd archive regions. */
} alloc;
/* This provides a slot for category-specific code to cache data computed
* about this locale. That code can set a cleanup function to deallocate
* the data.
struct
{
void (*cleanup) (struct locale_data *);
union
{
void *data;
struct lc_time_data *time;
const struct gconv_fcts *ctype;
};
} private;
*/
unsigned int usage_count; /* Counter for users. */
int use_translit; /* Nonzero if the mb*towv*() and wc*tomb()
functions should use transliteration. */
unsigned int nstrings; /* Number of strings below. */
union locale_data_value
{
const uint32_t *wstr;
const char *string;
unsigned int word; /* Note endian issues vs 64-bit pointers. */
}
values[1]; /* Items, usually pointers into `filedata'. */
};
#else /* GLIBC 2.2.x */
struct locale_data
{
const char *name;
const char *filedata; /* Region mapping the file data. */
off_t filesize; /* Size of the file (and the region). */
int mmaped; /* If nonzero the data is mmaped. */
unsigned int usage_count; /* Counter for users. */
int use_translit; /* Nonzero if the mb*towv*() and wc*tomb()
functions should use transliteration. */
const char *options; /* Extra options from the locale name,
not used in the path to the locale data. */
unsigned int nstrings; /* Number of strings below. */
union locale_data_value
{
const uint32_t *wstr;
const char *string;
unsigned int word;
}
values[1]; /* Items, usually pointers into `filedata'. */
};
#endif
typedef __locale_t __c_locale;
#if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ > 2))
# define __nl_langinfo_l nl_langinfo_l
#endif
#if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ > 2))
# define __LOCALE_CREATE(nm,category) (void*)newlocale(1 << category, nm, NULL )
# define __LOCALE_DESTROY(__loc) freelocale((__c_locale)__loc)
#else
# define __LOCALE_CREATE(nm,category) (void*)__newlocale(1 << category, nm, NULL )
# define __LOCALE_DESTROY(__loc) __freelocale((__c_locale)__loc)
#endif
static const char *_empty_str = "";
static const char *_C_name = "C";
#if 0
struct _Locale_ctype
{
__c_locale __cloc;
};
struct _Locale_numeric
{
__c_locale __cloc;
};
struct _Locale_time
{
__c_locale __cloc;
};
struct _Locale_collate
{
__c_locale __cloc;
};
struct _Locale_monetary
{
__c_locale __cloc;
};
struct _Locale_messages
{
__c_locale __cloc;
};
#endif
void _Locale_init()
{}
void _Locale_final()
{}
void *_Locale_ctype_create( const char *nm, struct _Locale_name_hint* hint )
{ return __LOCALE_CREATE( nm, LC_CTYPE ); }
void* _Locale_numeric_create( const char *nm, struct _Locale_name_hint* hint )
{ return __LOCALE_CREATE( nm, LC_NUMERIC ); }
void* _Locale_time_create( const char *nm, struct _Locale_name_hint* hint )
{ return __LOCALE_CREATE( nm, LC_TIME ); }
void *_Locale_collate_create( const char *nm, struct _Locale_name_hint* hint )
{ return __LOCALE_CREATE( nm, LC_COLLATE ); }
void *_Locale_monetary_create( const char *nm, struct _Locale_name_hint* hint )
{ return __LOCALE_CREATE( nm, LC_MONETARY ); }
void *_Locale_messages_create( const char *nm, struct _Locale_name_hint* hint )
{ return __LOCALE_CREATE( nm, LC_MESSAGES ); }
/*
try to see locale category LC should be used from environment;
according POSIX, the order is
1. LC_ALL
2. category (LC_CTYPE, LC_NUMERIC, ... )
3. LANG
If set nothing, return "C" (this really implemetation-specific).
*/
const char *_Locale_aux_default( const char *LC, char *nm )
{
char *name = getenv( "LC_ALL" );
if ( name != NULL && *name != 0 ) {
return strncpy( nm, name, _Locale_MAX_SIMPLE_NAME );
}
name = getenv( LC );
if ( name != NULL && *name != 0 ) {
return strncpy( nm, name, _Locale_MAX_SIMPLE_NAME );
}
name = getenv( "LANG" );
if ( name != NULL && *name != 0 ) {
return strncpy( nm, name, _Locale_MAX_SIMPLE_NAME );
}
return strcpy( nm, "C" );
}
const char *_Locale_ctype_default( char *nm )
{
return _Locale_aux_default( "LC_CTYPE", nm );
}
const char *_Locale_numeric_default( char *nm )
{
return _Locale_aux_default( "LC_NUMERIC", nm );
}
const char *_Locale_time_default( char *nm )
{
return _Locale_aux_default( "LC_TIME", nm );
}
const char *_Locale_collate_default( char *nm )
{
return _Locale_aux_default( "LC_COLLATE", nm );
}
const char *_Locale_monetary_default( char *nm )
{
return _Locale_aux_default( "LC_MONETARY", nm );
}
const char *_Locale_messages_default( char *nm )
{
return _Locale_aux_default( "LC_MESSAGES", nm );
}
char const*_Locale_ctype_name( const void *__loc, char *buf )
{
return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_CTYPE]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
}
char const*_Locale_numeric_name( const void *__loc, char *buf )
{
return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_NUMERIC]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
}
char const*_Locale_time_name( const void *__loc, char *buf )
{
return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_TIME]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
}
char const*_Locale_collate_name( const void *__loc, char *buf )
{
return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_COLLATE]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
}
char const*_Locale_monetary_name( const void *__loc, char *buf )
{
return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_MONETARY]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
}
char const*_Locale_messages_name( const void *__loc, char *buf )
{
return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_MESSAGES]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
}
void _Locale_ctype_destroy( void *__loc )
{ __LOCALE_DESTROY(__loc); }
void _Locale_numeric_destroy( void *__loc )
{ __LOCALE_DESTROY(__loc); }
void _Locale_time_destroy( void *__loc )
{ __LOCALE_DESTROY(__loc); }
void _Locale_collate_destroy( void *__loc )
{ __LOCALE_DESTROY(__loc); }
void _Locale_monetary_destroy( void *__loc )
{ __LOCALE_DESTROY(__loc); }
void _Locale_messages_destroy( void* __loc )
{ __LOCALE_DESTROY(__loc); }
/*
* locale loc expected either locale name indeed (platform-specific)
* or string like "LC_CTYPE=LocaleNameForCType;LC_NUMERIC=LocaleNameForNum;"
*
*/
char const*__Extract_locale_name( const char *loc, const char *category, char *buf )
{
char *expr;
size_t len_name;
buf[0] = 0;
if( loc[0]=='L' && loc[1]=='C' && loc[2]=='_') {
expr = strstr( (char*)loc, category );
if ( expr == NULL )
return NULL; /* Category not found. */
++expr;
len_name = strcspn( expr, ";" );
len_name = len_name > _Locale_MAX_SIMPLE_NAME ? _Locale_MAX_SIMPLE_NAME : len_name;
strncpy( buf, expr, len_name );
buf[len_name] = 0;
return buf;
}
return strncpy( buf, loc, _Locale_MAX_SIMPLE_NAME );
}
char const*_Locale_extract_ctype_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
{ return __Extract_locale_name( loc, "LC_CTYPE=", buf ); }
char const*_Locale_extract_numeric_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
{ return __Extract_locale_name( loc, "LC_NUMERIC=", buf ); }
char const*_Locale_extract_time_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
{ return __Extract_locale_name( loc, "LC_TIME=", buf ); }
char const*_Locale_extract_collate_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
{ return __Extract_locale_name( loc, "LC_COLLATE=", buf ); }
char const*_Locale_extract_monetary_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
{ return __Extract_locale_name( loc, "LC_MONETARY=", buf ); }
char const*_Locale_extract_messages_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
{ return __Extract_locale_name( loc, "LC_MESSAGES=", buf ); }
char const*_Locale_compose_name(char*__DUMMY_PAR1, const char*__DUMMY_PAR2, const char*__DUMMY_PAR3,
const char*__DUMMY_PAR4,
const char*__DUMMY_PAR5, const char*__DUMMY_PAR6, const char*__DUMMY_PAR7, const char*__DUMMY_PAR8) {
/* TODO: what's this? Is this a marker that this is not yet completely
implemented? Copy the implementation from c_locale_win32 perhaps? It seems
to complement the extract functions above. */
printf( "%s:%d\n", __FILE__, __LINE__ );
return 0;
}
struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype)
{ return 0; }
struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric)
{ return 0; }
struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time)
{ return 0; }
struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate)
{ return 0; }
struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary)
{ return 0; }
struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages)
{ return 0; }
/* ctype */
const _Locale_mask_t *_Locale_ctype_table( struct _Locale_ctype *__loc )
{
/* return table with masks (upper, lower, alpha, etc.) */
/* return ((__c_locale)__loc)->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS)].string + 128; */
return ((__c_locale)__loc)->__ctype_b;
}
int _Locale_toupper( struct _Locale_ctype *__loc, int c )
{ return ((__c_locale)__loc)->__ctype_toupper[c]; }
int _Locale_tolower( struct _Locale_ctype *__loc, int c )
{ return ((__c_locale)__loc)->__ctype_tolower[c]; }
#if !defined (_STLP_NO_WCHAR_T)
_Locale_mask_t _Locale_wchar_ctype(struct _Locale_ctype*__DUMMY_PAR1, wint_t __DUMMY_PAR2, _Locale_mask_t __DUMMY_PAR3) {
printf( "%s:%d\n", __FILE__, __LINE__ );
return 0;
}
wint_t _Locale_wchar_tolower( struct _Locale_ctype *__loc, wint_t c ) {
printf( "%s:%d\n", __FILE__, __LINE__ );
return __towlower_l( c, ((__c_locale)__loc) );
}
wint_t _Locale_wchar_toupper( struct _Locale_ctype *__loc, wint_t c ) {
printf( "%s:%d\n", __FILE__, __LINE__ );
return __towupper_l( c, ((__c_locale)__loc) );
}
#endif
#if !defined (_STLP_NO_MBSTATE_T)
int _Locale_mb_cur_max( struct _Locale_ctype * __DUMMY_PAR) {
printf( "%s:%d\n", __FILE__, __LINE__ );
return 0;
}
int _Locale_mb_cur_min( struct _Locale_ctype * __DUMMY_PAR) {
printf( "%s:%d\n", __FILE__, __LINE__ );
return 0;
}
int _Locale_is_stateless( struct _Locale_ctype * __DUMMY_PAR) {
printf( "%s:%d\n", __FILE__, __LINE__ );
return 1;
}
#if !defined (_STLP_NO_WCHAR_T)
wint_t _Locale_btowc(struct _Locale_ctype *__loc, int c) {
wint_t _c;
/* __c_locale __tmp = __uselocale( __loc ); */
_c = btowc( c );
/* __uselocale( __tmp ); */
return _c;
}
int _Locale_wctob(struct _Locale_ctype *__loc, wint_t c) {
int _c;
/* __c_locale __tmp = __uselocale( __loc ); */
_c = wctob( c );
/* __uselocale( __tmp ); */
return _c;
}
size_t _Locale_mbtowc(struct _Locale_ctype *__DUMMY_PAR1,
wchar_t *__DUMMY_PAR2,
const char *__DUMMY_PAR3, size_t __DUMMY_PAR4,
mbstate_t *__DUMMY_PAR5) {
printf( "%s:%d\n", __FILE__, __LINE__ );
return (size_t) -1;
}
size_t _Locale_wctomb(struct _Locale_ctype *__DUMMY_PAR1,
char *__DUMMY_PAR2, size_t __DUMMY_PAR3,
const wchar_t __DUMMY_PAR4,
mbstate_t *__DUMMY_PAR5) {
printf( "%s:%d\n", __FILE__, __LINE__ );
return (size_t) -1;
}
#endif
size_t _Locale_unshift(struct _Locale_ctype *__DUMMY_PAR1,
mbstate_t *__DUMMY_PAR2,
char *__DUMMY_PAR3, size_t __DUMMY_PAR4, char ** __DUMMY_PAR5) {
printf( "%s:%d\n", __FILE__, __LINE__ );
return (size_t) -1;
}
#endif /* _STLP_NO_MBSTATE_T */
/* Collate */
int _Locale_strcmp(struct _Locale_collate * __loc,
const char *s1, size_t n1,
const char *s2, size_t n2) {
int ret;
char buf1[64], buf2[64];
while (n1 > 0 && n2 > 0) {
size_t bufsize1 = n1 < 63 ? n1 : 63;
size_t bufsize2 = n2 < 63 ? n2 : 63;
strncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0;
strncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0;
ret = strcoll_l(buf1, buf2, (__c_locale)__loc);
if (ret != 0) return ret;
s1 += bufsize1; n1 -= bufsize1;
s2 += bufsize2; n2 -= bufsize2;
}
return ret;
}
#if !defined (_STLP_NO_WCHAR_T)
int _Locale_strwcmp(struct _Locale_collate *__loc,
const wchar_t *s1, size_t n1,
const wchar_t *s2, size_t n2) {
int ret;
wchar_t buf1[64], buf2[64];
while (n1 > 0 && n2 > 0) {
size_t bufsize1 = n1 < 63 ? n1 : 63;
size_t bufsize2 = n2 < 63 ? n2 : 63;
wcsncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0;
wcsncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0;
ret = wcscoll_l(buf1, buf2, (__c_locale)__loc);
if (ret != 0) return ret;
s1 += bufsize1; n1 -= bufsize1;
s2 += bufsize2; n2 -= bufsize2;
}
return ret;
}
#endif
size_t _Locale_strxfrm(struct _Locale_collate *__loc,
char *dest, size_t dest_n,
const char *src, size_t src_n )
{
const char *real_src;
char *buf = NULL;
size_t result;
if (src_n == 0)
{
if (dest != NULL) dest[0] = 0;
return 0;
}
if (src[src_n] != 0) {
buf = malloc(src_n + 1);
strncpy(buf, src, src_n);
buf[src_n] = 0;
real_src = buf;
}
else
real_src = src;
result = __strxfrm_l(dest, real_src, dest_n, (__c_locale)__loc);
if (buf != NULL) free(buf);
return result;
}
# ifndef _STLP_NO_WCHAR_T
size_t _Locale_strwxfrm( struct _Locale_collate *__loc,
wchar_t *dest, size_t dest_n,
const wchar_t *src, size_t src_n )
{
const wchar_t *real_src;
wchar_t *buf = NULL;
size_t result;
if (src_n == 0)
{
if (dest != NULL) dest[0] = 0;
return 0;
}
if (src[src_n] != 0) {
buf = malloc((src_n + 1) * sizeof(wchar_t));
wcsncpy(buf, src, src_n);
buf[src_n] = 0;
real_src = buf;
}
else
real_src = src;
result = __wcsxfrm_l(dest, real_src, dest_n, (__c_locale)__loc);
if (buf != NULL) free(buf);
return result;
}
# endif
/* Numeric */
char _Locale_decimal_point(struct _Locale_numeric *__loc)
{
return (__loc != 0) ? *(__nl_langinfo_l(RADIXCHAR, (__c_locale)__loc)) : '.';
}
char _Locale_thousands_sep(struct _Locale_numeric *__loc)
{
return (__loc != 0) ? *(__nl_langinfo_l(THOUSEP, (__c_locale)__loc)) : ',';
}
const char* _Locale_grouping(struct _Locale_numeric *__loc)
{
return (__loc != 0 && _Locale_thousands_sep(__loc) != '\0' ) ?
(__nl_langinfo_l(GROUPING, (__c_locale)__loc)) : "";
}
const char *_Locale_true(struct _Locale_numeric *__loc)
{
return __loc != 0 ? __nl_langinfo_l(YESSTR, (__c_locale)__loc) : "true";
}
const char *_Locale_false(struct _Locale_numeric *__loc)
{
return __loc != 0 ? __nl_langinfo_l(NOSTR, (__c_locale)__loc) : "false";
}
/* Monetary */
const char *_Locale_int_curr_symbol(struct _Locale_monetary *__loc)
{
return __loc != 0 ? __nl_langinfo_l(INT_CURR_SYMBOL, (__c_locale)__loc) : 0;
}
const char *_Locale_currency_symbol(struct _Locale_monetary *__loc)
{
return __loc != 0 ? __nl_langinfo_l(CURRENCY_SYMBOL, (__c_locale)__loc) : 0;
}
char _Locale_mon_decimal_point(struct _Locale_monetary * __loc)
{
return __loc != 0 ? *(__nl_langinfo_l(MON_DECIMAL_POINT,(__c_locale)__loc)) : '.';
}
char _Locale_mon_thousands_sep(struct _Locale_monetary *__loc)
{
return __loc != 0 ? *(__nl_langinfo_l(MON_THOUSANDS_SEP, (__c_locale)__loc)) : ',';
}
const char *_Locale_mon_grouping(struct _Locale_monetary *__loc)
{
return (__loc != 0 && _Locale_mon_thousands_sep( __loc ) != '\0' ) ?
__nl_langinfo_l(MON_GROUPING, (__c_locale)__loc) : _empty_str;
}
const char *_Locale_positive_sign(struct _Locale_monetary *__loc)
{
return __loc != 0 ? __nl_langinfo_l(POSITIVE_SIGN, (__c_locale)__loc) : _empty_str;
}
const char *_Locale_negative_sign(struct _Locale_monetary *__loc)
{
return __loc != 0 ? __nl_langinfo_l(NEGATIVE_SIGN, (__c_locale)__loc) : _empty_str;
}
char _Locale_int_frac_digits(struct _Locale_monetary *__loc)
{
return __loc != 0 ? *(__nl_langinfo_l(INT_FRAC_DIGITS, (__c_locale)__loc)) : CHAR_MAX;
}
char _Locale_frac_digits(struct _Locale_monetary *__loc)
{
return __loc != 0 ? *(__nl_langinfo_l(FRAC_DIGITS, (__c_locale)__loc)) : CHAR_MAX;
}
/* 1 if currency_symbol precedes a positive value, 0 if succeeds */
int _Locale_p_cs_precedes(struct _Locale_monetary *__loc)
{
return __loc != 0 ? *(__nl_langinfo_l(P_CS_PRECEDES, (__c_locale)__loc)) : CHAR_MAX;
}
/* 1 if a space separates currency_symbol from a positive value. */
int _Locale_p_sep_by_space(struct _Locale_monetary *__loc)
{
return __loc != 0 ? *(__nl_langinfo_l(P_SEP_BY_SPACE, (__c_locale)__loc)) : CHAR_MAX;
}
/*
* 0 Parentheses surround the quantity and currency_symbol
* 1 The sign string precedes the quantity and currency_symbol
* 2 The sign string succeeds the quantity and currency_symbol.
* 3 The sign string immediately precedes the currency_symbol.
* 4 The sign string immediately succeeds the currency_symbol.
*/
int _Locale_p_sign_posn(struct _Locale_monetary *__loc)
{
return __loc != 0 ? *(__nl_langinfo_l(P_SIGN_POSN, (__c_locale)__loc)) : CHAR_MAX;
}
/* 1 if currency_symbol precedes a negative value, 0 if succeeds */
int _Locale_n_cs_precedes(struct _Locale_monetary *__loc)
{
return __loc != 0 ? *(__nl_langinfo_l(N_CS_PRECEDES, (__c_locale)__loc)) : CHAR_MAX;
}
/* 1 if a space separates currency_symbol from a negative value. */
int _Locale_n_sep_by_space(struct _Locale_monetary *__loc)
{
return __loc != 0 ? *(__nl_langinfo_l(N_SEP_BY_SPACE, (__c_locale)__loc)) : CHAR_MAX;
}
/*
* 0 Parentheses surround the quantity and currency_symbol
* 1 The sign string precedes the quantity and currency_symbol
* 2 The sign string succeeds the quantity and currency_symbol.
* 3 The sign string immediately precedes the currency_symbol.
* 4 The sign string immediately succeeds the currency_symbol.
*/
int _Locale_n_sign_posn(struct _Locale_monetary *__loc)
{
return __loc != 0 ? *(__nl_langinfo_l(N_SIGN_POSN, (__c_locale)__loc)) : CHAR_MAX;
}
/* Time */
const char *_Locale_full_monthname(struct _Locale_time *__loc, int _m )
{
return (__loc != 0 && _m >= 0 && _m < 12) ? __nl_langinfo_l(MON_1 + _m, (__c_locale)__loc) : 0;
}
const char *_Locale_abbrev_monthname(struct _Locale_time *__loc, int _m )
{
return (__loc != 0 && _m >= 0 && _m < 12) ? __nl_langinfo_l(ABMON_1 + _m, (__c_locale)__loc) : 0;
}
const char *_Locale_full_dayofweek(struct _Locale_time *__loc, int _d )
{
return (__loc != 0 && _d >= 0 && _d < 7) ? __nl_langinfo_l(DAY_1 + _d, (__c_locale)__loc) : 0;
}
const char *_Locale_abbrev_dayofweek(struct _Locale_time *__loc, int _d )
{
return (__loc != 0 && _d >= 0 && _d < 7) ? __nl_langinfo_l(ABDAY_1 + _d, (__c_locale)__loc) : 0;
}
const char *_Locale_d_t_fmt(struct _Locale_time *__loc)
{
return __loc != 0 ? __nl_langinfo_l(D_T_FMT, (__c_locale)__loc) : 0;
}
const char *_Locale_d_fmt(struct _Locale_time *__loc )
{
return __loc != 0 ? __nl_langinfo_l(D_FMT, (__c_locale)__loc) : 0;
}
const char *_Locale_t_fmt(struct _Locale_time *__loc )
{
return __loc != 0 ? __nl_langinfo_l(T_FMT, (__c_locale)__loc) : 0;
}
const char *_Locale_long_d_t_fmt(struct _Locale_time *__loc )
{
return __loc != 0 ? __nl_langinfo_l(ERA_D_T_FMT, (__c_locale)__loc) : 0;
}
const char *_Locale_long_d_fmt(struct _Locale_time *__loc )
{
return __loc != 0 ? __nl_langinfo_l(ERA_D_FMT, (__c_locale)__loc) : 0;
}
const char *_Locale_am_str(struct _Locale_time *__loc )
{
return __loc != 0 ? __nl_langinfo_l(AM_STR, (__c_locale)__loc) : _empty_str;
}
const char *_Locale_pm_str(struct _Locale_time* __loc )
{
return __loc != 0 ? __nl_langinfo_l(PM_STR, (__c_locale)__loc) : _empty_str;
}
const char *_Locale_t_fmt_ampm(struct _Locale_time *__loc )
{
return __loc != 0 ? __nl_langinfo_l(T_FMT_AMPM, (__c_locale)__loc) : 0;
}
/* Messages */
nl_catd_type _Locale_catopen(struct _Locale_messages *__loc, const char *__cat_name )
{
return catopen( __cat_name, NL_CAT_LOCALE );
}
void _Locale_catclose(struct _Locale_messages *__loc, nl_catd_type __cat )
{
catclose( __cat );
}
const char *_Locale_catgets(struct _Locale_messages *__loc, nl_catd_type __cat,
int __setid, int __msgid, const char *dfault)
{
return catgets( __cat, __setid, __msgid, dfault );
}

View File

@@ -1,207 +0,0 @@
/* localeinfo.h -- declarations for internal libc locale interfaces
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _LOCALEINFO_H
#define _LOCALEINFO_H 1
#include <stddef.h>
#include <langinfo.h>
#include <time.h>
#include <sys/types.h>
/* stuff from loadinfo.h */
#ifndef PARAMS
# if __STDC__
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
#endif
/* Encoding of locale name parts. */
#define CEN_REVISION 1
#define CEN_SPONSOR 2
#define CEN_SPECIAL 4
#define XPG_NORM_CODESET 8
#define XPG_CODESET 16
#define TERRITORY 32
#define CEN_AUDIENCE 64
#define XPG_MODIFIER 128
#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
struct loaded_l10nfile
{
const char *filename;
int decided;
const void *data;
struct loaded_l10nfile *next;
struct loaded_l10nfile *successor[1];
};
extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
size_t name_len));
extern struct loaded_l10nfile *
_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
const char *dirlist, size_t dirlist_len, int mask,
const char *language, const char *territory,
const char *codeset,
const char *normalized_codeset,
const char *modifier, const char *special,
const char *sponsor, const char *revision,
const char *filename, int do_allocate));
extern const char *_nl_expand_alias PARAMS ((const char *name));
extern int _nl_explode_name PARAMS ((char *name, const char **language,
const char **modifier,
const char **territory,
const char **codeset,
const char **normalized_codeset,
const char **special,
const char **sponsor,
const char **revision));
/* Magic number at the beginning of a locale data file for CATEGORY. */
#define LIMAGIC(category) (0x960617de ^ (category))
/* Two special weight constants for the collation data. */
#define FORWARD_CHAR ((wchar_t) 0xfffffffd)
#define ELLIPSIS_CHAR ((wchar_t) 0xfffffffe)
#define IGNORE_CHAR ((wchar_t) 0xffffffff)
#define MAX_USAGE_COUNT (UINT_MAX - 1)
#define UNDELETABLE UINT_MAX
/* Structure describing locale data in core for a category. */
struct locale_data
{
const char *name;
const char *filedata; /* Region mapping the file data. */
off_t filesize; /* Size of the file (and the region). */
/* unsigned int usage_count; */
/* int mmaped; */
unsigned int nstrings; /* Number of strings below. */
union locale_data_value
{
const wchar_t *wstr;
const char *string;
unsigned int word;
}
values[0]; /* Items, usually pointers into `filedata'. */
};
/* We know three kinds of collation sorting rules. */
enum coll_sort_rule
{
illegal_0__,
sort_forward,
sort_backward,
illegal_3__,
sort_position,
sort_forward_position,
sort_backward_position,
sort_mask
};
/* We can map the types of the entries into a few categories. */
enum value_type
{
none,
string,
stringarray,
byte,
bytearray,
word
};
/* Structure to access `era' information from LC_TIME. */
struct era_entry
{
u_int32_t direction; /* Contains '+' or '-'. */
int32_t offset;
int32_t start_date[3];
int32_t stop_date[3];
const char name_fmt[0];
};
extern const char *const _nl_category_names[LC_ALL + 1];
extern const size_t _nl_category_name_sizes[LC_ALL + 1];
extern const struct locale_data * *const _nl_current[LC_ALL];
/* Name of the standard locale. */
extern const char _nl_C_name[];
/* Extract the current CATEGORY locale's string for ITEM. */
#define _NL_CURRENT(category, item) \
(_nl_current_##category->values[_NL_ITEM_INDEX (item)].string)
/* Extract the current CATEGORY locale's word for ITEM. */
#define _NL_CURRENT_WORD(category, item) \
(_nl_current_##category->values[_NL_ITEM_INDEX (item)].word)
/* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
#define _NL_CURRENT_DEFINE(category) \
extern const struct locale_data _nl_C_##category; \
const struct locale_data *_nl_current_##category = &_nl_C_##category
/* Load the locale data for CATEGORY from the file specified by *NAME.
If *NAME is "", use environment variables as specified by POSIX,
and fill in *NAME with the actual name used. The directories
listed in LOCALE_PATH are searched for the locale files. */
extern const struct locale_data *_nl_find_locale (const char *locale_path,
size_t locale_path_len,
int category, char **name);
/* Try to load the file described by FILE. */
extern void _nl_load_locale (struct loaded_l10nfile *file, int category);
/* Return `era' entry which corresponds to TP. Used in strftime. */
struct era_entry *_nl_get_era_entry (const struct tm *tp);
/* Return `alt_digit' which corresponds to NUMBER. Used in strftime. */
const char *_nl_get_alt_digit (unsigned int number);
/* Global variables for LC_COLLATE category data. */
extern const u_int32_t *__collate_table;
extern const u_int32_t *__collate_extra;
extern const u_int32_t *__collate_element_hash;
extern const char *__collate_element_strings;
extern const wchar_t *__collate_element_values;
extern const u_int32_t *__collate_symbol_hash;
extern const char *__collate_symbol_strings;
extern const u_int32_t *__collate_symbol_classes;
#endif /* localeinfo.h */

File diff suppressed because it is too large Load Diff

View File

@@ -1,147 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#ifndef _STLP_NO_MBSTATE_T
#include <locale>
#include <algorithm>
_STLP_BEGIN_NAMESPACE
//----------------------------------------------------------------------
// codecvt<char, char, mbstate_t>
codecvt<char, char, mbstate_t>::~codecvt() {}
int codecvt<char, char, mbstate_t>::do_length(const mbstate_t&,
const char* from,
const char* end,
size_t mx) const
{ return (int)(min) ( __STATIC_CAST(size_t, (end - from)), mx); }
int codecvt<char, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
{ return 1; }
bool
codecvt<char, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
{ return true; }
int
codecvt<char, char, mbstate_t>::do_encoding() const _STLP_NOTHROW
{ return 1; }
codecvt_base::result
codecvt<char, char, mbstate_t>::do_unshift(mbstate_t& /* __state */,
char* __to,
char* /* __to_limit */,
char*& __to_next) const
{ __to_next = __to; return noconv; }
codecvt_base::result
codecvt<char, char, mbstate_t>::do_in (mbstate_t& /* __state */ ,
const char* __from,
const char* /* __from_end */,
const char*& __from_next,
char* __to,
char* /* __to_end */,
char*& __to_next) const
{ __from_next = __from; __to_next = __to; return noconv; }
codecvt_base::result
codecvt<char, char, mbstate_t>::do_out(mbstate_t& /* __state */,
const char* __from,
const char* /* __from_end */,
const char*& __from_next,
char* __to,
char* /* __to_limit */,
char*& __to_next) const
{ __from_next = __from; __to_next = __to; return noconv; }
#if !defined (_STLP_NO_WCHAR_T)
//----------------------------------------------------------------------
// codecvt<wchar_t, char, mbstate_t>
codecvt<wchar_t, char, mbstate_t>::~codecvt() {}
codecvt<wchar_t, char, mbstate_t>::result
codecvt<wchar_t, char, mbstate_t>::do_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 {
ptrdiff_t len = (min) (from_end - from, to_limit - to);
copy(from, from + len, to);
from_next = from + len;
to_next = to + len;
return ok;
}
codecvt<wchar_t, char, mbstate_t>::result
codecvt<wchar_t, char, mbstate_t>::do_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 {
ptrdiff_t len = (min) (from_end - from, to_limit - to);
copy(__REINTERPRET_CAST(const unsigned char*, from),
__REINTERPRET_CAST(const unsigned char*, from) + len, to);
from_next = from + len;
to_next = to + len;
return ok;
}
codecvt<wchar_t, char, mbstate_t>::result
codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& /* state */,
extern_type* to,
extern_type* ,
extern_type*& to_next) const {
to_next = to;
return noconv;
}
int codecvt<wchar_t, char, mbstate_t>::do_encoding() const _STLP_NOTHROW
{ return 1; }
bool codecvt<wchar_t, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
{ return true; }
int codecvt<wchar_t, char, mbstate_t>::do_length(const state_type&,
const extern_type* from,
const extern_type* end,
size_t mx) const
{ return (int)(min) ((size_t) (end - from), mx); }
int codecvt<wchar_t, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
{ return 1; }
#endif /* wchar_t */
_STLP_END_NAMESPACE
#endif /* _STLP_NO_MBSTATE_T */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,69 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <locale>
_STLP_BEGIN_NAMESPACE
// collate<char>
collate<char>::~collate() {}
int collate<char>::do_compare(const char* low1, const char* high1,
const char* low2, const char* high2) const
{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
string collate<char>::do_transform(const char* low, const char* high) const
{ return string(low, high); }
long collate<char>::do_hash(const char* low, const char* high) const {
unsigned long result = 0;
for ( ; low < high; ++low)
result = 5 * result + *low;
return result;
}
#if !defined (_STLP_NO_WCHAR_T)
// collate<wchar_t>
collate<wchar_t>::~collate() {}
int
collate<wchar_t>::do_compare(const wchar_t* low1, const wchar_t* high1,
const wchar_t* low2, const wchar_t* high2) const
{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
wstring collate<wchar_t>::do_transform(const wchar_t* low, const wchar_t* high) const
{ return wstring(low, high); }
long collate<wchar_t>::do_hash(const wchar_t* low, const wchar_t* high) const {
unsigned long result = 0;
for ( ; low < high; ++low)
result = 5 * result + *low;
return result;
}
#endif
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,347 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <numeric>
#include <cmath>
#include <complex>
#if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB >= 1400)
// hypot is deprecated.
# if defined (_STLP_MSVC)
# pragma warning (disable : 4996)
# elif defined (__ICL)
# pragma warning (disable : 1478)
# endif
#endif
_STLP_BEGIN_NAMESPACE
// Complex division and square roots.
// Absolute value
_STLP_TEMPLATE_NULL
_STLP_DECLSPEC float _STLP_CALL abs(const complex<float>& __z)
{ return ::hypot(__z._M_re, __z._M_im); }
_STLP_TEMPLATE_NULL
_STLP_DECLSPEC double _STLP_CALL abs(const complex<double>& __z)
{ return ::hypot(__z._M_re, __z._M_im); }
#if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_TEMPLATE_NULL
_STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>& __z)
{ return ::hypot(__z._M_re, __z._M_im); }
#endif
// Phase
_STLP_TEMPLATE_NULL
_STLP_DECLSPEC float _STLP_CALL arg(const complex<float>& __z)
{ return ::atan2(__z._M_im, __z._M_re); }
_STLP_TEMPLATE_NULL
_STLP_DECLSPEC double _STLP_CALL arg(const complex<double>& __z)
{ return ::atan2(__z._M_im, __z._M_re); }
#if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_TEMPLATE_NULL
_STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>& __z)
{ return ::atan2(__z._M_im, __z._M_re); }
#endif
// Construct a complex number from polar representation
_STLP_TEMPLATE_NULL
_STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi)
{ return complex<float>(__rho * ::cos(__phi), __rho * ::sin(__phi)); }
_STLP_TEMPLATE_NULL
_STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi)
{ return complex<double>(__rho * ::cos(__phi), __rho * ::sin(__phi)); }
#if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_TEMPLATE_NULL
_STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double& __rho, const long double& __phi)
{ return complex<long double>(__rho * ::cos(__phi), __rho * ::sin(__phi)); }
#endif
// Division
template <class _Tp>
static void _divT(const _Tp& __z1_r, const _Tp& __z1_i,
const _Tp& __z2_r, const _Tp& __z2_i,
_Tp& __res_r, _Tp& __res_i) {
_Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
_Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
if (__ar <= __ai) {
_Tp __ratio = __z2_r / __z2_i;
_Tp __denom = __z2_i * (1 + __ratio * __ratio);
__res_r = (__z1_r * __ratio + __z1_i) / __denom;
__res_i = (__z1_i * __ratio - __z1_r) / __denom;
}
else {
_Tp __ratio = __z2_i / __z2_r;
_Tp __denom = __z2_r * (1 + __ratio * __ratio);
__res_r = (__z1_r + __z1_i * __ratio) / __denom;
__res_i = (__z1_i - __z1_r * __ratio) / __denom;
}
}
template <class _Tp>
static void _divT(const _Tp& __z1_r,
const _Tp& __z2_r, const _Tp& __z2_i,
_Tp& __res_r, _Tp& __res_i) {
_Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
_Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
if (__ar <= __ai) {
_Tp __ratio = __z2_r / __z2_i;
_Tp __denom = __z2_i * (1 + __ratio * __ratio);
__res_r = (__z1_r * __ratio) / __denom;
__res_i = - __z1_r / __denom;
}
else {
_Tp __ratio = __z2_i / __z2_r;
_Tp __denom = __z2_r * (1 + __ratio * __ratio);
__res_r = __z1_r / __denom;
__res_i = - (__z1_r * __ratio) / __denom;
}
}
void _STLP_CALL
complex<float>::_div(const float& __z1_r, const float& __z1_i,
const float& __z2_r, const float& __z2_i,
float& __res_r, float& __res_i)
{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); }
void _STLP_CALL
complex<float>::_div(const float& __z1_r,
const float& __z2_r, const float& __z2_i,
float& __res_r, float& __res_i)
{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }
void _STLP_CALL
complex<double>::_div(const double& __z1_r, const double& __z1_i,
const double& __z2_r, const double& __z2_i,
double& __res_r, double& __res_i)
{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); }
void _STLP_CALL
complex<double>::_div(const double& __z1_r,
const double& __z2_r, const double& __z2_i,
double& __res_r, double& __res_i)
{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }
#if !defined (_STLP_NO_LONG_DOUBLE)
void _STLP_CALL
complex<long double>::_div(const long double& __z1_r, const long double& __z1_i,
const long double& __z2_r, const long double& __z2_i,
long double& __res_r, long double& __res_i)
{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); }
void _STLP_CALL
complex<long double>::_div(const long double& __z1_r,
const long double& __z2_r, const long double& __z2_i,
long double& __res_r, long double& __res_i)
{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }
#endif
//----------------------------------------------------------------------
// Square root
template <class _Tp>
static complex<_Tp> sqrtT(const complex<_Tp>& z) {
_Tp re = z._M_re;
_Tp im = z._M_im;
_Tp mag = ::hypot(re, im);
complex<_Tp> result;
if (mag == 0.f) {
result._M_re = result._M_im = 0.f;
} else if (re > 0.f) {
result._M_re = ::sqrt(0.5f * (mag + re));
result._M_im = im/result._M_re/2.f;
} else {
result._M_im = ::sqrt(0.5f * (mag - re));
if (im < 0.f)
result._M_im = - result._M_im;
result._M_re = im/result._M_im/2.f;
}
return result;
}
complex<float> _STLP_CALL
sqrt(const complex<float>& z) { return sqrtT(z); }
complex<double> _STLP_CALL
sqrt(const complex<double>& z) { return sqrtT(z); }
#if !defined (_STLP_NO_LONG_DOUBLE)
complex<long double> _STLP_CALL
sqrt(const complex<long double>& z) { return sqrtT(z); }
#endif
// exp, log, pow for complex<float>, complex<double>, and complex<long double>
//----------------------------------------------------------------------
// exp
template <class _Tp>
static complex<_Tp> expT(const complex<_Tp>& z) {
_Tp expx = ::exp(z._M_re);
return complex<_Tp>(expx * ::cos(z._M_im),
expx * ::sin(z._M_im));
}
_STLP_DECLSPEC complex<float> _STLP_CALL exp(const complex<float>& z)
{ return expT(z); }
_STLP_DECLSPEC complex<double> _STLP_CALL exp(const complex<double>& z)
{ return expT(z); }
#if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>& z)
{ return expT(z); }
#endif
//----------------------------------------------------------------------
// log10
template <class _Tp>
static complex<_Tp> log10T(const complex<_Tp>& z, const _Tp& ln10_inv) {
complex<_Tp> r;
r._M_im = ::atan2(z._M_im, z._M_re) * ln10_inv;
r._M_re = ::log10(::hypot(z._M_re, z._M_im));
return r;
}
static const float LN10_INVF = 1.f / ::log(10.f);
_STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>& z)
{ return log10T(z, LN10_INVF); }
static const double LN10_INV = 1. / ::log10(10.);
_STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>& z)
{ return log10T(z, LN10_INV); }
#if !defined (_STLP_NO_LONG_DOUBLE)
static const long double LN10_INVL = 1.l / ::log(10.l);
_STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>& z)
{ return log10T(z, LN10_INVL); }
#endif
//----------------------------------------------------------------------
// log
template <class _Tp>
static complex<_Tp> logT(const complex<_Tp>& z) {
complex<_Tp> r;
r._M_im = ::atan2(z._M_im, z._M_re);
r._M_re = ::log(::hypot(z._M_re, z._M_im));
return r;
}
_STLP_DECLSPEC complex<float> _STLP_CALL log(const complex<float>& z)
{ return logT(z); }
_STLP_DECLSPEC complex<double> _STLP_CALL log(const complex<double>& z)
{ return logT(z); }
#ifndef _STLP_NO_LONG_DOUBLE
_STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>& z)
{ return logT(z); }
# endif
//----------------------------------------------------------------------
// pow
template <class _Tp>
static complex<_Tp> powT(const _Tp& a, const complex<_Tp>& b) {
_Tp logr = ::log(a);
_Tp x = ::exp(logr * b._M_re);
_Tp y = logr * b._M_im;
return complex<_Tp>(x * ::cos(y), x * ::sin(y));
}
template <class _Tp>
static complex<_Tp> powT(const complex<_Tp>& z_in, int n) {
complex<_Tp> z = z_in;
z = _STLP_PRIV __power(z, (n < 0 ? -n : n), multiplies< complex<_Tp> >());
if (n < 0)
return _Tp(1.0) / z;
else
return z;
}
template <class _Tp>
static complex<_Tp> powT(const complex<_Tp>& a, const _Tp& b) {
_Tp logr = ::log(::hypot(a._M_re,a._M_im));
_Tp logi = ::atan2(a._M_im, a._M_re);
_Tp x = ::exp(logr * b);
_Tp y = logi * b;
return complex<_Tp>(x * ::cos(y), x * ::sin(y));
}
template <class _Tp>
static complex<_Tp> powT(const complex<_Tp>& a, const complex<_Tp>& b) {
_Tp logr = ::log(::hypot(a._M_re,a._M_im));
_Tp logi = ::atan2(a._M_im, a._M_re);
_Tp x = ::exp(logr * b._M_re - logi * b._M_im);
_Tp y = logr * b._M_im + logi * b._M_re;
return complex<_Tp>(x * ::cos(y), x * ::sin(y));
}
_STLP_DECLSPEC complex<float> _STLP_CALL pow(const float& a, const complex<float>& b)
{ return powT(a, b); }
_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>& z_in, int n)
{ return powT(z_in, n); }
_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>& a, const float& b)
{ return powT(a, b); }
_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>& a, const complex<float>& b)
{ return powT(a, b); }
_STLP_DECLSPEC complex<double> _STLP_CALL pow(const double& a, const complex<double>& b)
{ return powT(a, b); }
_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>& z_in, int n)
{ return powT(z_in, n); }
_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>& a, const double& b)
{ return powT(a, b); }
_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>& a, const complex<double>& b)
{ return powT(a, b); }
#if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const long double& a,
const complex<long double>& b)
{ return powT(a, b); }
_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>& z_in, int n)
{ return powT(z_in, n); }
_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>& a,
const long double& b)
{ return powT(a, b); }
_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>& a,
const complex<long double>& b)
{ return powT(a, b); }
#endif
_STLP_END_NAMESPACE

View File

@@ -1,161 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <complex>
#include <istream>
_STLP_BEGIN_NAMESPACE
#if !(defined (_STLP_MSVC) && _STLP_MSVC < 1200)
// Specializations for narrow characters; lets us avoid the nuisance of
// widening.
_STLP_OPERATOR_SPEC
basic_ostream<char, char_traits<char> >& _STLP_CALL
operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<float>& __z)
{ return __os << '(' << (double)__z.real() << ',' << (double)__z.imag() << ')'; }
_STLP_OPERATOR_SPEC
basic_ostream<char, char_traits<char> >& _STLP_CALL
operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<double>& __z)
{ return __os << '(' << __z.real() << ',' << __z.imag() << ')'; }
# ifndef _STLP_NO_LONG_DOUBLE
_STLP_OPERATOR_SPEC
basic_ostream<char, char_traits<char> >& _STLP_CALL
operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<long double>& __z)
{ return __os << '(' << __z.real() << ',' << __z.imag() << ')'; }
# endif
// Specialization for narrow characters; lets us avoid widen.
_STLP_OPERATOR_SPEC
basic_istream<char, char_traits<char> >& _STLP_CALL
operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z) {
float __re = 0;
float __im = 0;
char __c;
__is >> __c;
if (__c == '(') {
__is >> __re >> __c;
if (__c == ',')
__is >> __im >> __c;
if (__c != ')')
__is.setstate(ios_base::failbit);
}
else {
__is.putback(__c);
__is >> __re;
}
if (__is)
__z = complex<float>(__re, __im);
return __is;
}
_STLP_OPERATOR_SPEC
basic_istream<char, char_traits<char> >& _STLP_CALL
operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z) {
double __re = 0;
double __im = 0;
char __c;
__is >> __c;
if (__c == '(') {
__is >> __re >> __c;
if (__c == ',')
__is >> __im >> __c;
if (__c != ')')
__is.setstate(ios_base::failbit);
}
else {
__is.putback(__c);
__is >> __re;
}
if (__is)
__z = complex<double>(__re, __im);
return __is;
}
# ifndef _STLP_NO_LONG_DOUBLE
_STLP_OPERATOR_SPEC
basic_istream<char, char_traits<char> >& _STLP_CALL
operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z) {
long double __re = 0;
long double __im = 0;
char __c;
__is >> __c;
if (__c == '(') {
__is >> __re >> __c;
if (__c == ',')
__is >> __im >> __c;
if (__c != ')')
__is.setstate(ios_base::failbit);
}
else {
__is.putback(__c);
__is >> __re;
}
if (__is)
__z = complex<long double>(__re, __im);
return __is;
}
# endif
#endif /* MSVC */
// Force instantiation of complex I/O functions
#if !(defined (_STLP_NO_FORCE_INSTANTIATE) || defined (_STLP_NO_WCHAR_T))
_STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
_STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
#ifndef _STLP_NO_LONG_DOUBLE
_STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
_STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
#endif
_STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
_STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
#endif /* _STLP_NO_WCHAR_T */
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,192 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
// Trigonometric and hyperbolic functions for complex<float>,
// complex<double>, and complex<long double>
#include <complex>
#include <cfloat>
#include <cmath>
_STLP_BEGIN_NAMESPACE
//----------------------------------------------------------------------
// helpers
#if defined (__sgi)
static const union { unsigned int i; float f; } float_ulimit = { 0x42b2d4fc };
static const float float_limit = float_ulimit.f;
static union {
struct { unsigned int h; unsigned int l; } w;
double d;
} double_ulimit = { 0x408633ce, 0x8fb9f87d };
static const double double_limit = double_ulimit.d;
static union {
struct { unsigned int h[2]; unsigned int l[2]; } w;
long double ld;
} ldouble_ulimit = {0x408633ce, 0x8fb9f87e, 0xbd23b659, 0x4e9bd8b1};
# if !defined (_STLP_NO_LONG_DOUBLE)
static const long double ldouble_limit = ldouble_ulimit.ld;
# endif
#else
# if defined (M_LN2) && defined (FLT_MAX_EXP)
static const float float_limit = float(M_LN2 * FLT_MAX_EXP);
static const double double_limit = M_LN2 * DBL_MAX_EXP;
# else
static const float float_limit = ::log(FLT_MAX);
static const double double_limit = ::log(DBL_MAX);
# endif
# if !defined (_STLP_NO_LONG_DOUBLE)
# if defined (M_LN2l)
static const long double ldouble_limit = M_LN2l * LDBL_MAX_EXP;
# else
static const long double ldouble_limit = ::log(LDBL_MAX);
# endif
# endif
#endif
//----------------------------------------------------------------------
// sin
template <class _Tp>
static complex<_Tp> sinT(const complex<_Tp>& z) {
return complex<_Tp>(::sin(z._M_re) * ::cosh(z._M_im),
::cos(z._M_re) * ::sinh(z._M_im));
}
_STLP_DECLSPEC complex<float> _STLP_CALL sin(const complex<float>& z)
{ return sinT(z); }
_STLP_DECLSPEC complex<double> _STLP_CALL sin(const complex<double>& z)
{ return sinT(z); }
#if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_DECLSPEC complex<long double> _STLP_CALL sin(const complex<long double>& z)
{ return sinT(z); }
#endif
//----------------------------------------------------------------------
// cos
template <class _Tp>
static complex<_Tp> cosT(const complex<_Tp>& z) {
return complex<_Tp>(::cos(z._M_re) * ::cosh(z._M_im),
-::sin(z._M_re) * ::sinh(z._M_im));
}
_STLP_DECLSPEC complex<float> _STLP_CALL cos(const complex<float>& z)
{ return cosT(z); }
_STLP_DECLSPEC complex<double> _STLP_CALL cos(const complex<double>& z)
{ return cosT(z); }
#if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_DECLSPEC complex<long double> _STLP_CALL cos(const complex<long double>& z)
{ return cosT(z); }
#endif
//----------------------------------------------------------------------
// tan
template <class _Tp>
static complex<_Tp> tanT(const complex<_Tp>& z, const _Tp& Tp_limit) {
_Tp re2 = 2.f * z._M_re;
_Tp im2 = 2.f * z._M_im;
if (::abs(im2) > Tp_limit)
return complex<_Tp>(0.f, (im2 > 0 ? 1.f : -1.f));
else {
_Tp den = ::cos(re2) + ::cosh(im2);
return complex<_Tp>(::sin(re2) / den, ::sinh(im2) / den);
}
}
_STLP_DECLSPEC complex<float> _STLP_CALL tan(const complex<float>& z)
{ return tanT(z, float_limit); }
_STLP_DECLSPEC complex<double> _STLP_CALL tan(const complex<double>& z)
{ return tanT(z, double_limit); }
#if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_DECLSPEC complex<long double> _STLP_CALL tan(const complex<long double>& z)
{ return tanT(z, ldouble_limit); }
#endif
//----------------------------------------------------------------------
// sinh
template <class _Tp>
static complex<_Tp> sinhT(const complex<_Tp>& z) {
return complex<_Tp>(::sinh(z._M_re) * ::cos(z._M_im),
::cosh(z._M_re) * ::sin(z._M_im));
}
_STLP_DECLSPEC complex<float> _STLP_CALL sinh(const complex<float>& z)
{ return sinhT(z); }
_STLP_DECLSPEC complex<double> _STLP_CALL sinh(const complex<double>& z)
{ return sinhT(z); }
#if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>& z)
{ return sinhT(z); }
#endif
//----------------------------------------------------------------------
// cosh
template <class _Tp>
static complex<_Tp> coshT(const complex<_Tp>& z) {
return complex<_Tp>(::cosh(z._M_re) * ::cos(z._M_im),
::sinh(z._M_re) * ::sin(z._M_im));
}
_STLP_DECLSPEC complex<float> _STLP_CALL cosh(const complex<float>& z)
{ return coshT(z); }
_STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>& z)
{ return coshT(z); }
#if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>& z)
{ return coshT(z); }
#endif
//----------------------------------------------------------------------
// tanh
template <class _Tp>
static complex<_Tp> tanhT(const complex<_Tp>& z, const _Tp& Tp_limit) {
_Tp re2 = 2.f * z._M_re;
_Tp im2 = 2.f * z._M_im;
if (::abs(re2) > Tp_limit)
return complex<_Tp>((re2 > 0 ? 1.f : -1.f), 0.f);
else {
_Tp den = ::cosh(re2) + ::cos(im2);
return complex<_Tp>(::sinh(re2) / den, ::sin(im2) / den);
}
}
_STLP_DECLSPEC complex<float> _STLP_CALL tanh(const complex<float>& z)
{ return tanhT(z, float_limit); }
_STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>& z)
{ return tanhT(z, double_limit); }
#if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>& z)
{ return tanhT(z, ldouble_limit); }
#endif
_STLP_END_NAMESPACE

View File

@@ -1,507 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <algorithm>
#include <locale>
#include <functional>
#include "c_locale.h"
_STLP_BEGIN_NAMESPACE
//----------------------------------------------------------------------
// ctype<char>
// The classic table: static data members.
#if !defined(_STLP_STATIC_CONST_INIT_BUG) && !(defined(__MRC__) || defined(__SC__))
//*TY 02/25/2000 - added workaround for MPW compilers; they confuse on in-class static const
const size_t ctype<char>::table_size;
#endif
// This macro is specifically for platforms where isprint() relies
// on separate flag
#define PRINTFLAG ctype_base::mask( _Locale_PRINT & ~(_Locale_UPPER | _Locale_LOWER | _Locale_ALPHA | _Locale_DIGIT | _Locale_PUNCT | _Locale_SPACE | _Locale_XDIGIT ))
const ctype_base::mask*
ctype<char>::classic_table() _STLP_NOTHROW {
/* Ctype table for the ASCII character set.
* There are 257 entries in this table. The first is EOF (-1).
* That is, the "table" seen by ctype<char> member functions is
* _S_classic_table + 1.
*/
/* The following static assert check that alpha is not defined as upper | lower.
* STLport flags character like 'a' with alpha | lower, if alpha is badly configure
* then 'a' will also be seen as upper which is wrong.
*/
#if !defined (__MWERKS__) && !defined(ANDROID)
/* CodeWarrior 8 don't understabd this */
_STLP_STATIC_ASSERT((alpha & (lower | upper)) == 0)
#endif
static const ctype_base::mask _S_classic_table[table_size] =
{
cntrl /* null */,
cntrl /* ^A */,
cntrl /* ^B */,
cntrl /* ^C */,
cntrl /* ^D */,
cntrl /* ^E */,
cntrl /* ^F */,
cntrl /* ^G */,
cntrl /* ^H */,
ctype_base::mask(space | cntrl) /* tab */,
ctype_base::mask(space | cntrl) /* LF */,
ctype_base::mask(space | cntrl) /* ^K */,
ctype_base::mask(space | cntrl) /* FF */,
ctype_base::mask(space | cntrl) /* ^M */,
cntrl /* ^N */,
cntrl /* ^O */,
cntrl /* ^P */,
cntrl /* ^Q */,
cntrl /* ^R */,
cntrl /* ^S */,
cntrl /* ^T */,
cntrl /* ^U */,
cntrl /* ^V */,
cntrl /* ^W */,
cntrl /* ^X */,
cntrl /* ^Y */,
cntrl /* ^Z */,
cntrl /* esc */,
cntrl /* ^\ */,
cntrl /* ^] */,
cntrl /* ^^ */,
cntrl /* ^_ */,
ctype_base::mask (space | PRINTFLAG) /* */,
ctype_base::mask (punct | PRINTFLAG ) /* ! */,
ctype_base::mask (punct | PRINTFLAG ) /* " */,
ctype_base::mask (punct | PRINTFLAG ) /* # */,
ctype_base::mask (punct | PRINTFLAG ) /* $ */,
ctype_base::mask (punct | PRINTFLAG ) /* % */,
ctype_base::mask (punct | PRINTFLAG ) /* & */,
ctype_base::mask (punct | PRINTFLAG ) /* ' */,
ctype_base::mask (punct | PRINTFLAG ) /* ( */,
ctype_base::mask (punct | PRINTFLAG ) /* ) */,
ctype_base::mask (punct | PRINTFLAG ) /* * */,
ctype_base::mask (punct | PRINTFLAG ) /* + */,
ctype_base::mask (punct | PRINTFLAG ) /* , */,
ctype_base::mask (punct | PRINTFLAG ) /* - */,
ctype_base::mask (punct | PRINTFLAG ) /* . */,
ctype_base::mask (punct | PRINTFLAG ) /* / */,
ctype_base::mask(digit | PRINTFLAG | xdigit) /* 0 */,
ctype_base::mask(digit | PRINTFLAG | xdigit) /* 1 */,
ctype_base::mask(digit | PRINTFLAG | xdigit) /* 2 */,
ctype_base::mask(digit | PRINTFLAG | xdigit) /* 3 */,
ctype_base::mask(digit | PRINTFLAG | xdigit) /* 4 */,
ctype_base::mask(digit | PRINTFLAG | xdigit) /* 5 */,
ctype_base::mask(digit | PRINTFLAG | xdigit) /* 6 */,
ctype_base::mask(digit | PRINTFLAG | xdigit) /* 7 */,
ctype_base::mask(digit | PRINTFLAG | xdigit) /* 8 */,
ctype_base::mask(digit | PRINTFLAG | xdigit) /* 9 */,
ctype_base::mask (punct | PRINTFLAG ) /* : */,
ctype_base::mask (punct | PRINTFLAG ) /* ; */,
ctype_base::mask (punct | PRINTFLAG ) /* < */,
ctype_base::mask (punct | PRINTFLAG ) /* = */,
ctype_base::mask (punct | PRINTFLAG ) /* > */,
ctype_base::mask (punct | PRINTFLAG ) /* ? */,
ctype_base::mask (punct | PRINTFLAG ) /* ! */,
ctype_base::mask(alpha | PRINTFLAG | upper | xdigit) /* A */,
ctype_base::mask(alpha | PRINTFLAG | upper | xdigit) /* B */,
ctype_base::mask(alpha | PRINTFLAG | upper | xdigit) /* C */,
ctype_base::mask(alpha | PRINTFLAG | upper | xdigit) /* D */,
ctype_base::mask(alpha | PRINTFLAG | upper | xdigit) /* E */,
ctype_base::mask(alpha | PRINTFLAG | upper | xdigit) /* F */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* G */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* H */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* I */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* J */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* K */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* L */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* M */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* N */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* O */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* P */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* Q */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* R */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* S */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* T */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* U */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* V */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* W */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* X */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* Y */,
ctype_base::mask(alpha | PRINTFLAG | upper) /* Z */,
ctype_base::mask (punct | PRINTFLAG ) /* [ */,
ctype_base::mask (punct | PRINTFLAG ) /* \ */,
ctype_base::mask (punct | PRINTFLAG ) /* ] */,
ctype_base::mask (punct | PRINTFLAG ) /* ^ */,
ctype_base::mask (punct | PRINTFLAG ) /* _ */,
ctype_base::mask (punct | PRINTFLAG ) /* ` */,
ctype_base::mask(alpha | PRINTFLAG | lower | xdigit) /* a */,
ctype_base::mask(alpha | PRINTFLAG | lower | xdigit) /* b */,
ctype_base::mask(alpha | PRINTFLAG | lower | xdigit) /* c */,
ctype_base::mask(alpha | PRINTFLAG | lower | xdigit) /* d */,
ctype_base::mask(alpha | PRINTFLAG | lower | xdigit) /* e */,
ctype_base::mask(alpha | PRINTFLAG | lower | xdigit) /* f */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* g */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* h */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* i */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* j */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* k */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* l */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* m */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* n */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* o */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* p */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* q */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* r */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* s */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* t */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* u */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* v */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* w */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* x */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* y */,
ctype_base::mask(alpha | PRINTFLAG | lower) /* x */,
ctype_base::mask (punct | PRINTFLAG ) /* { */,
ctype_base::mask (punct | PRINTFLAG ) /* | */,
ctype_base::mask (punct | PRINTFLAG ) /* } */,
ctype_base::mask (punct | PRINTFLAG ) /* ~ */,
cntrl /* del (0x7f)*/,
/* ASCII is a 7-bit code, so everything else is non-ASCII */
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0)
};
return _S_classic_table;
}
// For every c in the range 0 <= c < 256, _S_upper[c] is the
// uppercased version of c and _S_lower[c] is the lowercased
// version. As before, these two tables assume the ASCII character
// set.
const unsigned char _S_upper[ctype<char>::table_size] =
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
};
const unsigned char _S_lower[ctype<char>::table_size] =
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
};
//An helper struct to check wchar_t index without generating warnings
//under some compilers (gcc) because of a limited range of value
//(when wchar_t is unsigned)
template <bool _IsSigned>
struct _WCharIndexT;
#if !defined (__BORLANDC__) && \
!(defined (__GNUC__) && (defined (__MINGW32__) || defined (__CYGWIN__))) && \
!defined (__ICL)
_STLP_TEMPLATE_NULL
struct _WCharIndexT<true> {
static bool in_range(wchar_t c, size_t upperBound) {
return c >= 0 && size_t(c) < upperBound;
}
};
#endif
_STLP_TEMPLATE_NULL
struct _WCharIndexT<false> {
static bool in_range(wchar_t c, size_t upperBound) {
return size_t(c) < upperBound;
}
};
typedef _WCharIndexT<wchar_t(-1) < 0> _WCharIndex;
// Some helper functions used in ctype<>::scan_is and scan_is_not.
struct _Ctype_is_mask {
typedef char argument_type;
typedef bool result_type;
ctype_base::mask _Mask;
const ctype_base::mask* _M_table;
_Ctype_is_mask(ctype_base::mask __m, const ctype_base::mask* __t) : _Mask(__m), _M_table(__t) {}
bool operator()(char __c) const { return (_M_table[(unsigned char) __c] & _Mask) != 0; }
};
struct _Ctype_not_mask {
typedef char argument_type;
typedef bool result_type;
ctype_base::mask _Mask;
const ctype_base::mask* _M_table;
_Ctype_not_mask(ctype_base::mask __m, const ctype_base::mask* __t) : _Mask(__m), _M_table(__t) {}
bool operator()(char __c) const { return (_M_table[(unsigned char) __c] & _Mask) == 0; }
};
ctype<char>::ctype(const ctype_base::mask * __tab, bool __del, size_t __refs) :
locale::facet(__refs),
_M_ctype_table(__tab ? __tab : classic_table()),
_M_delete(__tab && __del)
{}
ctype<char>::~ctype() {
if (_M_delete)
delete[] __CONST_CAST(ctype_base::mask *, _M_ctype_table);
}
const char*
ctype<char>::scan_is(ctype_base::mask __m, const char* __low, const char* __high) const {
return _STLP_STD::find_if(__low, __high, _Ctype_is_mask(__m, _M_ctype_table));
}
const char*
ctype<char>::scan_not(ctype_base::mask __m, const char* __low, const char* __high) const {
return _STLP_STD::find_if(__low, __high, _Ctype_not_mask(__m, _M_ctype_table));
}
char ctype<char>::do_toupper(char __c) const
{ return (char) _S_upper[(unsigned char) __c]; }
char ctype<char>::do_tolower(char __c) const
{ return (char) _S_lower[(unsigned char) __c]; }
const char* ctype<char>::do_toupper(char* __low, const char* __high) const {
for ( ; __low < __high; ++__low)
*__low = (char) _S_upper[(unsigned char) *__low];
return __high;
}
const char* ctype<char>::do_tolower(char* __low, const char* __high) const {
for ( ; __low < __high; ++__low)
*__low = (char) _S_lower[(unsigned char) *__low];
return __high;
}
char
ctype<char>::do_widen(char __c) const { return __c; }
const char*
ctype<char>::do_widen(const char* __low, const char* __high,
char* __to) const {
_STLP_PRIV __copy_trivial(__low, __high, __to);
return __high;
}
char
ctype<char>::do_narrow(char __c, char /* dfault */ ) const { return __c; }
const char*
ctype<char>::do_narrow(const char* __low, const char* __high,
char /* dfault */, char* __to) const {
_STLP_PRIV __copy_trivial(__low, __high, __to);
return __high;
}
#if !defined (_STLP_NO_WCHAR_T)
struct _Ctype_w_is_mask {
typedef wchar_t argument_type;
typedef bool result_type;
ctype_base::mask M;
const ctype_base::mask* table;
_Ctype_w_is_mask(ctype_base::mask m, const ctype_base::mask* t)
: M(m), table(t) {}
bool operator()(wchar_t c) const {
return _WCharIndex::in_range(c, ctype<char>::table_size) && (table[c] & M);
}
};
//----------------------------------------------------------------------
// ctype<wchar_t>
ctype<wchar_t>::~ctype() {}
bool ctype<wchar_t>::do_is(ctype_base::mask m, wchar_t c) const {
const ctype_base::mask * table = ctype<char>::classic_table();
return _WCharIndex::in_range(c, ctype<char>::table_size) && (m & table[c]);
}
const wchar_t* ctype<wchar_t>::do_is(const wchar_t* low, const wchar_t* high,
ctype_base::mask * vec) const {
// boris : not clear if this is the right thing to do...
const ctype_base::mask * table = ctype<char>::classic_table();
for ( ; low < high; ++low, ++vec) {
wchar_t c = *low;
*vec = _WCharIndex::in_range(c, ctype<char>::table_size) ? table[c] : ctype_base::mask(0);
}
return high;
}
const wchar_t*
ctype<wchar_t>::do_scan_is(ctype_base::mask m,
const wchar_t* low, const wchar_t* high) const {
return find_if(low, high, _Ctype_w_is_mask(m, ctype<char>::classic_table()));
}
const wchar_t*
ctype<wchar_t>::do_scan_not(ctype_base::mask m,
const wchar_t* low, const wchar_t* high) const {
return find_if(low, high, not1(_Ctype_w_is_mask(m, ctype<char>::classic_table())));
}
wchar_t ctype<wchar_t>::do_toupper(wchar_t c) const {
return _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_upper[c]
: c;
}
const wchar_t*
ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const {
for ( ; low < high; ++low) {
wchar_t c = *low;
*low = _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_upper[c]
: c;
}
return high;
}
wchar_t ctype<wchar_t>::do_tolower(wchar_t c) const {
return _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_lower[c]
: c;
}
const wchar_t*
ctype<wchar_t>::do_tolower(wchar_t* low, const wchar_t* high) const {
for ( ; low < high; ++low) {
wchar_t c = *low;
*low = _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_lower[c]
: c;
}
return high;
}
wchar_t ctype<wchar_t>::do_widen(char c) const {
return (wchar_t)(unsigned char)c;
}
const char*
ctype<wchar_t>::do_widen(const char* low, const char* high,
wchar_t* dest) const {
while (low != high)
*dest++ = (wchar_t)(unsigned char)*low++;
return high;
}
char ctype<wchar_t>::do_narrow(wchar_t c, char dfault) const {
return (unsigned char) c == c ? c : dfault;
}
const wchar_t* ctype<wchar_t>::do_narrow(const wchar_t* low,
const wchar_t* high,
char dfault, char* dest) const {
while (low != high) {
wchar_t c = *low++;
*dest++ = (unsigned char) c == c ? c : dfault;
}
return high;
}
# endif
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,182 +0,0 @@
#include "stlport_prefix.h"
#if defined(__unix) && defined(__GNUC__)
#ifdef __FreeBSD__
# include <osreldate.h>
#endif
#if (defined(__FreeBSD__) && (__FreeBSD_version < 503001)) || defined(__sun)
/* Note: __cxa_finalize and __cxa_atexit present in libc in FreeBSD 5.3, but again absent in 6.0 */
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@" "STLPORT_5_0_0"); */
/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@@" "STLPORT_5_0_0"); */
/* Not atomic! */
/* But we can use static mutexes here: I hope that performance issue isn't very
significant on unloading (for only few calls, ~10) - ptr */
/*
#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
({ __typeof (mem) __gmemp = (mem); \
__typeof (*mem) __gnewval = (newval); \
\
*__gmemp == (oldval) ? (*__gmemp = __gnewval, 0) : 1; })
*/
enum {
ef_free, /* `ef_free' MUST be zero! */
ef_us,
ef_on,
ef_at,
ef_cxa
};
struct exit_function
{
/* `flavour' should be of type of the `enum' above but since we need
this element in an atomic operation we have to use `long int'. */
long int flavor;
union {
void (*at)(void);
struct {
void (*fn)(int status, void *arg);
void *arg;
} on;
struct {
void (*fn)(void *arg, int status);
void *arg;
void *dso_handle;
} cxa;
} func;
};
struct exit_function_list
{
struct exit_function_list *next;
size_t idx;
struct exit_function fns[32];
};
struct exit_function *__new_exitfn (void);
/* Register a function to be called by exit or when a shared library
is unloaded. This function is only called from code generated by
the C++ compiler. */
int __cxa_atexit(void (*func)(void *), void *arg, void *d)
{
struct exit_function *new = __new_exitfn ();
if ( new == NULL )
return -1;
new->flavor = ef_cxa;
new->func.cxa.fn = (void (*) (void *, int)) func;
new->func.cxa.arg = arg;
new->func.cxa.dso_handle = d;
return 0;
}
/* We change global data, so we need locking. */
#ifdef __linux__
static pthread_mutex_t lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
#endif
#ifdef __FreeBSD__
static pthread_mutex_t lock =
{ PTHREAD_MUTEX_RECURSIVE /* PTHREAD_MUTEX_DEFAULT */, PTHREAD_PRIO_NONE, {NULL,NULL},
NULL, { NULL }, /* MUTEX_FLAGS_PRIVATE */ 0x1, 0, 0, 0, {NULL, NULL},
{ 0, 0, 0, 0 } };
#endif
#ifdef __sun
static pthread_mutex_t lock =
{{0, 0, 0, PTHREAD_MUTEX_RECURSIVE, _MUTEX_MAGIC}, {{{0}}}, 0};
#endif
static struct exit_function_list initial;
struct exit_function_list *__exit_funcs = &initial;
struct exit_function *__new_exitfn(void)
{
struct exit_function_list *l;
size_t i = 0;
pthread_mutex_lock( &lock );
for (l = __exit_funcs; l != NULL; l = l->next) {
for (i = 0; i < l->idx; ++i)
if (l->fns[i].flavor == ef_free)
break;
if ( i < l->idx )
break;
if (l->idx < sizeof (l->fns) / sizeof (l->fns[0])) {
i = l->idx++;
break;
}
}
if (l == NULL) {
l = (struct exit_function_list *)malloc( sizeof(struct exit_function_list) );
if (l != NULL) {
l->next = __exit_funcs;
__exit_funcs = l;
l->idx = 1;
i = 0;
}
}
/* Mark entry as used, but we don't know the flavor now. */
if ( l != NULL )
l->fns[i].flavor = ef_us;
pthread_mutex_unlock( &lock );
return l == NULL ? NULL : &l->fns[i];
}
/* If D is non-NULL, call all functions registered with `__cxa_atexit'
with the same dso handle. Otherwise, if D is NULL, call all of the
registered handlers. */
/*
* Note, that original __cxa_finalize don't use lock, but use __exit_funcs
* i.e. global data.
*/
void __cxa_finalize(void *d)
{
struct exit_function_list *funcs;
pthread_mutex_lock( &lock );
for (funcs = __exit_funcs; funcs; funcs = funcs->next) {
struct exit_function *f;
for (f = &funcs->fns[funcs->idx - 1]; f >= &funcs->fns[0]; --f) {
if ( (d == NULL || d == f->func.cxa.dso_handle) && (f->flavor == ef_cxa) ) {
f->flavor = ef_free;
(*f->func.cxa.fn) (f->func.cxa.arg, 0);
}
}
}
/* Remove the registered fork handlers. We do not have to
unregister anything if the program is going to terminate anyway. */
#ifdef UNREGISTER_ATFORK
if (d != NULL)
UNREGISTER_ATFORK (d);
#endif
pthread_mutex_unlock( &lock );
}
/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@@" "STLPORT_5_0_0"); */
/* void __cxa_finalize(void *d) __attribute__ ((weak)); */
#endif /* OS name */
#endif /* __unix */

View File

@@ -1,313 +0,0 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#define __PUT_STATIC_DATA_MEMBERS_HERE
#define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
#include "stlport_prefix.h"
#if !defined (_STLP_DEBUG) && ! defined (_STLP_ASSERTIONS)
# if !defined (__APPLE__) || !defined (__GNUC__) || (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
/* dums: Please if the following code was being uncommented please explain why
* as for the moment it only looks like a source of inconsistency in the way
* STLport different translation units are compiled.
*/
//# define _STLP_ASSERTIONS 1
# endif
#endif
#include <utility>
#include <memory>
#include <vector>
#include <set>
#include <list>
#include <slist>
#include <deque>
#include <hash_map>
#include <limits>
#include <string>
#include <stdexcept>
#include <bitset>
#include <locale>
#if (_STLP_STATIC_TEMPLATE_DATA < 1) || defined (__DMC__)
// for rope static members
# include <rope>
#endif
// boris : this piece of code duplicated from _range_errors.h
#undef _STLP_THROW_MSG
#if defined(_STLP_THROW_RANGE_ERRORS)
# ifndef _STLP_STDEXCEPT
# include <stdexcept>
# endif
# ifndef _STLP_STRING
# include <string>
# endif
# define _STLP_THROW_MSG(ex,msg) throw ex(string(msg))
#else
# if defined (_STLP_RTTI_BUG)
# define _STLP_THROW_MSG(ex,msg) TerminateProcess(GetCurrentProcess(), 0)
# else
# include <cstdlib>
# include <cstdio>
# define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT()
# endif
#endif
#if defined (_STLP_MSVC) && (_STLP_MSVC < 1310)
# pragma optimize("g", off)
#endif
_STLP_BEGIN_NAMESPACE
void _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg)
{ _STLP_THROW_MSG(runtime_error, __msg); }
void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg)
{ _STLP_THROW_MSG(range_error, __msg); }
void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg)
{ _STLP_THROW_MSG(out_of_range, __msg); }
void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg)
{ _STLP_THROW_MSG(length_error, __msg); }
void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg)
{ _STLP_THROW_MSG(invalid_argument, __msg); }
void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg)
{ _STLP_THROW_MSG(overflow_error, __msg); }
#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
exception::exception() _STLP_NOTHROW {}
exception::~exception() _STLP_NOTHROW {}
bad_exception::bad_exception() _STLP_NOTHROW {}
bad_exception::~bad_exception() _STLP_NOTHROW {}
const char* exception::what() const _STLP_NOTHROW { return "class exception"; }
const char* bad_exception::what() const _STLP_NOTHROW { return "class bad_exception"; }
#endif
#if defined (_STLP_OWN_STDEXCEPT)
__Named_exception::__Named_exception(const string& __str) {
#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
strncpy(_M_name, __str.c_str(), _S_bufsize);
_M_name[_S_bufsize - 1] = '\0';
#else
strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), __str.c_str(), _TRUNCATE);
#endif
}
const char* __Named_exception::what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
// boris : those are needed to force typeinfo nodes to be created in here only
__Named_exception::~__Named_exception() _STLP_NOTHROW_INHERENTLY {}
logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {}
runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {}
domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {}
invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {}
length_error::~length_error() _STLP_NOTHROW_INHERENTLY {}
out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {}
range_error::~range_error() _STLP_NOTHROW_INHERENTLY {}
overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {}
underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {}
#endif /* _STLP_OWN_STDEXCEPT */
#if !defined(_STLP_WCE_EVC3)
# if defined (_STLP_NO_BAD_ALLOC)
const nothrow_t nothrow /* = {} */;
# endif
#endif
#if !defined (_STLP_NO_FORCE_INSTANTIATE)
# if defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS)
_STLP_MOVE_TO_PRIV_NAMESPACE
template struct _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>;
_STLP_MOVE_TO_STD_NAMESPACE
# endif
template class _STLP_CLASS_DECLSPEC __debug_alloc<__node_alloc>;
template class _STLP_CLASS_DECLSPEC __debug_alloc<__new_alloc>;
//Export of the types used to represent buckets in the hashtable implementation.
/*
* For the vector class we do not use any MSVC6 workaround even if we export it from
* the STLport dynamic libraries because we know what methods are called and none is
* a template method. Moreover the exported class is an instanciation of vector with
* _Slist_node_base struct that is an internal STLport class that no user should ever
* use.
*/
# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
template class _STLP_CLASS_DECLSPEC allocator<_STLP_PRIV _Slist_node_base*>;
_STLP_MOVE_TO_PRIV_NAMESPACE
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
allocator<_Slist_node_base*> >;
template class _STLP_CLASS_DECLSPEC _Vector_base<_Slist_node_base*,
allocator<_Slist_node_base*> >;
_STLP_MOVE_TO_STD_NAMESPACE
# endif
# if defined (_STLP_DEBUG)
_STLP_MOVE_TO_PRIV_NAMESPACE
template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_NAME(vector)<_Slist_node_base*,
allocator<_Slist_node_base*> >;
_STLP_MOVE_TO_STD_NAMESPACE
# endif
template class _STLP_CLASS_DECLSPEC vector<_STLP_PRIV _Slist_node_base*,
allocator<_STLP_PRIV _Slist_node_base*> >;
//End of hashtable bucket types export.
//Export of _Locale_impl facets container:
# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
template class _STLP_CLASS_DECLSPEC allocator<locale::facet*>;
_STLP_MOVE_TO_PRIV_NAMESPACE
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
template class _STLP_CLASS_DECLSPEC _Vector_base<locale::facet*, allocator<locale::facet*> >;
_STLP_MOVE_TO_STD_NAMESPACE
# endif
# if defined (_STLP_DEBUG)
_STLP_MOVE_TO_PRIV_NAMESPACE
# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
template class _STLP_CLASS_DECLSPEC __construct_checker<_STLP_PRIV _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
# undef _STLP_NON_DBG_VECTOR
_STLP_MOVE_TO_STD_NAMESPACE
# endif
template class _STLP_CLASS_DECLSPEC vector<locale::facet*, allocator<locale::facet*> >;
//End of export of _Locale_impl facets container.
# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
template class _STLP_CLASS_DECLSPEC allocator<void*>;
typedef _STLP_PRIV _List_node<void*> _VoidPtr_Node;
template class _STLP_CLASS_DECLSPEC allocator<_VoidPtr_Node>;
_STLP_MOVE_TO_PRIV_NAMESPACE
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void**, void*, allocator<void*> >;
template class _STLP_CLASS_DECLSPEC _Vector_base<void*, allocator<void*> >;
template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(vector)<void*, allocator<void*> >;
template class _STLP_CLASS_DECLSPEC _List_node<void*>;
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_List_node_base, _VoidPtr_Node, allocator<_VoidPtr_Node> >;
template class _STLP_CLASS_DECLSPEC _List_base<void*, allocator<void*> >;
template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(list)<void*, allocator<void*> >;
template class _STLP_CLASS_DECLSPEC _Slist_node<void*>;
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base, _Slist_node<void*>, allocator<_Slist_node<void*> > >;
template class _STLP_CLASS_DECLSPEC _Slist_base<void*, allocator<void*> >;
template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(slist)<void*, allocator<void*> >;
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void***, void**, allocator<void**> >;
template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
template class _STLP_CLASS_DECLSPEC _Deque_base<void*, allocator<void*> >;
template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(deque)<void*, allocator<void*> >;
_STLP_MOVE_TO_STD_NAMESPACE
# endif /* _STLP_USE_PTR_SPECIALIZATIONS */
_STLP_MOVE_TO_PRIV_NAMESPACE
template class _STLP_CLASS_DECLSPEC _Rb_global<bool>;
template class _STLP_CLASS_DECLSPEC _List_global<bool>;
template class _STLP_CLASS_DECLSPEC _Sl_global<bool>;
template class _STLP_CLASS_DECLSPEC _Stl_prime<bool>;
template class _STLP_CLASS_DECLSPEC _LimG<bool>;
_STLP_MOVE_TO_STD_NAMESPACE
#endif /* _STLP_NO_FORCE_INSTANTIATE */
_STLP_END_NAMESPACE
#define FORCE_SYMBOL extern
#if defined (_WIN32) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_USE_STATIC_LIB)
// stlportmt.cpp : Defines the entry point for the DLL application.
//
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef FORCE_SYMBOL
# define FORCE_SYMBOL APIENTRY
extern "C" {
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls((HINSTANCE)hModule);
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
} /* extern "C" */
#if !defined (_STLP_MSVC) && !defined (__MINGW32__)
_STLP_BEGIN_NAMESPACE
static void FORCE_SYMBOL
force_link() {
set<int>::iterator iter;
// _M_increment; _M_decrement instantiation
++iter;
--iter;
}
_STLP_END_NAMESPACE
#endif
#endif /* _WIN32 */
#if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
# undef std
namespace std
{
void _STLP_CALL unexpected() {
unexpected_handler hdl;
set_unexpected(hdl = set_unexpected((unexpected_handler)0));
hdl();
}
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,33 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef FSTREAM_IMPL_H
#define FSTREAM_IMPL_H
#include "_stdio_file.h"
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
bool __is_regular_file(_STLP_fd fd);
streamoff __file_size(_STLP_fd fd);
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
#endif /* FSTREAM_IMPL_H */

View File

@@ -1,324 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <algorithm>
#include <ios>
#include <locale>
#include <ostream> // for __get_ostreambuf definition
#include "aligned_buffer.h"
_STLP_BEGIN_NAMESPACE
//----------------------------------------------------------------------
// ios_base members
// class ios_base::failure, a subclass of exception. It's used solely
// for reporting errors.
ios_base::failure::failure(const string& s)
: __Named_exception(s)
{}
ios_base::failure::~failure() _STLP_NOTHROW_INHERENTLY {}
#if !defined (_STLP_STATIC_CONST_INIT_BUG)
// Definitions of ios_base's formatting flags.
const ios_base::fmtflags ios_base::left;
const ios_base::fmtflags ios_base::right;
const ios_base::fmtflags ios_base::internal;
const ios_base::fmtflags ios_base::dec;
const ios_base::fmtflags ios_base::hex;
const ios_base::fmtflags ios_base::oct;
const ios_base::fmtflags ios_base::fixed;
const ios_base::fmtflags ios_base::scientific;
const ios_base::fmtflags ios_base::boolalpha;
const ios_base::fmtflags ios_base::showbase;
const ios_base::fmtflags ios_base::showpoint;
const ios_base::fmtflags ios_base::showpos;
const ios_base::fmtflags ios_base::skipws;
const ios_base::fmtflags ios_base::unitbuf;
const ios_base::fmtflags ios_base::uppercase;
const ios_base::fmtflags ios_base::adjustfield;
const ios_base::fmtflags ios_base::basefield;
const ios_base::fmtflags ios_base::floatfield;
// Definitions of ios_base's state flags.
const ios_base::iostate ios_base::goodbit;
const ios_base::iostate ios_base::badbit;
const ios_base::iostate ios_base::eofbit;
const ios_base::iostate ios_base::failbit;
// Definitions of ios_base's openmode flags.
const ios_base::openmode ios_base::app;
const ios_base::openmode ios_base::ate;
const ios_base::openmode ios_base::binary;
const ios_base::openmode ios_base::in;
const ios_base::openmode ios_base::out;
const ios_base::openmode ios_base::trunc;
// Definitions of ios_base's seekdir flags.
const ios_base::seekdir ios_base::beg;
const ios_base::seekdir ios_base::cur;
const ios_base::seekdir ios_base::end;
#endif /* _STLP_STATIC_CONST_INIT_BUG */
// Internal functions used for managing exponentially-growing arrays of
// POD types.
// array is a pointer to N elements of type PODType. Expands the array,
// if necessary, so that array[index] is meaningful. All new elements are
// initialized to zero. Returns a pointer to the new array, and the new
// size.
template <class PODType>
static pair<PODType*, size_t>
_Stl_expand_array(PODType* __array, size_t N, int index) {
if ((int)N < index + 1) {
size_t new_N = (max)(2 * N, size_t(index + 1));
PODType* new_array
= __STATIC_CAST(PODType*,realloc(__array, new_N * sizeof(PODType)));
if (new_array) {
fill(new_array + N, new_array + new_N, PODType());
return pair<PODType*, size_t>(new_array, new_N);
}
else
return pair<PODType*, size_t>(__STATIC_CAST(PODType*,0), 0);
}
else
return pair<PODType*, size_t>(__array, N);
}
// array is a pointer to N elements of type PODType. Allocate a new
// array of N elements, copying the values from the old array to the new.
// Return a pointer to the new array. It is assumed that array is non-null
// and N is nonzero.
template <class PODType>
static PODType* _Stl_copy_array(const PODType* __array, size_t N) {
PODType* result = __STATIC_CAST(PODType*,malloc(N * sizeof(PODType)));
if (result)
copy(__array, __array + N, result);
return result;
}
locale ios_base::imbue(const locale& loc) {
if (loc._M_impl != _M_locale._M_impl) {
locale previous = _M_locale;
_M_locale = loc;
_M_invoke_callbacks(imbue_event);
return previous;
}
else {
_M_invoke_callbacks(imbue_event);
return _M_locale;
}
}
int _STLP_CALL ios_base::xalloc() {
#if defined (_STLP_THREADS) && \
defined (_STLP_WIN32THREADS) && defined (_STLP_NEW_PLATFORM_SDK)
static volatile __stl_atomic_t _S_index = 0;
return _STLP_ATOMIC_INCREMENT(&_S_index);
#else
static int _S_index = 0;
static _STLP_STATIC_MUTEX __lock _STLP_MUTEX_INITIALIZER;
_STLP_auto_lock sentry(__lock);
return _S_index++;
#endif
}
long& ios_base::iword(int index) {
static long dummy = 0;
pair<long*, size_t> tmp = _Stl_expand_array(_M_iwords, _M_num_iwords, index);
if (tmp.first) { // The allocation, if any, succeeded.
_M_iwords = tmp.first;
_M_num_iwords = tmp.second;
return _M_iwords[index];
}
else {
_M_setstate_nothrow(badbit);
_M_check_exception_mask();
return dummy;
}
}
void*& ios_base::pword(int index) {
static void* dummy = 0;
pair<void**, size_t> tmp = _Stl_expand_array(_M_pwords, _M_num_pwords, index);
if (tmp.first) { // The allocation, if any, succeeded.
_M_pwords = tmp.first;
_M_num_pwords = tmp.second;
return _M_pwords[index];
}
else {
_M_setstate_nothrow(badbit);
_M_check_exception_mask();
return dummy;
}
}
void ios_base::register_callback(event_callback __fn, int index) {
pair<pair<event_callback, int>*, size_t> tmp
= _Stl_expand_array(_M_callbacks, _M_num_callbacks, (int)_M_callback_index /* fbp: index ??? */ );
if (tmp.first) {
_M_callbacks = tmp.first;
_M_num_callbacks = tmp.second;
_M_callbacks[_M_callback_index++] = make_pair(__fn, index);
}
else {
_M_setstate_nothrow(badbit);
_M_check_exception_mask();
}
}
// Invokes all currently registered callbacks for a particular event.
// Behaves correctly even if one of the callbacks adds a new callback.
void ios_base::_M_invoke_callbacks(event E) {
for (size_t i = _M_callback_index; i > 0; --i) {
event_callback f = _M_callbacks[i-1].first;
int n = _M_callbacks[i-1].second;
f(E, *this, n);
}
}
// This function is called if the state, rdstate(), has a bit set
// that is also set in the exception mask exceptions().
void ios_base::_M_throw_failure() {
const char* arg ;
# if 0
char buffer[256];
char* ptr;
strcpy(buffer, "ios failure: rdstate = 0x");
ptr = __write_integer(buffer+strlen(buffer), ios_base::hex, __STATIC_CAST(unsigned long,_M_iostate));
strcpy(ptr, " mask = 0x");
ptr = __write_integer(buffer+strlen(buffer), ios_base::hex, __STATIC_CAST(unsigned long,_M_exception_mask));
*ptr = 0;
arg = buffer;
# else
arg = "ios failure";
# endif
# ifndef _STLP_USE_EXCEPTIONS
fputs(arg, stderr);
# else
throw failure(arg);
# endif
}
// Copy x's state to *this. This member function is used in the
// implementation of basic_ios::copyfmt. Does not copy _M_exception_mask
// or _M_iostate.
void ios_base::_M_copy_state(const ios_base& x) {
_M_fmtflags = x._M_fmtflags; // Copy the flags, except for _M_iostate
_M_openmode = x._M_openmode; // and _M_exception_mask.
_M_seekdir = x._M_seekdir;
_M_precision = x._M_precision;
_M_width = x._M_width;
if (_M_locale != x._M_locale) {
_M_locale = x._M_locale;
_M_cached_ctype = x._M_cached_ctype;
_M_cached_numpunct = x._M_cached_numpunct;
}
if (x._M_callbacks) {
pair<event_callback, int>* tmp = _Stl_copy_array(x._M_callbacks, x._M_callback_index);
if (tmp) {
free(_M_callbacks);
_M_callbacks = tmp;
_M_num_callbacks = _M_callback_index = x._M_callback_index;
}
else {
_M_setstate_nothrow(badbit);
_M_check_exception_mask();
}
}
if (x._M_iwords) {
long* tmp = _Stl_copy_array(x._M_iwords, x._M_num_iwords);
if (tmp) {
free(_M_iwords);
_M_iwords = tmp;
_M_num_iwords = x._M_num_iwords;
}
else {
_M_setstate_nothrow(badbit);
_M_check_exception_mask();
}
}
if (x._M_pwords) {
void** tmp = _Stl_copy_array(x._M_pwords, x._M_num_pwords);
if (tmp) {
free(_M_pwords);
_M_pwords = tmp;
_M_num_pwords = x._M_num_pwords;
}
else {
_M_setstate_nothrow(badbit);
_M_check_exception_mask();
}
}
}
// ios's (protected) default constructor. The standard says that all
// fields have indeterminate values; we initialize them to zero for
// simplicity. The only thing that really matters is that the arrays
// are all initially null pointers, and the array element counts are all
// initially zero.
ios_base::ios_base()
: _M_fmtflags(0), _M_iostate(0), _M_openmode(0), _M_seekdir(0),
_M_exception_mask(0),
_M_precision(0), _M_width(0),
_M_locale(),
_M_callbacks(0), _M_num_callbacks(0), _M_callback_index(0),
_M_iwords(0), _M_num_iwords(0),
_M_pwords(0),
_M_num_pwords(0) , _M_cached_ctype(0), _M_cached_numpunct(0)
{}
// ios's destructor.
ios_base::~ios_base() {
_M_invoke_callbacks(erase_event);
free(_M_callbacks);
free(_M_iwords);
free(_M_pwords);
}
//----------------------------------------------------------------------
// Force instantiation of basic_ios
// For DLL exports, they are already instantiated.
#if !defined(_STLP_NO_FORCE_INSTANTIATE)
template class _STLP_CLASS_DECLSPEC basic_ios<char, char_traits<char> >;
# if !defined (_STLP_NO_WCHAR_T)
template class _STLP_CLASS_DECLSPEC basic_ios<wchar_t, char_traits<wchar_t> >;
# endif /* _STLP_NO_WCHAR_T */
#endif
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,538 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <istream>
#include <fstream>
#if defined (_STLP_MSVC) || defined (__MWERKS__) || defined (__ICL) || defined (__ISCPP__)
# define _STLP_USE_NOT_INIT_SEGMENT
# include <iostream>
#endif
#include "stdio_streambuf.h"
#include "aligned_buffer.h"
#include "_stdio_file.h"
#include "c_locale.h"
// boris : note this is repeated in <iostream>
#ifndef _STLP_USE_NAMESPACES
// in case of SGI iostreams, we have to rename our streams not to clash with those
// provided in native lib
# define cin _STLP_cin
# define cout _STLP_cout
# define cerr _STLP_cerr
# define clog _STLP_clog
#endif
_STLP_BEGIN_NAMESPACE
#if defined (__BORLANDC__) && ! defined (_STLP_USE_GLIBC)
using _STLP_VENDOR_CSTD::_streams;
#endif
// This file handles iostream initialization. It is inherently
// nonportable, since the C++ language definition provides no mechanism
// for controlling order of initialization of nonlocal objects.
// Initialization has three parts, which must be performed in the following
// order:
// (1) Initialize the locale system
// (2) Call the constructors for the eight global stream objects.
// (3) Create streambufs for the global stream objects, and initialize
// the stream objects by calling the init() member function.
#if defined (ANDROID_NO_COUT)
#include <android/log.h>
/* Outputting anything to cout/cerr WILL CRASH YOUR PROGRAM on specific devices -
x5a/x6d Android 2.1 tablet, and some other tablets,
however the same code runs on my HTC Evo without problem.
So I've just disabled cin/cout/cerr altogether.
*/
long ios_base::Init::_S_count = 0;
// by default, those are synced
bool ios_base::_S_was_synced = true;
ios_base::Init::Init() {
if (_S_count++ == 0) {
_Locale_init();
//ios_base::_S_initialize();
_Filebuf_base::_S_initialize();
}
}
ios_base::Init::~Init() {
if (--_S_count == 0) {
//ios_base::_S_uninitialize();
_Locale_final();
}
}
class _android_debugbuf: public streambuf
{
public:
_android_debugbuf()
{
pos = 0;
buf[0] = 0;
}
protected:
virtual int overflow(int c = EOF)
{
if (EOF == c)
{
return '\0'; // returning EOF indicates an error
}
else
{
outputchar(c);
return c;
}
};
// we dont do input so always return EOF
virtual int uflow() {return EOF;}
// we dont do input so always return 0 chars read
virtual int xsgetn(char *, int) {return 0;}
// Calls outputchar() for each character.
virtual int xsputn(const char *s, int n)
{
for (int i = 0; i < n; ++i)
{
outputchar(s[i]);
}
return n;// we always process all of the chars
};
private:
// the buffer
char buf[256];
int pos;
void outputchar(char c)
{
// TODO: mutex
if( pos >= sizeof(buf)-1 || c == '\n' || c == '\r' || c == 0 )
{
buf[pos] = 0;
__android_log_print(ANDROID_LOG_INFO, "libSDL", "%s", buf);
pos = 0;
buf[pos] = 0;
return;
};
buf[pos] = c;
pos++;
};
};
class debugbufinit
{
static unsigned int count;
public:
debugbufinit();
// Our destructor is not virtual. It is important that objects of this class have no
// memory footprint. We will end up with one object of this class per translation
// unit (.cp file). If this class has any virtual member functions then objects of
// this class would have v tables in memory. Since this is not intended to be a
// base class for other class, there is no need to be virtual.
~debugbufinit();
};
static filebuf*
_Stl_create_filebuf(int f, ios_base::openmode mode ) {
basic_filebuf<char, char_traits<char> >* result =
new basic_filebuf<char, char_traits<char> >();
_STLP_TRY {
result->_M_open(f, mode);
}
_STLP_CATCH_ALL {}
if (!result->is_open()) {
delete result;
result = 0;
}
return result;
}
static ios_base::Init _IosInit;
bool _STLP_CALL ios_base::sync_with_stdio(bool sync)
{
}
_STLP_DECLSPEC istream cin(_Stl_create_filebuf(0, ios_base::in));
_STLP_DECLSPEC ostream cout(new _android_debugbuf());
_STLP_DECLSPEC ostream cerr(new _android_debugbuf());
_STLP_DECLSPEC ostream clog(new _android_debugbuf());
#else
#if defined (_STLP_USE_NOT_INIT_SEGMENT)
// Definitions of the eight global I/O objects that are declared in
// <iostream>. For some compilers we use pragmas to put the global I/O
// objects into an initialization segment that will not
// be executed. We then explicitly invoke the constructors
// with placement new in ios_base::_S_initialize()
# if defined (__MWERKS__)
# pragma suppress_init_code on
# else
# pragma init_seg("STLPORT_NO_INIT")
# endif
_STLP_DECLSPEC istream cin(0);
# ifdef _STLP_REDIRECT_STDSTREAMS
_STLP_DECLSPEC ofstream cout;
_STLP_DECLSPEC ofstream cerr;
_STLP_DECLSPEC ofstream clog;
# else
_STLP_DECLSPEC ostream cout(0);
_STLP_DECLSPEC ostream cerr(0);
_STLP_DECLSPEC ostream clog(0);
# endif
# ifndef _STLP_NO_WCHAR_T
_STLP_DECLSPEC wistream wcin(0);
_STLP_DECLSPEC wostream wcout(0);
_STLP_DECLSPEC wostream wcerr(0);
_STLP_DECLSPEC wostream wclog(0);
# endif
# if defined (__MWERKS__)
# pragma suppress_init_code off
# endif
#else
// Definitions of the eight global I/O objects that are declared in
// <iostream>. Disgusting hack: we deliberately define them with the
// wrong types so that the constructors don't get run automatically.
// We need special tricks to make sure that these objects are struct-
// aligned rather than byte-aligned.
// This is not portable. Declaring a variable with different types in
// two translations units is "undefined", according to the C++ standard.
// Most compilers, however, silently accept this instead of diagnosing
// it as an error.
# ifndef __DMC__
_STLP_DECLSPEC _Stl_aligned_buffer<istream> cin;
_STLP_DECLSPEC _Stl_aligned_buffer<ostream> cout;
_STLP_DECLSPEC _Stl_aligned_buffer<ostream> cerr;
_STLP_DECLSPEC _Stl_aligned_buffer<ostream> clog;
# else
_Stl_aligned_buffer<istream> cin;
_Stl_aligned_buffer<ostream> cout;
_Stl_aligned_buffer<ostream> cerr;
_Stl_aligned_buffer<ostream> clog;
# pragma alias("?cin@std@@3V?$basic_istream@std@DV?$char_traits@std@D@1@@1@A", "?cin@std@@3T?$_Stl_aligned_buffer@std@V?$basic_istream@std@DV?$char_traits@std@D@1@@1@@1@A")
# pragma alias("?cout@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?cout@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A")
# pragma alias("?cerr@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?cerr@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A")
# pragma alias("?clog@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?clog@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A")
# endif
# ifndef _STLP_NO_WCHAR_T
# ifndef __DMC__
_STLP_DECLSPEC _Stl_aligned_buffer<wistream> wcin;
_STLP_DECLSPEC _Stl_aligned_buffer<wostream> wcout;
_STLP_DECLSPEC _Stl_aligned_buffer<wostream> wcerr;
_STLP_DECLSPEC _Stl_aligned_buffer<wostream> wclog;
# else
_Stl_aligned_buffer<wistream> wcin;
_Stl_aligned_buffer<wostream> wcout;
_Stl_aligned_buffer<wostream> wcerr;
_Stl_aligned_buffer<wostream> wclog;
# pragma alias("?wcin@std@@3V?$basic_istream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcin@std@@3T?$_Stl_aligned_buffer@std@V?$basic_istream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
# pragma alias("?wcout@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcout@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
# pragma alias("?wcerr@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcerr@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
# pragma alias("?wclog@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wclog@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
# endif
# endif
#endif /* STL_MSVC || __MWERKS__ */
// Member functions from class ios_base and ios_base::Init
long ios_base::Init::_S_count = 0;
// by default, those are synced
bool ios_base::_S_was_synced = true;
ios_base::Init::Init() {
if (_S_count++ == 0) {
_Locale_init();
ios_base::_S_initialize();
_Filebuf_base::_S_initialize();
}
}
ios_base::Init::~Init() {
if (--_S_count == 0) {
ios_base::_S_uninitialize();
_Locale_final();
}
}
static filebuf*
_Stl_create_filebuf(FILE* f, ios_base::openmode mode ) {
basic_filebuf<char, char_traits<char> >* result =
new basic_filebuf<char, char_traits<char> >();
_STLP_TRY {
result->_M_open(_FILE_fd(f), mode);
}
_STLP_CATCH_ALL {}
if (!result->is_open()) {
delete result;
result = 0;
}
return result;
}
#if !defined (_STLP_NO_WCHAR_T)
static wfilebuf*
_Stl_create_wfilebuf(FILE* f, ios_base::openmode mode) {
basic_filebuf<wchar_t, char_traits<wchar_t> >* result =
new basic_filebuf<wchar_t, char_traits<wchar_t> >();
_STLP_TRY {
result->_M_open(_FILE_fd(f), mode);
}
_STLP_CATCH_ALL {}
if (!result->is_open()) {
delete result;
result = 0;
}
return result;
}
#endif
void _STLP_CALL ios_base::_S_initialize() {
#if !defined (_STLP_HAS_NO_NAMESPACES) && !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
using _STLP_PRIV stdio_istreambuf;
using _STLP_PRIV stdio_ostreambuf;
#endif
_STLP_TRY {
istream* ptr_cin = new(static_cast<void*>(&cin)) istream(0);
# ifdef _STLP_REDIRECT_STDSTREAMS
ofstream* ptr_cout = new(static_cast<void*>(&cout)) ofstream;
ofstream* ptr_cerr = new(static_cast<void*>(&cerr)) ofstream;
ofstream* ptr_clog = new(static_cast<void*>(&clog)) ofstream;
// Initialize the four narrow stream objects.
if (_S_was_synced) {
ptr_cin->init(new stdio_istreambuf(stdin));
ptr_cout->open("/stdout.txt", ios::out);
ptr_cerr->open("/stderr.txt", ios::out);
ptr_clog->open("/stdlog.txt", ios::out);
} else {
ptr_cin->init(_Stl_create_filebuf(stdin, ios_base::in));
ptr_cin->init(_Stl_create_filebuf(stdout, ios_base::out));
ptr_cin->init(_Stl_create_filebuf(stderr, ios_base::out));
ptr_cin->init(_Stl_create_filebuf(stderr, ios_base::out));
}
ptr_cin->tie(ptr_cout);
ptr_cerr->setf(ios_base::unitbuf);
# else
ostream* ptr_cout = new(static_cast<void*>(&cout)) ostream(0);
ostream* ptr_cerr = new(static_cast<void*>(&cerr)) ostream(0);
ostream* ptr_clog = new(static_cast<void*>(&clog)) ostream(0);
// Initialize the four narrow stream objects.
if (_S_was_synced) {
ptr_cin->init(new stdio_istreambuf(stdin));
ptr_cout->init(new stdio_ostreambuf(stdout));
ptr_cerr->init(new stdio_ostreambuf(stderr));
ptr_clog->init(new stdio_ostreambuf(stderr));
} else {
ptr_cin->init(_Stl_create_filebuf(stdin, ios_base::in));
ptr_cin->init(_Stl_create_filebuf(stdout, ios_base::out));
ptr_cin->init(_Stl_create_filebuf(stderr, ios_base::out));
ptr_cin->init(_Stl_create_filebuf(stderr, ios_base::out));
}
ptr_cin->tie(ptr_cout);
ptr_cerr->setf(ios_base::unitbuf);
# endif /* _STLP_REDIRECT_STDSTREAMS */
# ifndef _STLP_NO_WCHAR_T
// Run constructors for the four wide stream objects.
wistream* ptr_wcin = new(&wcin) wistream(0);
wostream* ptr_wcout = new(&wcout) wostream(0);
wostream* ptr_wcerr = new(&wcerr) wostream(0);
wostream* ptr_wclog = new(&wclog) wostream(0);
wfilebuf* win = _Stl_create_wfilebuf(stdin, ios_base::in);
wfilebuf* wout = _Stl_create_wfilebuf(stdout, ios_base::out);
wfilebuf* werr = _Stl_create_wfilebuf(stderr, ios_base::out);
wfilebuf* wlog = _Stl_create_wfilebuf(stderr, ios_base::out);
ptr_wcin->init(win);
ptr_wcout->init(wout);
ptr_wcerr->init(werr);
ptr_wclog->init(wlog);
ptr_wcin->tie(ptr_wcout);
ptr_wcerr->setf(ios_base::unitbuf);
# endif /* _STLP_NO_WCHAR_T */
}
_STLP_CATCH_ALL {}
}
void _STLP_CALL ios_base::_S_uninitialize() {
// Note that destroying output streambufs flushes the buffers.
istream* ptr_cin = &cin;
ostream* ptr_cout = &cout;
ostream* ptr_cerr = &cerr;
ostream* ptr_clog = &clog;
#ifndef _STLP_NO_WCHAR_T
wistream* ptr_wcin = &wcin;
wostream* ptr_wcout = &wcout;
wostream* ptr_wcerr = &wcerr;
wostream* ptr_wclog = &wclog;
#endif
// we don't want any exceptions being thrown here
ptr_cin->exceptions(0);
ptr_cout->exceptions(0);
ptr_cerr->exceptions(0);
ptr_clog->exceptions(0);
delete ptr_cin->rdbuf(0);
delete ptr_cout->rdbuf(0);
delete ptr_cerr->rdbuf(0);
delete ptr_clog->rdbuf(0);
_Destroy(ptr_cin);
_Destroy(ptr_cout);
_Destroy(ptr_cerr);
_Destroy(ptr_clog);
#ifndef _STLP_NO_WCHAR_T
// we don't want any exceptions being thrown here
ptr_wcin->exceptions(0);
ptr_wcout->exceptions(0);
ptr_wcerr->exceptions(0);
ptr_wclog->exceptions(0);
delete ptr_wcin->rdbuf(0);
delete ptr_wcout->rdbuf(0);
delete ptr_wcerr->rdbuf(0);
delete ptr_wclog->rdbuf(0);
_Destroy(ptr_wcin);
_Destroy(ptr_wcout);
_Destroy(ptr_wcerr);
_Destroy(ptr_wclog);
#endif
}
bool _STLP_CALL ios_base::sync_with_stdio(bool sync) {
# if !defined (_STLP_HAS_NO_NAMESPACES) && !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
using _STLP_PRIV stdio_istreambuf;
using _STLP_PRIV stdio_ostreambuf;
# endif
bool was_synced = _S_was_synced;
// if by any chance we got there before std streams initialization,
// just set the sync flag and exit
if (Init::_S_count == 0) {
_S_was_synced = sync;
return was_synced;
}
istream* ptr_cin = &cin;
ostream* ptr_cout = &cout;
ostream* ptr_cerr = &cerr;
ostream* ptr_clog = &clog;
streambuf* old_cin = ptr_cin->rdbuf();
streambuf* old_cout = ptr_cout->rdbuf();
streambuf* old_cerr = ptr_cerr->rdbuf();
streambuf* old_clog = ptr_clog->rdbuf();
streambuf* new_cin = 0;
streambuf* new_cout = 0;
streambuf* new_cerr = 0;
streambuf* new_clog = 0;
_STLP_TRY {
if (sync && !was_synced) {
new_cin = new stdio_istreambuf(stdin);
new_cout = new stdio_ostreambuf(stdout);
new_cerr = new stdio_ostreambuf(stderr);
new_clog = new stdio_ostreambuf(stderr);
}
else if (!sync && was_synced) {
new_cin = _Stl_create_filebuf(stdin, ios_base::in);
new_cout = _Stl_create_filebuf(stdout, ios_base::out);
new_cerr = _Stl_create_filebuf(stderr, ios_base::out);
new_clog = _Stl_create_filebuf(stderr, ios_base::out);
}
}
_STLP_CATCH_ALL {}
if (new_cin && new_cout && new_cerr && new_clog) {
ptr_cin->rdbuf(new_cin);
ptr_cout->rdbuf(new_cout);
ptr_cerr->rdbuf(new_cerr);
ptr_clog->rdbuf(new_clog);
delete old_cin;
delete old_cout;
delete old_cerr;
delete old_clog;
}
else {
delete new_cin;
delete new_cout;
delete new_cerr;
delete new_clog;
}
return was_synced;
}
#endif /* ANDROID */
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,53 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
# include "stlport_prefix.h"
#include <istream>
_STLP_BEGIN_NAMESPACE
#if !defined(_STLP_NO_FORCE_INSTANTIATE)
// instantiations
# if defined (_STLP_USE_TEMPLATE_EXPORT)
template class _STLP_CLASS_DECLSPEC _Isentry<char, char_traits<char> >;
# endif
template class _STLP_CLASS_DECLSPEC basic_iostream<char, char_traits<char> >;
# if !defined(_STLP_MSVC) || (_STLP_MSVC > 1100)
template class _STLP_CLASS_DECLSPEC basic_istream<char, char_traits<char> >;
# endif
# if !defined (_STLP_NO_WCHAR_T)
# if defined (_STLP_USE_TEMPLATE_EXPORT)
template class _STLP_CLASS_DECLSPEC _Isentry<wchar_t, char_traits<wchar_t> >;
# endif
# if !defined(_STLP_MSVC) || (_STLP_MSVC > 1100)
template class _STLP_CLASS_DECLSPEC basic_istream<wchar_t, char_traits<wchar_t> >;
# endif
template class _STLP_CLASS_DECLSPEC basic_iostream<wchar_t, char_traits<wchar_t> >;
# endif /* !_STLP_NO_WCHAR_T */
#endif /* _STLP_NO_FORCE_INSTANTIATE */
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,348 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
// This file is #included into locale_impl.cpp, due to locale use many
// statics from locale_impl.cpp
_STLP_BEGIN_NAMESPACE
#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
# define locale _STLP_NO_MEM_T_NAME(loc)
#endif
locale::facet::~facet() {}
#if !defined (_STLP_MEMBER_TEMPLATES) || defined (_STLP_INLINE_MEMBER_TEMPLATES)
// members that fail to be templates
bool locale::operator()(const string& __x,
const string& __y) const
{ return __locale_do_operator_call(*this, __x, __y); }
# if !defined (_STLP_NO_WCHAR_T)
bool locale::operator()(const wstring& __x,
const wstring& __y) const
{ return __locale_do_operator_call(*this, __x, __y); }
# endif
#endif
void _STLP_CALL locale::_M_throw_runtime_error(const char* name) {
char buf[256];
if (name) {
const char* prefix = "bad locale name: ";
#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
strcpy(buf, prefix);
strncat(buf, name, _STLP_ARRAY_SIZE(buf) - strlen(prefix));
buf[_STLP_ARRAY_SIZE(buf) - 1] = 0;
#else
strcpy_s(_STLP_ARRAY_AND_SIZE(buf), prefix);
strncat_s(_STLP_ARRAY_AND_SIZE(buf), name, _TRUNCATE);
#endif
}
else {
#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
strcpy(buf, "locale error");
#else
strcpy_s(_STLP_ARRAY_AND_SIZE(buf), "locale error");
#endif
}
_STLP_THROW(runtime_error(buf));
}
// Takes a reference to a locale::id, and returns its numeric index.
// If no numeric index has yet been assigned, assigns one. The return
// value is always positive.
static size_t _Stl_loc_get_index(locale::id& id) {
if (id._M_index == 0) {
#if defined (_STLP_ATOMIC_INCREMENT) && \
(!defined (_STLP_WIN32_VERSION) || (_STLP_WIN32_VERSION > 0x0400))
static _STLP_VOLATILE __stl_atomic_t _S_index = __STATIC_CAST(__stl_atomic_t, locale::id::_S_max);
id._M_index = _STLP_ATOMIC_INCREMENT(&_S_index);
#else
static _STLP_STATIC_MUTEX _Index_lock _STLP_MUTEX_INITIALIZER;
_STLP_auto_lock sentry(_Index_lock);
size_t new_index = locale::id::_S_max++;
id._M_index = new_index;
#endif
}
return id._M_index;
}
// Default constructor: create a copy of the global locale.
locale::locale() _STLP_NOTHROW
: _M_impl(_get_Locale_impl(_Stl_get_global_locale()->_M_impl))
{}
// Copy constructor
locale::locale(const locale& L) _STLP_NOTHROW
: _M_impl( _get_Locale_impl( L._M_impl ) )
{}
void locale::_M_insert(facet* f, locale::id& n) {
if (f)
_M_impl->insert(f, _Stl_loc_get_index(n));
}
locale::locale( _Locale_impl* impl ) :
_M_impl( _get_Locale_impl( impl ) )
{}
// Create a locale from a name.
locale::locale(const char* name)
: _M_impl(0) {
if (!name)
_M_throw_runtime_error(0);
if (is_C_locale_name(name)) {
_M_impl = _get_Locale_impl( locale::classic()._M_impl );
return;
}
_Locale_impl* impl = 0;
_STLP_TRY {
impl = new _Locale_impl(locale::id::_S_max, name);
// Insert categories one at a time.
_Locale_name_hint *hint = 0;
hint = impl->insert_ctype_facets(name, hint);
hint = impl->insert_numeric_facets(name, hint);
hint = impl->insert_time_facets(name, hint);
hint = impl->insert_collate_facets(name, hint);
hint = impl->insert_monetary_facets(name, hint);
impl->insert_messages_facets(name, hint);
// reassign impl
_M_impl = _get_Locale_impl( impl );
}
_STLP_UNWIND(delete impl);
}
// Give L a name where all facets except those in category c
// are taken from name1, and those in category c are taken from name2.
static void _Stl_loc_combine_names(_Locale_impl* L,
const char* name1, const char* name2,
locale::category c) {
if ((c & locale::all) == 0 || strcmp(name1, name2) == 0)
L->name = name1;
else if ((c & locale::all) == locale::all)
L->name = name2;
else {
// Decompose the names.
char ctype_buf[_Locale_MAX_SIMPLE_NAME];
char numeric_buf[_Locale_MAX_SIMPLE_NAME];
char time_buf[_Locale_MAX_SIMPLE_NAME];
char collate_buf[_Locale_MAX_SIMPLE_NAME];
char monetary_buf[_Locale_MAX_SIMPLE_NAME];
char messages_buf[_Locale_MAX_SIMPLE_NAME];
// TODO: check returnvalues?
_Locale_extract_ctype_name((c & locale::ctype) ? name2 : name1, ctype_buf, 0);
_Locale_extract_numeric_name((c & locale::numeric) ? name2 : name1, numeric_buf, 0);
_Locale_extract_time_name((c & locale::time) ? name2 : name1, time_buf, 0);
_Locale_extract_collate_name((c & locale::collate) ? name2 : name1, collate_buf, 0);
_Locale_extract_monetary_name((c & locale::monetary) ? name2 : name1, monetary_buf, 0);
_Locale_extract_messages_name((c & locale::messages) ? name2 : name1, messages_buf, 0);
// Construct a new composite name.
char composite_buf[_Locale_MAX_COMPOSITE_NAME];
// TODO: check returnvalue?
_Locale_compose_name(composite_buf,
ctype_buf, numeric_buf, time_buf,
collate_buf, monetary_buf, messages_buf,
name1);
L->name = composite_buf;
}
}
// Create a locale that's a copy of L, except that all of the facets
// in category c are instead constructed by name.
locale::locale(const locale& L, const char* name, locale::category c)
: _M_impl(0) {
if (name == 0 || (_Nameless == name))
_M_throw_runtime_error(name);
_Locale_impl* impl = 0;
_STLP_TRY {
impl = new _Locale_impl(*L._M_impl);
_Stl_loc_combine_names(impl, L._M_impl->name.c_str(), name, c);
_Locale_name_hint *hint = 0;
if (c & locale::ctype)
hint = impl->insert_ctype_facets(name, hint);
if (c & locale::numeric)
hint = impl->insert_numeric_facets(name, hint);
if (c & locale::time)
hint = impl->insert_time_facets(name, hint);
if (c & locale::collate)
hint = impl->insert_collate_facets(name, hint);
if (c & locale::monetary)
hint = impl->insert_monetary_facets(name, hint);
if (c & locale::messages)
impl->insert_messages_facets(name, hint);
_M_impl = _get_Locale_impl( impl );
}
_STLP_UNWIND(delete impl)
}
// Contruct a new locale where all facets that aren't in category c
// come from L1, and all those that are in category c come from L2.
locale::locale(const locale& L1, const locale& L2, category c)
: _M_impl(0) {
_Locale_impl* impl = new _Locale_impl(*L1._M_impl);
_Locale_impl* i2 = L2._M_impl;
if (L1.name() != _Nameless && L2.name() != _Nameless)
_Stl_loc_combine_names(impl, L1._M_impl->name.c_str(), L2._M_impl->name.c_str(), c);
else {
impl->name = _Nameless;
}
if (c & collate) {
impl->insert( i2, _STLP_STD::collate<char>::id);
# ifndef _STLP_NO_WCHAR_T
impl->insert( i2, _STLP_STD::collate<wchar_t>::id);
# endif
}
if (c & ctype) {
impl->insert( i2, _STLP_STD::ctype<char>::id);
impl->insert( i2, _STLP_STD::codecvt<char, char, mbstate_t>::id);
# ifndef _STLP_NO_WCHAR_T
impl->insert( i2, _STLP_STD::ctype<wchar_t>::id);
impl->insert( i2, _STLP_STD::codecvt<wchar_t, char, mbstate_t>::id);
# endif
}
if (c & monetary) {
impl->insert( i2, _STLP_STD::moneypunct<char, true>::id);
impl->insert( i2, _STLP_STD::moneypunct<char, false>::id);
impl->insert( i2, _STLP_STD::money_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
impl->insert( i2, _STLP_STD::money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
# ifndef _STLP_NO_WCHAR_T
impl->insert( i2, _STLP_STD::moneypunct<wchar_t, true>::id);
impl->insert( i2, _STLP_STD::moneypunct<wchar_t, false>::id);
impl->insert( i2, _STLP_STD::money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
impl->insert( i2, _STLP_STD::money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
# endif
}
if (c & numeric) {
impl->insert( i2, _STLP_STD::numpunct<char>::id);
impl->insert( i2, _STLP_STD::num_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
impl->insert( i2, _STLP_STD::num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
# ifndef _STLP_NO_WCHAR_T
impl->insert( i2, _STLP_STD::numpunct<wchar_t>::id);
impl->insert( i2, num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
impl->insert( i2, num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
# endif
}
if (c & time) {
impl->insert( i2, _STLP_STD::time_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
impl->insert( i2, _STLP_STD::time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
# ifndef _STLP_NO_WCHAR_T
impl->insert( i2, _STLP_STD::time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
impl->insert( i2, _STLP_STD::time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
# endif
}
if (c & messages) {
impl->insert( i2, _STLP_STD::messages<char>::id);
# ifndef _STLP_NO_WCHAR_T
impl->insert( i2, _STLP_STD::messages<wchar_t>::id);
# endif
}
_M_impl = _get_Locale_impl( impl );
}
// Destructor.
locale::~locale() _STLP_NOTHROW {
if (_M_impl)
_release_Locale_impl(_M_impl);
}
// Assignment operator. Much like the copy constructor: just a bit of
// pointer twiddling.
const locale& locale::operator=(const locale& L) _STLP_NOTHROW {
if (this->_M_impl != L._M_impl) {
if (this->_M_impl)
_release_Locale_impl(this->_M_impl);
this->_M_impl = _get_Locale_impl(L._M_impl);
}
return *this;
}
locale::facet* locale::_M_get_facet(const locale::id& n) const {
return n._M_index < _M_impl->size() ? _M_impl->facets_vec[n._M_index] : 0;
}
locale::facet* locale::_M_use_facet(const locale::id& n) const {
locale::facet* f = (n._M_index < _M_impl->size() ? _M_impl->facets_vec[n._M_index] : 0);
if (!f)
_M_impl->_M_throw_bad_cast();
return f;
}
string locale::name() const {
return _M_impl->name;
}
// Compare two locales for equality.
bool locale::operator==(const locale& L) const {
return this->_M_impl == L._M_impl ||
(this->name() == L.name() && this->name() != _Nameless);
}
bool locale::operator!=(const locale& L) const {
return !(*this == L);
}
// static data members.
const locale& _STLP_CALL locale::classic() {
return *_Stl_get_classic_locale();
}
locale _STLP_CALL locale::global(const locale& L) {
locale old(_Stl_get_global_locale()->_M_impl);
if (_Stl_get_global_locale()->_M_impl != L._M_impl) {
_release_Locale_impl(_Stl_get_global_locale()->_M_impl);
// this assign should be atomic, should be fixed here:
_Stl_get_global_locale()->_M_impl = _get_Locale_impl(L._M_impl);
// Set the global C locale, if appropriate.
#if !defined(_STLP_NO_LOCALE_SUPPORT)
if (L.name() != _Nameless)
setlocale(LC_ALL, L.name().c_str());
#endif
}
return old;
}
# if !defined (_STLP_STATIC_CONST_INIT_BUG) && ! defined (_STLP_USE_DECLSPEC)
const locale::category locale::none;
const locale::category locale::collate;
const locale::category locale::ctype;
const locale::category locale::monetary;
const locale::category locale::numeric;
const locale::category locale::time;
const locale::category locale::messages;
const locale::category locale::all;
# endif
_STLP_END_NAMESPACE

View File

@@ -1,256 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <hash_map>
#include <string>
#include <locale>
#include <istream>
#include "c_locale.h"
#include "locale_impl.h"
#include "acquire_release.h"
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
// those wrappers are needed to avoid extern "C"
static void* _Loc_ctype_create(const char * s, _Locale_name_hint* hint)
{ return _Locale_ctype_create(s, hint); }
static void* _Loc_numeric_create(const char * s, _Locale_name_hint* hint)
{ return _Locale_numeric_create(s, hint); }
static void* _Loc_time_create(const char * s, _Locale_name_hint* hint)
{ return _Locale_time_create(s, hint); }
static void* _Loc_collate_create(const char * s, _Locale_name_hint* hint)
{ return _Locale_collate_create(s, hint); }
static void* _Loc_monetary_create(const char * s, _Locale_name_hint* hint)
{ return _Locale_monetary_create(s, hint); }
static void* _Loc_messages_create(const char * s, _Locale_name_hint* hint)
{ return _Locale_messages_create(s, hint); }
static char const* _Loc_ctype_name(const void* l, char* s)
{ return _Locale_ctype_name(l, s); }
static char const* _Loc_numeric_name(const void* l, char* s)
{ return _Locale_numeric_name(l, s); }
static char const* _Loc_time_name(const void* l, char* s)
{ return _Locale_time_name(l,s); }
static char const* _Loc_collate_name( const void* l, char* s)
{ return _Locale_collate_name(l,s); }
static char const* _Loc_monetary_name(const void* l, char* s)
{ return _Locale_monetary_name(l,s); }
static char const* _Loc_messages_name(const void* l, char* s)
{ return _Locale_messages_name(l,s); }
static const char* _Loc_ctype_default(char* p)
{ return _Locale_ctype_default(p); }
static const char* _Loc_numeric_default(char * p)
{ return _Locale_numeric_default(p); }
static const char* _Loc_time_default(char* p)
{ return _Locale_time_default(p); }
static const char* _Loc_collate_default(char* p)
{ return _Locale_collate_default(p); }
static const char* _Loc_monetary_default(char* p)
{ return _Locale_monetary_default(p); }
static const char* _Loc_messages_default(char* p)
{ return _Locale_messages_default(p); }
static void _Loc_ctype_destroy(void* p) {_Locale_ctype_destroy(p); }
static void _Loc_numeric_destroy(void* p) {_Locale_numeric_destroy(p); }
static void _Loc_time_destroy(void* p) {_Locale_time_destroy(p);}
static void _Loc_collate_destroy(void* p) {_Locale_collate_destroy(p);}
static void _Loc_monetary_destroy(void* p) {_Locale_monetary_destroy(p);}
static void _Loc_messages_destroy(void* p) {_Locale_messages_destroy(p);}
typedef void* (*loc_create_func_t)(const char *, _Locale_name_hint*);
typedef char const* (*loc_name_func_t)(const void* l, char* s);
typedef void (*loc_destroy_func_t)(void* l);
typedef const char* (*loc_default_name_func_t)(char* s);
typedef char const* (*loc_extract_name_func_t)(const char*, char*, _Locale_name_hint*);
//----------------------------------------------------------------------
// Acquire and release low-level category objects. The whole point of
// this is so that we don't allocate (say) four different _Locale_ctype
// objects for a single locale.
// Global hash tables for category objects.
typedef hash_map<string, pair<void*, size_t>, hash<string>, equal_to<string> > Category_Map;
// Look up a category by name
static Category_Map** ctype_hash() {
static Category_Map *_S_ctype_hash = 0;
return &_S_ctype_hash;
}
static Category_Map** numeric_hash() {
static Category_Map *_S_numeric_hash = 0;
return &_S_numeric_hash;
}
static Category_Map** time_hash() {
static Category_Map *_S_time_hash = 0;
return &_S_time_hash;
}
static Category_Map** collate_hash() {
static Category_Map *_S_collate_hash = 0;
return &_S_collate_hash;
}
static Category_Map** monetary_hash() {
static Category_Map *_S_monetary_hash = 0;
return &_S_monetary_hash;
}
static Category_Map** messages_hash() {
static Category_Map *_S_messages_hash;
return &_S_messages_hash;
}
// We have a single lock for all of the hash tables. We may wish to
// replace it with six different locks.
/* REFERENCED */
static _STLP_STATIC_MUTEX __category_hash_lock _STLP_MUTEX_INITIALIZER;
static void*
__acquire_category(const char* name, _Locale_name_hint* hint,
loc_extract_name_func_t extract_name,
loc_create_func_t create_obj, loc_default_name_func_t default_obj,
Category_Map ** M) {
#if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x564)
typedef Category_Map::iterator Category_iterator;
pair<Category_iterator, bool> result;
#else
pair<Category_Map::iterator, bool> result;
#endif
// Find what name to look for. Be careful if user requests the default.
const char *cname;
char buf[_Locale_MAX_SIMPLE_NAME];
if (name == 0 || name[0] == 0) {
cname = default_obj(buf);
if (cname == 0 || cname[0] == 0)
cname = "C";
}
else {
cname = extract_name(name, buf, hint);
if (cname == 0) {
return 0;
}
}
Category_Map::value_type __e(cname, pair<void*,size_t>((void*)0,size_t(0)));
_STLP_auto_lock sentry(__category_hash_lock);
if (!*M)
*M = new Category_Map();
#if defined(__SC__) //*TY 06/01/2000 - added workaround for SCpp
if(!*M) delete *M; //*TY 06/01/2000 - it forgets to generate dtor for Category_Map class. This fake code forces to generate one.
#endif //*TY 06/01/2000 -
// Look for an existing entry with that name.
result = (*M)->insert_noresize(__e);
// There was no entry in the map already. Create the category.
if (result.second)
(*result.first).second.first = create_obj(cname, hint);
// Increment the reference count.
++((*result.first).second.second);
return (*result.first).second.first;
}
static void
__release_category(void* cat,
loc_destroy_func_t destroy_fun,
loc_name_func_t get_name,
Category_Map** M) {
Category_Map *pM = *M;
if (cat && pM) {
// Find the name of the category object.
char buf[_Locale_MAX_SIMPLE_NAME + 1];
char const* name = get_name(cat, buf);
if (name != 0) {
_STLP_auto_lock sentry(__category_hash_lock);
Category_Map::iterator it = pM->find(name);
if (it != pM->end()) {
// Decrement the ref count. If it goes to zero, delete this category
// from the map.
if (--((*it).second.second) == 0) {
void* cat1 = (*it).second.first;
destroy_fun(cat1);
pM->erase(it);
#if defined (_STLP_LEAKS_PEDANTIC)
if (pM->empty()) {
delete pM;
*M = 0;
}
#endif /* _STLP_LEAKS_PEDANTIC */
}
}
}
}
}
_Locale_ctype* _STLP_CALL __acquire_ctype(const char* name, _Locale_name_hint* hint) {
return __REINTERPRET_CAST(_Locale_ctype*, __acquire_category(name, hint,
_Locale_extract_ctype_name, _Loc_ctype_create, _Loc_ctype_default,
ctype_hash()));
}
_Locale_numeric* _STLP_CALL __acquire_numeric(const char* name, _Locale_name_hint* hint) {
return __REINTERPRET_CAST(_Locale_numeric*, __acquire_category(name, hint,
_Locale_extract_numeric_name, _Loc_numeric_create, _Loc_numeric_default,
numeric_hash()));
}
_Locale_time* _STLP_CALL __acquire_time(const char* name, _Locale_name_hint* hint) {
return __REINTERPRET_CAST(_Locale_time*, __acquire_category(name, hint,
_Locale_extract_time_name, _Loc_time_create, _Loc_time_default,
time_hash()));
}
_Locale_collate* _STLP_CALL __acquire_collate(const char* name, _Locale_name_hint* hint) {
return __REINTERPRET_CAST(_Locale_collate*, __acquire_category(name, hint,
_Locale_extract_collate_name, _Loc_collate_create, _Loc_collate_default,
collate_hash()));
}
_Locale_monetary* _STLP_CALL __acquire_monetary(const char* name, _Locale_name_hint* hint) {
return __REINTERPRET_CAST(_Locale_monetary*, __acquire_category(name, hint,
_Locale_extract_monetary_name, _Loc_monetary_create, _Loc_monetary_default,
monetary_hash()));
}
_Locale_messages* _STLP_CALL __acquire_messages(const char* name, _Locale_name_hint* hint) {
return __REINTERPRET_CAST(_Locale_messages*, __acquire_category(name, hint,
_Locale_extract_messages_name, _Loc_messages_create, _Loc_messages_default,
messages_hash()));
}
void _STLP_CALL __release_ctype(_Locale_ctype* cat)
{ __release_category(cat, _Loc_ctype_destroy, _Loc_ctype_name, ctype_hash()); }
void _STLP_CALL __release_numeric(_Locale_numeric* cat)
{ __release_category(cat, _Loc_numeric_destroy, _Loc_numeric_name, numeric_hash()); }
void _STLP_CALL __release_time(_Locale_time* cat)
{ __release_category(cat, _Loc_time_destroy, _Loc_time_name, time_hash()); }
void _STLP_CALL __release_collate(_Locale_collate* cat)
{ __release_category(cat, _Loc_collate_destroy, _Loc_collate_name, collate_hash()); }
void _STLP_CALL __release_monetary(_Locale_monetary* cat)
{ __release_category(cat, _Loc_monetary_destroy, _Loc_monetary_name, monetary_hash()); }
void _STLP_CALL __release_messages(_Locale_messages* cat)
{ __release_category(cat, _Loc_messages_destroy, _Loc_messages_name, messages_hash()); }
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE

View File

@@ -1,853 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <locale>
#include <typeinfo>
#include <algorithm>
#include <stdexcept>
#include "c_locale.h"
#include "aligned_buffer.h"
#include "locale_impl.h"
#include "message_facets.h"
_STLP_BEGIN_NAMESPACE
static const string _Nameless("*");
static inline bool is_C_locale_name (const char* name)
{ return ((name[0] == 'C') && (name[1] == 0)); }
_Locale_impl * _STLP_CALL _copy_Locale_impl(_Locale_impl *loc)
{
_STLP_ASSERT( loc != 0 );
loc->_M_incr();
_Locale_impl *loc_new = new _Locale_impl(*loc);
loc->_M_decr();
return loc_new;
}
locale::facet * _STLP_CALL _get_facet(locale::facet *f)
{
if (f != 0)
f->_M_incr();
return f;
}
void _STLP_CALL _release_facet(locale::facet *&f)
{
if ((f != 0) && (f->_M_decr() == 0)) {
delete f;
f = 0;
}
}
size_t locale::id::_S_max = 39;
static void _Stl_loc_assign_ids();
static _Stl_aligned_buffer<_Locale_impl::Init> __Loc_init_buf;
_Locale_impl::Init::Init() {
if (_M_count()._M_incr() == 1) {
_Locale_impl::_S_initialize();
}
}
_Locale_impl::Init::~Init() {
if (_M_count()._M_decr() == 0) {
_Locale_impl::_S_uninitialize();
}
}
_Refcount_Base& _Locale_impl::Init::_M_count() const {
static _Refcount_Base _S_count(0);
return _S_count;
}
_Locale_impl::_Locale_impl(const char* s)
: _Refcount_Base(0), name(s), facets_vec() {
facets_vec.reserve( locale::id::_S_max );
new (&__Loc_init_buf) Init();
}
_Locale_impl::_Locale_impl( _Locale_impl const& locimpl )
: _Refcount_Base(0), name(locimpl.name), facets_vec() {
for_each( locimpl.facets_vec.begin(), locimpl.facets_vec.end(), _get_facet);
facets_vec = locimpl.facets_vec;
new (&__Loc_init_buf) Init();
}
_Locale_impl::_Locale_impl( size_t n, const char* s)
: _Refcount_Base(0), name(s), facets_vec(n, 0) {
new (&__Loc_init_buf) Init();
}
_Locale_impl::~_Locale_impl() {
(&__Loc_init_buf)->~Init();
for_each( facets_vec.begin(), facets_vec.end(), _release_facet);
}
// Initialization of the locale system. This must be called before
// any locales are constructed. (Meaning that it must be called when
// the I/O library itself is initialized.)
void _STLP_CALL _Locale_impl::_S_initialize() {
_Stl_loc_assign_ids();
make_classic_locale();
}
// Release of the classic locale ressources. Has to be called after the last
// locale destruction and not only after the classic locale destruction as
// the facets can be shared between different facets.
void _STLP_CALL _Locale_impl::_S_uninitialize() {
//Not necessary anymore as classic facets are now 'normal' dynamically allocated
//facets with a reference counter telling to _release_facet when the facet can be
//deleted.
//free_classic_locale();
}
// _Locale_impl non-inline member functions.
void _STLP_CALL _Locale_impl::_M_throw_bad_cast() {
_STLP_THROW(bad_cast());
}
void _Locale_impl::insert( _Locale_impl *from, const locale::id& n ) {
size_t index = n._M_index;
if (index > 0 && index < from->size()) {
this->insert( from->facets_vec[index], index);
}
}
locale::facet* _Locale_impl::insert(locale::facet *f, size_t index) {
if (f == 0 || index == 0)
return 0;
if (index >= facets_vec.size()) {
facets_vec.resize(index + 1);
}
if (f != facets_vec[index])
{
_release_facet(facets_vec[index]);
facets_vec[index] = _get_facet(f);
}
return f;
}
#if !defined (__DMC__)
_Locale_name_hint* _Locale_extract_hint(ctype_byname<char>* ct)
{ return _Locale_get_ctype_hint(ct->_M_ctype); }
_Locale_name_hint* _Locale_extract_hint(numpunct_byname<char>* punct)
{ return _Locale_get_numeric_hint(punct->_M_numeric); }
# if defined (__GNUC__) && (__GNUC__ < 3)
template <class _Ch, class _InIt>
_Locale_name_hint* _Locale_time_extract_hint(time_get_byname<_Ch, _InIt>* tget)
# else
_Locale_name_hint* _Locale_time_extract_hint(time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >* tget)
# endif
{ return _Locale_get_time_hint(tget->_M_time); }
_Locale_name_hint* _Locale_extract_hint(collate_byname<char>* coll)
{ return _Locale_get_collate_hint(coll->_M_collate); }
_Locale_name_hint* _Locale_extract_hint(moneypunct_byname<char, false>* money)
{ return _Locale_get_monetary_hint(money->_M_monetary); }
#endif
//
// <locale> content which is dependent on the name
//
template <class Facet>
static inline locale::facet* _Locale_insert(_Locale_impl *__that, Facet* f)
{ return __that->insert(f, Facet::id._M_index); }
/*
* Six functions, one for each category. Each of them takes a
* _Locale* and a name, constructs that appropriate category
* facets by name, and inserts them into the locale.
*/
_Locale_name_hint* _Locale_impl::insert_ctype_facets(const char* pname, _Locale_name_hint* hint) {
char buf[_Locale_MAX_SIMPLE_NAME];
_Locale_impl* i2 = locale::classic()._M_impl;
if (pname == 0 || pname[0] == 0)
pname = _Locale_ctype_default(buf);
if (pname == 0 || pname[0] == 0 || is_C_locale_name(pname)) {
this->insert(i2, ctype<char>::id);
#ifndef _STLP_NO_MBSTATE_T
this->insert(i2, codecvt<char, char, mbstate_t>::id);
#endif
#ifndef _STLP_NO_WCHAR_T
this->insert(i2, ctype<wchar_t>::id);
# ifndef _STLP_NO_MBSTATE_T
this->insert(i2, codecvt<wchar_t, char, mbstate_t>::id);
# endif
#endif
} else {
ctype<char>* ct = 0;
#ifndef _STLP_NO_MBSTATE_T
codecvt<char, char, mbstate_t>* cvt = 0;
#endif
#ifndef _STLP_NO_WCHAR_T
ctype<wchar_t>* wct = 0;
codecvt<wchar_t, char, mbstate_t>* wcvt = 0;
#endif
_STLP_TRY {
ctype_byname<char> *ctbn = new ctype_byname<char>(pname, 0, hint);
ct = ctbn;
#if !defined (__DMC__)
if (hint == 0) hint = _Locale_extract_hint(ctbn);
#endif
#ifndef _STLP_NO_MBSTATE_T
cvt = new codecvt_byname<char, char, mbstate_t>(pname);
#endif
#ifndef _STLP_NO_WCHAR_T
wct = new ctype_byname<wchar_t>(pname, 0, hint);
wcvt = new codecvt_byname<wchar_t, char, mbstate_t>(pname, 0, hint);
#endif
}
#ifndef _STLP_NO_WCHAR_T
# ifdef _STLP_NO_MBSTATE_T
_STLP_UNWIND(delete ct; delete wct; delete wcvt);
# else
_STLP_UNWIND(delete ct; delete wct; delete cvt; delete wcvt);
# endif
#else
# ifdef _STLP_NO_MBSTATE_T
_STLP_UNWIND(delete ct);
# else
_STLP_UNWIND(delete ct; delete cvt);
# endif
#endif
_Locale_insert(this, ct);
#ifndef _STLP_NO_MBSTATE_T
_Locale_insert(this, cvt);
#endif
#ifndef _STLP_NO_WCHAR_T
_Locale_insert(this, wct);
_Locale_insert(this, wcvt);
#endif
}
return hint;
}
_Locale_name_hint* _Locale_impl::insert_numeric_facets(const char* pname, _Locale_name_hint* hint) {
_Locale_impl* i2 = locale::classic()._M_impl;
numpunct<char>* punct = 0;
num_get<char, istreambuf_iterator<char, char_traits<char> > > *get = 0;
num_put<char, ostreambuf_iterator<char, char_traits<char> > > *put = 0;
#ifndef _STLP_NO_WCHAR_T
numpunct<wchar_t>* wpunct = 0;
num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wget = 0;
num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wput = 0;
#endif
char buf[_Locale_MAX_SIMPLE_NAME];
if (pname == 0 || pname[0] == 0)
pname = _Locale_numeric_default(buf);
if (pname == 0 || pname[0] == 0 || is_C_locale_name(pname)) {
this->insert(i2, numpunct<char>::id);
this->insert(i2,
num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
this->insert(i2,
num_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
#ifndef _STLP_NO_WCHAR_T
this->insert(i2, numpunct<wchar_t>::id);
this->insert(i2,
num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
this->insert(i2,
num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
#endif
}
else {
_STLP_TRY {
numpunct_byname<char> *punctbn = new numpunct_byname<char>(pname, 0, hint);
punct = punctbn;
#if !defined (__DMC__)
if (hint == 0) hint = _Locale_extract_hint(punctbn);
#endif
get = new num_get<char, istreambuf_iterator<char, char_traits<char> > >;
put = new num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
#ifndef _STLP_NO_WCHAR_T
wpunct = new numpunct_byname<wchar_t>(pname, 0, hint);
wget = new num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
wput = new num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
#endif
}
#ifndef _STLP_NO_WCHAR_T
_STLP_UNWIND(delete punct; delete wpunct; delete get; delete wget; delete put; delete wput);
#else
_STLP_UNWIND(delete punct; delete get;delete put);
#endif
_Locale_insert(this,punct);
_Locale_insert(this,get);
_Locale_insert(this,put);
#ifndef _STLP_NO_WCHAR_T
_Locale_insert(this,wpunct);
_Locale_insert(this,wget);
_Locale_insert(this,wput);
#endif
}
return hint;
}
_Locale_name_hint* _Locale_impl::insert_time_facets(const char* pname, _Locale_name_hint* hint) {
_Locale_impl* i2 = locale::classic()._M_impl;
time_get<char, istreambuf_iterator<char, char_traits<char> > > *get = 0;
time_put<char, ostreambuf_iterator<char, char_traits<char> > > *put = 0;
#ifndef _STLP_NO_WCHAR_T
time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wget = 0;
time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wput = 0;
#endif
char buf[_Locale_MAX_SIMPLE_NAME];
if (pname == 0 || pname[0] == 0)
pname = _Locale_time_default(buf);
if (pname == 0 || pname[0] == 0 || is_C_locale_name(pname)) {
this->insert(i2,
time_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
this->insert(i2,
time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
#ifndef _STLP_NO_WCHAR_T
this->insert(i2,
time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
this->insert(i2,
time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
#endif
} else {
_STLP_TRY {
time_get_byname<char, istreambuf_iterator<char, char_traits<char> > > *getbn =
new time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >(pname, 0, hint);
get = getbn;
#if !defined (__DMC__)
if (hint == 0) hint = _Locale_time_extract_hint(getbn);
#endif
put = new time_put_byname<char, ostreambuf_iterator<char, char_traits<char> > >(pname, 0, hint);
#ifndef _STLP_NO_WCHAR_T
wget = new time_get_byname<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(pname, 0, hint);
wput = new time_put_byname<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(pname, 0, hint);
#endif
}
#ifndef _STLP_NO_WCHAR_T
_STLP_UNWIND(delete get; delete wget; delete put; delete wput);
#else
_STLP_UNWIND(delete get; delete put);
#endif
_Locale_insert(this,get);
_Locale_insert(this,put);
#ifndef _STLP_NO_WCHAR_T
_Locale_insert(this,wget);
_Locale_insert(this,wput);
#endif
}
return hint;
}
_Locale_name_hint* _Locale_impl::insert_collate_facets(const char* nam, _Locale_name_hint* hint) {
_Locale_impl* i2 = locale::classic()._M_impl;
collate<char> *col = 0;
#ifndef _STLP_NO_WCHAR_T
collate<wchar_t> *wcol = 0;
#endif
char buf[_Locale_MAX_SIMPLE_NAME];
if (nam == 0 || nam[0] == 0)
nam = _Locale_collate_default(buf);
if (nam == 0 || nam[0] == 0 || is_C_locale_name(nam)) {
this->insert(i2, collate<char>::id);
#ifndef _STLP_NO_WCHAR_T
this->insert(i2, collate<wchar_t>::id);
#endif
}
else {
_STLP_TRY {
collate_byname<char> *colbn = new collate_byname<char>(nam, 0, hint);
col = colbn;
#if !defined (__DMC__)
if (hint == 0) hint = _Locale_extract_hint(colbn);
#endif
#ifndef _STLP_NO_WCHAR_T
wcol = new collate_byname<wchar_t>(nam, 0, hint);
#endif
}
#ifndef _STLP_NO_WCHAR_T
_STLP_UNWIND(delete col; delete wcol);
#else
_STLP_UNWIND(delete col);
#endif
_Locale_insert(this,col);
#ifndef _STLP_NO_WCHAR_T
_Locale_insert(this,wcol);
#endif
}
return hint;
}
_Locale_name_hint* _Locale_impl::insert_monetary_facets(const char* pname, _Locale_name_hint* hint) {
_Locale_impl* i2 = locale::classic()._M_impl;
moneypunct<char, false> *punct = 0;
moneypunct<char, true> *ipunct = 0;
money_get<char, istreambuf_iterator<char, char_traits<char> > > *get = 0;
money_put<char, ostreambuf_iterator<char, char_traits<char> > > *put = 0;
#ifndef _STLP_NO_WCHAR_T
moneypunct<wchar_t, false>* wpunct = 0;
moneypunct<wchar_t, true>* wipunct = 0;
money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wget = 0;
money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wput = 0;
#endif
char buf[_Locale_MAX_SIMPLE_NAME];
if (pname == 0 || pname[0] == 0)
pname = _Locale_monetary_default(buf);
if (pname == 0 || pname[0] == 0 || is_C_locale_name(pname)) {
this->insert(i2, moneypunct<char, false>::id);
this->insert(i2, moneypunct<char, true>::id);
this->insert(i2, money_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
this->insert(i2, money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
#ifndef _STLP_NO_WCHAR_T
this->insert(i2, moneypunct<wchar_t, false>::id);
this->insert(i2, moneypunct<wchar_t, true>::id);
this->insert(i2, money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
this->insert(i2, money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
#endif
}
else {
_STLP_TRY {
moneypunct_byname<char, false>* punctbn = new moneypunct_byname<char, false>(pname, 0, hint);
punct = punctbn;
#if !defined (__DMC__)
if (hint == 0) hint = _Locale_extract_hint(punctbn);
#endif
ipunct = new moneypunct_byname<char, true>(pname, 0, hint);
get = new money_get<char, istreambuf_iterator<char, char_traits<char> > >;
put = new money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
#ifndef _STLP_NO_WCHAR_T
wpunct = new moneypunct_byname<wchar_t, false>(pname, 0, hint);
wipunct = new moneypunct_byname<wchar_t, true>(pname, 0, hint);
wget = new money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
wput = new money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
#endif
}
#ifndef _STLP_NO_WCHAR_T
_STLP_UNWIND(delete punct; delete ipunct; delete wpunct; delete wipunct; delete get; delete wget; delete put; delete wput);
#else
_STLP_UNWIND(delete punct; delete ipunct; delete get; delete put);
#endif
_Locale_insert(this,punct);
_Locale_insert(this,ipunct);
_Locale_insert(this,get);
_Locale_insert(this,put);
#ifndef _STLP_NO_WCHAR_T
_Locale_insert(this,wget);
_Locale_insert(this,wpunct);
_Locale_insert(this,wipunct);
_Locale_insert(this,wput);
#endif
}
return hint;
}
_Locale_name_hint* _Locale_impl::insert_messages_facets(const char* pname, _Locale_name_hint* hint) {
_Locale_impl* i2 = locale::classic()._M_impl;
messages<char> *msg = 0;
#ifndef _STLP_NO_WCHAR_T
messages<wchar_t> *wmsg = 0;
#endif
char buf[_Locale_MAX_SIMPLE_NAME];
if (pname == 0 || pname[0] == 0)
pname = _Locale_messages_default(buf);
if (pname == 0 || pname[0] == 0 || is_C_locale_name(pname)) {
this->insert(i2, messages<char>::id);
#ifndef _STLP_NO_WCHAR_T
this->insert(i2, messages<wchar_t>::id);
#endif
}
else {
_STLP_TRY {
msg = new messages_byname<char>(pname, 0, hint);
#ifndef _STLP_NO_WCHAR_T
wmsg = new messages_byname<wchar_t>(pname, 0, hint);
#endif
}
#ifndef _STLP_NO_WCHAR_T
_STLP_UNWIND(delete msg; delete wmsg);
#else
_STLP_UNWIND(delete msg);
#endif
_Locale_insert(this,msg);
#ifndef _STLP_NO_WCHAR_T
_Locale_insert(this,wmsg);
#endif
}
return hint;
}
static void _Stl_loc_assign_ids() {
// This assigns ids to every facet that is a member of a category,
// and also to money_get/put, num_get/put, and time_get/put
// instantiated using ordinary pointers as the input/output
// iterators. (The default is [io]streambuf_iterator.)
money_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 8;
//money_get<char, const char*>::id._M_index = 9;
money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 10;
//money_put<char, char*>::id._M_index = 11;
num_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 12;
//num_get<char, const char*>::id._M_index = 13;
num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 14;
//num_put<char, char*>::id._M_index = 15;
time_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 16;
//time_get<char, const char*>::id._M_index = 17;
time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 18;
//time_put<char, char*>::id._M_index = 19;
#ifndef _STLP_NO_WCHAR_T
money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 27;
//money_get<wchar_t, const wchar_t*>::id._M_index = 28;
money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 29;
//money_put<wchar_t, wchar_t*>::id._M_index = 30;
num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 31;
//num_get<wchar_t, const wchar_t*>::id._M_index = 32;
num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > ::id._M_index = 33;
//num_put<wchar_t, wchar_t*>::id._M_index = 34;
time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 35;
//time_get<wchar_t, const wchar_t*>::id._M_index = 36;
time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 37;
//time_put<wchar_t, wchar_t*>::id._M_index = 38;
#endif
// locale::id::_S_max = 39;
}
// To access those static instance use the getter below, they guaranty
// a correct initialization.
static locale *_Stl_classic_locale = 0;
static locale *_Stl_global_locale = 0;
static locale* _Stl_get_classic_locale() {
static _Locale_impl::Init init;
return _Stl_classic_locale;
}
static locale* _Stl_get_global_locale() {
static _Locale_impl::Init init;
return _Stl_global_locale;
}
#if defined (_STLP_MSVC) || defined (__ICL) || defined (__ISCPP__)
/*
* The following static variable needs to be initialized before STLport
* users static variable in order for him to be able to use Standard
* streams in its variable initialization.
* This variable is here because MSVC do not allow to change the initialization
* segment in a given translation unit, iostream.cpp already contains an
* initialization segment specification.
*/
# pragma warning (disable : 4073)
# pragma init_seg(lib)
#endif
#if !defined(ANDROID) && !defined(__ANDROID__)
static ios_base::Init _IosInit;
#endif
void _Locale_impl::make_classic_locale() {
// This funcion will be called once: during build classic _Locale_impl
// The classic locale contains every facet that belongs to a category.
static _Stl_aligned_buffer<_Locale_impl> _Locale_classic_impl_buf;
_Locale_impl *classic = new(&_Locale_classic_impl_buf) _Locale_impl("C");
locale::facet* classic_facets[] = {
0,
new collate<char>(1),
new ctype<char>(0, false, 1),
#ifndef _STLP_NO_MBSTATE_T
new codecvt<char, char, mbstate_t>(1),
#else
0,
#endif
new moneypunct<char, true>(1),
new moneypunct<char, false>(1),
new numpunct<char>(1),
new messages<char>(new _STLP_PRIV _Messages()),
new money_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
0,
new money_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
0,
new num_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
0,
new num_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
0,
new time_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
0,
new time_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
0,
#ifndef _STLP_NO_WCHAR_T
new collate<wchar_t>(1),
new ctype<wchar_t>(1),
# ifndef _STLP_NO_MBSTATE_T
new codecvt<wchar_t, char, mbstate_t>(1),
# else
0,
# endif
new moneypunct<wchar_t, true>(1),
new moneypunct<wchar_t, false>(1),
new numpunct<wchar_t>(1),
new messages<wchar_t>(new _STLP_PRIV _Messages()),
new money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
0,
new money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
0,
new num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
0,
new num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
0,
new time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
0,
new time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
0,
#endif
0
};
const size_t nb_classic_facets = sizeof(classic_facets) / sizeof(locale::facet *);
classic->facets_vec.reserve(nb_classic_facets);
classic->facets_vec.assign(&classic_facets[0], &classic_facets[0] + nb_classic_facets);
static locale _Locale_classic(classic);
_Stl_classic_locale = &_Locale_classic;
static locale _Locale_global(_copy_Locale_impl(classic));
_Stl_global_locale = &_Locale_global;
}
#if defined (__BORLANDC__) && (__BORLANDC__ < 0x564)
template <>
_STLP_DECLSPEC locale::id time_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id time_get<char, const char*>::id;
*/
template <>
_STLP_DECLSPEC locale::id time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id time_put<char, char*>::id;
*/
# if !defined (_STLP_NO_WCHAR_T)
template <>
_STLP_DECLSPEC locale::id time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id time_get<wchar_t, const wchar_t*>::id;
*/
template <>
_STLP_DECLSPEC locale::id time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id time_put<wchar_t, wchar_t*>::id;
*/
# endif /* _STLP_NO_WCHAR_T */
template <>
_STLP_DECLSPEC locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id money_get<char, const char*>::id;
*/
template <>
_STLP_DECLSPEC locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id money_put<char, char*>::id;
*/
# if !defined (_STLP_NO_WCHAR_T)
template <>
_STLP_DECLSPEC locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id money_get<wchar_t, const wchar_t*>::id;
*/
template <>
_STLP_DECLSPEC locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id money_put<wchar_t, wchar_t*>::id;
*/
# endif
template <>
_STLP_DECLSPEC locale::id num_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id num_get<char, const char*>::id;
*/
# if !defined (STLP_NO_WCHAR_T)
template <>
_STLP_DECLSPEC locale::id num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id num_get<wchar_t, const wchar_t*>::id;
*/
# endif
template <>
_STLP_DECLSPEC locale::id num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id num_put<char, char*>::id;
*/
# if !defined (_STLP_NO_WCHAR_T)
template <>
_STLP_DECLSPEC locale::id num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
/*
template <>
_STLP_DECLSPEC locale::id num_put<wchar_t, wchar_t*>::id;
*/
# endif
#endif
// Declarations of (non-template) facets' static data members
// size_t locale::id::_S_max = 39; // made before
_STLP_STATIC_MEMBER_DECLSPEC locale::id collate<char>::id = { 1 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id ctype<char>::id = { 2 };
#ifndef _STLP_NO_MBSTATE_T
_STLP_STATIC_MEMBER_DECLSPEC locale::id codecvt<char, char, mbstate_t>::id = { 3 };
# ifndef _STLP_NO_WCHAR_T
_STLP_STATIC_MEMBER_DECLSPEC locale::id codecvt<wchar_t, char, mbstate_t>::id = { 22 };
# endif
#endif
_STLP_STATIC_MEMBER_DECLSPEC locale::id moneypunct<char, true>::id = { 4 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id moneypunct<char, false>::id = { 5 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id numpunct<char>::id = { 6 } ;
_STLP_STATIC_MEMBER_DECLSPEC locale::id messages<char>::id = { 7 };
#if defined (__BORLANDC__) && (__BORLANDC__ >= 0x564)
_STLP_STATIC_MEMBER_DECLSPEC locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id = { 8 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id = { 10 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id num_get<char, istreambuf_iterator<char, char_traits<char> > >::id = { 12 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id = { 14 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id time_get<char, istreambuf_iterator<char, char_traits<char> > >::id = { 16 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id = { 18 };
/*
_STLP_STATIC_MEMBER_DECLSPEC locale::id money_get<char, const char*>::id = { 9 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id money_put<char, char*>::id = { 11 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id num_get<char, const char*>::id = { 13 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id num_put<char, char*>::id = { 15 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id time_get<char, const char*>::id = { 17 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id time_put<char, char*>::id = { 19 };
*/
#endif
#ifndef _STLP_NO_WCHAR_T
_STLP_STATIC_MEMBER_DECLSPEC locale::id collate<wchar_t>::id = { 20 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id ctype<wchar_t>::id = { 21 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id moneypunct<wchar_t, true>::id = { 23 } ;
_STLP_STATIC_MEMBER_DECLSPEC locale::id moneypunct<wchar_t, false>::id = { 24 } ;
_STLP_STATIC_MEMBER_DECLSPEC locale::id numpunct<wchar_t>::id = { 25 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id messages<wchar_t>::id = { 26 };
#if defined (__BORLANDC__) && (__BORLANDC__ >= 0x564)
_STLP_STATIC_MEMBER_DECLSPEC locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id = { 27 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id = { 29 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id = { 31 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > ::id = { 33 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id = { 35 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id = { 37 };
/*
_STLP_STATIC_MEMBER_DECLSPEC locale::id money_get<wchar_t, const wchar_t*>::id = { 28 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id money_put<wchar_t, wchar_t*>::id = { 30 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id num_get<wchar_t, const wchar_t*>::id = { 32 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id num_put<wchar_t, wchar_t*>::id = { 34 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id time_get<wchar_t, const wchar_t*>::id = { 36 };
_STLP_STATIC_MEMBER_DECLSPEC locale::id time_put<wchar_t, wchar_t*>::id = { 38 };
*/
# endif
#endif
_STLP_DECLSPEC _Locale_impl* _STLP_CALL _get_Locale_impl(_Locale_impl *loc)
{
_STLP_ASSERT( loc != 0 );
loc->_M_incr();
return loc;
}
void _STLP_CALL _release_Locale_impl(_Locale_impl *& loc)
{
_STLP_ASSERT( loc != 0 );
if (loc->_M_decr() == 0) {
if (*loc != *_Stl_classic_locale)
delete loc;
else
loc->~_Locale_impl();
loc = 0;
}
}
_STLP_DECLSPEC _Locale_impl* _STLP_CALL _copy_Nameless_Locale_impl(_Locale_impl *loc)
{
_STLP_ASSERT( loc != 0 );
loc->_M_incr();
_Locale_impl *loc_new = new _Locale_impl(*loc);
loc->_M_decr();
loc_new->name = _Nameless;
return loc_new;
}
_STLP_END_NAMESPACE
// locale use many static functions/pointers from this file:
// to avoid making ones extern, simple #include implementation of locale
#include "locale.cpp.inline"

View File

@@ -1,134 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef LOCALE_IMPL_H
#define LOCALE_IMPL_H
#include <clocale> // C locale header file.
#include <vector>
#include <string>
#include <locale>
#include "c_locale.h"
_STLP_BEGIN_NAMESPACE
#if defined (_STLP_USE_TEMPLATE_EXPORT)
//Export of _Locale_impl facets container:
# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
//If we are using pointer specialization, vector<locale::facet*> will use
//the already exported vector<void*> implementation.
_STLP_EXPORT_TEMPLATE_CLASS allocator<locale::facet*>;
_STLP_MOVE_TO_PRIV_NAMESPACE
_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
_STLP_EXPORT_TEMPLATE_CLASS _Vector_base<locale::facet*, allocator<locale::facet*> >;
_STLP_MOVE_TO_STD_NAMESPACE
# endif
# if defined (_STLP_DEBUG)
_STLP_MOVE_TO_PRIV_NAMESPACE
# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
_STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
# undef _STLP_NON_DBG_VECTOR
_STLP_MOVE_TO_STD_NAMESPACE
# endif
_STLP_EXPORT_TEMPLATE_CLASS vector<locale::facet*, allocator<locale::facet*> >;
#endif
//----------------------------------------------------------------------
// Class _Locale_impl
// This is the base class which implements access only and is supposed to
// be used for classic locale only
class _STLP_CLASS_DECLSPEC _Locale_impl : public _Refcount_Base {
public:
_Locale_impl(const char* s);
_Locale_impl(const _Locale_impl&);
_Locale_impl(size_t n, const char* s);
private:
~_Locale_impl();
public:
size_t size() const { return facets_vec.size(); }
basic_string<char, char_traits<char>, allocator<char> > name;
static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_bad_cast();
private:
void operator=(const _Locale_impl&);
public:
class _STLP_CLASS_DECLSPEC Init {
public:
Init();
~Init();
private:
_Refcount_Base& _M_count() const;
};
static void _STLP_CALL _S_initialize();
static void _STLP_CALL _S_uninitialize();
static void make_classic_locale();
static void free_classic_locale();
friend class Init;
public: // _Locale
// void remove(size_t index);
locale::facet* insert(locale::facet*, size_t index);
void insert(_Locale_impl* from, const locale::id& n);
// Helper functions for byname construction of locales.
_Locale_name_hint* insert_ctype_facets(const char* name, _Locale_name_hint* hint);
_Locale_name_hint* insert_numeric_facets(const char* name, _Locale_name_hint* hint);
_Locale_name_hint* insert_time_facets(const char* name, _Locale_name_hint* hint);
_Locale_name_hint* insert_collate_facets(const char* name, _Locale_name_hint* hint);
_Locale_name_hint* insert_monetary_facets(const char* name, _Locale_name_hint* hint);
_Locale_name_hint* insert_messages_facets(const char* name, _Locale_name_hint* hint);
bool operator != (const locale& __loc) const { return __loc._M_impl != this; }
private:
vector<locale::facet*> facets_vec;
private:
friend _Locale_impl * _STLP_CALL _copy_Locale_impl( _Locale_impl * );
friend _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl * );
friend void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc );
#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
friend class _STLP_NO_MEM_T_NAME(loc);
#else
friend class locale;
#endif
};
void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc );
_Locale_impl * _STLP_CALL _copy_Locale_impl( _Locale_impl *loc );
_STLP_END_NAMESPACE
#endif
// Local Variables:
// mode:C++
// End:

View File

@@ -1,309 +0,0 @@
/*
* Copyright (c) 1997-1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_LOCK_FREE_SLIST_H
#define _STLP_LOCK_FREE_SLIST_H
#if defined(_STLP_PTHREADS)
# include <pthread.h>
# if defined (__GNUC__) && defined (__i386__)
# define _STLP_HAS_ATOMIC_FREELIST
/**
* Class that implements a non-blocking and thread-safe freelist.
* It is used for the lock-free node allocation engine.
*
* @author felixw@inin.com
*/
class _STLP_atomic_freelist {
public:
/**
* Type representing items of the freelist
*/
struct item {
item* _M_next;
};
_STLP_atomic_freelist() {
// Statically assert layout of member is as expected by assembly code
_STLP_STATIC_ASSERT(sizeof(_M) == 8)
_M._M_data._M_top = 0;
_M._M_data._M_sequence = 0;
}
/**
* Atomically pushes the specified item onto the freelist.
*
* @param __item [in] Item to add to the front of the list
*/
void push(item* __item) {
// NOTE: GCC uses ebx as the PIC register for globals in shared libraries.
// The GCC version I'm using (3.4.1) won't temporarily spill it if it's
// used as input, output, or clobber. Instead, it complains with a
// "can't find a register in class `BREG' while reloading `asm'" error.
// This is probably a compiler bug, but as the cmpxchg8b instruction
// requires ebx, I work around this here by using ecx for the '__item'
// input and spilling ebx into edi. This also precludes us from using
// a "m" operand for the cmpxchg8b argument (GCC might think it can make
// it relative to ebx). Instead, we're using esi for the address of _M_data.
//
int __tmp1; // These dummy variables are used to tell GCC that the eax, ecx,
int __tmp2; // and edx registers will not have the same value as their input.
int __tmp3; // The optimizer will remove them as their values are not used.
__asm__ __volatile__
(" movl %%ebx, %%edi\n\t"
" movl %%ecx, %%ebx\n\t"
"L1_%=: movl %%eax, (%%ebx)\n\t" // __item._M_next = _M._M_data._M_top
" leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1
"lock; cmpxchg8b (%%esi)\n\t"
" jne L1_%=\n\t" // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
" movl %%edi, %%ebx"
:"=a" (__tmp1), "=d" (__tmp2), "=c" (__tmp3)
:"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "c" (__item), "S" (&_M._M_data)
:"edi", "memory", "cc");
}
/**
* Atomically removes the topmost item from the freelist and returns a
* pointer to it. Returns NULL if the list is empty.
*
* @return Item that was removed from front of list; NULL if list empty
*/
item* pop() {
item* __result;
int __tmp;
__asm__ __volatile__
(" movl %%ebx, %%edi\n\t"
"L1_%=: testl %%eax, %%eax\n\t" // _M_top == NULL?
" je L2_%=\n\t" // If yes, we're done
" movl (%%eax), %%ebx\n\t" // new top = _M._M_data._M_top->_M_next
" leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1
"lock; cmpxchg8b (%%esi)\n\t"
" jne L1_%=\n\t" // We failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
"L2_%=: movl %%edi, %%ebx"
:"=a" (__result), "=d" (__tmp)
:"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "S" (&_M._M_data)
:"edi", "ecx", "memory", "cc");
return __result;
}
/**
* Atomically detaches all items from the list and returns a pointer to the
* topmost item. The items are still chained and may be traversed safely as
* they're now "owned" by the calling thread.
*
* @return Pointer to topmost item in the list; NULL if list empty
*/
item* clear() {
item* __result;
int __tmp;
__asm__ __volatile__
(" movl %%ebx, %%edi\n\t"
"L1_%=: testl %%eax, %%eax\n\t" // _M_top == NULL?
" je L2_%=\n\t" // If yes, we're done
" xorl %%ebx, %%ebx\n\t" // We're attempting to set _M_top to NULL
" leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1
"lock; cmpxchg8b (%%esi)\n\t"
" jne L1_%=\n\t" // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
"L2_%=: movl %%edi, %%ebx"
:"=a" (__result), "=d" (__tmp)
:"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "S" (&_M._M_data)
:"edi", "ecx", "memory", "cc");
return __result;
}
private:
union {
long long _M_align;
struct {
item* _M_top; // Topmost element in the freelist
unsigned int _M_sequence; // Sequence counter to prevent "ABA problem"
} _M_data;
} _M;
_STLP_atomic_freelist(const _STLP_atomic_freelist&);
_STLP_atomic_freelist& operator=(const _STLP_atomic_freelist&);
};
# endif /* if defined(__GNUC__) && defined(__i386__) */
#elif defined (_STLP_WIN32THREADS)
# if !defined (_WIN64)
# define _STLP_USE_ASM_IMPLEMENTATION
# endif
// Here are the compiler/platform requirements for the thread safe and
// lock free singly linked list implementation:
# if defined (_STLP_USE_ASM_IMPLEMENTATION)
// For the asm version:
# if defined (_STLP_MSVC) && defined (_M_IX86) && (_M_IX86 >= 500)
# define _STLP_HAS_ATOMIC_FREELIST
# endif
# else
// For the API based version:
# if defined (_STLP_NEW_PLATFORM_SDK) && (!defined (WINVER) || (WINVER >= 0x0501)) && \
(!defined (_WIN32_WINDOWS) || (_WIN32_WINDOWS >= 0x0501))
# define _STLP_HAS_ATOMIC_FREELIST
# endif
# endif
# if defined (_STLP_HAS_ATOMIC_FREELIST)
# if !defined (_STLP_USE_ASM_IMPLEMENTATION)
# include <windows.h>
# else
# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) || defined (__ICL)
# pragma warning (push)
# pragma warning (disable : 4035) //function has no return value
# endif
# endif
/**
* Class that implements a non-blocking and thread-safe freelist.
* It is used for the lock-free node allocation engine.
*
* @author felixw@inin.com
*/
class _STLP_atomic_freelist {
public:
/**
* Type representing items of the freelist
*/
# if defined (_STLP_USE_ASM_IMPLEMENTATION)
struct item {
item* _M_next;
};
# else
typedef SLIST_ENTRY item;
# endif
_STLP_atomic_freelist() {
// Statically assert layout of member is as expected by assembly code
# if defined (_STLP_USE_ASM_IMPLEMENTATION)
_STLP_STATIC_ASSERT((sizeof(item) == sizeof(item*)) && (sizeof(_M) == 8))
_M._M_data._M_top = 0;
_M._M_data._M_sequence = 0;
# else
InitializeSListHead(&_M_head);
# endif
}
/**
* Atomically pushes the specified item onto the freelist.
*
* @param __item [in] Item to add to the front of the list
*/
void push(item* __item) {
# if defined (_STLP_USE_ASM_IMPLEMENTATION)
__asm
{
mov esi, this
mov ebx, __item
mov eax, [esi] // _M._M_data._M_top
mov edx, [esi+4] // _M._M_data._M_sequence
L1: mov [ebx], eax // __item._M_next = _M._M_data._M_top
lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1
lock cmpxchg8b qword ptr [esi]
jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
}
# else
InterlockedPushEntrySList(&_M_head, __item);
# endif
}
/**
* Atomically removes the topmost item from the freelist and returns a
* pointer to it. Returns NULL if the list is empty.
*
* @return Item that was removed from front of list; NULL if list empty
*/
item* pop() {
# if defined (_STLP_USE_ASM_IMPLEMENTATION)
__asm
{
mov esi, this
mov eax, [esi] // _M._M_data._M_top
mov edx, [esi+4] // _M._M_data._M_sequence
L1: test eax, eax // _M_top == NULL?
je L2 // Yes, we're done
mov ebx, [eax] // new top = _M._M_data._M_top->_M_next
lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1
lock cmpxchg8b qword ptr [esi]
jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
L2:
}
# else
return InterlockedPopEntrySList(&_M_head);
# endif
}
/**
* Atomically detaches all items from the list and returns pointer to the
* topmost. The items are still chained and may be traversed safely as
* they're now "owned" by the calling thread.
*
* @return Pointer to topmost item in the list; NULL if list empty
*/
item* clear() {
# if defined (_STLP_USE_ASM_IMPLEMENTATION)
__asm
{
mov esi, this
mov eax, [esi] // _M._M_data._M_top
mov edx, [esi+4] // _M._M_data._M_sequence
L1: test eax, eax // _M_top == NULL?
je L2 // Yes, we're done
xor ebx,ebx // We're attempting to set _M._M_data._M_top to NULL
lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1
lock cmpxchg8b qword ptr [esi]
jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
L2:
}
# else
return InterlockedFlushSList(&_M_head);
# endif
}
private:
# if defined (_STLP_USE_ASM_IMPLEMENTATION)
union {
__int64 _M_align;
struct {
item* _M_top; // Topmost element in the freelist
unsigned int _M_sequence; // Sequence counter to prevent "ABA problem"
} _M_data;
} _M;
# else
SLIST_HEADER _M_head;
# endif
_STLP_atomic_freelist(const _STLP_atomic_freelist&);
_STLP_atomic_freelist& operator = (const _STLP_atomic_freelist&);
};
# if defined (_STLP_USE_ASM_IMPLEMENTATION)
# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) || defined (__ICL)
# pragma warning (pop)
# endif
# endif
# endif /* _STLP_HAS_ATOMIC_FREELIST */
#endif
#endif /* _STLP_LOCK_FREE_SLIST_H */

View File

@@ -1,168 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef MESSAGE_FACETS_H
#define MESSAGE_FACETS_H
#include <string>
#include <locale>
#include <typeinfo>
#include <hash_map>
#include "c_locale.h"
#include "acquire_release.h"
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
// Class _Catalog_locale_map. The reason for this is that, internally,
// a message string is always a char*. We need a ctype facet to convert
// a string to and from wchar_t, and the user is permitted to provide such
// a facet when calling open().
struct _Catalog_locale_map {
_Catalog_locale_map() : M(0) {}
~_Catalog_locale_map() { if (M) delete M; }
void insert(nl_catd_type key, const locale& L);
locale lookup(nl_catd_type key) const;
void erase(nl_catd_type key);
typedef hash_map<nl_catd_type, locale, hash<nl_catd_type>, equal_to<nl_catd_type> > map_type;
map_type *M;
private: // Invalidate copy constructor and assignment
_Catalog_locale_map(const _Catalog_locale_map&);
void operator=(const _Catalog_locale_map&);
};
/*
* In glibc nl_catd type is void *, but messages_base::catalog is defined as int
* by ISO/IEC 14882; The int may be too short to store pointer on 64-bit platforms;
* Another problem, is that do_open() may return negative value to indicate that no
* catalog open---this case can't be represented with pointers.
* The class _Catalog_nl_catd_map intended to make relation between
* messages_base::catalog and nl_catd handler.
*
*/
#if defined (_STLP_REAL_LOCALE_IMPLEMENTED) && (defined (_STLP_USE_GLIBC) && !defined (__CYGWIN__))
# define _STLP_USE_NL_CATD_MAPPING
#else
/* If no mapping a message_base::catalog entry, int typedef according C++ Standard 22.2.7.1,
* has to be large enough to contain a nl_catd_type value.
*/
_STLP_STATIC_ASSERT(sizeof(nl_catd_type) <= sizeof(int))
#endif
class _STLP_CLASS_DECLSPEC _Catalog_nl_catd_map {
public:
_Catalog_nl_catd_map()
{}
~_Catalog_nl_catd_map()
{}
typedef hash_map<messages_base::catalog, nl_catd_type, hash<messages_base::catalog>, equal_to<messages_base::catalog> > map_type;
typedef hash_map<nl_catd_type, messages_base::catalog, hash<nl_catd_type>, equal_to<nl_catd_type> > rmap_type;
// typedef map<messages_base::catalog,nl_catd_type> map_type;
// typedef map<nl_catd_type,messages_base::catalog> rmap_type;
messages_base::catalog insert(nl_catd_type cat)
#if !defined (_STLP_USE_NL_CATD_MAPPING)
{ return (messages_base::catalog)cat; }
#else
;
#endif
void erase(messages_base::catalog)
#if !defined (_STLP_USE_NL_CATD_MAPPING)
{}
#else
;
#endif
nl_catd_type operator [] ( messages_base::catalog cat ) const
#if !defined (_STLP_USE_NL_CATD_MAPPING)
{ return cat; }
#else
{ return cat < 0 ? 0 : M[cat]; }
#endif
private:
_Catalog_nl_catd_map(const _Catalog_nl_catd_map&);
_Catalog_nl_catd_map& operator =(const _Catalog_nl_catd_map&);
#if defined (_STLP_USE_NL_CATD_MAPPING)
mutable map_type M;
mutable rmap_type Mr;
static _STLP_VOLATILE __stl_atomic_t _count;
#endif
};
class _STLP_CLASS_DECLSPEC _Messages {
public:
typedef messages_base::catalog catalog;
_Messages();
virtual catalog do_open(const string& __fn, const locale& __loc) const;
virtual string do_get(catalog __c, int __set, int __msgid,
const string& __dfault) const;
#if !defined (_STLP_NO_WCHAR_T)
virtual wstring do_get(catalog __c, int __set, int __msgid,
const wstring& __dfault) const;
#endif
virtual void do_close(catalog __c) const;
virtual ~_Messages();
bool _M_delete;
};
class _STLP_CLASS_DECLSPEC _Messages_impl : public _Messages {
public:
_Messages_impl(bool, _Locale_name_hint* hint = 0);
_Messages_impl(bool, _Locale_messages*);
catalog do_open(const string& __fn, const locale& __loc) const;
string do_get(catalog __c, int __set, int __msgid,
const string& __dfault) const;
#if !defined (_STLP_NO_WCHAR_T)
wstring do_get(catalog __c, int __set, int __msgid,
const wstring& __dfault) const;
#endif
void do_close(catalog __c) const;
~_Messages_impl();
private:
_Locale_messages* _M_message_obj;
_Catalog_locale_map* _M_map;
mutable _Catalog_nl_catd_map _M_cat;
//private definition to avoid warning (with ICL)
_Messages_impl(const _Messages_impl&);
_Messages_impl& operator=(const _Messages_impl&);
};
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
#endif
// Local Variables:
// mode:C++
// End:

View File

@@ -1,98 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include "message_facets.h"
_STLP_BEGIN_NAMESPACE
//----------------------------------------------------------------------
// messages<char>
messages<char>::messages(_STLP_PRIV _Messages* imp) :
locale::facet(1), _M_impl(imp) { if (imp) imp->_M_delete = true; }
messages<char>::~messages()
{ if (_M_impl && _M_impl->_M_delete) delete _M_impl; }
messages<char>::catalog
messages<char>::do_open(const string& filename, const locale& l) const
{ return _M_impl->do_open(filename, l); }
string
messages<char>::do_get(catalog cat, int set, int p_id,
const string& dfault) const
{ return _M_impl->do_get(cat, set, p_id, dfault); }
void messages<char>::do_close(catalog cat) const
{ _M_impl->do_close(cat); }
_STLP_MOVE_TO_PRIV_NAMESPACE
_Messages::_Messages()
{}
_Messages::~_Messages()
{}
_Messages::catalog _Messages::do_open(const string&, const locale&) const
{ return -1; }
string _Messages::do_get(catalog, int, int, const string& dfault) const
{ return dfault; }
void _Messages::do_close(catalog) const
{}
_STLP_MOVE_TO_STD_NAMESPACE
#if !defined (_STLP_NO_WCHAR_T)
messages<wchar_t>::messages(_STLP_PRIV _Messages* imp) :
locale::facet(1), _M_impl(imp) { if (imp) imp->_M_delete = true; }
messages<wchar_t>::~messages()
{ if (_M_impl && _M_impl->_M_delete) delete _M_impl; }
messages<wchar_t>::catalog
messages<wchar_t>::do_open(const string& filename, const locale& L) const
{ return _M_impl->do_open(filename, L); }
wstring
messages<wchar_t>::do_get(catalog thecat,
int set, int p_id, const wstring& dfault) const
{ return _M_impl->do_get(thecat, set, p_id, dfault); }
void messages<wchar_t>::do_close(catalog cat) const
{ _M_impl->do_close(cat); }
_STLP_MOVE_TO_PRIV_NAMESPACE
wstring
_Messages::do_get(catalog, int, int, const wstring& dfault) const
{ return dfault; }
_STLP_MOVE_TO_STD_NAMESPACE
#endif
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,143 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <locale>
#include <istream>
_STLP_BEGIN_NAMESPACE
static void _Init_monetary_formats(money_base::pattern& pos_format,
money_base::pattern& neg_format) {
pos_format.field[0] = (char) money_base::symbol;
pos_format.field[1] = (char) money_base::sign;
pos_format.field[2] = (char) money_base::none;
pos_format.field[3] = (char) money_base::value;
neg_format.field[0] = (char) money_base::symbol;
neg_format.field[1] = (char) money_base::sign;
neg_format.field[2] = (char) money_base::none;
neg_format.field[3] = (char) money_base::value;
}
// This is being used throughout the library
static const string _S_empty_string;
#ifndef _STLP_NO_WCHAR_T
static const wstring _S_empty_wstring;
#endif
//
// moneypunct<>
//
moneypunct<char, true>::moneypunct(size_t __refs) : locale::facet(__refs)
{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
moneypunct<char, true>::~moneypunct() {}
char moneypunct<char, true>::do_decimal_point() const {return ' ';}
char moneypunct<char, true>::do_thousands_sep() const {return ' ';}
string moneypunct<char, true>::do_grouping() const { return _S_empty_string; }
string moneypunct<char, true>::do_curr_symbol() const { return _S_empty_string; }
string moneypunct<char, true>::do_positive_sign() const { return _S_empty_string; }
string moneypunct<char, true>::do_negative_sign() const { return _S_empty_string; }
money_base::pattern moneypunct<char, true>::do_pos_format() const {return _M_pos_format;}
money_base::pattern moneypunct<char, true>::do_neg_format() const {return _M_neg_format;}
int moneypunct<char, true>::do_frac_digits() const {return 0;}
moneypunct<char, false>::moneypunct(size_t __refs) : locale::facet(__refs)
{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
moneypunct<char, false>::~moneypunct() {}
char moneypunct<char, false>::do_decimal_point() const {return ' ';}
char moneypunct<char, false>::do_thousands_sep() const {return ' ';}
string moneypunct<char, false>::do_grouping() const { return _S_empty_string; }
string moneypunct<char, false>::do_curr_symbol() const { return _S_empty_string; }
string moneypunct<char, false>::do_positive_sign() const { return _S_empty_string; }
string moneypunct<char, false>::do_negative_sign() const { return _S_empty_string; }
money_base::pattern moneypunct<char, false>::do_pos_format() const {return _M_pos_format;}
money_base::pattern moneypunct<char, false>::do_neg_format() const {return _M_neg_format;}
int moneypunct<char, false>::do_frac_digits() const {return 0;}
#ifndef _STLP_NO_WCHAR_T
moneypunct<wchar_t, true>::moneypunct(size_t __refs) : locale::facet(__refs)
{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
moneypunct<wchar_t, true>::~moneypunct() {}
wchar_t moneypunct<wchar_t, true>::do_decimal_point() const {return L' ';}
wchar_t moneypunct<wchar_t, true>::do_thousands_sep() const {return L' ';}
string moneypunct<wchar_t, true>::do_grouping() const {return _S_empty_string;}
wstring moneypunct<wchar_t, true>::do_curr_symbol() const
{return _S_empty_wstring;}
wstring moneypunct<wchar_t, true>::do_positive_sign() const
{return _S_empty_wstring;}
wstring moneypunct<wchar_t, true>::do_negative_sign() const
{return _S_empty_wstring;}
int moneypunct<wchar_t, true>::do_frac_digits() const {return 0;}
money_base::pattern moneypunct<wchar_t, true>::do_pos_format() const
{return _M_pos_format;}
money_base::pattern moneypunct<wchar_t, true>::do_neg_format() const
{return _M_neg_format;}
moneypunct<wchar_t, false>::moneypunct(size_t __refs) : locale::facet(__refs)
{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
moneypunct<wchar_t, false>::~moneypunct() {}
wchar_t moneypunct<wchar_t, false>::do_decimal_point() const {return L' ';}
wchar_t moneypunct<wchar_t, false>::do_thousands_sep() const {return L' ';}
string moneypunct<wchar_t, false>::do_grouping() const { return _S_empty_string;}
wstring moneypunct<wchar_t, false>::do_curr_symbol() const
{return _S_empty_wstring;}
wstring moneypunct<wchar_t, false>::do_positive_sign() const
{return _S_empty_wstring;}
wstring moneypunct<wchar_t, false>::do_negative_sign() const
{return _S_empty_wstring;}
int moneypunct<wchar_t, false>::do_frac_digits() const {return 0;}
money_base::pattern moneypunct<wchar_t, false>::do_pos_format() const
{return _M_pos_format;}
money_base::pattern moneypunct<wchar_t, false>::do_neg_format() const
{return _M_neg_format;}
#endif /* WCHAR_T */
//
// Instantiations
//
#if !defined(_STLP_NO_FORCE_INSTANTIATE)
template class _STLP_CLASS_DECLSPEC money_get<char, istreambuf_iterator<char, char_traits<char> > >;
template class _STLP_CLASS_DECLSPEC money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
// template class money_put<char, char*>;
# ifndef _STLP_NO_WCHAR_T
template class _STLP_CLASS_DECLSPEC money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
template class _STLP_CLASS_DECLSPEC money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
// template class money_put<wchar_t, wchar_t*>;
// template class money_get<wchar_t, const wchar_t*>;
# endif
#endif
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,120 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <locale>
#include <istream>
#include <algorithm>
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
// __valid_grouping compares two strings, one representing the
// group sizes encountered when reading an integer, and the other
// representing the valid group sizes as returned by the numpunct
// grouping() member function. Both are interpreted right-to-left.
// The grouping string is treated as if it were extended indefinitely
// with its last value. For a grouping to be valid, each term in
// the first string must be equal to the corresponding term in the
// second, except for the last, which must be less than or equal.
// boris : this takes reversed first string !
bool _STLP_CALL
__valid_grouping(const char * first1, const char * last1,
const char * first2, const char * last2) {
if (first1 == last1 || first2 == last2) return true;
--last1; --last2;
while (first1 != last1) {
if (*last1 != *first2)
return false;
--last1;
if (first2 != last2) ++first2;
}
return *last1 <= *first2;
}
_STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned __index) {
static const unsigned char __val_table[128] = {
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
};
return __val_table[__index];
}
_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms()
{ return "+-0xX"; }
// index is actually a char
#if !defined (_STLP_NO_WCHAR_T)
// Similar, except return the character itself instead of the numeric
// value. Used for floating-point input.
bool _STLP_CALL __get_fdigit(wchar_t& c, const wchar_t* digits) {
const wchar_t* p = find(digits, digits + 10, c);
if (p != digits + 10) {
c = (char)('0' + (p - digits));
return true;
}
else
return false;
}
bool _STLP_CALL __get_fdigit_or_sep(wchar_t& c, wchar_t sep,
const wchar_t * digits) {
if (c == sep) {
c = (char)',';
return true;
}
else
return __get_fdigit(c, digits);
}
#endif
_STLP_MOVE_TO_STD_NAMESPACE
#if !defined(_STLP_NO_FORCE_INSTANTIATE)
//----------------------------------------------------------------------
// Force instantiation of of num_get<>
template class _STLP_CLASS_DECLSPEC istreambuf_iterator<char, char_traits<char> >;
// template class num_get<char, const char*>;
template class num_get<char, istreambuf_iterator<char, char_traits<char> > >;
# if !defined (_STLP_NO_WCHAR_T)
template class _STLP_CLASS_DECLSPEC istreambuf_iterator<wchar_t, char_traits<wchar_t> >;
template class num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
// template class num_get<wchar_t, const wchar_t*>;
# endif
#endif
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,996 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <limits>
#include <locale>
#include <istream>
#if defined (__GNUC__) && !defined (__sun) || \
defined (__DMC__)
# include <stdint.h>
#endif
#if defined (__linux__) && !defined(__ANDROID__)
# include <ieee754.h>
union _ll {
uint64_t i64;
struct {
# if defined (_STLP_BIG_ENDIAN)
uint32_t hi;
uint32_t lo;
# elif defined (_STLP_LITTLE_ENDIAN)
uint32_t lo;
uint32_t hi;
# else
# error Unknown endianess
# endif
} i32;
};
#endif
#if defined (N_PLAT_NLM)
# include <nlm/nwintxx.h>
# if defined (INT64)
typedef unsigned INT64 uint64_t;
# else
// #error "Can't find INT64"
// 64-bit int really not defined in headers
// (_INTEGRAL_MAX_BITS < 64 in any case?), but compiler indeed know __int64
// - ptr, 2005-05-06
typedef unsigned __int64 uint64_t;
# endif
# if defined (INT32)
typedef unsigned INT32 uint32_t;
# else
# error Can not find INT32
# endif
union _ll {
uint64_t i64;
struct {
uint32_t lo;
uint32_t hi;
} i32;
};
#endif
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
//----------------------------------------------------------------------
// num_get
// Helper functions for _M_do_get_float.
#if !defined (_STLP_NO_WCHAR_T)
void _STLP_CALL
_Initialize_get_float( const ctype<wchar_t>& ct,
wchar_t& Plus, wchar_t& Minus,
wchar_t& pow_e, wchar_t& pow_E,
wchar_t* digits) {
char ndigits[11] = "0123456789";
Plus = ct.widen('+');
Minus = ct.widen('-');
pow_e = ct.widen('e');
pow_E = ct.widen('E');
ct.widen(ndigits + 0, ndigits + 10, digits);
}
#endif /* WCHAR_T */
/*
* __string_to_double is just lifted from atof, the difference being
* that we just use '.' for the decimal point, rather than let it
* be taken from the current C locale, which of course is not accessible
* to us.
*/
#if defined (_STLP_MSVC) || defined (__BORLANDC__) || defined (__ICL)
typedef unsigned long uint32;
typedef unsigned __int64 uint64;
# define ULL(x) x##Ui64
#elif defined (__MRC__) || defined (__SC__)
typedef unsigned long uint32;
# include "uint64.h" //*TY 03/25/2000 - added 64bit math type definition
#elif defined (__unix) || defined (__MINGW32__) || defined (N_PLAT_NLM) || \
(defined (__DMC__) && (__LONGLONG)) || defined(__PIPS__) || \
defined(ANDROID)
typedef uint32_t uint32;
typedef uint64_t uint64;
# define ULL(x) x##ULL
#else
# error There should be some unsigned 64-bit integer on the system!
#endif
// Multiplication of two 64-bit integers, giving a 128-bit result.
// Taken from Algorithm M in Knuth section 4.3.1, with the loop
// hand-unrolled.
static void _Stl_mult64(const uint64 u, const uint64 v,
uint64& high, uint64& low) {
const uint64 low_mask = ULL(0xffffffff);
const uint64 u0 = u & low_mask;
const uint64 u1 = u >> 32;
const uint64 v0 = v & low_mask;
const uint64 v1 = v >> 32;
uint64 t = u0 * v0;
low = t & low_mask;
t = u1 * v0 + (t >> 32);
uint64 w1 = t & low_mask;
uint64 w2 = t >> 32;
uint64 x = u0 * v1 + w1;
low += (x & low_mask) << 32;
high = u1 * v1 + w2 + (x >> 32);
}
#define bit11 ULL(0x7ff)
#define exponent_mask (bit11 << 52)
#if !defined (__GNUC__) || (__GNUC__ != 3) || (__GNUC_MINOR__ != 4) || \
(!defined (__CYGWIN__) && !defined (__MINGW32__))
//Generate bad code when compiled with -O2 option.
inline
#endif
void _Stl_set_exponent(uint64 &val, uint64 exp)
{ val = (val & ~exponent_mask) | ((exp & bit11) << 52); }
/* Power of ten fractions for tenscale*/
/* The constants are factored so that at most two constants
* and two multiplies are needed. Furthermore, one of the constants
* is represented exactly - 10**n where 1<= n <= 27.
*/
#if !defined (__SC__) //*TY 03/25/2000 - no native 64bit integer under SCpp
static const uint64 _Stl_tenpow[80] = {
ULL(0xa000000000000000), /* _Stl_tenpow[0]=(10**1)/(2**4) */
ULL(0xc800000000000000), /* _Stl_tenpow[1]=(10**2)/(2**7) */
ULL(0xfa00000000000000), /* _Stl_tenpow[2]=(10**3)/(2**10) */
ULL(0x9c40000000000000), /* _Stl_tenpow[3]=(10**4)/(2**14) */
ULL(0xc350000000000000), /* _Stl_tenpow[4]=(10**5)/(2**17) */
ULL(0xf424000000000000), /* _Stl_tenpow[5]=(10**6)/(2**20) */
ULL(0x9896800000000000), /* _Stl_tenpow[6]=(10**7)/(2**24) */
ULL(0xbebc200000000000), /* _Stl_tenpow[7]=(10**8)/(2**27) */
ULL(0xee6b280000000000), /* _Stl_tenpow[8]=(10**9)/(2**30) */
ULL(0x9502f90000000000), /* _Stl_tenpow[9]=(10**10)/(2**34) */
ULL(0xba43b74000000000), /* _Stl_tenpow[10]=(10**11)/(2**37) */
ULL(0xe8d4a51000000000), /* _Stl_tenpow[11]=(10**12)/(2**40) */
ULL(0x9184e72a00000000), /* _Stl_tenpow[12]=(10**13)/(2**44) */
ULL(0xb5e620f480000000), /* _Stl_tenpow[13]=(10**14)/(2**47) */
ULL(0xe35fa931a0000000), /* _Stl_tenpow[14]=(10**15)/(2**50) */
ULL(0x8e1bc9bf04000000), /* _Stl_tenpow[15]=(10**16)/(2**54) */
ULL(0xb1a2bc2ec5000000), /* _Stl_tenpow[16]=(10**17)/(2**57) */
ULL(0xde0b6b3a76400000), /* _Stl_tenpow[17]=(10**18)/(2**60) */
ULL(0x8ac7230489e80000), /* _Stl_tenpow[18]=(10**19)/(2**64) */
ULL(0xad78ebc5ac620000), /* _Stl_tenpow[19]=(10**20)/(2**67) */
ULL(0xd8d726b7177a8000), /* _Stl_tenpow[20]=(10**21)/(2**70) */
ULL(0x878678326eac9000), /* _Stl_tenpow[21]=(10**22)/(2**74) */
ULL(0xa968163f0a57b400), /* _Stl_tenpow[22]=(10**23)/(2**77) */
ULL(0xd3c21bcecceda100), /* _Stl_tenpow[23]=(10**24)/(2**80) */
ULL(0x84595161401484a0), /* _Stl_tenpow[24]=(10**25)/(2**84) */
ULL(0xa56fa5b99019a5c8), /* _Stl_tenpow[25]=(10**26)/(2**87) */
ULL(0xcecb8f27f4200f3a), /* _Stl_tenpow[26]=(10**27)/(2**90) */
ULL(0xd0cf4b50cfe20766), /* _Stl_tenpow[27]=(10**55)/(2**183) */
ULL(0xd2d80db02aabd62c), /* _Stl_tenpow[28]=(10**83)/(2**276) */
ULL(0xd4e5e2cdc1d1ea96), /* _Stl_tenpow[29]=(10**111)/(2**369) */
ULL(0xd6f8d7509292d603), /* _Stl_tenpow[30]=(10**139)/(2**462) */
ULL(0xd910f7ff28069da4), /* _Stl_tenpow[31]=(10**167)/(2**555) */
ULL(0xdb2e51bfe9d0696a), /* _Stl_tenpow[32]=(10**195)/(2**648) */
ULL(0xdd50f1996b947519), /* _Stl_tenpow[33]=(10**223)/(2**741) */
ULL(0xdf78e4b2bd342cf7), /* _Stl_tenpow[34]=(10**251)/(2**834) */
ULL(0xe1a63853bbd26451), /* _Stl_tenpow[35]=(10**279)/(2**927) */
ULL(0xe3d8f9e563a198e5), /* _Stl_tenpow[36]=(10**307)/(2**1020) */
ULL(0xfd87b5f28300ca0e), /* _Stl_tenpow[37]=(10**-28)/(2**-93) */
ULL(0xfb158592be068d2f), /* _Stl_tenpow[38]=(10**-56)/(2**-186) */
ULL(0xf8a95fcf88747d94), /* _Stl_tenpow[39]=(10**-84)/(2**-279) */
ULL(0xf64335bcf065d37d), /* _Stl_tenpow[40]=(10**-112)/(2**-372) */
ULL(0xf3e2f893dec3f126), /* _Stl_tenpow[41]=(10**-140)/(2**-465) */
ULL(0xf18899b1bc3f8ca2), /* _Stl_tenpow[42]=(10**-168)/(2**-558) */
ULL(0xef340a98172aace5), /* _Stl_tenpow[43]=(10**-196)/(2**-651) */
ULL(0xece53cec4a314ebe), /* _Stl_tenpow[44]=(10**-224)/(2**-744) */
ULL(0xea9c227723ee8bcb), /* _Stl_tenpow[45]=(10**-252)/(2**-837) */
ULL(0xe858ad248f5c22ca), /* _Stl_tenpow[46]=(10**-280)/(2**-930) */
ULL(0xe61acf033d1a45df), /* _Stl_tenpow[47]=(10**-308)/(2**-1023) */
ULL(0xe3e27a444d8d98b8), /* _Stl_tenpow[48]=(10**-336)/(2**-1116) */
ULL(0xe1afa13afbd14d6e) /* _Stl_tenpow[49]=(10**-364)/(2**-1209) */
#else //*TY 03/20/2000 - added support for SCpp which lacks native 64bit integer type
static const UnsignedWide _Stl_tenpow[80] = {
ULL2(0xa0000000,0x00000000), /* _Stl_tenpow[0]=(10**1)/(2**4) */
ULL2(0xc8000000,0x00000000), /* _Stl_tenpow[1]=(10**2)/(2**7) */
ULL2(0xfa000000,0x00000000), /* _Stl_tenpow[2]=(10**3)/(2**10) */
ULL2(0x9c400000,0x00000000), /* _Stl_tenpow[3]=(10**4)/(2**14) */
ULL2(0xc3500000,0x00000000), /* _Stl_tenpow[4]=(10**5)/(2**17) */
ULL2(0xf4240000,0x00000000), /* _Stl_tenpow[5]=(10**6)/(2**20) */
ULL2(0x98968000,0x00000000), /* _Stl_tenpow[6]=(10**7)/(2**24) */
ULL2(0xbebc2000,0x00000000), /* _Stl_tenpow[7]=(10**8)/(2**27) */
ULL2(0xee6b2800,0x00000000), /* _Stl_tenpow[8]=(10**9)/(2**30) */
ULL2(0x9502f900,0x00000000), /* _Stl_tenpow[9]=(10**10)/(2**34) */
ULL2(0xba43b740,0x00000000), /* _Stl_tenpow[10]=(10**11)/(2**37) */
ULL2(0xe8d4a510,0x00000000), /* _Stl_tenpow[11]=(10**12)/(2**40) */
ULL2(0x9184e72a,0x00000000), /* _Stl_tenpow[12]=(10**13)/(2**44) */
ULL2(0xb5e620f4,0x80000000), /* _Stl_tenpow[13]=(10**14)/(2**47) */
ULL2(0xe35fa931,0xa0000000), /* _Stl_tenpow[14]=(10**15)/(2**50) */
ULL2(0x8e1bc9bf,0x04000000), /* _Stl_tenpow[15]=(10**16)/(2**54) */
ULL2(0xb1a2bc2e,0xc5000000), /* _Stl_tenpow[16]=(10**17)/(2**57) */
ULL2(0xde0b6b3a,0x76400000), /* _Stl_tenpow[17]=(10**18)/(2**60) */
ULL2(0x8ac72304,0x89e80000), /* _Stl_tenpow[18]=(10**19)/(2**64) */
ULL2(0xad78ebc5,0xac620000), /* _Stl_tenpow[19]=(10**20)/(2**67) */
ULL2(0xd8d726b7,0x177a8000), /* _Stl_tenpow[20]=(10**21)/(2**70) */
ULL2(0x87867832,0x6eac9000), /* _Stl_tenpow[21]=(10**22)/(2**74) */
ULL2(0xa968163f,0x0a57b400), /* _Stl_tenpow[22]=(10**23)/(2**77) */
ULL2(0xd3c21bce,0xcceda100), /* _Stl_tenpow[23]=(10**24)/(2**80) */
ULL2(0x84595161,0x401484a0), /* _Stl_tenpow[24]=(10**25)/(2**84) */
ULL2(0xa56fa5b9,0x9019a5c8), /* _Stl_tenpow[25]=(10**26)/(2**87) */
ULL2(0xcecb8f27,0xf4200f3a), /* _Stl_tenpow[26]=(10**27)/(2**90) */
ULL2(0xd0cf4b50,0xcfe20766), /* _Stl_tenpow[27]=(10**55)/(2**183) */
ULL2(0xd2d80db0,0x2aabd62c), /* _Stl_tenpow[28]=(10**83)/(2**276) */
ULL2(0xd4e5e2cd,0xc1d1ea96), /* _Stl_tenpow[29]=(10**111)/(2**369) */
ULL2(0xd6f8d750,0x9292d603), /* _Stl_tenpow[30]=(10**139)/(2**462) */
ULL2(0xd910f7ff,0x28069da4), /* _Stl_tenpow[31]=(10**167)/(2**555) */
ULL2(0xdb2e51bf,0xe9d0696a), /* _Stl_tenpow[32]=(10**195)/(2**648) */
ULL2(0xdd50f199,0x6b947519), /* _Stl_tenpow[33]=(10**223)/(2**741) */
ULL2(0xdf78e4b2,0xbd342cf7), /* _Stl_tenpow[34]=(10**251)/(2**834) */
ULL2(0xe1a63853,0xbbd26451), /* _Stl_tenpow[35]=(10**279)/(2**927) */
ULL2(0xe3d8f9e5,0x63a198e5), /* _Stl_tenpow[36]=(10**307)/(2**1020) */
ULL2(0xfd87b5f2,0x8300ca0e), /* _Stl_tenpow[37]=(10**-28)/(2**-93) */
ULL2(0xfb158592,0xbe068d2f), /* _Stl_tenpow[38]=(10**-56)/(2**-186) */
ULL2(0xf8a95fcf,0x88747d94), /* _Stl_tenpow[39]=(10**-84)/(2**-279) */
ULL2(0xf64335bc,0xf065d37d), /* _Stl_tenpow[40]=(10**-112)/(2**-372) */
ULL2(0xf3e2f893,0xdec3f126), /* _Stl_tenpow[41]=(10**-140)/(2**-465) */
ULL2(0xf18899b1,0xbc3f8ca2), /* _Stl_tenpow[42]=(10**-168)/(2**-558) */
ULL2(0xef340a98,0x172aace5), /* _Stl_tenpow[43]=(10**-196)/(2**-651) */
ULL2(0xece53cec,0x4a314ebe), /* _Stl_tenpow[44]=(10**-224)/(2**-744) */
ULL2(0xea9c2277,0x23ee8bcb), /* _Stl_tenpow[45]=(10**-252)/(2**-837) */
ULL2(0xe858ad24,0x8f5c22ca), /* _Stl_tenpow[46]=(10**-280)/(2**-930) */
ULL2(0xe61acf03,0x3d1a45df), /* _Stl_tenpow[47]=(10**-308)/(2**-1023) */
ULL2(0xe3e27a44,0x4d8d98b8), /* _Stl_tenpow[48]=(10**-336)/(2**-1116) */
ULL2(0xe1afa13a,0xfbd14d6e) /* _Stl_tenpow[49]=(10**-364)/(2**-1209) */
#endif
};
static const short _Stl_twoexp[80] = {
4,7,10,14,17,20,24,27,30,34,37,40,44,47,50,54,57,60,64,67,70,74,77,80,84,87,90,
183,276,369,462,555,648,741,834,927,1020,
-93,-186,-279,-372,-465,-558,-651,-744,-837,-930,-1023,-1116,-1209
};
#define TEN_1 0 /* offset to 10 ** 1 */
#define TEN_27 26 /* offset to 10 ** 27 */
#define TEN_M28 37 /* offset to 10 ** -28 */
#define NUM_HI_P 11
#define NUM_HI_N 13
#define _Stl_HIBITULL (ULL(1) << 63)
static void _Stl_norm_and_round(uint64& p, int& norm, uint64 prodhi, uint64 prodlo) {
norm = 0;
if ((prodhi & _Stl_HIBITULL) == 0) {
/* leading bit is a zero
* may have to normalize
*/
if ((prodhi == ~_Stl_HIBITULL) &&
((prodlo >> 62) == 0x3)) { /* normalization followed by round
* would cause carry to create
* extra bit, so don't normalize
*/
p = _Stl_HIBITULL;
return;
}
p = (prodhi << 1) | (prodlo >> 63); /* normalize */
norm = 1;
prodlo <<= 1;
}
else {
p = prodhi;
}
if ((prodlo & _Stl_HIBITULL) != 0) { /* first guard bit a one */ //*TY 03/25/2000 - added explicit comparison to zero to avoid reliance to the implicit conversion from uint64 to bool
#if !defined (__SC__) //*TY 03/25/2000 -
if (((p & 0x1) != 0) ||
prodlo != _Stl_HIBITULL ) { /* not borderline for round to even */
#else //*TY 03/25/2000 - added workaround for SCpp compiler
bool b1 = ((p & 0x1) != 0);
if (b1 || prodlo != _Stl_HIBITULL) { //*TY 03/25/2000 - SCpp confuses on this particular original boolean expression
#endif //*TY 03/25/2000 -
/* round */
++p;
if (p == 0)
++p;
}
}
return;
}
// Convert a 64-bitb fraction * 10^exp to a 64-bit fraction * 2^bexp.
// p: 64-bit fraction
// exp: base-10 exponent
// bexp: base-2 exponent (output parameter)
static void _Stl_tenscale(uint64& p, int exp, int& bexp) {
uint64 prodhi, prodlo; /* 128b product */
int exp_hi, exp_lo; /* exp = exp_hi*32 + exp_lo */
int hi, lo, tlo, thi; /* offsets in power of ten table */
int norm; /* number of bits of normalization */
int num_hi; /* number of high exponent powers */
bexp = 0;
if (exp > 0) { /* split exponent */
exp_lo = exp;
exp_hi = 0;
if (exp_lo > 27) {
exp_lo++;
while (exp_lo > 27) {
exp_hi++;
exp_lo -= 28;
}
}
tlo = TEN_1;
thi = TEN_27;
num_hi = NUM_HI_P;
}
else if (exp < 0) {
exp_lo = exp;
exp_hi = 0;
while (exp_lo < 0) {
exp_hi++;
exp_lo += 28;
}
tlo = TEN_1;
thi = TEN_M28;
num_hi = NUM_HI_N;
}
else { /* no scaling needed */
return;
}
while (exp_hi) { /* scale */
hi = (min) (exp_hi, num_hi); /* only a few large powers of 10 */
exp_hi -= hi; /* could iterate in extreme case */
hi += thi-1;
_Stl_mult64(p, _Stl_tenpow[hi], prodhi, prodlo);
_Stl_norm_and_round(p, norm, prodhi, prodlo);
bexp += _Stl_twoexp[hi] - norm;
}
if (exp_lo) {
lo = tlo + exp_lo -1;
_Stl_mult64(p, _Stl_tenpow[lo], prodhi, prodlo);
_Stl_norm_and_round(p, norm, prodhi, prodlo);
bexp += _Stl_twoexp[lo] - norm;
}
return;
}
// First argument is a buffer of values from 0 to 9, NOT ascii.
// Second argument is number of digits in buffer, 1 <= digits <= 17.
// Third argument is base-10 exponent.
#if defined (__SC__) || defined (__MRC__)
//*TY 04/06/2000 - powermac's 68K emulator utilizes apple's SANE floating point, which is not compatible with IEEE format.
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
# include <fp.h>
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
static inline double _Stl_atod(char *buffer, int ndigit, int dexp) {
decimal d; // ref. inside macintosh powerpc numerics p.9-13
d.sgn = 0;
d.exp = dexp;
d.sig.length = ndigit;
for (int i = 0; i < ndigit; ++i) {
d.sig.text[i] = buffer[i] + '0';
}
return dec2num(&d);
}
#else /* IEEE representation */
# if !defined (__linux__) || defined(__ANDROID__)
static double _Stl_atod(char *buffer, int ndigit, int dexp) {
uint64 value; /* Value develops as follows:
* 1) decimal digits as an integer
* 2) left adjusted fraction
* 3) right adjusted fraction
* 4) exponent and fraction
*/
uint32 guard; /* First guard bit */
uint64 rest; /* Remaining guard bits */
int bexp; /* binary exponent */
int nzero; /* number of non-zero bits */
int sexp; /* scaling exponent */
char *bufferend; /* pointer to char after last digit */
/* Check for zero and treat it as a special case */
if (buffer == 0){
return 0.0;
}
/* Convert the decimal digits to a binary integer. */
bufferend = buffer + ndigit;
value = 0;
while (buffer < bufferend) {
value *= 10;
value += *buffer++;
}
/* Check for zero and treat it as a special case */
if (value == 0) {
return 0.0;
}
/* Normalize value */
bexp = 64; /* convert from 64b int to fraction */
/* Count number of non-zeroes in value */
nzero = 0;
if ((value >> 32) != 0) { nzero = 32; } //*TY 03/25/2000 - added explicit comparison to zero to avoid uint64 to bool conversion operator
if ((value >> (16 + nzero)) != 0) { nzero += 16; }
if ((value >> ( 8 + nzero)) != 0) { nzero += 8; }
if ((value >> ( 4 + nzero)) != 0) { nzero += 4; }
if ((value >> ( 2 + nzero)) != 0) { nzero += 2; }
if ((value >> ( 1 + nzero)) != 0) { nzero += 1; }
if ((value >> ( nzero)) != 0) { nzero += 1; }
/* Normalize */
value <<= /*(uint64)*/ (64 - nzero); //*TY 03/25/2000 - removed extraneous cast to uint64
bexp -= 64 - nzero;
/* At this point we have a 64b fraction and a binary exponent
* but have yet to incorporate the decimal exponent.
*/
/* multiply by 10^dexp */
_Stl_tenscale(value, dexp, sexp);
bexp += sexp;
if (bexp <= -1022) { /* HI denorm or underflow */
bexp += 1022;
if (bexp < -53) { /* guaranteed underflow */
value = 0;
}
else { /* denorm or possible underflow */
int lead0 = 12 - bexp; /* 12 sign and exponent bits */
/* we must special case right shifts of more than 63 */
if (lead0 > 64) {
rest = value;
guard = 0;
value = 0;
}
else if (lead0 == 64) {
rest = value & ((ULL(1)<< 63)-1);
#if !defined(__SC__)
guard = (uint32) ((value>> 63) & 1 );
#else
guard = to_ulong((value>> 63) & 1 ); //*TY 03/25/2000 - use member function instead of problematic conversion operator utilization
#endif
value = 0;
}
else {
rest = value & (((ULL(1) << lead0)-1)-1);
#if !defined(__SC__)
guard = (uint32) (((value>> lead0)-1) & 1);
#else //*TY 03/25/2000 -
guard = to_ulong(((value>> lead0)-1) & 1);
#endif //*TY 03/25/2000 -
value >>= /*(uint64)*/ lead0; /* exponent is zero */
}
/* Round */
if (guard && ((value & 1) || rest) ) {
++value;
if (value == (ULL(1) << 52)) { /* carry created normal number */
value = 0;
_Stl_set_exponent(value, 1);
}
}
}
}
else { /* not zero or denorm */
/* Round to 53 bits */
rest = value & (1<<10)-1;
value >>= 10;
#if !defined(__SC__)
guard = (uint32) value & 1;
#else //*TY 03/25/2000 -
guard = to_ulong(value & 1);
#endif
value >>= 1;
/* value&1 guard rest Action
*
* dc 0 dc none
* 1 1 dc round
* 0 1 0 none
* 0 1 !=0 round
*/
if (guard) {
if (((value&1)!=0) || (rest!=0)) {
++value; /* round */
if ((value >> 53) != 0) { /* carry all the way across */
value >>= 1; /* renormalize */
++bexp;
}
}
}
/*
* Check for overflow
* IEEE Double Precision Format
* (From Table 7-8 of Kane and Heinrich)
*
* Fraction bits 52
* Emax +1023
* Emin -1022
* Exponent bias +1023
* Exponent bits 11
* Integer bit hidden
* Total width in bits 64
*/
if (bexp > 1024) { /* overflow */
return numeric_limits<double>::infinity();
}
else { /* value is normal */
value &= ~(ULL(1) << 52); /* hide hidden bit */
_Stl_set_exponent(value, bexp + 1022); /* add bias */
}
}
_STLP_STATIC_ASSERT(sizeof(value) == sizeof(double))
return *((double *) &value);
}
# else // __linux__
static double _Stl_atod(char *buffer, int ndigit, int dexp) {
ieee754_double v;
char *bufferend; /* pointer to char after last digit */
/* Check for zero and treat it as a special case */
if (buffer == 0) {
return 0.0;
}
/* Convert the decimal digits to a binary integer. */
bufferend = buffer + ndigit;
_ll vv;
vv.i64 = 0L;
while (buffer < bufferend) {
vv.i64 *= 10;
vv.i64 += *buffer++;
}
/* Check for zero and treat it as a special case */
if (vv.i64 == 0){
return 0.0;
}
/* Normalize value */
int bexp = 64; /* convert from 64b int to fraction */
/* Count number of non-zeroes in value */
int nzero = 0;
if ((vv.i64 >> 32) !=0 ) { nzero = 32; } //*TY 03/25/2000 - added explicit comparison to zero to avoid uint64 to bool conversion operator
if ((vv.i64 >> (16 + nzero)) != 0) { nzero += 16; }
if ((vv.i64 >> ( 8 + nzero)) != 0) { nzero += 8; }
if ((vv.i64 >> ( 4 + nzero)) != 0) { nzero += 4; }
if ((vv.i64 >> ( 2 + nzero)) != 0) { nzero += 2; }
if ((vv.i64 >> ( 1 + nzero)) != 0) { nzero += 1; }
if ((vv.i64 >> ( nzero)) != 0) { nzero += 1; }
/* Normalize */
nzero = 64 - nzero;
vv.i64 <<= nzero; //*TY 03/25/2000 - removed extraneous cast to uint64
bexp -= nzero;
/* At this point we have a 64b fraction and a binary exponent
* but have yet to incorporate the decimal exponent.
*/
/* multiply by 10^dexp */
int sexp;
_Stl_tenscale(vv.i64, dexp, sexp);
bexp += sexp;
if (bexp <= -1022) { /* HI denorm or underflow */
bexp += 1022;
if (bexp < -53) { /* guaranteed underflow */
vv.i64 = 0;
}
else { /* denorm or possible underflow */
int lead0;
uint64_t rest;
uint32_t guard;
lead0 = 12-bexp; /* 12 sign and exponent bits */
/* we must special case right shifts of more than 63 */
if (lead0 > 64) {
rest = vv.i64;
guard = 0;
vv.i64 = 0;
}
else if (lead0 == 64) {
rest = vv.i64 & ((ULL(1) << 63)-1);
#if !defined(__SC__)
guard = (uint32) ((vv.i64 >> 63) & 1 );
#else
guard = to_ulong((vv.i64 >> 63) & 1 ); //*TY 03/25/2000 - use member function instead of problematic conversion operator utilization
#endif
vv.i64 = 0;
}
else {
rest = vv.i64 & (((ULL(1) << lead0)-1)-1);
#if !defined(__SC__)
guard = (uint32) (((vv.i64 >> lead0)-1) & 1);
#else //*TY 03/25/2000 -
guard = to_ulong(((vv.i64 >> lead0)-1) & 1);
#endif //*TY 03/25/2000 -
vv.i64 >>= /*(uint64)*/ lead0; /* exponent is zero */
}
/* Round */
if (guard && ( (vv.i64 & 1) || rest)) {
vv.i64++;
if (vv.i64 == (ULL(1) << 52)) { /* carry created normal number */
v.ieee.mantissa0 = 0;
v.ieee.mantissa1 = 0;
v.ieee.negative = 0;
v.ieee.exponent = 1;
return v.d;
}
}
}
}
else { /* not zero or denorm */
/* Round to 53 bits */
uint64_t rest = vv.i64 & (1<<10)-1;
vv.i64 >>= 10;
#if !defined(__SC__)
uint32_t guard = (uint32) vv.i64 & 1;
#else //*TY 03/25/2000 -
uint32_t guard = to_ulong(vv.i64 & 1);
#endif
vv.i64 >>= 1;
/* value&1 guard rest Action
*
* dc 0 dc none
* 1 1 dc round
* 0 1 0 none
* 0 1 !=0 round
*/
if (guard) {
if (((vv.i64&1)!=0) || (rest!=0)) {
vv.i64++; /* round */
if ((vv.i64>>53)!=0) { /* carry all the way across */
vv.i64 >>= 1; /* renormalize */
++bexp;
}
}
}
/*
* Check for overflow
* IEEE Double Precision Format
* (From Table 7-8 of Kane and Heinrich)
*
* Fraction bits 52
* Emax +1023
* Emin -1022
* Exponent bias +1023
* Exponent bits 11
* Integer bit hidden
* Total width in bits 64
*/
if (bexp > 1024) { /* overflow */
return numeric_limits<double>::infinity();
}
else { /* value is normal */
vv.i64 &= ~(ULL(1) << 52); /* hide hidden bit */
v.ieee.mantissa0 = vv.i32.hi;
v.ieee.mantissa1 = vv.i32.lo;
v.ieee.negative = 0;
v.ieee.exponent = bexp + 1022;
return v.d;
}
}
v.ieee.mantissa0 = vv.i32.hi;
v.ieee.mantissa1 = vv.i32.lo;
v.ieee.negative = 0;
v.ieee.exponent = 0;
return v.d;
}
# endif // __linux__
#endif
static double _Stl_string_to_double(const char *s) {
const int max_digits = 17;
unsigned c;
unsigned Negate, decimal_point;
char *d;
int exp;
double x;
int dpchar;
char digits[max_digits];
// Skip leading whitespace, if any.
const ctype<char>& ct = use_facet<ctype<char> >(locale::classic());
while (c = *s++, ct.is(ctype_base::space, char(c))) {}
/* process sign */
Negate = 0;
if (c == '+') {
c = *s++;
}
else if (c == '-') {
Negate = 1;
c = *s++;
}
d = digits;
dpchar = '.' - '0';
decimal_point = 0;
exp = 0;
for (;;) {
c -= '0';
if (c < 10) {
if (d == digits + max_digits) {
/* ignore more than 17 digits, but adjust exponent */
exp += (decimal_point ^ 1);
}
else {
if (c == 0 && d == digits) {
/* ignore leading zeros */
}
else {
*d++ = (char) c;
}
exp -= decimal_point;
}
}
else if (c == (unsigned int) dpchar && !decimal_point) { /* INTERNATIONAL */
decimal_point = 1;
}
else {
break;
}
c = *s++;
}
/* strtod cant return until it finds the end of the exponent */
if (d == digits) {
return 0.0;
}
if (c == 'e'-'0' || c == 'E'-'0') {
register unsigned negate_exp = 0;
register int e = 0;
c = *s++;
if (c == '+' || c == ' ') {
c = *s++;
}
else if (c == '-') {
negate_exp = 1;
c = *s++;
}
if (c -= '0', c < 10) {
do {
if (e <= 340)
e = e * 10 + (int)c;
else break;
c = *s++;
}
while (c -= '0', c < 10);
if (negate_exp) {
e = -e;
}
if (e < -340 || e > 340)
exp = e;
else
exp += e;
}
}
if (exp < -340) {
x = 0;
}
else if (exp > 308) {
x = numeric_limits<double>::infinity();
}
else {
/* let _Stl_atod diagnose under- and over-flows */
/* if the input was == 0.0, we have already returned,
so retval of +-Inf signals OVERFLOW, 0.0 UNDERFLOW
*/
x = _Stl_atod(digits, (int)(d - digits), exp);
}
if (Negate) {
x = -x;
}
return x;
}
#if !defined (_STLP_NO_LONG_DOUBLE)
/*
* __string_to_long_double is just lifted from atold, the difference being
* that we just use '.' for the decimal point, rather than let it
* be taken from the current C locale, which of course is not accessible
* to us.
*/
static long double
_Stl_string_to_long_double(const char * s) {
const int max_digits = 34;
register unsigned c;
register unsigned Negate, decimal_point;
register char *d;
register int exp;
long double x;
register int dpchar;
char digits[max_digits];
const ctype<char>& ct = use_facet<ctype<char> >(locale::classic());
while (c = *s++, ct.is(ctype_base::space, char(c)))
;
/* process sign */
Negate = 0;
if (c == '+') {
c = *s++;
}
else if (c == '-') {
Negate = 1;
c = *s++;
}
d = digits;
dpchar = '.' - '0';
decimal_point = 0;
exp = 0;
for (;;) {
c -= '0';
if (c < 10) {
if (d == digits+max_digits) {
/* ignore more than 34 digits, but adjust exponent */
exp += (decimal_point ^ 1);
}
else {
if (c == 0 && d == digits) {
/* ignore leading zeros */
;
}
else {
*d++ = (char)c;
}
exp -= decimal_point;
}
}
else if ((char)c == dpchar && !decimal_point) { /* INTERNATIONAL */
decimal_point = 1;
}
else {
break;
}
c = *s++;
} /* for */
if (d == digits) {
return 0.0L;
}
if (c == 'e'-'0' || c == 'E'-'0') {
register unsigned negate_exp = 0;
register int e = 0;
c = *s++;
if (c == '+' || c == ' ') {
c = *s++;
}
else if (c == '-') {
negate_exp = 1;
c = *s++;
}
if (c -= '0', c < 10) {
do {
if (e <= 340)
e = e * 10 + c;
else break;
c = *s++;
}
while (c -= '0', c < 10);
if (negate_exp) {
e = -e;
}
if (e < -(323+max_digits) || e > 308)
exp = e;
else
exp += e;
}
}
if (exp < -(324+max_digits)) {
x = 0;
}
else if (exp > 308) {
x = numeric_limits<long double>::infinity();
}
else {
/* let _Stl_atod diagnose under- and over-flows */
/* if the input was == 0.0, we have already returned,
so retval of +-Inf signals OVERFLOW, 0.0 UNDERFLOW
*/
// x = _Stl_atod (digits, (int)(d - digits), exp); // TEMPORARY!!:1
double tmp = _Stl_atod (digits, (int)(d - digits), exp); // TEMPORARY!!:1
x = tmp == numeric_limits<double>::infinity()
? numeric_limits<long double>::infinity()
: tmp;
}
if (Negate) {
x = -x;
}
return x;
}
#endif
void _STLP_CALL
__string_to_float(const __iostring& v, float& val)
{ val = (float)_Stl_string_to_double(v.c_str()); }
void _STLP_CALL
__string_to_float(const __iostring& v, double& val)
{ val = _Stl_string_to_double(v.c_str()); }
#if !defined (_STLP_NO_LONG_DOUBLE)
void _STLP_CALL
__string_to_float(const __iostring& v, long double& val)
{ val = _Stl_string_to_long_double(v.c_str()); }
#endif
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,177 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <locale>
#include <ostream>
_STLP_BEGIN_NAMESPACE
// Note that grouping[0] is the number of digits in the *rightmost* group.
// We assume, without checking, that *last is null and that there is enough
// space in the buffer to extend the number past [first, last).
template <class Char>
static ptrdiff_t
__insert_grouping_aux(Char* first, Char* last, const string& grouping,
Char separator, Char Plus, Char Minus,
int basechars) {
typedef string::size_type str_size;
if (first == last)
return 0;
int sign = 0;
if (*first == Plus || *first == Minus) {
sign = 1;
++first;
}
first += basechars;
str_size n = 0; // Index of the current group.
Char* cur_group = last; // Points immediately beyond the rightmost
// digit of the current group.
int groupsize = 0; // Size of the current group.
for (;;) {
groupsize = n < grouping.size() ? grouping[n] : groupsize;
++n;
if (groupsize <= 0 || groupsize >= cur_group - first)
break;
// Insert a separator character just before position cur_group - groupsize
cur_group -= groupsize;
++last;
copy_backward(cur_group, last, last + 1);
*cur_group = separator;
}
return (last - first) + sign + basechars;
}
//Dynamic output buffer version.
template <class Char, class Str>
static void
__insert_grouping_aux( /* __basic_iostring<Char> */ Str& iostr, size_t __group_pos,
const string& grouping,
Char separator, Char Plus, Char Minus,
int basechars) {
typedef string::size_type str_size;
if (iostr.size() < __group_pos)
return;
size_t __first_pos = 0;
Char __first = *iostr.begin();
if (__first == Plus || __first == Minus) {
++__first_pos;
}
__first_pos += basechars;
str_size n = 0; // Index of the current group.
typename basic_string<Char>::iterator cur_group(iostr.begin() + __group_pos); // Points immediately beyond the rightmost
// digit of the current group.
unsigned int groupsize = 0; // Size of the current group.
for (;;) {
groupsize = n < grouping.size() ? grouping[n] : groupsize;
++n;
if (groupsize <= 0 || groupsize >= ((cur_group - iostr.begin()) + __first_pos))
break;
// Insert a separator character just before position cur_group - groupsize
cur_group -= groupsize;
cur_group = iostr.insert(cur_group, separator);
}
}
//----------------------------------------------------------------------
// num_put
_STLP_MOVE_TO_PRIV_NAMESPACE
_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo()
{ return "0123456789abcdefx"; }
_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi()
{ return "0123456789ABCDEFX"; }
char* _STLP_CALL
__write_integer(char* buf, ios_base::fmtflags flags, long x) {
char tmp[64];
char* bufend = tmp+64;
char* beg = __write_integer_backward(bufend, flags, x);
return copy(beg, bufend, buf);
}
///-------------------------------------
ptrdiff_t _STLP_CALL
__insert_grouping(char * first, char * last, const string& grouping,
char separator, char Plus, char Minus, int basechars) {
return __insert_grouping_aux(first, last, grouping,
separator, Plus, Minus, basechars);
}
void _STLP_CALL
__insert_grouping(__iostring &str, size_t group_pos, const string& grouping,
char separator, char Plus, char Minus, int basechars) {
__insert_grouping_aux(str, group_pos, grouping, separator, Plus, Minus, basechars);
}
#if !defined (_STLP_NO_WCHAR_T)
ptrdiff_t _STLP_CALL
__insert_grouping(wchar_t* first, wchar_t* last, const string& grouping,
wchar_t separator, wchar_t Plus, wchar_t Minus,
int basechars) {
return __insert_grouping_aux(first, last, grouping, separator,
Plus, Minus, basechars);
}
void _STLP_CALL
__insert_grouping(__iowstring &str, size_t group_pos, const string& grouping,
wchar_t separator, wchar_t Plus, wchar_t Minus,
int basechars) {
__insert_grouping_aux(str, group_pos, grouping, separator, Plus, Minus, basechars);
}
#endif
_STLP_MOVE_TO_STD_NAMESPACE
//----------------------------------------------------------------------
// Force instantiation of num_put<>
#if !defined(_STLP_NO_FORCE_INSTANTIATE)
template class _STLP_CLASS_DECLSPEC ostreambuf_iterator<char, char_traits<char> >;
// template class num_put<char, char*>;
template class num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
# ifndef _STLP_NO_WCHAR_T
template class ostreambuf_iterator<wchar_t, char_traits<wchar_t> >;
template class num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
// template class num_put<wchar_t, wchar_t*>;
# endif /* INSTANTIATE_WIDE_STREAMS */
#endif
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,867 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <cmath>
#include <ios>
#include <locale>
#if defined (__DECCXX)
# define NDIG 400
#else
# define NDIG 82
#endif
#if defined (_STLP_NO_LONG_DOUBLE)
# define MAXECVT 17
# define MAXFCVT 18
typedef double max_double_type;
#else
# define MAXECVT 35
# define MAXFCVT 36
typedef long double max_double_type;
#endif
#define MAXFSIG MAXECVT
#define MAXESIZ 5
#define todigit(x) ((x)+'0')
#if defined (_STLP_UNIX)
# if defined (__sun)
# include <floatingpoint.h>
# endif
# if defined (__sun) || defined (__digital__) || defined (__sgi) || defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
// DEC, SGI & Solaris need this
# include <values.h>
# include <nan.h>
# endif
# if defined (__QNXNTO__) || ( defined(__GNUC__) && defined(__APPLE__) ) || defined(_STLP_USE_UCLIBC) /* 0.9.26 */ || \
defined(__FreeBSD__) || defined(ANDROID)
# define USE_SPRINTF_INSTEAD
# endif
# if defined( _AIX ) // JFA 3-Aug-2000
# include <math.h>
# include <float.h>
# endif
#endif
#include <cstdio>
#include <cstdlib>
//#if defined(_CRAY)
//# include <stdlib.h>
//#endif
#if defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__) || defined (__DJGPP) || \
defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
# include <float.h>
#endif
#if defined(__MRC__) || defined(__SC__) || defined(_CRAY) //*TY 02/24/2000 - added support for MPW
# include <fp.h>
#endif
#if defined (__CYGWIN__)
# include <ieeefp.h>
#endif
#if defined (__MSL__)
# include <cstdlib> // for atoi
# include <cstdio> // for snprintf
# include <algorithm>
# include <cassert>
#endif
#if defined (__ISCPP__)
# include <cfloat>
#endif
#include <algorithm>
#if defined (__DMC__)
# define snprintf _snprintf
#endif
#if defined(__hpux) && (!defined(_INCLUDE_HPUX_SOURCE) || defined(__GNUC__))
extern "C" double erf(double);
extern "C" double erfc(double);
extern "C" double gamma(double); /* obsolescent */
extern "C" double hypot(double, double);
extern "C" int isnan(double);
extern "C" double j0(double);
extern "C" double j1(double);
extern "C" double jn(int, double);
extern "C" double lgamma(double);
extern "C" double y0(double);
extern "C" double y1(double);
extern "C" double yn(int, double);
# define HUGE_VALF _SINFINITY
# define INFINITY _SINFINITY
# define NAN _SQNAN
# define isnan(x) _ISNAN(x)
# define isinf(x) _ISINF(x)
# define signbit(x) _SIGNBIT(x)
# define isfinite(x) _ISFINITE(x)
# define isnormal(x) _ISNORMAL(x)
# define fpclassify(x) _FPCLASSIFY(x)
# define isunordered(x,y) _ISUNORDERED(x,y)
# define isgreater(x,y) _ISGREATER(x,y)
# define isgreaterequal(x,y) _ISGREATEREQUAL(x,y)
# define isless(x,y) _ISLESS(x,y)
# define islessequal(x,y) _ISLESSEQUAL(x,y)
# define islessgreater(x,y) _ISLESSGREATER(x,y)
# define FP_NORMAL 0
# define FP_ZERO 1
# define FP_INFINITE 2
# define FP_SUBNORMAL 3
# define FP_NAN 4
# define DECIMAL_DIG 17
# define _IS64(x) (sizeof(x) == sizeof(double))
# define _IS32(x) (sizeof(x) == sizeof(float))
extern "C" {
extern double copysign(double, double);
extern const float _SINFINITY;
extern const float _SQNAN;
# if defined (_PA_RISC)
# define _ISNAN(x) (_IS32(x)?_Isnanf(x):(isnan)(x))
# define _ISINF(x) (_IS32(x)?_Isinff(x):_Isinf(x))
# define _SIGNBIT(x) (_IS32(x)?_Signbitf(x):_Signbit(x))
# define _ISFINITE(x) (_IS32(x)?_Isfinitef(x):_Isfinite(x))
# define _ISNORMAL(x) (_IS32(x)?_Isnormalf(x):_Isnormal(x))
# define _FPCLASSIFY(x) (_IS32(x)?_Fpclassifyf(x)>>1:_Fpclassify(x)>>1)
# define _ISUNORDERED(x,y) (_IS32(x)&&_IS32(y)?_Isunorderedf(x,y):_Isunordered(x,y))
extern int _Signbit(double);
extern int _Signbitf(float);
extern int _Isnanf(float);
extern int _Isfinite(double);
extern int _Isfinitef(float);
extern int _Isinf(double);
extern int _Isinff(float);
extern int _Isnormal(double);
extern int _Isnormalf(float);
extern int _Isunordered(double, double);
extern int _Isunorderedf(float, float);
extern int _Fpclassify(double);
extern int _Fpclassifyf(float);
# else
# include "math_ia64_internal.h"
# define _FPCLASSIFY(x) (_IS32(x)?_Fpclassf(x):_Fpclass(x))
extern int _Fpclass(double);
extern int _Fpclassf(float);
# endif
}
# if !defined (_INCLUDE_XOPEN_SOURCE_EXTENDED)
extern "C" char *fcvt(double, int, int *, int *);
extern "C" char *ecvt(double, int, int *, int *);
# endif
# if !defined (_INCLUDE_HPUX_SOURCE)
# if !defined (_LONG_DOUBLE)
# define _LONG_DOUBLE
typedef struct {
uint32_t word1, word2, word3, word4;
} long_double;
# endif /* _LONG_DOUBLE */
extern "C" char *_ldecvt(long_double, int, int *, int *);
extern "C" char *_ldfcvt(long_double, int, int *, int *);
# endif
#endif /* __hpux */
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
#if defined (__MWERKS__) || defined(__BEOS__)
# define USE_SPRINTF_INSTEAD
#endif
#if defined (_AIX) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
// Some OS'es only provide non-reentrant primitives, so we have to use additional synchronization here
# if !defined(_REENTRANT) && !defined(_THREAD_SAFE) && !(defined(_POSIX_THREADS) && defined(__OpenBSD__))
# define LOCK_CVT
# define RETURN_CVT(ecvt, x, n, pt, sign, buf) return ecvt(x, n, pt, sign);
# else
static _STLP_STATIC_MUTEX __put_float_mutex _STLP_MUTEX_INITIALIZER;
# define LOCK_CVT _STLP_auto_lock lock(__put_float_mutex);
# define RETURN_CVT(ecvt, x, n, pt, sign, buf) strcpy(buf, ecvt(x, n, pt, sign)); return buf;
# endif // !_REENTRANT
#endif // _AIX || __FreeBSD__ || __NetBSD__ || __OpenBSD__
// Tests for infinity and NaN differ on different OSs. We encapsulate
// these differences here.
#if !defined (USE_SPRINTF_INSTEAD)
# if defined (__hpux) || defined (__DJGPP) || (defined (_STLP_USE_GLIBC) && ! defined (__MSL__)) || \
defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__)
static inline bool _Stl_is_nan_or_inf(double x)
# if defined (isfinite)
{ return !isfinite(x); }
# else
{ return !finite(x); }
# endif
static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && ( copysign(1., x) < 0 ); }
static inline bool _Stl_is_inf(double x) { return isinf(x); }
// inline bool _Stl_is_neg_inf(double x) { return isinf(x) < 0; }
static inline bool _Stl_is_neg_inf(double x) { return isinf(x) && x < 0; }
# elif (defined (__unix) || defined (__unix__)) && \
!defined (__APPLE__) && !defined (__DJGPP) && !defined(__osf__) && \
!defined (_CRAY)
static inline bool _Stl_is_nan_or_inf(double x) { return IsNANorINF(x); }
static inline bool _Stl_is_inf(double x) { return IsNANorINF(x) && IsINF(x); }
static inline bool _Stl_is_neg_inf(double x) { return (IsINF(x)) && (x < 0.0); }
static inline bool _Stl_is_neg_nan(double x) { return IsNegNAN(x); }
# elif defined (__BORLANDC__) && ( __BORLANDC__ < 0x540 )
static inline bool _Stl_is_nan_or_inf(double x) { return !_finite(x); }
static inline bool _Stl_is_inf(double x) { return _Stl_is_nan_or_inf(x) && ! _isnan(x);}
static inline bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && x < 0 ; }
static inline bool _Stl_is_neg_nan(double x) { return _isnan(x) && x < 0 ; }
# elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__)
static inline bool _Stl_is_nan_or_inf(double x) { return !_finite(x); }
static inline bool _Stl_is_inf(double x) {
int fclass = _fpclass(x);
return fclass == _FPCLASS_NINF || fclass == _FPCLASS_PINF;
}
static inline bool _Stl_is_neg_inf(double x) { return _fpclass(x) == _FPCLASS_NINF; }
static inline bool _Stl_is_neg_nan(double x) { return _isnan(x) && _copysign(1., x) < 0 ; }
# elif defined (__MRC__) || defined (__SC__) //*TY 02/24/2000 - added support for MPW
static bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !isfinite(x); }
static bool _Stl_is_inf(double x) { return !isfinite(x); }
static bool _Stl_is_neg_inf(double x) { return !isfinite(x) && signbit(x); }
static bool _Stl_is_neg_nan(double x) { return isnan(x) && signbit(x); }
# elif /* defined(__FreeBSD__) || defined(__OpenBSD__) || */ (defined(__GNUC__) && defined(__APPLE__))
static inline bool _Stl_is_nan_or_inf(double x) { return !finite(x); }
static inline bool _Stl_is_inf(double x) { return _Stl_is_nan_or_inf(x) && ! isnan(x); }
static inline bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && x < 0 ; }
static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && copysign(1., x) < 0 ; }
# elif defined( _AIX ) // JFA 11-Aug-2000
static bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !finite(x); }
static bool _Stl_is_inf(double x) { return !finite(x); }
// bool _Stl_is_neg_inf(double x) { return _class(x) == FP_MINUS_INF; }
static bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && ( copysign(1., x) < 0 ); }
static bool _Stl_is_neg_nan(double x) { return isnan(x) && ( copysign(1., x) < 0 ); }
# elif defined (__ISCPP__)
static inline bool _Stl_is_nan_or_inf (double x) { return _fp_isINF(x) || _fp_isNAN(x); }
static inline bool _Stl_is_inf (double x) { return _fp_isINF(x); }
static inline bool _Stl_is_neg_inf (double x) { return _fp_isINF(x) && x < 0; }
static inline bool _Stl_is_neg_nan (double x) { return _fp_isNAN(x) && x < 0; }
# elif defined (_CRAY)
# if defined (_CRAYIEEE)
static inline bool _Stl_is_nan_or_inf(double x) { return isnan(x) || isinf(x); }
static inline bool _Stl_is_inf(double x) { return isinf(x); }
static inline bool _Stl_is_neg_inf(double x) { return isinf(x) && signbit(x); }
static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && signbit(x); }
# else
static inline bool _Stl_is_nan_or_inf(double x) { return false; }
static inline bool _Stl_is_inf(double x) { return false; }
static inline bool _Stl_is_neg_inf(double x) { return false; }
static inline bool _Stl_is_neg_nan(double x) { return false; }
# endif
# else // nothing from above
# define USE_SPRINTF_INSTEAD
# endif
#endif // !USE_SPRINTF_INSTEAD
#if !defined (USE_SPRINTF_INSTEAD)
// Reentrant versions of floating-point conversion functions. The argument
// lists look slightly different on different operating systems, so we're
// encapsulating the differences here.
# if defined (__CYGWIN__) || defined(__DJGPP)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return ecvtbuf(x, n, pt, sign, buf); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return fcvtbuf(x, n, pt, sign, buf); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return ecvtbuf(x, n, pt, sign, buf); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return fcvtbuf(x, n, pt, sign, buf); }
# endif
# elif defined (_STLP_USE_GLIBC)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return buf + ecvt_r(x, n, pt, sign, buf, NDIG+2); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return buf + fcvt_r(x, n, pt, sign, buf, NDIG+2); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return buf + qecvt_r(x, n, pt, sign, buf, NDIG+2); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return buf + qfcvt_r(x, n, pt, sign, buf, NDIG+2); }
# endif
# elif defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return ecvt(x, n, pt, sign); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return fcvt(x, n, pt, sign); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return ecvtl(x, n, pt, sign); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return fcvtl(x, n, pt, sign); }
# endif
# elif defined (__sun)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return econvert(x, n, pt, sign, buf); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return fconvert(x, n, pt, sign, buf); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return qeconvert(&x, n, pt, sign, buf); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return qfconvert(&x, n, pt, sign, buf); }
# endif
# elif defined (__DECCXX)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return (ecvt_r(x, n, pt, sign, buf, NDIG)==0 ? buf : 0); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return (fcvt_r(x, n, pt, sign, buf, NDIG)==0 ? buf : 0); }
# if !defined (_STLP_NO_LONG_DOUBLE)
// fbp : no "long double" conversions !
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return (ecvt_r((double)x, n, pt, sign, buf, NDIG)==0 ? buf : 0) ; }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return (fcvt_r((double)x, n, pt, sign, buf, NDIG)==0 ? buf : 0); }
# endif
# elif defined (__hpux)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return ecvt(x, n, pt, sign); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return fcvt(x, n, pt, sign); }
# if !defined (_STLP_NO_LONG_DOUBLE)
# if defined( _REENTRANT ) && (defined(_PTHREADS_DRAFT4) || defined(PTHREAD_THREADS_MAX))
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return (_ldecvt_r(*(long_double*)&x, n, pt, sign, buf, NDIG+2)==0 ? buf : 0); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return (_ldfcvt_r(*(long_double*)&x, n, pt, sign, buf, NDIG+2)==0 ? buf : 0); }
# else
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return _ldecvt(*(long_double*)&x, n, pt, sign); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return _ldfcvt(*(long_double*)&x, n, pt, sign); }
# endif
# endif
# elif defined (_AIX) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ LOCK_CVT RETURN_CVT(ecvt, x, n, pt, sign, buf) }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ LOCK_CVT RETURN_CVT(fcvt, x, n, pt, sign, buf) }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ LOCK_CVT RETURN_CVT(ecvt, x, n, pt, sign, buf) }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ LOCK_CVT RETURN_CVT(fcvt, x, n, pt, sign, buf) }
# endif
# elif defined (__unix) && !defined (__APPLE__) && !defined (_CRAY)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return ecvt_r(x, n, pt, sign, buf); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return fcvt_r(x, n, pt, sign, buf); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return qecvt_r(x, n, pt, sign, buf); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return qfcvt_r(x, n, pt, sign, buf); }
# endif
# elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__)
// those guys claim _cvt functions being reentrant.
# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
# define _STLP_APPEND(a, b) a##b
# define _STLP_BUF_PARAMS , char* buf, size_t bsize
# define _STLP_SECURE_FUN(F, X, N, PT, SIGN) _STLP_APPEND(F, _s)(buf, bsize, X, N, PT, SIGN); return buf
# else
# define _STLP_CVT_DONT_NEED_BUF
# define _STLP_BUF_PARAMS
# define _STLP_SECURE_FUN(F, X, N, PT, SIGN) return F(X, N, PT, SIGN)
# endif
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
{ _STLP_SECURE_FUN(_ecvt, x, n, pt, sign); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
{ _STLP_SECURE_FUN(_fcvt, x, n, pt, sign); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
{ _STLP_SECURE_FUN(_ecvt, (double)x, n, pt, sign); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
{ _STLP_SECURE_FUN(_fcvt, (double)x, n, pt, sign); }
# endif
# undef _STLP_SECURE_FUN
# undef _STLP_BUF_PARAMS
# undef _STLP_APPEND
# elif defined (__ISCPP__)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return _fp_ecvt( x, n, pt, sign, buf); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return _fp_fcvt(x, n, pt, sign, buf); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return _fp_ecvt( x, n, pt, sign, buf); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return _fp_fcvt(x, n, pt, sign, buf); }
# endif
# elif defined (__MRC__) || defined (__SC__) || defined (_CRAY)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* )
{ return ecvt( x, n, pt, sign ); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* )
{ return fcvt(x, n, pt, sign); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* )
{ return ecvt( x, n, pt, sign ); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* )
{ return fcvt(x, n, pt, sign); }
# endif
# endif
# if defined (_STLP_CVT_DONT_NEED_BUF)
# define _STLP_CVT_BUFFER(B)
# elif !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
# define _STLP_CVT_BUFFER(B) , B
# else
# define _STLP_CVT_BUFFER(B) , _STLP_ARRAY_AND_SIZE(B)
# endif
# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
# define _STLP_BUFFER(B) B
# else
# define _STLP_BUFFER(B) _STLP_ARRAY_AND_SIZE(B)
# endif
//----------------------------------------------------------------------
// num_put
// __format_float formats a mantissa and exponent as returned by
// one of the conversion functions (ecvt_r, fcvt_r, qecvt_r, qfcvt_r)
// according to the specified precision and format flags. This is
// based on doprnt but is much simpler since it is concerned only
// with floating point input and does not consider all formats. It
// also does not deal with blank padding, which is handled by
// __copy_float_and_fill.
static size_t __format_float_scientific( __iostring& buf, const char *bp,
int decpt, int sign, bool is_zero,
ios_base::fmtflags flags,
int precision, bool /* islong */)
{
// sign if required
if (sign)
buf += '-';
else if (flags & ios_base::showpos)
buf += '+';
// first digit of mantissa
buf += *bp++;
// start of grouping position, grouping won't occur in scientific notation
// as it is impossible to have something like 1234.0e04 but we return a correct
// group position for coherency with __format_float_fixed.
size_t __group_pos = buf.size();
// decimal point if required
if (precision != 0 || flags & ios_base::showpoint) {
buf += '.';
}
// rest of mantissa
int rz = precision;
while (rz-- > 0 && *bp != 0)
buf += *bp++;
// exponent
char expbuf[MAXESIZ + 2];
char *suffix = expbuf + MAXESIZ;
*suffix = 0;
if (!is_zero) {
int nn = decpt - 1;
if (nn < 0)
nn = -nn;
for (; nn > 9; nn /= 10)
*--suffix = (char) todigit(nn % 10);
*--suffix = (char) todigit(nn);
}
// prepend leading zeros to exponent
while (suffix > &expbuf[MAXESIZ - 2])
*--suffix = '0';
// put in the exponent sign
*--suffix = (char) ((decpt > 0 || is_zero ) ? '+' : '-');
// put in the e
*--suffix = flags & ios_base::uppercase ? 'E' : 'e';
// copy the suffix
buf += suffix;
return __group_pos;
}
static size_t __format_float_fixed( __iostring &buf, const char *bp,
int decpt, int sign, bool /* x */,
ios_base::fmtflags flags,
int precision, bool islong )
{
if ( sign && (decpt > -precision) && (*bp != 0) )
buf += '-';
else if ( flags & ios_base::showpos )
buf += '+';
int k = 0;
int maxfsig = islong ? 2*MAXFSIG : MAXFSIG;
// digits before decimal point
int nnn = decpt;
do {
buf += ((nnn <= 0 || *bp == 0 || k >= maxfsig) ? '0' : (++k, *bp++));
} while ( --nnn > 0 );
// start of grouping position
size_t __group_pos = buf.size();
// decimal point if needed
if ( flags & ios_base::showpoint || precision > 0 ) {
buf += '.';
}
// digits after decimal point if any
nnn = (min) (precision, MAXFCVT);
while ( --nnn >= 0 ) {
buf += (++decpt <= 0 || *bp == 0 || k >= maxfsig) ? '0' : (++k, *bp++);
}
// trailing zeros if needed
if ( precision > MAXFCVT ) {
buf.append( precision - MAXFCVT, '0' );
}
return __group_pos;
}
static void __format_nan_or_inf(__iostring& buf, double x, ios_base::fmtflags flags)
{
static const char* inf[2] = { "inf", "Inf" };
static const char* nan[2] = { "nan", "NaN" };
const char** inf_or_nan;
if (_Stl_is_inf(x)) { // Infinity
inf_or_nan = inf;
if (_Stl_is_neg_inf(x))
buf += '-';
else if (flags & ios_base::showpos)
buf += '+';
} else { // NaN
inf_or_nan = nan;
if (_Stl_is_neg_nan(x))
buf += '-';
else if (flags & ios_base::showpos)
buf += '+';
}
buf += inf_or_nan[flags & ios_base::uppercase ? 1 : 0];
}
template <class max_double_type>
static inline size_t __format_float( __iostring &buf, const char * bp,
int decpt, int sign, max_double_type x,
ios_base::fmtflags flags,
int precision, bool islong)
{
size_t __group_pos = 0;
// Output of infinities and NANs does not depend on the format flags
if (_Stl_is_nan_or_inf((double)x)) { // Infinity or NaN
__format_nan_or_inf(buf, (double)x, flags);
} else { // representable number
switch (flags & ios_base::floatfield) {
case ios_base::scientific:
__group_pos = __format_float_scientific( buf, bp, decpt, sign, x == 0.0,
flags, precision, islong);
break;
case ios_base::fixed:
__group_pos = __format_float_fixed( buf, bp, decpt, sign, true,
flags, precision, islong);
break;
default: // g format
// establish default precision
if (flags & ios_base::showpoint || precision > 0) {
if (precision == 0) precision = 1;
} else
precision = 6;
// reset exponent if value is zero
if (x == 0)
decpt = 1;
int kk = precision;
if (!(flags & ios_base::showpoint)) {
size_t n = strlen(bp);
if (n < (size_t)kk)
kk = (int)n;
while (kk >= 1 && bp[kk-1] == '0')
--kk;
}
if (decpt < -3 || decpt > precision) {
precision = kk - 1;
__group_pos = __format_float_scientific( buf, bp, decpt, sign, x == 0,
flags, precision, islong);
} else {
precision = kk - decpt;
__group_pos = __format_float_fixed( buf, bp, decpt, sign, true,
flags, precision, islong);
}
break;
} /* switch */
} /* else is_nan_or_inf */
return __group_pos;
}
#else /* USE_SPRINTF_INSTEAD */
struct GroupPos {
bool operator () (char __c) const {
return __c == '.' ||
__c == 'e' || __c == 'E';
}
};
// Creates a format string for sprintf()
static int __fill_fmtbuf(char* fmtbuf, ios_base::fmtflags flags, char long_modifier) {
fmtbuf[0] = '%';
int i = 1;
if (flags & ios_base::showpos)
fmtbuf[i++] = '+';
if (flags & ios_base::showpoint)
fmtbuf[i++] = '#';
fmtbuf[i++] = '.';
fmtbuf[i++] = '*';
if (long_modifier)
fmtbuf[i++] = long_modifier;
switch (flags & ios_base::floatfield)
{
case ios_base::scientific:
fmtbuf[i++] = (flags & ios_base::uppercase) ? 'E' : 'e';
break;
case ios_base::fixed:
# if defined (__FreeBSD__)
fmtbuf[i++] = 'f';
# else
fmtbuf[i++] = (flags & ios_base::uppercase) ? 'F' : 'f';
# endif
break;
default:
fmtbuf[i++] = (flags & ios_base::uppercase) ? 'G' : 'g';
break;
}
fmtbuf[i] = 0;
return i;
}
#endif /* USE_SPRINTF_INSTEAD */
size_t _STLP_CALL
__write_float(__iostring &buf, ios_base::fmtflags flags, int precision,
double x) {
#if defined (USE_SPRINTF_INSTEAD)
/* If we want 'abitrary' precision, we should use 'abitrary' buffer size
* below. - ptr
*/
char static_buf[128];
// char *static_buf = new char [128+precision];
char fmtbuf[32];
__fill_fmtbuf(fmtbuf, flags, 0);
// snprintf(static_buf, 128+precision, fmtbuf, precision, x);
# if !defined (N_PLAT_NLM)
snprintf(_STLP_ARRAY_AND_SIZE(static_buf), fmtbuf, precision, x);
# else
sprintf(static_buf, fmtbuf, precision, x);
# endif
buf = static_buf;
// delete [] static_buf;
return find_if(buf.begin(), buf.end(), GroupPos()) - buf.begin();
#else
# if !defined (_STLP_CVT_DONT_NEED_BUF)
char cvtbuf[NDIG + 2];
# endif
char * bp;
int decpt, sign;
switch (flags & ios_base::floatfield) {
case ios_base::fixed:
bp = _Stl_fcvtR(x, (min) (precision, MAXFCVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
case ios_base::scientific :
bp = _Stl_ecvtR(x, (min) (precision + 1, MAXECVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
default :
bp = _Stl_ecvtR(x, (min) (precision, MAXECVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
}
return __format_float(buf, bp, decpt, sign, x, flags, precision, false);
#endif
}
#if !defined (_STLP_NO_LONG_DOUBLE)
size_t _STLP_CALL
__write_float(__iostring &buf, ios_base::fmtflags flags, int precision,
long double x) {
# if defined (USE_SPRINTF_INSTEAD)
/* If we want 'abitrary' precision, we should use 'abitrary' buffer size
* below. - ptr
*/
char static_buf[128];
// char *static_buf = new char [128+precision];
char fmtbuf[64];
int i = __fill_fmtbuf(fmtbuf, flags, 'L');
// snprintf(static_buf, 128+precision, fmtbuf, precision, x);
# if !defined (N_PLAT_NLM)
snprintf(_STLP_ARRAY_AND_SIZE(static_buf), fmtbuf, precision, x);
# else
sprintf(static_buf, fmtbuf, precision, x);
# endif
// we should be able to return buf + sprintf(), but we do not trust'em...
buf = static_buf;
// delete [] static_buf;
return find_if(buf.begin(), buf.end(), GroupPos()) - buf.begin();
# else
# if !defined (_STLP_CVT_DONT_NEED_BUF)
char cvtbuf[NDIG + 2];
# endif
char * bp;
int decpt, sign;
switch (flags & ios_base::floatfield) {
case ios_base::fixed:
bp = _Stl_qfcvtR(x, (min) (precision, MAXFCVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
case ios_base::scientific:
bp = _Stl_qecvtR(x, (min) (precision + 1, MAXECVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
default :
bp = _Stl_qecvtR(x, (min) (precision, MAXECVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
}
return __format_float(buf, bp, decpt, sign, x, flags, precision, true);
# endif /* USE_SPRINTF_INSTEAD */
}
#endif /* _STLP_NO_LONG_DOUBLE */
void _STLP_CALL __get_floor_digits(__iostring &out, _STLP_LONGEST_FLOAT_TYPE __x) {
#if defined (USE_SPRINTF_INSTEAD)
char cvtbuf[128];
# if !defined (_STLP_NO_LONG_DOUBLE)
# if !defined (N_PLAT_NLM)
snprintf(_STLP_ARRAY_AND_SIZE(cvtbuf), "%Lf", __x); // check for 1234.56!
# else
sprintf(cvtbuf, "%Lf", __x); // check for 1234.56!
# endif
# else
snprintf(_STLP_ARRAY_AND_SIZE(cvtbuf), "%f", __x); // check for 1234.56!
# endif
char *p = strchr( cvtbuf, '.' );
if ( p == 0 ) {
out.append( cvtbuf );
} else {
out.append( cvtbuf, p );
}
#else
# if !defined (_STLP_CVT_DONT_NEED_BUF)
char cvtbuf[NDIG + 2];
# endif
char * bp;
int decpt, sign;
# if !defined (_STLP_NO_LONG_DOUBLE)
bp = _Stl_qfcvtR(__x, 0, &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
# else
bp = _Stl_fcvtR(__x, 0, &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
# endif
if (sign) {
out += '-';
}
out.append(bp, bp + decpt);
#endif // USE_PRINTF_INSTEAD
}
#if !defined (_STLP_NO_WCHAR_T)
void _STLP_CALL __convert_float_buffer( __iostring const& str, __iowstring &out,
const ctype<wchar_t>& ct, wchar_t dot, bool __check_dot)
{
string::const_iterator str_ite(str.begin()), str_end(str.end());
//First loop, check the dot char
if (__check_dot) {
while (str_ite != str_end) {
if (*str_ite != '.') {
out += ct.widen(*str_ite++);
} else {
out += dot;
break;
}
}
} else {
if (str_ite != str_end) {
out += ct.widen(*str_ite);
}
}
if (str_ite != str_end) {
//Second loop, dot has been found, no check anymore
while (++str_ite != str_end) {
out += ct.widen(*str_ite);
}
}
}
#endif
void _STLP_CALL
__adjust_float_buffer(__iostring &str, char dot) {
if ('.' != dot) {
size_t __dot_pos = str.find('.');
if (__dot_pos != string::npos) {
str[__dot_pos] = dot;
}
}
}
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,46 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <locale>
_STLP_BEGIN_NAMESPACE
//----------------------------------------------------------------------
// numpunct<char>
char numpunct<char>::do_decimal_point() const {return '.';}
char numpunct<char>::do_thousands_sep() const { return ','; }
string numpunct<char>::do_grouping() const { return string();}
string numpunct<char>::do_truename() const { return _M_truename;}
string numpunct<char>::do_falsename() const { return _M_falsename; }
numpunct<char>::~numpunct() {}
#if !defined (_STLP_NO_WCHAR_T)
wchar_t numpunct<wchar_t>::do_decimal_point() const { return L'.'; }
wchar_t numpunct<wchar_t>::do_thousands_sep() const { return L','; }
string numpunct<wchar_t>::do_grouping() const { return string(); }
wstring numpunct<wchar_t>::do_truename() const { return _M_truename; }
wstring numpunct<wchar_t>::do_falsename() const { return _M_falsename; }
numpunct<wchar_t>::~numpunct() {}
#endif
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,47 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <ostream>
_STLP_BEGIN_NAMESPACE
#if !defined(_STLP_NO_FORCE_INSTANTIATE)
// instantiations
template class _STLP_CLASS_DECLSPEC basic_ostream<char, char_traits<char> >;
# if defined (_STLP_USE_TEMPLATE_EXPORT)
template class _STLP_CLASS_DECLSPEC _Osentry<char, char_traits<char> >;
# endif
#ifndef _STLP_NO_WCHAR_T
# if defined (_STLP_USE_TEMPLATE_EXPORT)
template class _STLP_CLASS_DECLSPEC _Osentry<wchar_t, char_traits<wchar_t> >;
# endif
template class _STLP_CLASS_DECLSPEC basic_ostream<wchar_t, char_traits<wchar_t> >;
#endif
#endif
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,68 +0,0 @@
.section ".text",#alloc,#execinstr
.align 8
.skip 16
/*
** int _STLP_atomic_exchange (void *pvalue, int value)
*/
.type _STLP_atomic_exchange,#function
.global _STLP_atomic_exchange
.align 8
_STLP_atomic_exchange:
0:
ld [%o0], %o2 ! Set the current value
mov %o1, %o3 ! Set the new value
! swap [%o0], %o3 ! Do the compare and swap
cas [%o0], %o2, %o3
cmp %o2, %o3 ! Check whether successful
bne 0b ! Retry upon failure
stbar
mov %o2, %o0 ! Set the new value
retl ! return
nop
.size _STLP_atomic_exchange,(.-_STLP_atomic_exchange)
/* int _STLP_atomic_increment (void *pvalue) */
.type _STLP_atomic_increment,#function
.global _STLP_atomic_increment
.align 8
_STLP_atomic_increment:
1:
ld [%o0], %o2 ! set the current
add %o2, 0x1, %o3 ! Increment and store current
! swap [%o0], %o3 ! Do the compare and swap
cas [%o0], %o2, %o3
cmp %o3, %o2 ! Check whether successful
bne 1b ! Retry if we failed.
membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
! returning
nop
retl ! return
nop
.size _STLP_atomic_increment,(.-_STLP_atomic_increment)
/* int _STLP_atomic_decrement (void *pvalue) */
.type _STLP_atomic_decrement,#function
.global _STLP_atomic_decrement
.align 8
_STLP_atomic_decrement:
2:
ld [%o0], %o2 ! set the current
sub %o2, 0x1, %o3 ! decrement and store current
! swap [%o0], %o3 ! Do the compare and swap
cas [%o0], %o2, %o3
cmp %o3, %o2 ! Check whether successful
bne 2b ! Retry if we failed.
membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
nop
! returning
retl ! return
nop
.size _STLP_atomic_decrement,(.-_STLP_atomic_decrement)

View File

@@ -1,65 +0,0 @@
.section ".text",#alloc,#execinstr
.align 8
.skip 16
! int _STLP_atomic_exchange (void *pvalue, int value)
!
.type _STLP_atomic_exchange,#function
.global _STLP_atomic_exchange
.align 8
_STLP_atomic_exchange:
1:
ldx [%o0], %o2 ! Set the current value
mov %o1, %o3 ! Set the new value
casx [%o0], %o2, %o3 ! Do the compare and swap
cmp %o2, %o3 ! Check whether successful
bne 1b ! Retry upon failure
membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
! returning
retl ! return
mov %o2, %o0 ! Set the new value
.size _STLP_atomic_exchange,(.-_STLP_atomic_exchange)
! int _STLP_atomic_increment (void *pvalue)
.type _STLP_atomic_increment,#function
.global _STLP_atomic_increment
.align 8
_STLP_atomic_increment:
0:
ldx [%o0], %o2 ! set the current
addx %o2, 0x1, %o3 ! Increment and store current
casx [%o0], %o2, %o3 ! Do the compare and swap
cmp %o3, %o2 ! Check whether successful
bne 0b
membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
! returning
retl ! return
mov %o1, %o0 ! Set the return value
.size _STLP_atomic_increment,(.-_STLP_atomic_increment)
! /* int _STLP_atomic_decrement (void *pvalue) */
.type _STLP_atomic_decrement,#function
.global _STLP_atomic_decrement
.align 8
_STLP_atomic_decrement:
0:
ldx [%o0], %o2 ! set the current
subx %o2, 0x1, %o3 ! decrement and store current
casx [%o0], %o2, %o3 ! Do the compare and swap
cmp %o3, %o2 ! Check whether successful
bne 0b
membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
! returning
retl ! return
nop
.size _STLP_atomic_decrement,(.-_STLP_atomic_decrement)

View File

@@ -1,45 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <sstream>
_STLP_BEGIN_NAMESPACE
#if !defined (_STLP_NO_FORCE_INSTANTIATE)
// Force instantiation of stringstream classes.
template class _STLP_CLASS_DECLSPEC basic_stringbuf<char, char_traits<char>, allocator<char> >;
template class _STLP_CLASS_DECLSPEC basic_ostringstream<char, char_traits<char>, allocator<char> >;
template class _STLP_CLASS_DECLSPEC basic_istringstream<char, char_traits<char>, allocator<char> >;
template class _STLP_CLASS_DECLSPEC basic_stringstream<char, char_traits<char>, allocator<char> >;
# if !defined (_STLP_NO_WCHAR_T)
template class _STLP_CLASS_DECLSPEC basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
template class _STLP_CLASS_DECLSPEC basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
template class _STLP_CLASS_DECLSPEC basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
template class _STLP_CLASS_DECLSPEC basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
# endif
#endif
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,290 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include "stdio_streambuf.h"
// #include "file_streambuf.h"
#ifdef _STLP_UNIX
# include <sys/types.h>
# include <sys/stat.h>
#endif /* __unix */
#include <fstream>
#include <limits>
#include "fstream_impl.h"
#if defined (_STLP_USE_WIN32_IO) && !defined(_STLP_WCE)
# if defined (__BORLANDC__)
// # include <cio.h>
# include <cfcntl.h>
# else
# include <io.h>
# include <fcntl.h>
# endif
# include <sys/stat.h>
#endif
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
// Compare with streamoff definition in stl/char_traits.h!
#ifdef _STLP_USE_DEFAULT_FILE_OFFSET
# define FSEEK fseek
# define FTELL ftell
# define FSTAT fstat
# define STAT stat
# define FSETPOS fsetpos
# define FGETPOS fgetpos
# define FPOS_T fpos_t
#elif defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE) /* || defined(__USE_FILE_OFFSET64) */ \
/* || (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */ /* || defined(__sgi) */
# define FSEEK fseeko64
# define FTELL ftello64
# define FSTAT fstat64
# define STAT stat64
# define FSETPOS fsetpos64
# define FGETPOS fgetpos64
# define FPOS_T fpos64_t
#else
# define FSEEK fseek
# define FTELL ftell
# define FSTAT fstat
# define STAT stat
# define FSETPOS fsetpos
# define FGETPOS fgetpos
# define FPOS_T fpos_t
#endif
//----------------------------------------------------------------------
// Class stdio_streambuf_base
stdio_streambuf_base::stdio_streambuf_base(FILE* file)
: /* _STLP_STD::FILE_basic_streambuf(file, 0), */
_M_file(file)
{}
stdio_streambuf_base::~stdio_streambuf_base() {
_STLP_VENDOR_CSTD::fflush(_M_file);
}
_STLP_STD::streambuf* stdio_streambuf_base::setbuf(char* s, streamsize n) {
#ifdef _STLP_WCE
// no buffering in windows ce .NET
#else
size_t __n_size_t = (sizeof(streamsize) > sizeof(size_t)) ? __STATIC_CAST(size_t, (min)(__STATIC_CAST(streamsize, (numeric_limits<size_t>::max)()), n))
: __STATIC_CAST(size_t, n);
_STLP_VENDOR_CSTD::setvbuf(_M_file, s, (s == 0 && n == 0) ? _IONBF : _IOFBF, __n_size_t);
#endif
return this;
}
stdio_streambuf_base::pos_type
stdio_streambuf_base::seekoff(off_type off, ios_base::seekdir dir,
ios_base::openmode /* mode */) {
int whence;
switch (dir) {
case ios_base::beg:
whence = SEEK_SET;
break;
case ios_base::cur:
whence = SEEK_CUR;
break;
case ios_base::end:
whence = SEEK_END;
break;
default:
return pos_type(-1);
}
if (off <= numeric_limits<off_type>::max() && FSEEK(_M_file, off, whence) == 0) {
FPOS_T pos;
FGETPOS(_M_file, &pos);
// added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead
// of a primitive type
#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2))))
return pos_type((streamoff)pos.__pos);
#elif defined (__ISCPP__) || defined (__MVS__) || defined (__OS400__)
return pos_type(pos.__fpos_elem[ 0 ]);
#elif defined (__EMX__)
return pos_type((streamoff)pos._pos);
#else
return pos_type(pos);
#endif
}
else
return pos_type(-1);
}
stdio_streambuf_base::pos_type
stdio_streambuf_base::seekpos(pos_type pos, ios_base::openmode /* mode */) {
// added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead
// of a primitive type
#if (defined(__GLIBC__) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) )
FPOS_T p;
p.__pos = pos;
# ifdef _STLP_USE_UCLIBC
# ifdef __STDIO_MBSTATE
memset( &(p.__mbstate), 0, sizeof(p.__mbstate) );
# endif
# ifdef __STDIO_WIDE
p.mblen_pending = 0;
# endif
# else
memset( &(p.__state), 0, sizeof(p.__state) );
# endif
#elif defined (__MVS__) || defined (__OS400__)
FPOS_T p;
p.__fpos_elem[0] = pos;
#elif defined(__EMX__)
FPOS_T p;
p._pos = pos;
memset( &(p._mbstate), 0, sizeof(p._mbstate) );
#else
FPOS_T p(pos);
#endif
return FSETPOS(_M_file, &p) == 0 ? pos : pos_type(-1);
}
int stdio_streambuf_base::sync() {
return _STLP_VENDOR_CSTD::fflush(_M_file) == 0 ? 0 : -1;
}
//----------------------------------------------------------------------
// Class stdio_istreambuf
stdio_istreambuf::~stdio_istreambuf() {}
streamsize stdio_istreambuf::showmanyc() {
if (feof(_M_file))
return -1;
else {
int fd = _FILE_fd(_M_file);
#ifdef _STLP_WCE
(fd); // prevent warning about unused variable
// not sure if i can mix win32 io mode with ftell but time will show
// cannot use WIN32_IO implementation since missing stat
streamsize tmp = FTELL(_M_file);
FSEEK(_M_file, 0, SEEK_END);
streamoff size= FTELL(_M_file)-tmp;
FSEEK(_M_file, tmp, SEEK_SET);
#elif defined (_STLP_USE_WIN32_IO)
// in this case, __file_size works with Win32 fh , not libc one
streamoff size;
struct stat buf;
if(FSTAT(fd, &buf) == 0 && ( _S_IFREG & buf.st_mode ) )
size = ( buf.st_size > 0 ? buf.st_size : 0);
else
size = 0;
#else
streamoff size = __file_size(fd);
#endif
// fbp : we can use ftell as this flavour always use stdio.
streamsize pos = FTELL(_M_file);
return pos >= 0 && size > pos ? size - pos : 0;
}
}
stdio_istreambuf::int_type stdio_istreambuf::underflow()
{
#ifdef _STLP_WCE
int c = fgetc(_M_file);
#else
int c = getc(_M_file);
#endif
if (c != EOF) {
_STLP_VENDOR_CSTD::ungetc(c, _M_file);
return c;
}
else
return traits_type::eof();
}
stdio_istreambuf::int_type stdio_istreambuf::uflow() {
#ifdef _STLP_WCE
int c = fgetc(_M_file);
#else
int c = getc(_M_file);
#endif
return c != EOF ? c : traits_type::eof();
}
stdio_istreambuf::int_type stdio_istreambuf::pbackfail(int_type c) {
if (c != traits_type::eof()) {
int result = _STLP_VENDOR_CSTD::ungetc(c, _M_file);
return result != EOF ? result : traits_type::eof();
}
else{
if (this->eback() < this->gptr()) {
this->gbump(-1);
return traits_type::not_eof(c);
}
else
return traits_type::eof();
}
}
//----------------------------------------------------------------------
// Class stdio_ostreambuf
stdio_ostreambuf::~stdio_ostreambuf() {}
streamsize stdio_ostreambuf::showmanyc() {
return -1;
}
stdio_ostreambuf::int_type stdio_ostreambuf::overflow(int_type c) {
// Write the existing buffer, without writing any additional character.
if (c == traits_type::eof()) {
// Do we have a buffer to write?
ptrdiff_t unwritten = this->pptr() - this->pbase();
if (unwritten != 0) {
_STLP_VENDOR_CSTD::fflush(_M_file);
// Test if the write succeeded.
if (this->pptr() - this->pbase() < unwritten)
return traits_type::not_eof(c);
else
return traits_type::eof();
}
// We always succeed if we don't have to do anything.
else
return traits_type::not_eof(c);
}
// Write the character c, and whatever else might be in the buffer.
else {
#ifdef _STLP_WCE
int result = fputc(c, _M_file);
#else
int result = putc(c, _M_file);
#endif
return result != EOF ? result : traits_type::eof();
}
}
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,101 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
// This header is an extension. It defines two streambufs:
// stdio_istreambuf, a read-only streambuf synchronized with a C stdio
// FILE object, and stdio_ostreambuf, a write-only streambuf
// synchronized with a C stdio FILE object. Note that neither
// stdio_istreambuf nor stdio_ostreambuf is a template; both classes
// are derived from basic_streambuf<char, char_traits<char> >.
// Note: the imbue() member function is a no-op. In particular, these
// classes assume that codecvt<char, char, mbstate_t> is always an identity
// transformation. This is true of the default locale, and of all locales
// defined for the C I/O library. If you need to use a locale where
// the codecvt<char, char, mbstate_t> facet performs a nontrivial
// conversion, then you should use basic_filebuf<> instead of stdio_istreambuf
// or stdio_ostreambuf. (If you don't understand what any of this means,
// then it's not a feature you need to worry about. Locales where
// codecvt<char, char, mbstate_t> does something nontrivial are a rare
// corner case.)
#ifndef _STLP_STDIO_STREAMBUF
#define _STLP_STDIO_STREAMBUF
#include <streambuf>
#include <cstdio> // For FILE.
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
// Base class for features common to stdio_istreambuf and stdio_ostreambuf
class stdio_streambuf_base :
public basic_streambuf<char, char_traits<char> > /* FILE_basic_streambuf */ {
public: // Constructor, destructor.
// The argument may not be null. It must be an open file pointer.
stdio_streambuf_base(FILE*);
// The destructor flushes the stream, but does not close it.
~stdio_streambuf_base();
protected: // Virtual functions from basic_streambuf.
streambuf* setbuf(char*, streamsize);
pos_type seekoff(off_type, ios_base::seekdir,
ios_base::openmode
= ios_base::in | ios_base::out);
pos_type seekpos(pos_type,
ios_base::openmode
= ios_base::in | ios_base::out);
int sync();
protected:
FILE* _M_file;
};
class stdio_istreambuf : public stdio_streambuf_base {
public: // Constructor, destructor.
stdio_istreambuf(FILE* __f) : stdio_streambuf_base(__f) {}
~stdio_istreambuf();
protected: // Virtual functions from basic_streambuf.
streamsize showmanyc();
int_type underflow();
int_type uflow();
virtual int_type pbackfail(int_type c = traits_type::eof());
};
class stdio_ostreambuf : public stdio_streambuf_base {
public: // Constructor, destructor.
stdio_ostreambuf(FILE* __f) : stdio_streambuf_base(__f) {}
~stdio_ostreambuf();
protected: // Virtual functions from basic_streambuf.
streamsize showmanyc();
int_type overflow(int_type c = traits_type::eof());
};
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
#endif /* _STLP_STDIO_STREAMBUF */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,96 +0,0 @@
///////////////////////////
//
// Version
//
#include <windows.h>
#include <stl/_stlport_version.h>
/* On some evc3/evc4 targets the windows.h doesn't include winver.h or doesn't
* define needed file version flags, so we redefine them here.
*/
#ifndef VS_FF_DEBUG
# define VS_FF_DEBUG 0x00000001L
#endif
#ifndef VOS__WINDOWS32
# define VOS__WINDOWS32 0x00000004L
#endif
#ifndef VFT_DLL
# define VFT_DLL 0x00000002L
#endif
#ifndef VFT2_UNKNOWN
# define VFT2_UNKNOWN 0x00000000L
#endif
#define STRINGIZE(X) STRINGIZE_AUX(X)
#define STRINGIZE_AUX(X) #X
#define VERSION_ID _STLPORT_MAJOR, _STLPORT_MINOR, _STLPORT_PATCHLEVEL, 0
#if !defined (__BORLANDC__)
# define VERSION_STR STRINGIZE(_STLPORT_MAJOR._STLPORT_MINOR._STLPORT_PATCHLEVEL)
#else
/* Borland precompiler happen weird character when trying to transform a
* macro containing 0 in a character string so we use a workaround for this
* value. We do not check the major version that will never be 0 again.
*/
# if (_STLPORT_MINOR == 0)
# define _STLP_MINOR "0"
# else
# define _STLP_MINOR STRINGIZE(_STLPORT_MINOR)
# endif
# if (_STLPORT_PATCHLEVEL == 0)
# define _STLP_PATCH "0"
# else
# define _STLP_PATCH STRINGIZE(_STLPORT_PATCHLEVEL)
# endif
# define VERSION_STR STRINGIZE(_STLPORT_MAJOR) "." _STLP_MINOR "." _STLP_PATCH "\0"
#endif
#if defined (__GNUC__)
# define LIB_MOTIF "libstlport"
#else
# define LIB_MOTIF "stlport"
#endif
#define DLLNAME LIB_MOTIF "." STRINGIZE(_STLPORT_MAJOR) "." STRINGIZE(_STLPORT_MINOR) ".dll\0"
#define DLLNAME2(buildstr) LIB_MOTIF "" STRINGIZE(buildstr) "." STRINGIZE(_STLPORT_MAJOR) "." STRINGIZE(_STLPORT_MINOR) ".dll\0"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_ID
PRODUCTVERSION VERSION_ID
FILEFLAGSMASK 0x3fL
FILEFLAGS VS_FF_DEBUG
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "STLport Consulting, Inc.\0"
VALUE "FileDescription", "STLport\0"
VALUE "FileVersion", VERSION_STR
VALUE "InternalName", "STLPORT.DLL\0"
VALUE "LegalCopyright", "Copyright (C) Boris Fomitchev\0"
#if !defined (BUILD)
VALUE "OriginalFilename", DLLNAME
#else
VALUE "OriginalFilename", DLLNAME2(BUILD)
#endif
VALUE "ProductName", "STLport Standard ANSI C++ Library\0"
VALUE "ProductVersion", VERSION_STR
#if defined (BUILD_INFOS)
VALUE "SpecialBuild", STRINGIZE(COMP) " " STRINGIZE(BUILD_INFOS) "\0"
#endif
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@@ -1,46 +0,0 @@
#ifndef STLPORT_PREFIX_H
#define STLPORT_PREFIX_H
#define __BUILDING_STLPORT 1
#if defined (_WIN32) || defined (WIN32)
# ifdef __cplusplus
# define WIN32_LEAN_AND_MEAN
# define NOSERVICE
# endif
# if !(defined (__CYGWIN__) || defined (_WIN32_WCE))
# define _STLP_REAL_LOCALE_IMPLEMENTED
# endif
#endif
#undef _STLP_NO_FORCE_INSTANTIATE
/* Please add extra compilation switches for particular compilers here */
#if defined (_MSC_VER) && !defined (__COMO__) && !defined (__MWERKS__)
# include "warning_disable.h"
#endif
#include <stl/config/features.h>
#if defined (_STLP_USE_TEMPLATE_EXPORT) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
#endif
#ifdef __cplusplus
# include <ctime>
# if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_VENDOR_GLOBAL_CSTD)
using _STLP_VENDOR_CSTD::time_t;
# endif
# if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
# define _STLP_OPERATOR_SPEC _STLP_DECLSPEC
# else
# define _STLP_OPERATOR_SPEC _STLP_TEMPLATE_NULL _STLP_DECLSPEC
# endif
#endif /* __cplusplus */
#endif /* PREFIX */

View File

@@ -1,102 +0,0 @@
#include "stlport_prefix.h"
#include <string>
_STLP_BEGIN_NAMESPACE
#if defined(_STLP_USE_WIDE_INTERFACE)
_STLP_MOVE_TO_PRIV_NAMESPACE
wstring __ASCIIToWide(const char *ascii) {
size_t size = strlen(ascii);
wchar_t* buff = new wchar_t[size+1];
mbstowcs(buff, ascii, size);
buff[size] = 0x00;
wstring ret(buff);
delete[] buff;
return ret;
}
string __WideToASCII(const wchar_t *wide) {
size_t size = wcslen(wide);
char* buff = new char[size+1];
wcstombs(buff, wide, size);
buff[size] = 0;
string ret(buff);
delete[] buff;
return ret;
}
_STLP_MOVE_TO_STD_NAMESPACE
#endif
#if !defined (_STLP_NO_FORCE_INSTANTIATE)
template class _STLP_CLASS_DECLSPEC allocator<char>;
_STLP_MOVE_TO_PRIV_NAMESPACE
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<char*, char, allocator<char> >;
template class _STLP_CLASS_DECLSPEC _String_base<char, allocator<char> >;
# if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC)
# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
# define basic_string _STLP_NON_DBG_NO_MEM_T_NAME(str)
# else
# define basic_string _STLP_NON_DBG_NAME(str)
# endif
template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;
template class _STLP_CLASS_DECLSPEC __construct_checker<basic_string<char, char_traits<char>, allocator<char> > >;
# undef basic_string
# endif
# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
# define basic_string _STLP_NO_MEM_T_NAME(str)
# else
_STLP_MOVE_TO_STD_NAMESPACE
# endif
template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;
# if defined (basic_string)
_STLP_MOVE_TO_STD_NAMESPACE
# undef basic_string
# endif
# if !defined (_STLP_NO_WCHAR_T)
template class _STLP_CLASS_DECLSPEC allocator<wchar_t>;
_STLP_MOVE_TO_PRIV_NAMESPACE
template class _STLP_CLASS_DECLSPEC _String_base<wchar_t, allocator<wchar_t> >;
# if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC)
# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
# define basic_string _STLP_NON_DBG_NO_MEM_T_NAME(str)
# else
# define basic_string _STLP_NON_DBG_NAME(str)
# endif
template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
template class _STLP_CLASS_DECLSPEC __construct_checker<basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > >;
# undef basic_string
# endif
# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
# define basic_string _STLP_NO_MEM_T_NAME(str)
# else
_STLP_MOVE_TO_STD_NAMESPACE
# endif
template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
# if defined (basic_string)
_STLP_MOVE_TO_STD_NAMESPACE
# undef basic_string
# endif
# endif
#endif
_STLP_END_NAMESPACE

View File

@@ -1,390 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
// Implementation of the classes in header <strstream>.
// WARNING: The classes defined in <strstream> are DEPRECATED. This
// header is defined in section D.7.1 of the C++ standard, and it
// MAY BE REMOVED in a future standard revision. You should use the
// header <sstream> instead.
#include "stlport_prefix.h"
#include <strstream>
#include <algorithm>
#include <limits>
_STLP_BEGIN_NAMESPACE
// strstreambuf constructor, destructor.
strstreambuf::strstreambuf(streamsize initial_capacity)
: _M_alloc_fun(0), _M_free_fun(0),
_M_dynamic(true), _M_frozen(false), _M_constant(false) {
size_t n = (sizeof(streamsize) > sizeof(size_t)) ? __STATIC_CAST(size_t, (min)(__STATIC_CAST(streamsize, (numeric_limits<size_t>::max)()),
(max)(initial_capacity, streamsize(16))))
: __STATIC_CAST(size_t, (max)(initial_capacity, streamsize(16)));
char* buf = _M_alloc(n);
if (buf) {
setp(buf, buf + n);
setg(buf, buf, buf);
}
}
strstreambuf::strstreambuf(__alloc_fn alloc_f, __free_fn free_f)
: _M_alloc_fun(alloc_f), _M_free_fun(free_f),
_M_dynamic(true), _M_frozen(false), _M_constant(false) {
size_t n = 16;
char* buf = _M_alloc(n);
if (buf) {
setp(buf, buf + n);
setg(buf, buf, buf);
}
}
strstreambuf::strstreambuf(char* get, streamsize n, char* put)
: _M_alloc_fun(0), _M_free_fun(0),
_M_dynamic(false), _M_frozen(false), _M_constant(false) {
_M_setup(get, put, n);
}
strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put)
: _M_alloc_fun(0), _M_free_fun(0),
_M_dynamic(false), _M_frozen(false), _M_constant(false) {
_M_setup(__REINTERPRET_CAST(char*,get), __REINTERPRET_CAST(char*,put), n);
}
strstreambuf::strstreambuf(unsigned char* get, streamsize n,
unsigned char* put)
: _M_alloc_fun(0), _M_free_fun(0),
_M_dynamic(false), _M_frozen(false), _M_constant(false) {
_M_setup(__REINTERPRET_CAST(char*,get), __REINTERPRET_CAST(char*,put), n);
}
strstreambuf::strstreambuf(const char* get, streamsize n)
: _M_alloc_fun(0), _M_free_fun(0),
_M_dynamic(false), _M_frozen(false), _M_constant(true) {
_M_setup(__CONST_CAST(char*,get), 0, n);
}
strstreambuf::strstreambuf(const signed char* get, streamsize n)
: _M_alloc_fun(0), _M_free_fun(0),
_M_dynamic(false), _M_frozen(false), _M_constant(true) {
_M_setup(__REINTERPRET_CAST(char*, __CONST_CAST(signed char*,get)), 0, n);
}
strstreambuf::strstreambuf(const unsigned char* get, streamsize n)
: _M_alloc_fun(0), _M_free_fun(0),
_M_dynamic(false), _M_frozen(false), _M_constant(true) {
_M_setup(__REINTERPRET_CAST(char*, __CONST_CAST(unsigned char*,get)), 0, n);
}
strstreambuf::~strstreambuf() {
if (_M_dynamic && !_M_frozen)
_M_free(eback());
}
void strstreambuf::freeze(bool frozenflag) {
if (_M_dynamic)
_M_frozen = frozenflag;
}
char* strstreambuf::str() {
freeze(true);
return eback();
}
int strstreambuf::pcount() const {
return int(pptr() ? pptr() - pbase() : 0);
}
strstreambuf::int_type strstreambuf::overflow(int_type c) {
if (c == traits_type::eof())
return traits_type::not_eof(c);
// Try to expand the buffer.
if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant) {
ptrdiff_t old_size = epptr() - pbase();
ptrdiff_t new_size = (max)(2 * old_size, ptrdiff_t(1));
char* buf = _M_alloc(new_size);
if (buf) {
memcpy(buf, pbase(), old_size);
char* old_buffer = pbase();
bool reposition_get = false;
ptrdiff_t old_get_offset;
if (gptr() != 0) {
reposition_get = true;
old_get_offset = gptr() - eback();
}
setp(buf, buf + new_size);
pbump((int)old_size);
if (reposition_get)
setg(buf, buf + old_get_offset, buf + (max)(old_get_offset, old_size));
_M_free(old_buffer);
}
}
if (pptr() != epptr()) {
*pptr() = traits_type::to_char_type(c);
pbump(1);
return c;
}
else
return traits_type::eof();
}
strstreambuf::int_type strstreambuf::pbackfail(int_type c) {
if (gptr() != eback()) {
if (c == traits_type::eof()) {
gbump(-1);
return traits_type::not_eof(c);
}
else if (c == gptr()[-1]) {
gbump(-1);
return c;
}
else if (!_M_constant) {
gbump(-1);
*gptr() = traits_type::to_char_type(c);
return c;
}
}
return traits_type::eof();
}
strstreambuf::int_type strstreambuf::underflow() {
if (gptr() == egptr() && pptr() && pptr() > egptr())
setg(eback(), gptr(), pptr());
if (gptr() != egptr())
return (unsigned char) *gptr();
else
return _Traits::eof();
}
basic_streambuf<char, char_traits<char> >*
strstreambuf::setbuf(char*, streamsize) {
return this;
}
strstreambuf::pos_type
strstreambuf::seekoff(off_type off,
ios_base::seekdir dir, ios_base::openmode mode) {
bool do_get = false;
bool do_put = false;
if ((mode & (ios_base::in | ios_base::out)) ==
(ios_base::in | ios_base::out) &&
(dir == ios_base::beg || dir == ios_base::end))
do_get = do_put = true;
else if (mode & ios_base::in)
do_get = true;
else if (mode & ios_base::out)
do_put = true;
// !gptr() is here because, according to D.7.1 paragraph 4, the seekable
// area is undefined if there is no get area.
if ((!do_get && !do_put) || (do_put && !pptr()) || !gptr())
return pos_type(off_type(-1));
char* seeklow = eback();
char* seekhigh = epptr() ? epptr() : egptr();
off_type newoff;
switch(dir) {
case ios_base::beg:
newoff = 0;
break;
case ios_base::end:
newoff = seekhigh - seeklow;
break;
case ios_base::cur:
newoff = do_put ? pptr() - seeklow : gptr() - seeklow;
break;
default:
return pos_type(off_type(-1));
}
off += newoff;
if (off < 0 || off > seekhigh - seeklow)
return pos_type(off_type(-1));
if (do_put) {
if (seeklow + __STATIC_CAST(ptrdiff_t, off) < pbase()) {
setp(seeklow, epptr());
pbump((int)off);
}
else {
setp(pbase(), epptr());
pbump((int)(off - (pbase() - seeklow)));
}
}
if (do_get) {
if (off <= egptr() - seeklow)
setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), egptr());
else if (off <= pptr() - seeklow)
setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), pptr());
else
setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), epptr());
}
return pos_type(newoff);
}
strstreambuf::pos_type
strstreambuf::seekpos(pos_type pos, ios_base::openmode mode) {
return seekoff(pos - pos_type(off_type(0)), ios_base::beg, mode);
}
char* strstreambuf::_M_alloc(size_t n) {
if (_M_alloc_fun)
return __STATIC_CAST(char*,_M_alloc_fun(n));
else
return new char[n];
}
void strstreambuf::_M_free(char* p) {
if (p)
if (_M_free_fun)
_M_free_fun(p);
else
delete[] p;
}
void strstreambuf::_M_setup(char* get, char* put, streamsize n) {
if (get) {
size_t N = n > 0 ? size_t(n) : n == 0 ? strlen(get) : size_t(INT_MAX);
if (put) {
setg(get, get, get + N);
setp(put, put + N);
}
else {
setg(get, get, get + N);
}
}
}
//----------------------------------------------------------------------
// Class istrstream
istrstream::istrstream(char* s)
: basic_istream<char, char_traits<char> >(0), _M_buf(s, 0) {
this->init(&_M_buf);
}
istrstream::istrstream(const char* s)
: basic_istream<char, char_traits<char> >(0), _M_buf(s, 0) {
this->init(&_M_buf);
}
istrstream::istrstream(char* s, streamsize n)
: basic_istream<char, char_traits<char> >(0), _M_buf(s, n) {
this->init(&_M_buf);
}
istrstream::istrstream(const char* s, streamsize n)
: basic_istream<char, char_traits<char> >(0), _M_buf(s, n) {
this->init(&_M_buf);
}
istrstream::~istrstream() {}
strstreambuf* istrstream::rdbuf() const {
return __CONST_CAST(strstreambuf*,&_M_buf);
}
char* istrstream::str() { return _M_buf.str(); }
//----------------------------------------------------------------------
// Class ostrstream
ostrstream::ostrstream()
: basic_ostream<char, char_traits<char> >(0), _M_buf() {
basic_ios<char, char_traits<char> >::init(&_M_buf);
}
ostrstream::ostrstream(char* s, int n, ios_base::openmode mode)
: basic_ostream<char, char_traits<char> >(0),
_M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) {
basic_ios<char, char_traits<char> >::init(&_M_buf);
}
ostrstream::~ostrstream() {}
strstreambuf* ostrstream::rdbuf() const {
return __CONST_CAST(strstreambuf*,&_M_buf);
}
void ostrstream::freeze(bool freezeflag) {
_M_buf.freeze(freezeflag);
}
char* ostrstream::str() {
return _M_buf.str();
}
int ostrstream::pcount() const {
return _M_buf.pcount();
}
//----------------------------------------------------------------------
// Class strstream
strstream::strstream()
: basic_iostream<char, char_traits<char> >(0), _M_buf() {
basic_ios<char, char_traits<char> >::init(&_M_buf);
}
strstream::strstream(char* s, int n, ios_base::openmode mode)
: basic_iostream<char, char_traits<char> >(0),
_M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) {
basic_ios<char, char_traits<char> >::init(&_M_buf);
}
strstream::~strstream() {}
strstreambuf* strstream::rdbuf() const {
return __CONST_CAST(strstreambuf*,&_M_buf);
}
void strstream::freeze(bool freezeflag) {
_M_buf.freeze(freezeflag);
}
int strstream::pcount() const {
return _M_buf.pcount();
}
char* strstream::str() {
return _M_buf.str();
}
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:

View File

@@ -1,452 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <cstdio>
#include <locale>
#include <istream>
#include <cstdio>
#include "c_locale.h"
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
// default "C" values for month and day names
const char default_dayname[][14] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday"};
const char default_monthname[][24] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"};
// _Init_time_info: initialize table with
// "C" values (note these are not defined in the C standard, so this
// is somewhat arbitrary).
void _STLP_CALL _Init_timeinfo(_Time_Info& table) {
int i;
for (i = 0; i < 14; ++i)
table._M_dayname[i] = default_dayname[i];
for (i = 0; i < 24; ++i)
table._M_monthname[i] = default_monthname[i];
table._M_am_pm[0] = "AM";
table._M_am_pm[1] = "PM";
table._M_time_format = "%H:%M:%S";
table._M_date_format = "%m/%d/%y";
table._M_date_time_format = "%m/%d/%y";
}
void _STLP_CALL _Init_timeinfo(_Time_Info& table, _Locale_time * time) {
if(!time)
locale::_M_throw_runtime_error();
int i;
for (i = 0; i < 7; ++i)
table._M_dayname[i] = _Locale_abbrev_dayofweek(time, i);
for (i = 0; i < 7; ++i)
table._M_dayname[i+7] = _Locale_full_dayofweek(time, i);
for (i = 0; i < 12; ++i)
table._M_monthname[i] = _Locale_abbrev_monthname(time, i);
for (i = 0; i < 12; ++i)
table._M_monthname[i+12] = _Locale_full_monthname(time, i);
table._M_am_pm[0] = _Locale_am_str(time);
table._M_am_pm[1] = _Locale_pm_str(time);
table._M_time_format = _Locale_t_fmt(time);
if ( table._M_time_format == "%T" ) {
table._M_time_format = "%H:%M:%S";
} else if ( table._M_time_format == "%r" ) {
table._M_time_format = "%I:%M:%S %p";
} else if ( table._M_time_format == "%R" ) {
table._M_time_format = "%H:%M";
}
table._M_date_format = _Locale_d_fmt(time);
table._M_date_time_format = _Locale_d_t_fmt(time);
table._M_long_date_format = _Locale_long_d_fmt(time);
table._M_long_date_time_format = _Locale_long_d_t_fmt(time);
}
inline char* __subformat(const string& format, char*& buf, size_t buf_size,
const _Time_Info& table, const tm* t) {
const char * cp = format.data();
const char * cp_end = cp + format.size();
while (cp != cp_end) {
if (*cp == '%') {
char mod = 0;
++cp;
if(*cp == '#') {
mod = *cp; ++cp;
}
char *former_buf = buf;
buf = __write_formatted_time(buf, buf_size, *cp++, mod, table, t);
buf_size -= (buf - former_buf);
} else
*buf++ = *cp++;
}
return buf;
}
#if defined (__GNUC__)
/* The number of days from the first day of the first ISO week of this
year to the year day YDAY with week day WDAY. ISO weeks start on
Monday; the first ISO week has the year's first Thursday. YDAY may
be as small as YDAY_MINIMUM. */
# define __ISO_WEEK_START_WDAY 1 /* Monday */
# define __ISO_WEEK1_WDAY 4 /* Thursday */
# define __YDAY_MINIMUM (-366)
# define __TM_YEAR_BASE 1900
static int
__iso_week_days(int yday, int wday) {
/* Add enough to the first operand of % to make it nonnegative. */
int big_enough_multiple_of_7 = (-__YDAY_MINIMUM / 7 + 2) * 7;
return (yday
- (yday - wday + __ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7
+ __ISO_WEEK1_WDAY - __ISO_WEEK_START_WDAY);
}
# define __is_leap(year)\
((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
#endif
#define __hour12(hour) \
(((hour) % 12 == 0) ? (12) : (hour) % 12)
#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
# define _STLP_SPRINTF(B, BS, F, D) sprintf(B, F, D)
#else
# define _STLP_SPRINTF(B, BS, F, D) sprintf_s(B, BS, F, D)
#endif
char * _STLP_CALL __write_formatted_time(char* buf, size_t buf_size, char format, char modifier,
const _Time_Info& table, const tm* t) {
switch (format) {
case 'a':
return copy(table._M_dayname[t->tm_wday].begin(),
table._M_dayname[t->tm_wday].end(),
buf);
case 'A':
return copy(table._M_dayname[t->tm_wday+7].begin(),
table._M_dayname[t->tm_wday+7].end(),
buf);
case 'b':
return copy(table._M_monthname[t->tm_mon].begin(),
table._M_monthname[t->tm_mon].end(),
buf);
case 'B':
return copy(table._M_monthname[t->tm_mon+12].begin(),
table._M_monthname[t->tm_mon+12].end(),
buf);
case 'c': {
const char *cp = (modifier != '#') ?
table._M_date_time_format.data() :
table._M_long_date_time_format.data();
const char* cp_end = cp +
((modifier != '#') ? table._M_date_time_format.size() :
table._M_long_date_time_format.size() );
char mod;
while (cp != cp_end) {
if (*cp == '%') {
++cp; if(*cp == '#') mod = *cp++; else mod = 0;
char *buf_pos = buf;
buf = __write_formatted_time(buf, buf_size, *cp++, mod, table, t);
buf_size -= (buf - buf_pos);
}
else {
*buf++ = *cp++; --buf_size;
}
}
return buf;
}
case 'd':
_STLP_SPRINTF(buf, buf_size, (modifier != '#')?"%.2ld":"%ld", (long)t->tm_mday);
return ((long)t->tm_mday < 10L && modifier == '#')?buf+1:buf + 2;
case 'e':
_STLP_SPRINTF(buf, buf_size, "%2ld", (long)t->tm_mday);
return buf + 2;
case 'H':
_STLP_SPRINTF(buf, buf_size, (modifier != '#')?"%.2ld":"%ld", (long)t->tm_hour);
return ((long)t->tm_hour < 10L && modifier == '#')?buf+1:buf + 2;
case 'I':
_STLP_SPRINTF(buf, buf_size, (modifier != '#')?"%.2ld":"%ld", (long)__hour12(t->tm_hour));
return ((long)__hour12(t->tm_hour) < 10L && modifier == '#')?buf+1:buf + 2;
case 'j':
return __write_integer(buf, 0, (long)((long)t->tm_yday + 1));
case 'm':
_STLP_SPRINTF(buf, buf_size, (modifier != '#')?"%.2ld":"%ld", (long)t->tm_mon + 1);
return ((long)(t->tm_mon + 1) < 10L && modifier == '#')?buf+1:buf + 2;
case 'M':
_STLP_SPRINTF(buf, buf_size, (modifier != '#')?"%.2ld":"%ld", (long)t->tm_min);
return ((long)t->tm_min < 10L && modifier == '#')?buf+1:buf + 2;
case 'p':
return copy(table._M_am_pm[t->tm_hour/12].begin(),
table._M_am_pm[t->tm_hour/12].end(),
buf);
case 'S': // pad with zeros
_STLP_SPRINTF(buf, buf_size, (modifier != '#')?"%.2ld":"%ld", (long)t->tm_sec);
return ((long)t->tm_sec < 10L && modifier == '#')?buf+1:buf + 2;
case 'U':
return __write_integer(buf, 0,
long((t->tm_yday - t->tm_wday + 7) / 7));
// break;
case 'w':
return __write_integer(buf, 0, (long)t->tm_wday);
// break;
case 'W':
return __write_integer(buf, 0,
(long)(t->tm_wday == 0 ? (t->tm_yday + 1) / 7 :
(t->tm_yday + 8 - t->tm_wday) / 7));
case'x': {
const char * cp = (modifier != '#') ? table._M_date_format.data():
table._M_long_date_format.data();
const char* cp_end = (modifier != '#') ? cp + table._M_date_format.size():
cp + table._M_long_date_format.size();
char mod;
while (cp != cp_end) {
if (*cp == '%') {
++cp; if(*cp == '#') mod = *cp++; else mod = 0;
char *buf_pos = buf;
buf = __write_formatted_time(buf, buf_size, *cp++, mod, table, t);
buf_size -= (buf - buf_pos);
}
else {
*buf++ = *cp++; --buf_size;
}
}
return buf;
}
case 'X': {
const char * cp = table._M_time_format.data();
const char* cp_end = cp + table._M_time_format.size();
char mod;
while (cp != cp_end) {
if (*cp == '%') {
++cp; if(*cp == '#') mod = *cp++; else mod = 0;
char *buf_pos = buf;
buf = __write_formatted_time(buf, buf_size, *cp++, mod, table, t);
buf_size -= (buf - buf_pos);
}
else {
*buf++ = *cp++; --buf_size;
}
}
return buf;
}
case 'y':
return __write_integer(buf, 0, (long)((long)(t->tm_year + 1900) % 100));
case 'Y':
return __write_integer(buf, 0, (long)((long)t->tm_year + 1900));
case '%':
*buf++ = '%';
return buf;
#if defined (__GNUC__)
// fbp : at least on SUN
# if defined (_STLP_UNIX) && !defined (__linux__)
# define __USE_BSD 1
# endif
/*********************************************
* JGS, handle various extensions *
*********************************************/
case 'h': /* POSIX.2 extension */
// same as 'b', abbrev month name
return copy(table._M_monthname[t->tm_mon].begin(),
table._M_monthname[t->tm_mon].end(),
buf);
case 'C': /* POSIX.2 extension */
// same as 'd', the day
_STLP_SPRINTF(buf, buf_size, "%2ld", (long)t->tm_mday);
return buf + 2;
case 'D': /* POSIX.2 extension */
// same as 'x'
return __subformat(table._M_date_format, buf, buf_size, table, t);
case 'k': /* GNU extension */
_STLP_SPRINTF(buf, buf_size, "%2ld", (long)t->tm_hour);
return buf + 2;
case 'l': /* GNU extension */
_STLP_SPRINTF(buf, buf_size, "%2ld", (long)t->tm_hour % 12);
return buf + 2;
case 'n': /* POSIX.2 extension */
*buf++ = '\n';
return buf;
case 'R': /* GNU extension */
return __subformat("%H:%M", buf, buf_size, table, t);
case 'r': /* POSIX.2 extension */
return __subformat("%I:%M:%S %p", buf, buf_size, table, t);
case 'T': /* POSIX.2 extension. */
return __subformat("%H:%M:%S", buf, buf_size, table, t);
case 't': /* POSIX.2 extension. */
*buf++ = '\t';
return buf;
case 'u': /* POSIX.2 extension. */
return __write_integer(buf, 0, long((t->tm_wday - 1 + 7)) % 7 + 1);
case 's': {
time_t __t;
__t = mktime(__CONST_CAST(tm*, t));
return __write_integer(buf, 0, (long)__t );
}
case 'g': /* GNU extension */
case 'G': {
int year = t->tm_year + __TM_YEAR_BASE;
int days = __iso_week_days (t->tm_yday, t->tm_wday);
if (days < 0) {
/* This ISO week belongs to the previous year. */
year--;
days = __iso_week_days (t->tm_yday + (365 + __is_leap (year)), t->tm_wday);
}
else {
int d = __iso_week_days (t->tm_yday - (365 + __is_leap (year)), t->tm_wday);
if (0 <= d) {
/* This ISO week belongs to the next year. */
++year;
days = d;
}
}
switch (format) {
case 'g':
return __write_integer(buf, 0, (long)(year % 100 + 100) % 100);
case 'G':
return __write_integer(buf, 0, (long)year);
default:
return __write_integer(buf, 0, (long)days / 7 + 1);
}
}
# if defined (_STLP_USE_GLIBC) && ! defined (__CYGWIN__)
case 'z': /* GNU extension. */
if (t->tm_isdst < 0)
break;
{
int diff;
# if defined (__USE_BSD) || defined (__BEOS__) || defined(__ANDROID__)
diff = t->tm_gmtoff;
# else
diff = t->__tm_gmtoff;
# endif
if (diff < 0) {
*buf++ = '-';
diff = -diff;
} else
*buf++ = '+';
diff /= 60;
_STLP_SPRINTF(buf, buf_size, "%.4d", (diff / 60) * 100 + diff % 60);
return buf + 4;
}
# endif /* __GLIBC__ */
#endif /* __GNUC__ */
default:
// return buf;
break;
}
return buf;
}
time_base::dateorder _STLP_CALL
__get_date_order(_Locale_time* time) {
const char * fmt = _Locale_d_fmt(time);
char first, second, third;
while (*fmt != 0 && *fmt != '%') ++fmt;
if (*fmt == 0)
return time_base::no_order;
first = *++fmt;
while (*fmt != 0 && *fmt != '%') ++fmt;
if (*fmt == 0)
return time_base::no_order;
second = *++fmt;
while (*fmt != 0 && *fmt != '%') ++fmt;
if (*fmt == 0)
return time_base::no_order;
third = *++fmt;
switch (first) {
case 'd':
return (second == 'm' && third == 'y') ? time_base::dmy
: time_base::no_order;
case 'm':
return (second == 'd' && third == 'y') ? time_base::mdy
: time_base::no_order;
case 'y':
switch (second) {
case 'd':
return third == 'm' ? time_base::ydm : time_base::no_order;
case 'm':
return third == 'd' ? time_base::ymd : time_base::no_order;
default:
return time_base::no_order;
}
default:
return time_base::no_order;
}
}
_STLP_MOVE_TO_STD_NAMESPACE
#if !defined(_STLP_NO_FORCE_INSTANTIATE)
template class time_get<char, istreambuf_iterator<char, char_traits<char> > >;
template class time_put<char, ostreambuf_iterator<char, char_traits<char> > >;
# if !defined (_STLP_NO_WCHAR_T)
template class time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
template class time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
# endif
#endif
_STLP_END_NAMESPACE

View File

@@ -1,240 +0,0 @@
// uint64.h
// minimal double precision unsigned int arithmetics for numeric_facets support.
// Written by Tsutomu Yoshida, Minokamo, Japan. 03/25/2000
#ifndef _UINT64_H
#define _UINT64_H
template <class _Tp>
class _compound_int : public _Tp {
public:
typedef _compound_int<_Tp> _Self;
// Constructors, destructor, assignment operator.
_compound_int(); // platform specific
_compound_int(unsigned long); // platform specific
_compound_int(unsigned long hi, unsigned long lo); // platform specific
_compound_int(const _Tp& rhs) : _Tp(rhs) {}
// Arithmetic op= operations involving two _compound_int.
_Self& operator+= (const _Self&); // platform specific
_Self& operator-= (const _Self&); // platform specific
_Self& operator*= (const _Self&); // platform specific
_Self& operator/= (const _Self&); // platform specific
_Self& operator%= (const _Self&); // platform specific
_Self& operator&= (const _Self&); // platform specific
_Self& operator|= (const _Self&); // platform specific
_Self& operator^= (const _Self&); // platform specific
// Arithmetic op= operations involving built-in integer.
_Self& operator<<= (unsigned int); // platform specific
_Self& operator>>= (unsigned int); // platform specific
_Self& operator= (unsigned long rhs) { return *this = _Self(rhs); }
_Self& operator+= (unsigned long rhs) { return *this += _Self(rhs); }
_Self& operator-= (unsigned long rhs) { return *this -= _Self(rhs); }
_Self& operator*= (unsigned long rhs) { return *this *= _Self(rhs); }
_Self& operator/= (unsigned long rhs) { return *this /= _Self(rhs); }
_Self& operator%= (unsigned long rhs) { return *this %= _Self(rhs); }
_Self& operator&= (unsigned long rhs) { return *this &= _Self(rhs); }
_Self& operator|= (unsigned long rhs) { return *this |= _Self(rhs); }
_Self& operator^= (unsigned long rhs) { return *this ^= _Self(rhs); }
// Increment and decrement
_Self& operator++() { return (*this) += 1; }
_Self& operator--() { return (*this) -= 1; }
_Self operator++(int) { _Self temp(*this); ++(*this); return temp; }
_Self operator--(int) { _Self temp(*this); --(*this); return temp; }
};
// Comparison operators.
template <class _Tp> bool operator==(const _compound_int<_Tp>&, const _compound_int<_Tp>&); // platform specific
template <class _Tp> bool operator<(const _compound_int<_Tp>&, const _compound_int<_Tp>&); // platform specific
template <class _Tp> inline bool operator==(const _compound_int<_Tp>& lhs, unsigned long rhs) { return lhs == _compound_int<_Tp>(rhs); }
template <class _Tp> inline bool operator==(unsigned long lhs, const _compound_int<_Tp>& rhs) { return rhs == lhs; }
template <class _Tp> inline bool operator< (const _compound_int<_Tp>& lhs, unsigned long rhs) { return lhs < _compound_int<_Tp>(rhs); }
template <class _Tp> inline bool operator< (unsigned long lhs, const _compound_int<_Tp>& rhs) { return _compound_int<_Tp>(lhs) < rhs; }
template <class _Tp> inline bool operator!=(const _compound_int<_Tp>& lhs, unsigned long rhs) { return !(lhs == rhs); }
template <class _Tp> inline bool operator!=(unsigned long lhs, const _compound_int<_Tp>& rhs) { return !(lhs == rhs); }
template <class _Tp> inline bool operator> (const _compound_int<_Tp>& lhs, unsigned long rhs) { return rhs < lhs; }
template <class _Tp> inline bool operator> (unsigned long lhs, const _compound_int<_Tp>& rhs) { return rhs < lhs; }
template <class _Tp> inline bool operator<=(const _compound_int<_Tp>& lhs, unsigned long rhs) { return !(lhs > rhs); }
template <class _Tp> inline bool operator<=(unsigned long lhs, const _compound_int<_Tp>& rhs) { return !(lhs > rhs); }
template <class _Tp> inline bool operator>=(const _compound_int<_Tp>& lhs, unsigned long rhs) { return !(lhs < rhs); }
template <class _Tp> inline bool operator>=(unsigned long lhs, const _compound_int<_Tp>& rhs) { return !(lhs < rhs); }
// Unary non-member arithmetic operators.
template <class _Tp> unsigned long to_ulong(const _compound_int<_Tp>&); // platform specific
template <class _Tp> _compound_int<_Tp> operator~(const _compound_int<_Tp>&); // platform specific
template <class _Tp> inline _compound_int<_Tp> operator+(const _compound_int<_Tp>& val) {return val;}
template <class _Tp> inline _compound_int<_Tp> operator-(const _compound_int<_Tp>& val) {return 0 - val;}
template <class _Tp> inline bool operator!(const _compound_int<_Tp>& val) {return val==0;}
// Non-member arithmetic operations involving two _compound_int arguments
template <class _Tp>
inline _compound_int<_Tp> operator+(const _compound_int<_Tp>& lhs, const _compound_int<_Tp>& rhs)
{ _compound_int<_Tp> temp(lhs); return temp += rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator-(const _compound_int<_Tp>& lhs, const _compound_int<_Tp>& rhs)
{ _compound_int<_Tp> temp(lhs); return temp -= rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator*(const _compound_int<_Tp>& lhs, const _compound_int<_Tp>& rhs)
{ _compound_int<_Tp> temp(lhs); return temp *= rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator/(const _compound_int<_Tp>& lhs, const _compound_int<_Tp>& rhs)
{ _compound_int<_Tp> temp(lhs); return temp /= rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator%(const _compound_int<_Tp>& lhs, const _compound_int<_Tp>& rhs)
{ _compound_int<_Tp> temp(lhs); return temp %= rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator&(const _compound_int<_Tp>& lhs, const _compound_int<_Tp>& rhs)
{ _compound_int<_Tp> temp(lhs); return temp &= rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator|(const _compound_int<_Tp>& lhs, const _compound_int<_Tp>& rhs)
{ _compound_int<_Tp> temp(lhs); return temp |= rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator^(const _compound_int<_Tp>& lhs, const _compound_int<_Tp>& rhs)
{ _compound_int<_Tp> temp(lhs); return temp ^= rhs; }
// Non-member arithmetic operations involving one built-in integer argument.
template <class _Tp>
inline _compound_int<_Tp> operator+(const _compound_int<_Tp>& lhs, unsigned long rhs) { return lhs + _compound_int<_Tp>(rhs); }
template <class _Tp>
inline _compound_int<_Tp> operator+(unsigned long lhs, const _compound_int<_Tp>& rhs) { return _compound_int<_Tp>(lhs) + rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator-(const _compound_int<_Tp>& lhs, unsigned long rhs) { return lhs - _compound_int<_Tp>(rhs); }
template <class _Tp>
inline _compound_int<_Tp> operator-(unsigned long lhs, const _compound_int<_Tp>& rhs) { return _compound_int<_Tp>(lhs) - rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator*(const _compound_int<_Tp>& lhs, unsigned long rhs) { return lhs * _compound_int<_Tp>(rhs); }
template <class _Tp>
inline _compound_int<_Tp> operator*(unsigned long lhs, const _compound_int<_Tp>& rhs) { return _compound_int<_Tp>(lhs) * rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator/(const _compound_int<_Tp>& lhs, unsigned long rhs) { return lhs / _compound_int<_Tp>(rhs); }
template <class _Tp>
inline _compound_int<_Tp> operator/(unsigned long lhs, const _compound_int<_Tp>& rhs) { return _compound_int<_Tp>(lhs) / rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator%(const _compound_int<_Tp>& lhs, unsigned long rhs) { return lhs % _compound_int<_Tp>(rhs); }
template <class _Tp>
inline _compound_int<_Tp> operator%(unsigned long lhs, const _compound_int<_Tp>& rhs) { return _compound_int<_Tp>(lhs) % rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator&(const _compound_int<_Tp>& lhs, unsigned long rhs) { return lhs & _compound_int<_Tp>(rhs); }
template <class _Tp>
inline _compound_int<_Tp> operator&(unsigned long lhs, const _compound_int<_Tp>& rhs) { return _compound_int<_Tp>(lhs) & rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator|(const _compound_int<_Tp>& lhs, unsigned long rhs) { return lhs | _compound_int<_Tp>(rhs); }
template <class _Tp>
inline _compound_int<_Tp> operator|(unsigned long lhs, const _compound_int<_Tp>& rhs) { return _compound_int<_Tp>(lhs) | rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator^(const _compound_int<_Tp>& lhs, unsigned long rhs) { return lhs ^ _compound_int<_Tp>(rhs); }
template <class _Tp>
inline _compound_int<_Tp> operator^(unsigned long lhs, const _compound_int<_Tp>& rhs) { return _compound_int<_Tp>(lhs) ^ rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator<<(const _compound_int<_Tp>& lhs, unsigned int rhs) { _compound_int<_Tp> temp(lhs); return temp <<= rhs; }
template <class _Tp>
inline _compound_int<_Tp> operator>>(const _compound_int<_Tp>& lhs, unsigned int rhs) { _compound_int<_Tp> temp(lhs); return temp >>= rhs; }
// platform specific specializations
#if defined (__MRC__) || defined (__SC__)
_STLP_END_NAMESPACE
# include <Math64.h>
# include <utility>
# undef modff //*TY 04/06/2000 - defined in <math.h> which conflicts with <fp.h> definition
# include <fp.h>
_STLP_BEGIN_NAMESPACE
# if TYPE_LONGLONG
typedef UInt64 uint64;
# define ULL(x) (U64SetU(x))
# else
// Apple's mpw sc compiler for 68k macintosh does not support native 64bit integer type.
// Instead, it comes with external support library and struct data type representing 64bit int:
//
// struct UnsignedWide {
// UInt32 hi;
// UInt32 lo;
// };
typedef _compound_int<UnsignedWide> uint64;
# define ULL(x) uint64(x)
# define ULL2(hi,lo) {hi,lo}
// Constructors, destructor, assignment operator.
_STLP_TEMPLATE_NULL inline _compound_int<UnsignedWide>::_compound_int() { hi = 0; lo = 0; }
_STLP_TEMPLATE_NULL inline _compound_int<UnsignedWide>::_compound_int(unsigned long val) { hi = 0; lo = val; }
_STLP_TEMPLATE_NULL inline _compound_int<UnsignedWide>::_compound_int(unsigned long h, unsigned long l) { hi = h; lo = l; }
// Arithmetic op= operations involving two _compound_int.
_STLP_TEMPLATE_NULL
inline _compound_int<UnsignedWide>& _compound_int<UnsignedWide>::operator+= (const _compound_int<UnsignedWide>& rhs)
{ *this = U64Add( *this, rhs ); return *this; }
_STLP_TEMPLATE_NULL
inline _compound_int<UnsignedWide>& _compound_int<UnsignedWide>::operator-= (const _compound_int<UnsignedWide>& rhs)
{ *this = U64Subtract( *this, rhs ); return *this; }
_STLP_TEMPLATE_NULL
inline _compound_int<UnsignedWide>& _compound_int<UnsignedWide>::operator*= (const _compound_int<UnsignedWide>& rhs)
{ *this = U64Multiply( *this, rhs ); return *this; }
_STLP_TEMPLATE_NULL
inline _compound_int<UnsignedWide>& _compound_int<UnsignedWide>::operator/= (const _compound_int<UnsignedWide>& rhs)
{ *this = U64Divide( *this, rhs, NULL ); return *this; }
_STLP_TEMPLATE_NULL
inline _compound_int<UnsignedWide>& _compound_int<UnsignedWide>::operator%= (const _compound_int<UnsignedWide>& rhs)
{ U64Divide( *this, rhs, this ); return *this; }
_STLP_TEMPLATE_NULL
inline _compound_int<UnsignedWide>& _compound_int<UnsignedWide>::operator&= (const _compound_int<UnsignedWide>& rhs)
{ *this = U64BitwiseAnd( *this, rhs ); return *this; }
_STLP_TEMPLATE_NULL
inline _compound_int<UnsignedWide>& _compound_int<UnsignedWide>::operator|= (const _compound_int<UnsignedWide>& rhs)
{ *this = U64BitwiseOr( *this, rhs ); return *this; }
_STLP_TEMPLATE_NULL
inline _compound_int<UnsignedWide>& _compound_int<UnsignedWide>::operator^= (const _compound_int<UnsignedWide>& rhs)
{ *this = U64BitwiseEor( *this, rhs ); return *this; }
// Arithmetic op= operations involving built-in integer.
_STLP_TEMPLATE_NULL
inline _compound_int<UnsignedWide>& _compound_int<UnsignedWide>::operator<<= (unsigned int rhs)
{ *this = U64ShiftLeft( *this, rhs ); return *this; }
_STLP_TEMPLATE_NULL
inline _compound_int<UnsignedWide>& _compound_int<UnsignedWide>::operator>>= (unsigned int rhs)
{ *this = U64ShiftRight( *this, rhs ); return *this; }
// Comparison operators.
_STLP_TEMPLATE_NULL
inline bool operator==(const _compound_int<UnsignedWide>& lhs, const _compound_int<UnsignedWide>& rhs)
{ return (lhs.hi == rhs.hi) && (lhs.lo == rhs.lo); }
_STLP_TEMPLATE_NULL
inline bool operator< (const _compound_int<UnsignedWide>& lhs, const _compound_int<UnsignedWide>& rhs)
{ return U64Compare( lhs, rhs ) < 0; }
_STLP_TEMPLATE_NULL
inline bool operator==(const _compound_int<UnsignedWide>& lhs, unsigned long rhs)
{ return (lhs.hi == 0) && (lhs.lo == rhs); }
// Unary non-member arithmetic operators.
_STLP_TEMPLATE_NULL
inline unsigned long to_ulong(const _compound_int<UnsignedWide>& val) { return val.lo; }
_STLP_TEMPLATE_NULL
inline _compound_int<UnsignedWide> operator~(const _compound_int<UnsignedWide>& val) { return U64BitwiseNot( val ); }
_STLP_TEMPLATE_NULL
inline bool operator!(const _compound_int<UnsignedWide>& val) { return !((val.hi == 0) && (val.lo == 0)); }
# endif // TYPE_LONGLONG
#endif // __MRC__
#endif // _UINT64_H

View File

@@ -1,43 +0,0 @@
/* This header is used to turn off warnings of Microsoft compilers generated.
* while building STLport.
* For compiling user code, see stlport/config/_msvc_warnings_off.h.
*/
#if (_MSC_VER < 1200) // VC5 and before
# pragma warning( disable : 4018 ) // signed/unsigned mismatch
# pragma warning( disable : 4290 ) // c++ exception specification ignored
# pragma warning( disable : 4389 ) // '==' : signed/unsigned mismatch
# pragma warning( disable : 4610 ) // struct '...' can never be instantiated - user defined constructor required
#endif
#if (_MSC_VER < 1300) // VC6/eVC4
# pragma warning( disable : 4097 ) // typedef-name used as based class of (...)
# pragma warning( disable : 4251 ) // DLL interface needed
# pragma warning( disable : 4284 ) // for -> operator
# pragma warning( disable : 4503 ) // decorated name length exceeded, name was truncated
# pragma warning( disable : 4514 ) // unreferenced inline function has been removed
# pragma warning( disable : 4660 ) // template-class specialization '...' is already instantiated
# pragma warning( disable : 4701 ) // local variable 'base' may be used without having been initialized
# pragma warning( disable : 4710 ) // function (...) not inlined
# pragma warning( disable : 4786 ) // identifier truncated to 255 characters
#endif
#if (_MSC_VER <= 1310)
# pragma warning( disable : 4511 ) // copy constructor cannot be generated
#endif
#if (_MSC_VER < 1300) && defined(UNDER_CE)
# pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union
# pragma warning( disable : 4214 ) // nonstandard extension used : bit field types other than int
#endif
#pragma warning( disable : 4075 ) // initializers put in unrecognized initialization area
//This warning is disable only for the c_locale_win32.c file compilation:
#pragma warning( disable : 4100 ) // unreferenced formal parameter
#pragma warning( disable : 4127 ) // conditional expression is constant
#pragma warning( disable : 4146 ) // unary minus applied to unsigned type
#pragma warning( disable : 4245 ) // conversion from 'enum ' to 'unsigned int', signed/unsigned mismatch
#pragma warning( disable : 4244 ) // implicit conversion: possible loss of data
#pragma warning( disable : 4512 ) // assignment operator could not be generated
#pragma warning( disable : 4571 ) // catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions
#pragma warning( disable : 4702 ) // unreachable code (appears in release with warning level4)

View File

@@ -1,58 +0,0 @@
#if !defined (__ICL)
/* This header is used to turn off warnings of Microsoft compilers generated.
* while building STLport.
* For compiling user code, see stlport/config/_msvc_warnings_off.h.
*/
# if (_MSC_VER < 1200) /* VC5 and before */
# pragma warning( disable : 4018 ) /* signed/unsigned mismatch */
# pragma warning( disable : 4290 ) /* C++ exception specification ignored */
# pragma warning( disable : 4389 ) /* '==' : signed/unsigned mismatch */
# pragma warning( disable : 4610 ) /* struct '...' can never be instantiated - user defined constructor required */
# endif
# if (_MSC_VER < 1300) /* VC6/eVC4 */
# pragma warning( disable : 4097 ) /* typedef-name used as based class of (...) */
# pragma warning( disable : 4251 ) /* DLL interface needed */
# pragma warning( disable : 4284 ) /* for -> operator */
# pragma warning( disable : 4503 ) /* decorated name length exceeded, name was truncated */
# pragma warning( disable : 4514 ) /* unreferenced inline function has been removed */
# pragma warning( disable : 4660 ) /* template-class specialization '...' is already instantiated */
# pragma warning( disable : 4701 ) /* local variable 'base' may be used without having been initialized */
# pragma warning( disable : 4710 ) /* function (...) not inlined */
# pragma warning( disable : 4786 ) /* identifier truncated to 255 characters */
# endif
# if (_MSC_VER <= 1310)
# pragma warning( disable : 4511 ) /* copy constructor cannot be generated */
# endif
# if (_MSC_VER < 1300) && defined (UNDER_CE)
# pragma warning( disable : 4201 ) /* nonstandard extension used : nameless struct/union */
# pragma warning( disable : 4214 ) /* nonstandard extension used : bit field types other than int */
# endif
# pragma warning( disable : 4075 ) /* initializers put in unrecognized initialization area */
/* This warning is disable only for the c_locale_win32.c file compilation: */
# pragma warning( disable : 4100 ) /* unreferenced formal parameter */
# pragma warning( disable : 4127 ) /* conditional expression is constant */
# pragma warning( disable : 4146 ) /* unary minus applied to unsigned type */
# pragma warning( disable : 4245 ) /* conversion from 'enum ' to 'unsigned int', signed/unsigned mismatch */
# pragma warning( disable : 4244 ) /* implicit conversion: possible loss of data */
# pragma warning( disable : 4512 ) /* assignment operator could not be generated */
# pragma warning( disable : 4571 ) /* catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions */
# pragma warning( disable : 4702 ) /* unreachable code (appears in release with warning level4) */
#else
# pragma warning( disable : 69 ) /* integer conversion resulted in truncation */
# pragma warning( disable : 174 ) /* expression has no effect */
# pragma warning( disable : 279 ) /* controling expression is constant */
# pragma warning( disable : 383 ) /* reference to temporary used */
# pragma warning( disable : 444 ) /* destructor for base class "..." is not virtual*/
# pragma warning( disable : 810 ) /* conversion from "int" to "char" may lose significant bits */
# pragma warning( disable : 981 ) /* operands are evaluated in unspecified order */
# pragma warning( disable : 1418 ) /* external definition with no prior declaration */
# pragma warning( disable : 1419 ) /* external declaration in primary source file */
# pragma warning( disable : 1572 ) /* floating-point equality and inequality comparisons are unreliable */
# pragma warning( disable : 1682 ) /* implicit conversion of a 64-bit integral type to a smaller integral type */
# pragma warning( disable : 1683 ) /* explicit conversion of a 64-bit integral type to a smaller integral type */
#endif

View File

@@ -1,60 +0,0 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_ALGORITHM
#define _STLP_ALGORITHM
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1
# include <stl/_prolog.h>
#endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
#ifndef _STLP_INTERNAL_CSTDIO
// remove() conflicts, <cstdio> should always go first
# include <stl/_cstdio.h>
#endif
#ifndef _STLP_INTERNAL_ALGO_H
# include <stl/_algo.h>
#endif
#if defined (_STLP_IMPORT_VENDOR_STD)
# include _STLP_NATIVE_HEADER(algorithm)
#endif /* _STLP_IMPORT_VENDOR_STD */
#if (_STLP_OUTERMOST_HEADER_ID == 0x1 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_ALGORITHM */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,39 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x202
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x202) && ! defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
/* evc3 doesn't have assert.h; macro assert() is defined in stl_evc.h */
#ifndef _STLP_WCE_EVC3
# include _STLP_NATIVE_C_HEADER(assert.h)
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x202)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
# undef _STLP_DONT_POP_HEADER_ID
#endif
/* Local Variables:
* mode:C++
* End:
*/

View File

@@ -1,63 +0,0 @@
/*
* Copyright (c) 1998
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_BITSET
#define _STLP_BITSET
// This implementation of bitset<> has a second template parameter,
// _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE
// THIS FEATURE*. It is experimental, and it may be removed in
// future releases.
// A bitset of size N, using words of type _WordT, will have
// N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high-
// order bits in the highest word.) It is a class invariant
// of class bitset<> that those unused bits are always zero.
// Most of the actual code isn't contained in bitset<> itself, but in the
// base class _Base_bitset. The base class works with whole words, not with
// individual bits. This allows us to specialize _Base_bitset for the
// important special case where the bitset is only a single word.
// The C++ standard does not define the precise semantics of operator[].
// In this implementation the const version of operator[] is equivalent
// to test(), except that it does no range checking. The non-const version
// returns a reference to a bit, again without doing any range checking.
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x2
# include <stl/_prolog.h>
#endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
#include <stl/_bitset.h>
#if (_STLP_OUTERMOST_HEADER_ID == 0x2 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_BITSET */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,42 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x103
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x103) && ! defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
#if !defined (_STLP_WCE_EVC3)
# if defined (_STLP_USE_NEW_C_HEADERS)
# include _STLP_NATIVE_CPP_C_HEADER(cassert)
# else
# include <assert.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x103 )
# if !defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif
// Local Variables:
// mode:C++
// End:

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CCTYPE
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x104
# define _STLP_CCTYPE
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x104 )
# include _STLP_NATIVE_CPP_C_HEADER(cctype)
#else
# ifndef _STLP_INTERNAL_CCTYPE
# include <stl/_cctype.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x104 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CCTYPE */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CERRNO
# define _STLP_CERRNO
# ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x105
# include <stl/_prolog.h>
# endif
# ifndef _STLP_WCE
# if defined (_STLP_USE_NEW_C_HEADERS)
# include _STLP_NATIVE_CPP_C_HEADER(cerrno)
# else
# include <errno.h>
# endif
# endif
#ifndef errno
# if defined (_STLP_IMPORT_VENDOR_CSTD) && \
! defined (__IBMCPP__) && ! defined(__hpux) && ! defined(__MWERKS__) && !defined(_STLP_WCE)
_STLP_BEGIN_NAMESPACE
using _STLP_VENDOR_CSTD::errno;
_STLP_END_NAMESPACE
# endif /* _STLP_IMPORT_VENDOR_CSTD */
#endif
# if (_STLP_OUTERMOST_HEADER_ID == 0x105 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
#endif /* _STLP_CERRNO */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CFLOAT
#define _STLP_CFLOAT
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x106
# include <stl/_prolog.h>
#endif
// Borland defines some implementation constants in std:: namespace,
// we do not want to import them.
#if defined (_STLP_USE_NEW_C_HEADERS) && !defined (__BORLANDC__)
# include _STLP_NATIVE_CPP_C_HEADER(cfloat)
#else
# include <float.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x106 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CFLOAT */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CISO646
#define _STLP_CISO646
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x107
# include <stl/_prolog.h>
#endif
#if !defined(_STLP_WCE_EVC3) && !defined (N_PLAT_NLM) && !defined (__BORLANDC__)
# if defined (_STLP_USE_NEW_C_HEADERS)
# include _STLP_NATIVE_CPP_C_HEADER(ciso646)
# else
# include <iso646.h>
# endif /* _STLP_USE_NEW_C_HEADERS */
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x107 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CISO646 */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,45 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CLIMITS
# define _STLP_CLIMITS
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x108
# include <stl/_prolog.h>
#endif
#if defined (__SUNPRO_CC) && ((__SUNPRO_CC == 0x500) && (__SUNPRO_CC_COMPAT > 4))
# include </usr/include/limits.h>
#elif defined (_STLP_USE_NEW_C_HEADERS)
# include _STLP_NATIVE_CPP_C_HEADER(climits)
#else
# if defined (__BORLANDC__)
# include _STLP_NATIVE_C_HEADER(limits.h)
# else
# include <limits.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x108 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CLIMITS */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CLOCALE
#define _STLP_CLOCALE
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x109
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x109 )
# include _STLP_NATIVE_CPP_C_HEADER(clocale)
#else
# ifndef _STLP_INTERNAL_CLOCALE
# include <stl/_clocale.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x109 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CLOCALE */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CMATH
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x110
# define _STLP_CMATH
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x110)
# include _STLP_NATIVE_CPP_C_HEADER(cmath)
#else
# ifndef _STLP_INTERNAL_CMATH
# include <stl/_cmath.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x110 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CMATH */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,48 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_COMPLEX
#define _STLP_COMPLEX
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x10
# include <stl/_prolog.h>
#endif
// This header declares the template class complex, as described in
// in the draft C++ standard. Single-precision complex numbers
// are complex<float>, double-precision are complex<double>, and
// quad precision are complex<long double>.
// Note that the template class complex is declared within namespace
// std, as called for by the draft C++ standard
#ifndef _STLP_INTERNAL_COMPLEX
# include <stl/_complex.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x10 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_COMPLEX */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSETJMP
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x111
# define _STLP_CSETJMP
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x111)
# include _STLP_NATIVE_CPP_C_HEADER(csetjmp)
#else
# ifndef _STLP_INTERNAL_CSETJMP
# include <stl/_csetjmp.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x111 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSETJMP */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSIGNAL
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x112
# define _STLP_CSIGNAL
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x112)
# include _STLP_NATIVE_CPP_C_HEADER(csignal)
#else
# ifndef _STLP_INTERNAL_CSIGNAL
# include <stl/_csignal.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x112 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSIGNAL */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,40 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
#ifndef _STLP_CSTDARG
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x113
# define _STLP_CSTDARG
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x113)
# include _STLP_NATIVE_CPP_C_HEADER(cstdarg)
#else
# ifndef _STLP_INTERNAL_CSTDARG
# include <stl/_cstdarg.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x113 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSTDARG */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSTDDEF
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x114
# define _STLP_CSTDDEF
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x114)
# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
#else
# ifndef _STLP_INTERNAL_CSTDDEF
# include <stl/_cstddef.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x114 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSTDDEF */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,42 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSTDIO
#define _STLP_CSTDIO
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x15
# define _STLP_CSTDIO
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x15)
# include _STLP_NATIVE_CPP_C_HEADER(cstdio)
#else
# ifndef _STLP_INTERNAL_CSTDIO
# include <stl/_cstdio.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x15)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif
// Local Variables:
// mode:C++
// End:

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSTDLIB
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x116
# define _STLP_CSTDLIB
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x116)
# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
#else
# ifndef _STLP_INTERNAL_CSTDLIB
# include <stl/_cstdlib.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x116)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSTDLIB */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSTRING
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x117
# define _STLP_CSTRING
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x117)
# include _STLP_NATIVE_CPP_C_HEADER(cstring)
#else
# ifndef _STLP_INTERNAL_CSTRING
# include <stl/_cstring.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x117)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSTRING */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,40 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
#ifndef _STLP_CTIME
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x118
# define _STLP_CTIME
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x118)
# include _STLP_NATIVE_CPP_C_HEADER(ctime)
#else
# ifndef _STLP_INTERNAL_CTIME
# include <stl/_ctime.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x118)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CTIME */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,110 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CTYPE_H
/* Workaround for a "misbehaviour" when compiling resource scripts using
* eMbedded Visual C++. The standard .rc file includes windows header files,
* which in turn include ctype.h, which results in warnings and errors
*/
#if !defined(RC_INVOKED)
# if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x219
# include <stl/_prolog.h>
# elif (_STLP_OUTERMOST_HEADER_ID == 0x219)
# define _STLP_DONT_POP_HEADER_ID
# define _STLP_CTYPE_H
# endif
# if defined(_STLP_WCE_EVC3)
struct _exception;
# endif
# include _STLP_NATIVE_C_HEADER(ctype.h)
/* on evc4 including ctype.h also defines setjmp macro */
# if defined (_STLP_WCE)
# define _STLP_NATIVE_SETJMP_H_INCLUDED
# endif
# ifndef _STLP_CTYPE_H_SEEN
# define _STLP_CTYPE_H_SEEN
/* Undef convenience interfaces */
# undef isspace
# undef isprint
# undef iscntrl
# undef isupper
# undef islower
# undef isalpha
# undef isdigit
# undef ispunct
# undef isxdigit
# undef isalnum
# undef isgraph
# undef toupper
# undef tolower
# if defined (UNDER_CE)
# if (_WIN32_WCE < 300) /* Only wide chars for older versions */
# define _isctype iswctype
# endif
__inline int (isalpha)(int c) { return _isctype(c, _ALPHA); }
__inline int (isupper)(int c) { return _isctype(c, _UPPER); }
__inline int (islower)(int c) { return _isctype(c, _LOWER); }
__inline int (isdigit)(int c) { return _isctype(c, _DIGIT); }
__inline int (isxdigit)(int c) { return _isctype(c, _HEX); }
__inline int (isspace)(int c) { return _isctype(c, _SPACE); }
__inline int (ispunct)(int c) { return _isctype(c, _PUNCT); }
__inline int (isalnum)(int c) { return _isctype(c, _ALPHA|_DIGIT); }
__inline int (isprint)(int c) { return _isctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); }
__inline int (isgraph)(int c) { return _isctype(c, _PUNCT|_ALPHA|_DIGIT); }
__inline int (iscntrl)(int c) { return _isctype(c, _CONTROL); }
__inline int (isascii)(int c) { return ((unsigned)(c) < 0x80); }
# undef _isctype
__inline int (iswalpha)(int c) { return iswctype(c, _ALPHA); }
__inline int (iswupper)(int c) { return iswctype(c, _UPPER); }
__inline int (iswlower)(int c) { return iswctype(c, _LOWER); }
__inline int (iswdigit)(int c) { return iswctype(c, _DIGIT); }
__inline int (iswxdigit)(int c) { return iswctype(c, _HEX); }
__inline int (iswspace)(int c) { return iswctype(c, _SPACE); }
__inline int (iswpunct)(int c) { return iswctype(c, _PUNCT); }
__inline int (iswalnum)(int c) { return iswctype(c, _ALPHA|_DIGIT); }
__inline int (iswprint)(int c) { return iswctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); }
__inline int (iswgraph)(int c) { return iswctype(c, _PUNCT|_ALPHA|_DIGIT); }
__inline int (iswcntrl)(int c) { return iswctype(c, _CONTROL); }
__inline int (iswascii)(int c) { return ((unsigned)(c) < 0x80); }
# endif /* UNDER_CE */
# endif /* _STLP_CTYPE_H_SEEN */
# if (_STLP_OUTERMOST_HEADER_ID == 0x219)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
# endif
#endif /* RC_INVOKED */
#endif /* _STLP_CTYPE_H */

View File

@@ -1,42 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CWCHAR
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x120
# define _STLP_CWCHAR
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x120)
# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
#else
# ifndef _STLP_INTERNAL_CWCHAR
# include <stl/_cwchar.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x120)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CWCHAR */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CWCTYPE
#define _STLP_CWCTYPE
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x121
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x121)
# include _STLP_NATIVE_CPP_C_HEADER(cwctype)
#else
# ifndef _STLP_INTERNAL_CWCTYPE
# include <stl/_cwctype.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x121)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CWCTYPE */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,55 +0,0 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_DEQUE
#define _STLP_DEQUE
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x22
# include <stl/_prolog.h>
#endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
#ifndef _STLP_INTERNAL_DEQUE_H
# include <stl/_deque.h>
#endif
#if defined (_STLP_IMPORT_VENDOR_STD)
# include _STLP_NATIVE_HEADER(deque)
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x22)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_DEQUE */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,74 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x205
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x205) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
#ifdef _STLP_WCE
// only show message when directly including this file in a non-library build
# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x205)
# pragma message("eMbedded Visual C++ 3 and .NET don't have a errno.h header; STLport won't include native errno.h here")
# endif
#else
# ifndef errno
/* We define the following macro first to guaranty the header reentrancy: */
# define _STLP_NATIVE_ERRNO_H_INCLUDED
# include _STLP_NATIVE_C_HEADER(errno.h)
# endif /* errno */
# if !defined (_STLP_NATIVE_ERRNO_H_INCLUDED)
/* If errno has been defined before inclusion of native errno.h including it from STLport errno.h
* becomes impossible because if:
* #define errno foo
* then
* #include _STLP_NATIVE_C_HEADER(errno.h)
* becomes:
* #include _STLP_NATIVE_C_HEADER(foo.h)
*
* To fix this problem you have to find where this definition comes from and include errno.h before it.
*/
# error errno has been defined before inclusion of errno.h header.
# endif
# ifdef __cplusplus
# ifndef errno /* errno still not defined */
_STLP_BEGIN_NAMESPACE
# if !defined (__BORLANDC__)
using ::errno;
# else
using _STLP_VENDOR_CSTD::errno;
# endif
_STLP_END_NAMESPACE
# endif /* errno */
# endif /* __cplusplus */
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x205)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
# undef _STLP_DONT_POP_HEADER_ID
#endif
/* Local Variables:
* mode:C++
* End:
*/

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
// This header exists solely for portability. Normally it just includes
// the native header <exception>.
#ifndef _STLP_EXCEPTION
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x423
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x423)
# define _STLP_DONT_POP_HEADER_ID
# define _STLP_EXCEPTION
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x423) || defined (_STLP_DONT_POP_HEADER_ID)
/* If we are here it means that we are in an include called
* from the native lib which means that we can simply forward this
* call to the native exception header:
*/
# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
#else
# include <stl/_exception.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x423)
# if !defined(_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif
#endif /* _STLP_EXCEPTION */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,39 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_OLDSTD_exception
#define _STLP_OLDSTD_exception
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x824
# include <stl/_prolog.h>
#endif
#if defined (__BORLANDC__) || defined (_MSC_VER)
# include <exception>
#else
# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x824)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_OLDSTD_exception */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,56 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x203
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x203) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#elif (_STLP_OUTERMOST_HEADER_ID == 0x203)
# error This header is only reentrant once, it should be modified if it has to be included more.
#endif
#if defined (_STLP_WCE_EVC3)
struct _exception;
#endif
#include _STLP_NATIVE_C_HEADER(float.h)
#if defined(__BORLANDC__) && defined (__cplusplus) && (__BORLANDC__ >= 0x560)
_STLP_BEGIN_NAMESPACE
using ::_max_dble;
using ::_max_flt;
using ::_max_ldble;
using ::_tiny_ldble;
_STLP_END_NAMESPACE
#endif
#if defined (__BORLANDC__) && defined (__cplusplus) && !defined (_STLP_BCC_FPU_BUG)
# define _STLP_BCC_FPU_BUG
// Ignore FPU exceptions, set FPU precision to 53 bits for floatio_test and cmath_test
static unsigned int _bcc_fpu_bug = _control87(PC_53|MCW_EM, MCW_PC|MCW_EM);
template <class _Fp>
int __fpclass(_Fp __val)
{ int __f = _fpclass(__val); _control87(PC_53|MCW_EM, MCW_PC|MCW_EM); return __f; }
# define _fpclass __fpclass
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x203)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
# undef _STLP_DONT_POP_HEADER_ID
#endif

View File

@@ -1,49 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
// This header defines classes basic_filebuf, basic_ifstream,
// basic_ofstream, and basic_fstream. These classes represent
// streambufs and streams whose sources or destinations are files.
#ifndef _STLP_FSTREAM
#define _STLP_FSTREAM
# ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1025
# include <stl/_prolog.h>
# endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
# include <stl/_ioserr.h>
# include <stl/_fstream.h>
# if (_STLP_OUTERMOST_HEADER_ID == 0x1025)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
#endif /* _STLP_FSTREAM */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,42 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_FSTREAM_H
#define _STLP_FSTREAM_H
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x2026
# include <stl/_prolog.h>
#endif
#include <fstream>
// get desired pollution
#include <iostream.h>
#ifndef _STLP_HAS_NO_NAMESPACES
# include <using/fstream>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x2026)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_FSTREAM_H */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,48 +0,0 @@
/*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_FUNCTIONAL
#define _STLP_FUNCTIONAL
# ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x27
# include <stl/_prolog.h>
# endif
# ifdef _STLP_PRAGMA_ONCE
# pragma once
# endif
# if defined (_STLP_IMPORT_VENDOR_STD)
# include _STLP_NATIVE_HEADER(functional)
# endif
# ifndef _STLP_INTERNAL_FUNCTION_H
# include <stl/_function.h>
# endif
# if (_STLP_OUTERMOST_HEADER_ID == 0x27)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
#endif /* _STLP_FUNCTIONAL */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,49 +0,0 @@
/*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_HASH_MAP
#define _STLP_HASH_MAP
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x4028
# include <stl/_prolog.h>
#endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
#if defined (_STLP_NO_EXTENSIONS)
/* Comment following if you want to use hash constainers even if you ask for
* no extension.
*/
# error The hash_map and hash_multimap class are STLport extensions.
#endif
#include <stl/_hash_map.h>
#if (_STLP_OUTERMOST_HEADER_ID == 0x4028)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_HASH_MAP */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,49 +0,0 @@
/*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_HASH_SET
#define _STLP_HASH_SET
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x4029
# include <stl/_prolog.h>
#endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
#if defined (_STLP_NO_EXTENSIONS)
/* Comment following if you want to use hash constainers even if you ask for
* no extension.
*/
# error The hash_set and hash_multiset class are STLport extensions.
#endif
#include <stl/_hash_set.h>
#if (_STLP_OUTERMOST_HEADER_ID == 0x4029)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_HASH_SET */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,175 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOMANIP
#define _STLP_IOMANIP
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1030
# include <stl/_prolog.h>
#endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
#include <stl/_ioserr.h>
#include <stl/_istream.h> // Includes <ostream> and <ios>
_STLP_BEGIN_NAMESPACE
//----------------------------------------------------------------------
// Machinery for defining manipulators.
// Class that calls one of ios_base's single-argument member functions.
template <class _Arg>
struct _Ios_Manip_1 {
typedef _Arg (ios_base::*__f_ptr_type)(_Arg);
_Ios_Manip_1(__f_ptr_type __f, const _Arg& __arg)
: _M_f(__f), _M_arg(__arg) {}
void operator()(ios_base& __ios) const
{ (__ios.*_M_f)(_M_arg); }
__f_ptr_type _M_f;
_Arg _M_arg;
};
// Class that calls one of ios_base's two-argument member functions.
struct _Ios_Setf_Manip {
ios_base::fmtflags _M_flag;
ios_base::fmtflags _M_mask;
bool _M_two_args;
_Ios_Setf_Manip(ios_base::fmtflags __f)
: _M_flag(__f), _M_mask(0), _M_two_args(false) {}
_Ios_Setf_Manip(ios_base::fmtflags __f, ios_base::fmtflags __m)
: _M_flag(__f), _M_mask(__m), _M_two_args(true) {}
void operator()(ios_base& __ios) const {
if (_M_two_args)
__ios.setf(_M_flag, _M_mask);
else
__ios.setf(_M_flag);
}
};
template <class _CharT, class _Traits, class _Arg>
inline basic_istream<_CharT, _Traits>& _STLP_CALL
operator>>(basic_istream<_CharT, _Traits>& __istr,
const _Ios_Manip_1<_Arg>& __f) {
__f(__istr);
return __istr;
}
template <class _CharT, class _Traits, class _Arg>
inline basic_ostream<_CharT, _Traits>& _STLP_CALL
operator<<(basic_ostream<_CharT, _Traits>& __os,
const _Ios_Manip_1<_Arg>& __f) {
__f(__os);
return __os;
}
template <class _CharT, class _Traits>
inline basic_istream<_CharT, _Traits>& _STLP_CALL
operator>>(basic_istream<_CharT, _Traits>& __istr, const _Ios_Setf_Manip& __f) {
__f(__istr);
return __istr;
}
template <class _CharT, class _Traits>
inline basic_ostream<_CharT, _Traits>& _STLP_CALL
operator<<(basic_ostream<_CharT, _Traits>& __os, const _Ios_Setf_Manip& __f) {
__f(__os);
return __os;
}
//----------------------------------------------------------------------
// The ios_base manipulators.
inline _Ios_Setf_Manip _STLP_CALL resetiosflags(ios_base::fmtflags __mask)
{ return _Ios_Setf_Manip(0, __mask); }
inline _Ios_Setf_Manip _STLP_CALL setiosflags(ios_base::fmtflags __flag)
{ return _Ios_Setf_Manip(__flag); }
inline _Ios_Setf_Manip _STLP_CALL setbase(int __n) {
ios_base::fmtflags __base = __n == 8 ? ios_base::oct :
__n == 10 ? ios_base::dec :
__n == 16 ? ios_base::hex :
ios_base::fmtflags(0);
return _Ios_Setf_Manip(__base, ios_base::basefield);
}
inline _Ios_Manip_1<streamsize> _STLP_CALL
setprecision(int __n) {
_Ios_Manip_1<streamsize>::__f_ptr_type __f = &ios_base::precision;
return _Ios_Manip_1<streamsize>(__f, __n);
}
inline _Ios_Manip_1<streamsize> _STLP_CALL
setw(int __n) {
_Ios_Manip_1<streamsize>::__f_ptr_type __f = &ios_base::width;
return _Ios_Manip_1<streamsize>(__f, __n);
}
//----------------------------------------------------------------------
// setfill, a manipulator that operates on basic_ios<> instead of ios_base.
template <class _CharT>
struct _Setfill_Manip {
_Setfill_Manip(_CharT __c) : _M_c(__c) {}
_CharT _M_c;
};
template <class _CharT, class _CharT2, class _Traits>
inline basic_ostream<_CharT, _Traits>& _STLP_CALL
operator<<(basic_ostream<_CharT, _Traits>& __os,
const _Setfill_Manip<_CharT2>& __m) {
__os.fill(__m._M_c);
return __os;
}
template <class _CharT, class _CharT2, class _Traits>
inline basic_istream<_CharT, _Traits>& _STLP_CALL
operator>>(basic_istream<_CharT, _Traits>& __is,
const _Setfill_Manip<_CharT2>& __m) {
__is.fill(__m._M_c);
return __is;
}
template <class _CharT>
inline _Setfill_Manip<_CharT> _STLP_CALL
setfill(_CharT __c) {
return _Setfill_Manip<_CharT>(__c);
}
_STLP_END_NAMESPACE
#if (_STLP_OUTERMOST_HEADER_ID == 0x1030)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOMANIP */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,53 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOMANIP_H
#define _STLP_IOMANIP_H
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x2031
# include <stl/_prolog.h>
#endif
#include <stl/_ioserr.h>
#include <iomanip>
#ifndef _STLP_HAS_NO_NAMESPACES
# ifdef _STLP_BROKEN_USING_DIRECTIVE
_STLP_USING_NAMESPACE(stlport)
# else
using _STLP_STD::setiosflags;
using _STLP_STD::resetiosflags;
using _STLP_STD::setbase;
using _STLP_STD::setfill;
using _STLP_STD::setprecision;
using _STLP_STD::setw;
# endif
#endif /* _STLP_HAS_NO_NAMESPACES */
// get all the pollution we want
#include <iostream.h>
#if (_STLP_OUTERMOST_HEADER_ID == 0x2031)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOMANIP_H */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,43 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOS
#define _STLP_IOS
# ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1032
# include <stl/_prolog.h>
# endif
# ifdef _STLP_PRAGMA_ONCE
# pragma once
# endif
# include <stl/_ioserr.h>
# include <stl/_ios.h>
# if (_STLP_OUTERMOST_HEADER_ID == 0x1032)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
#endif /* _STLP_IOS */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,39 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOS_H
#define _STLP_IOS_H
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1033
# include <stl/_prolog.h>
#endif
#include <ios>
#if defined (_STLP_USE_NAMESPACES)
# include <using/ios>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1033)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOS_H */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,51 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOSFWD
#define _STLP_IOSFWD
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1034
# include <stl/_prolog.h>
#endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
#if !defined (_STLP_USE_NO_IOSTREAMS)
# if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR)
# include <stl/_cwchar.h>
# endif /* _STLP_HAS_WCHAR_T && !_STLP_CWCHAR */
# include <stl/_iosfwd.h>
#else
# include <stl/char_traits.h>
#endif /* _STLP_USE_NO_IOSTREAMS */
#if (_STLP_OUTERMOST_HEADER_ID == 0x1034)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOSFWD */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,92 +0,0 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOSTREAM
#define _STLP_IOSTREAM
# ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1037
# include <stl/_prolog.h>
# endif
# ifdef _STLP_PRAGMA_ONCE
# pragma once
# endif
#include <stl/_ioserr.h>
#ifdef _STLP_REDIRECT_STDSTREAMS
// for ofstream redirection
# include <fstream>
#endif
#include <stl/_iosfwd.h>
#include <stl/_istream.h>
_STLP_BEGIN_NAMESPACE
#ifndef _STLP_USE_NAMESPACES
// in case of SGI iostreams, we have to rename our streams not to clash with those
// provided in native lib
# define cin _STLP_cin
# define cout _STLP_cout
# define cerr _STLP_cerr
# define clog _STLP_clog
#endif
// Note: cin and wcin are both associated with stdio. The C standard
// (Amendment 1, section 4.6.2.1) says that it is an error to mix
// wide- and narrow-oriented I/O on the same stream. This implies
// that it is an error to use both cin and wcin in the same C++
// program; the same applies to cout and wcout, and cerr/clog and
// wcerr/wclog.
# ifdef _STLP_REDIRECT_STDSTREAMS
extern _STLP_DECLSPEC istream cin;
extern _STLP_DECLSPEC ofstream cout;
extern _STLP_DECLSPEC ofstream cerr;
extern _STLP_DECLSPEC ofstream clog;
# else
extern _STLP_DECLSPEC istream cin;
extern _STLP_DECLSPEC ostream cout;
extern _STLP_DECLSPEC ostream cerr;
extern _STLP_DECLSPEC ostream clog;
# endif
# ifndef _STLP_NO_WCHAR_T
extern _STLP_DECLSPEC wistream wcin;
extern _STLP_DECLSPEC wostream wcout;
extern _STLP_DECLSPEC wostream wcerr;
extern _STLP_DECLSPEC wostream wclog;
# endif
_STLP_END_NAMESPACE
//# elif defined ( _STLP_USE_NO_IOSTREAMS )
//# include <stl/_null_stream.h>
# if (_STLP_OUTERMOST_HEADER_ID == 0x1037)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
#endif /* _STLP_IOSTREAM */
// Local Variables:
// mode:C++
// End:

View File

@@ -1,106 +0,0 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOSTREAM_H
#define _STLP_IOSTREAM_H
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x2035
# include <stl/_prolog.h>
#endif
#include <iostream>
// Those should be included all separately, as they do contain using declarations
#include <streambuf.h>
#include <ostream.h>
#include <istream.h>
#ifndef _STLP_HAS_NO_NAMESPACES
# ifdef _STLP_BROKEN_USING_DIRECTIVE
_STLP_USING_NAMESPACE(stlport)
# else
using _STLP_STD::cin;
using _STLP_STD::cout;
using _STLP_STD::clog;
using _STLP_STD::cerr;
using _STLP_STD::iostream;
# ifndef _STLP_NO_WCHAR_T
using _STLP_STD::wcin;
using _STLP_STD::wcout;
using _STLP_STD::wclog;
using _STLP_STD::wcerr;
# endif
# endif
#endif /* _STLP_HAS_NO_NAMESPACES */
// Obsolete classes for old-style backwards compatibility
class istream_withassign : public istream {
public:
istream_withassign() : istream((streambuf*)0) {}
~istream_withassign() {}
istream_withassign& operator=(istream& __s) {
ios::init(__s.rdbuf());
return *this;
}
istream_withassign& operator=(streambuf* __s) {
ios::init(__s);
return *this;
}
};
class ostream_withassign : public ostream {
public:
ostream_withassign() : ostream((streambuf*)0) {}
~ostream_withassign() {}
ostream_withassign& operator=(ostream& __s) {
ios::init(__s.rdbuf());
return *this;
}
ostream_withassign& operator=(streambuf* __s) {
ios::init(__s);
return *this;
}
};
class iostream_withassign : public iostream {
public:
iostream_withassign() : iostream((streambuf*)0) {}
~iostream_withassign() {}
iostream_withassign & operator=(ios& __i) {
ios::init(__i.rdbuf());
return *this;
}
iostream_withassign & operator=(streambuf* __s) {
ios::init(__s);
return *this;
}
} ;
#if (_STLP_OUTERMOST_HEADER_ID == 0x2035)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOSTREAM_H */
// Local Variables:
// mode:C++
// End:

Some files were not shown because too many files have changed in this diff Show More