summaryrefslogtreecommitdiff
path: root/system/lib
diff options
context:
space:
mode:
Diffstat (limited to 'system/lib')
-rw-r--r--system/lib/dlmalloc.c5706
-rw-r--r--system/lib/dlmalloc.symbols50
-rw-r--r--system/lib/libcxx/LICENSE.txt76
-rw-r--r--system/lib/libcxx/Makefile34
-rw-r--r--system/lib/libcxx/algorithm.cpp83
-rw-r--r--system/lib/libcxx/bind.cpp30
-rw-r--r--system/lib/libcxx/chrono.cpp128
-rw-r--r--system/lib/libcxx/condition_variable.cpp70
-rw-r--r--system/lib/libcxx/debug.cpp473
-rw-r--r--system/lib/libcxx/exception.cpp206
-rw-r--r--system/lib/libcxx/future.cpp285
-rw-r--r--system/lib/libcxx/hash.cpp559
-rw-r--r--system/lib/libcxx/ios.cpp455
-rw-r--r--system/lib/libcxx/iostream.cpp53
-rw-r--r--system/lib/libcxx/locale.cpp5838
-rw-r--r--system/lib/libcxx/memory.cpp168
-rw-r--r--system/lib/libcxx/mutex.cpp250
-rw-r--r--system/lib/libcxx/new.cpp185
-rw-r--r--system/lib/libcxx/random.cpp45
-rw-r--r--system/lib/libcxx/readme.txt1
-rw-r--r--system/lib/libcxx/regex.cpp315
-rw-r--r--system/lib/libcxx/stdexcept.cpp178
-rw-r--r--system/lib/libcxx/string.cpp679
-rw-r--r--system/lib/libcxx/strstream.cpp327
-rw-r--r--system/lib/libcxx/symbols3098
-rw-r--r--system/lib/libcxx/system_error.cpp201
-rw-r--r--system/lib/libcxx/thread.cpp183
-rw-r--r--system/lib/libcxx/typeinfo.cpp50
-rw-r--r--system/lib/libcxx/utility.cpp16
-rw-r--r--system/lib/libcxx/valarray.cpp54
30 files changed, 19796 insertions, 0 deletions
diff --git a/system/lib/dlmalloc.c b/system/lib/dlmalloc.c
new file mode 100644
index 00000000..6185b1c7
--- /dev/null
+++ b/system/lib/dlmalloc.c
@@ -0,0 +1,5706 @@
+
+#define __THROW
+#define __attribute_malloc__
+#define __wur
+
+
+/*
+ This is a version (aka dlmalloc) of malloc/free/realloc written by
+ Doug Lea and released to the public domain, as explained at
+ http://creativecommons.org/licenses/publicdomain. Send questions,
+ comments, complaints, performance data, etc to dl@cs.oswego.edu
+
+* Version 2.8.4 Wed May 27 09:56:23 2009 Doug Lea (dl at gee)
+
+ Note: There may be an updated version of this malloc obtainable at
+ ftp://gee.cs.oswego.edu/pub/misc/malloc.c
+ Check before installing!
+
+* Quickstart
+
+ This library is all in one file to simplify the most common usage:
+ ftp it, compile it (-O3), and link it into another program. All of
+ the compile-time options default to reasonable values for use on
+ most platforms. You might later want to step through various
+ compile-time and dynamic tuning options.
+
+ For convenience, an include file for code using this malloc is at:
+ ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.4.h
+ You don't really need this .h file unless you call functions not
+ defined in your system include files. The .h file contains only the
+ excerpts from this file needed for using this malloc on ANSI C/C++
+ systems, so long as you haven't changed compile-time options about
+ naming and tuning parameters. If you do, then you can create your
+ own malloc.h that does include all settings by cutting at the point
+ indicated below. Note that you may already by default be using a C
+ library containing a malloc that is based on some version of this
+ malloc (for example in linux). You might still want to use the one
+ in this file to customize settings or to avoid overheads associated
+ with library versions.
+
+* Vital statistics:
+
+ Supported pointer/size_t representation: 4 or 8 bytes
+ size_t MUST be an unsigned type of the same width as
+ pointers. (If you are using an ancient system that declares
+ size_t as a signed type, or need it to be a different width
+ than pointers, you can use a previous release of this malloc
+ (e.g. 2.7.2) supporting these.)
+
+ Alignment: 8 bytes (default)
+ This suffices for nearly all current machines and C compilers.
+ However, you can define MALLOC_ALIGNMENT to be wider than this
+ if necessary (up to 128bytes), at the expense of using more space.
+
+ Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes)
+ 8 or 16 bytes (if 8byte sizes)
+ Each malloced chunk has a hidden word of overhead holding size
+ and status information, and additional cross-check word
+ if FOOTERS is defined.
+
+ Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead)
+ 8-byte ptrs: 32 bytes (including overhead)
+
+ Even a request for zero bytes (i.e., malloc(0)) returns a
+ pointer to something of the minimum allocatable size.
+ The maximum overhead wastage (i.e., number of extra bytes
+ allocated than were requested in malloc) is less than or equal
+ to the minimum size, except for requests >= mmap_threshold that
+ are serviced via mmap(), where the worst case wastage is about
+ 32 bytes plus the remainder from a system page (the minimal
+ mmap unit); typically 4096 or 8192 bytes.
+
+ Security: static-safe; optionally more or less
+ The "security" of malloc refers to the ability of malicious
+ code to accentuate the effects of errors (for example, freeing
+ space that is not currently malloc'ed or overwriting past the
+ ends of chunks) in code that calls malloc. This malloc
+ guarantees not to modify any memory locations below the base of
+ heap, i.e., static variables, even in the presence of usage
+ errors. The routines additionally detect most improper frees
+ and reallocs. All this holds as long as the static bookkeeping
+ for malloc itself is not corrupted by some other means. This
+ is only one aspect of security -- these checks do not, and
+ cannot, detect all possible programming errors.
+
+ If FOOTERS is defined nonzero, then each allocated chunk
+ carries an additional check word to verify that it was malloced
+ from its space. These check words are the same within each
+ execution of a program using malloc, but differ across
+ executions, so externally crafted fake chunks cannot be
+ freed. This improves security by rejecting frees/reallocs that
+ could corrupt heap memory, in addition to the checks preventing
+ writes to statics that are always on. This may further improve
+ security at the expense of time and space overhead. (Note that
+ FOOTERS may also be worth using with MSPACES.)
+
+ By default detected errors cause the program to abort (calling
+ "abort()"). You can override this to instead proceed past
+ errors by defining PROCEED_ON_ERROR. In this case, a bad free
+ has no effect, and a malloc that encounters a bad address
+ caused by user overwrites will ignore the bad address by
+ dropping pointers and indices to all known memory. This may
+ be appropriate for programs that should continue if at all
+ possible in the face of programming errors, although they may
+ run out of memory because dropped memory is never reclaimed.
+
+ If you don't like either of these options, you can define
+ CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything
+ else. And if if you are sure that your program using malloc has
+ no errors or vulnerabilities, you can define INSECURE to 1,
+ which might (or might not) provide a small performance improvement.
+
+ Thread-safety: NOT thread-safe unless USE_LOCKS defined
+ When USE_LOCKS is defined, each public call to malloc, free,
+ etc is surrounded with either a pthread mutex or a win32
+ spinlock (depending on WIN32). This is not especially fast, and
+ can be a major bottleneck. It is designed only to provide
+ minimal protection in concurrent environments, and to provide a
+ basis for extensions. If you are using malloc in a concurrent
+ program, consider instead using nedmalloc
+ (http://www.nedprod.com/programs/portable/nedmalloc/) or
+ ptmalloc (See http://www.malloc.de), which are derived
+ from versions of this malloc.
+
+ System requirements: Any combination of MORECORE and/or MMAP/MUNMAP
+ This malloc can use unix sbrk or any emulation (invoked using
+ the CALL_MORECORE macro) and/or mmap/munmap or any emulation
+ (invoked using CALL_MMAP/CALL_MUNMAP) to get and release system
+ memory. On most unix systems, it tends to work best if both
+ MORECORE and MMAP are enabled. On Win32, it uses emulations
+ based on VirtualAlloc. It also uses common C library functions
+ like memset.
+
+ Compliance: I believe it is compliant with the Single Unix Specification
+ (See http://www.unix.org). Also SVID/XPG, ANSI C, and probably
+ others as well.
+
+* Overview of algorithms
+
+ This is not the fastest, most space-conserving, most portable, or
+ most tunable malloc ever written. However it is among the fastest
+ while also being among the most space-conserving, portable and
+ tunable. Consistent balance across these factors results in a good
+ general-purpose allocator for malloc-intensive programs.
+
+ In most ways, this malloc is a best-fit allocator. Generally, it
+ chooses the best-fitting existing chunk for a request, with ties
+ broken in approximately least-recently-used order. (This strategy
+ normally maintains low fragmentation.) However, for requests less
+ than 256bytes, it deviates from best-fit when there is not an
+ exactly fitting available chunk by preferring to use space adjacent
+ to that used for the previous small request, as well as by breaking
+ ties in approximately most-recently-used order. (These enhance
+ locality of series of small allocations.) And for very large requests
+ (>= 256Kb by default), it relies on system memory mapping
+ facilities, if supported. (This helps avoid carrying around and
+ possibly fragmenting memory used only for large chunks.)
+
+ All operations (except malloc_stats and mallinfo) have execution
+ times that are bounded by a constant factor of the number of bits in
+ a size_t, not counting any clearing in calloc or copying in realloc,
+ or actions surrounding MORECORE and MMAP that have times
+ proportional to the number of non-contiguous regions returned by
+ system allocation routines, which is often just 1. In real-time
+ applications, you can optionally suppress segment traversals using
+ NO_SEGMENT_TRAVERSAL, which assures bounded execution even when
+ system allocators return non-contiguous spaces, at the typical
+ expense of carrying around more memory and increased fragmentation.
+
+ The implementation is not very modular and seriously overuses
+ macros. Perhaps someday all C compilers will do as good a job
+ inlining modular code as can now be done by brute-force expansion,
+ but now, enough of them seem not to.
+
+ Some compilers issue a lot of warnings about code that is
+ dead/unreachable only on some platforms, and also about intentional
+ uses of negation on unsigned types. All known cases of each can be
+ ignored.
+
+ For a longer but out of date high-level description, see
+ http://gee.cs.oswego.edu/dl/html/malloc.html
+
+* MSPACES
+ If MSPACES is defined, then in addition to malloc, free, etc.,
+ this file also defines mspace_malloc, mspace_free, etc. These
+ are versions of malloc routines that take an "mspace" argument
+ obtained using create_mspace, to control all internal bookkeeping.
+ If ONLY_MSPACES is defined, only these versions are compiled.
+ So if you would like to use this allocator for only some allocations,
+ and your system malloc for others, you can compile with
+ ONLY_MSPACES and then do something like...
+ static mspace mymspace = create_mspace(0,0); // for example
+ #define mymalloc(bytes) mspace_malloc(mymspace, bytes)
+
+ (Note: If you only need one instance of an mspace, you can instead
+ use "USE_DL_PREFIX" to relabel the global malloc.)
+
+ You can similarly create thread-local allocators by storing
+ mspaces as thread-locals. For example:
+ static __thread mspace tlms = 0;
+ void* tlmalloc(size_t bytes) {
+ if (tlms == 0) tlms = create_mspace(0, 0);
+ return mspace_malloc(tlms, bytes);
+ }
+ void tlfree(void* mem) { mspace_free(tlms, mem); }
+
+ Unless FOOTERS is defined, each mspace is completely independent.
+ You cannot allocate from one and free to another (although
+ conformance is only weakly checked, so usage errors are not always
+ caught). If FOOTERS is defined, then each chunk carries around a tag
+ indicating its originating mspace, and frees are directed to their
+ originating spaces.
+
+ ------------------------- Compile-time options ---------------------------
+
+Be careful in setting #define values for numerical constants of type
+size_t. On some systems, literal values are not automatically extended
+to size_t precision unless they are explicitly casted. You can also
+use the symbolic values MAX_SIZE_T, SIZE_T_ONE, etc below.
+
+WIN32 default: defined if _WIN32 defined
+ Defining WIN32 sets up defaults for MS environment and compilers.
+ Otherwise defaults are for unix. Beware that there seem to be some
+ cases where this malloc might not be a pure drop-in replacement for
+ Win32 malloc: Random-looking failures from Win32 GDI API's (eg;
+ SetDIBits()) may be due to bugs in some video driver implementations
+ when pixel buffers are malloc()ed, and the region spans more than
+ one VirtualAlloc()ed region. Because dlmalloc uses a small (64Kb)
+ default granularity, pixel buffers may straddle virtual allocation
+ regions more often than when using the Microsoft allocator. You can
+ avoid this by using VirtualAlloc() and VirtualFree() for all pixel
+ buffers rather than using malloc(). If this is not possible,
+ recompile this malloc with a larger DEFAULT_GRANULARITY.
+
+MALLOC_ALIGNMENT default: (size_t)8
+ Controls the minimum alignment for malloc'ed chunks. It must be a
+ power of two and at least 8, even on machines for which smaller
+ alignments would suffice. It may be defined as larger than this
+ though. Note however that code and data structures are optimized for
+ the case of 8-byte alignment.
+
+MSPACES default: 0 (false)
+ If true, compile in support for independent allocation spaces.
+ This is only supported if HAVE_MMAP is true.
+
+ONLY_MSPACES default: 0 (false)
+ If true, only compile in mspace versions, not regular versions.
+
+USE_LOCKS default: 0 (false)
+ Causes each call to each public routine to be surrounded with
+ pthread or WIN32 mutex lock/unlock. (If set true, this can be
+ overridden on a per-mspace basis for mspace versions.) If set to a
+ non-zero value other than 1, locks are used, but their
+ implementation is left out, so lock functions must be supplied manually,
+ as described below.
+
+USE_SPIN_LOCKS default: 1 iff USE_LOCKS and on x86 using gcc or MSC
+ If true, uses custom spin locks for locking. This is currently
+ supported only for x86 platforms using gcc or recent MS compilers.
+ Otherwise, posix locks or win32 critical sections are used.
+
+FOOTERS default: 0
+ If true, provide extra checking and dispatching by placing
+ information in the footers of allocated chunks. This adds
+ space and time overhead.
+
+INSECURE default: 0
+ If true, omit checks for usage errors and heap space overwrites.
+
+USE_DL_PREFIX default: NOT defined
+ Causes compiler to prefix all public routines with the string 'dl'.
+ This can be useful when you only want to use this malloc in one part
+ of a program, using your regular system malloc elsewhere.
+
+ABORT default: defined as abort()
+ Defines how to abort on failed checks. On most systems, a failed
+ check cannot die with an "assert" or even print an informative
+ message, because the underlying print routines in turn call malloc,
+ which will fail again. Generally, the best policy is to simply call
+ abort(). It's not very useful to do more than this because many
+ errors due to overwriting will show up as address faults (null, odd
+ addresses etc) rather than malloc-triggered checks, so will also
+ abort. Also, most compilers know that abort() does not return, so
+ can better optimize code conditionally calling it.
+
+PROCEED_ON_ERROR default: defined as 0 (false)
+ Controls whether detected bad addresses cause them to bypassed
+ rather than aborting. If set, detected bad arguments to free and
+ realloc are ignored. And all bookkeeping information is zeroed out
+ upon a detected overwrite of freed heap space, thus losing the
+ ability to ever return it from malloc again, but enabling the
+ application to proceed. If PROCEED_ON_ERROR is defined, the
+ static variable malloc_corruption_error_count is compiled in
+ and can be examined to see if errors have occurred. This option
+ generates slower code than the default abort policy.
+
+DEBUG default: NOT defined
+ The DEBUG setting is mainly intended for people trying to modify
+ this code or diagnose problems when porting to new platforms.
+ However, it may also be able to better isolate user errors than just
+ using runtime checks. The assertions in the check routines spell
+ out in more detail the assumptions and invariants underlying the
+ algorithms. The checking is fairly extensive, and will slow down
+ execution noticeably. Calling malloc_stats or mallinfo with DEBUG
+ set will attempt to check every non-mmapped allocated and free chunk
+ in the course of computing the summaries.
+
+ABORT_ON_ASSERT_FAILURE default: defined as 1 (true)
+ Debugging assertion failures can be nearly impossible if your
+ version of the assert macro causes malloc to be called, which will
+ lead to a cascade of further failures, blowing the runtime stack.
+ ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(),
+ which will usually make debugging easier.
+
+MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32
+ The action to take before "return 0" when malloc fails to be able to
+ return memory because there is none available.
+
+HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES
+ True if this system supports sbrk or an emulation of it.
+
+MORECORE default: sbrk
+ The name of the sbrk-style system routine to call to obtain more
+ memory. See below for guidance on writing custom MORECORE
+ functions. The type of the argument to sbrk/MORECORE varies across
+ systems. It cannot be size_t, because it supports negative
+ arguments, so it is normally the signed type of the same width as
+ size_t (sometimes declared as "intptr_t"). It doesn't much matter
+ though. Internally, we only call it with arguments less than half
+ the max value of a size_t, which should work across all reasonable
+ possibilities, although sometimes generating compiler warnings.
+
+MORECORE_CONTIGUOUS default: 1 (true) if HAVE_MORECORE
+ If true, take advantage of fact that consecutive calls to MORECORE
+ with positive arguments always return contiguous increasing
+ addresses. This is true of unix sbrk. It does not hurt too much to
+ set it true anyway, since malloc copes with non-contiguities.
+ Setting it false when definitely non-contiguous saves time
+ and possibly wasted space it would take to discover this though.
+
+MORECORE_CANNOT_TRIM default: NOT defined
+ True if MORECORE cannot release space back to the system when given
+ negative arguments. This is generally necessary only if you are
+ using a hand-crafted MORECORE function that cannot handle negative
+ arguments.
+
+NO_SEGMENT_TRAVERSAL default: 0
+ If non-zero, suppresses traversals of memory segments
+ returned by either MORECORE or CALL_MMAP. This disables
+ merging of segments that are contiguous, and selectively
+ releasing them to the OS if unused, but bounds execution times.
+
+HAVE_MMAP default: 1 (true)
+ True if this system supports mmap or an emulation of it. If so, and
+ HAVE_MORECORE is not true, MMAP is used for all system
+ allocation. If set and HAVE_MORECORE is true as well, MMAP is
+ primarily used to directly allocate very large blocks. It is also
+ used as a backup strategy in cases where MORECORE fails to provide
+ space from system. Note: A single call to MUNMAP is assumed to be
+ able to unmap memory that may have be allocated using multiple calls
+ to MMAP, so long as they are adjacent.
+
+HAVE_MREMAP default: 1 on linux, else 0
+ If true realloc() uses mremap() to re-allocate large blocks and
+ extend or shrink allocation spaces.
+
+MMAP_CLEARS default: 1 except on WINCE.
+ True if mmap clears memory so calloc doesn't need to. This is true
+ for standard unix mmap using /dev/zero and on WIN32 except for WINCE.
+
+USE_BUILTIN_FFS default: 0 (i.e., not used)
+ Causes malloc to use the builtin ffs() function to compute indices.
+ Some compilers may recognize and intrinsify ffs to be faster than the
+ supplied C version. Also, the case of x86 using gcc is special-cased
+ to an asm instruction, so is already as fast as it can be, and so
+ this setting has no effect. Similarly for Win32 under recent MS compilers.
+ (On most x86s, the asm version is only slightly faster than the C version.)
+
+malloc_getpagesize default: derive from system includes, or 4096.
+ The system page size. To the extent possible, this malloc manages
+ memory from the system in page-size units. This may be (and
+ usually is) a function rather than a constant. This is ignored
+ if WIN32, where page size is determined using getSystemInfo during
+ initialization.
+
+USE_DEV_RANDOM default: 0 (i.e., not used)
+ Causes malloc to use /dev/random to initialize secure magic seed for
+ stamping footers. Otherwise, the current time is used.
+
+NO_MALLINFO default: 0
+ If defined, don't compile "mallinfo". This can be a simple way
+ of dealing with mismatches between system declarations and
+ those in this file.
+
+MALLINFO_FIELD_TYPE default: size_t
+ The type of the fields in the mallinfo struct. This was originally
+ defined as "int" in SVID etc, but is more usefully defined as
+ size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set
+
+REALLOC_ZERO_BYTES_FREES default: not defined
+ This should be set if a call to realloc with zero bytes should
+ be the same as a call to free. Some people think it should. Otherwise,
+ since this malloc returns a unique pointer for malloc(0), so does
+ realloc(p, 0).
+
+LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H
+LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H
+LACKS_STDLIB_H default: NOT defined unless on WIN32
+ Define these if your system does not have these header files.
+ You might need to manually insert some of the declarations they provide.
+
+DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS,
+ system_info.dwAllocationGranularity in WIN32,
+ otherwise 64K.
+ Also settable using mallopt(M_GRANULARITY, x)
+ The unit for allocating and deallocating memory from the system. On
+ most systems with contiguous MORECORE, there is no reason to
+ make this more than a page. However, systems with MMAP tend to
+ either require or encourage larger granularities. You can increase
+ this value to prevent system allocation functions to be called so
+ often, especially if they are slow. The value must be at least one
+ page and must be a power of two. Setting to 0 causes initialization
+ to either page size or win32 region size. (Note: In previous
+ versions of malloc, the equivalent of this option was called
+ "TOP_PAD")
+
+DEFAULT_TRIM_THRESHOLD default: 2MB
+ Also settable using mallopt(M_TRIM_THRESHOLD, x)
+ The maximum amount of unused top-most memory to keep before
+ releasing via malloc_trim in free(). Automatic trimming is mainly
+ useful in long-lived programs using contiguous MORECORE. Because
+ trimming via sbrk can be slow on some systems, and can sometimes be
+ wasteful (in cases where programs immediately afterward allocate
+ more large chunks) the value should be high enough so that your
+ overall system performance would improve by releasing this much
+ memory. As a rough guide, you might set to a value close to the
+ average size of a process (program) running on your system.
+ Releasing this much memory would allow such a process to run in
+ memory. Generally, it is worth tuning trim thresholds when a
+ program undergoes phases where several large chunks are allocated
+ and released in ways that can reuse each other's storage, perhaps
+ mixed with phases where there are no such chunks at all. The trim
+ value must be greater than page size to have any useful effect. To
+ disable trimming completely, you can set to MAX_SIZE_T. Note that the trick
+ some people use of mallocing a huge space and then freeing it at
+ program startup, in an attempt to reserve system memory, doesn't
+ have the intended effect under automatic trimming, since that memory
+ will immediately be returned to the system.
+
+DEFAULT_MMAP_THRESHOLD default: 256K
+ Also settable using mallopt(M_MMAP_THRESHOLD, x)
+ The request size threshold for using MMAP to directly service a
+ request. Requests of at least this size that cannot be allocated
+ using already-existing space will be serviced via mmap. (If enough
+ normal freed space already exists it is used instead.) Using mmap
+ segregates relatively large chunks of memory so that they can be
+ individually obtained and released from the host system. A request
+ serviced through mmap is never reused by any other request (at least
+ not directly; the system may just so happen to remap successive
+ requests to the same locations). Segregating space in this way has
+ the benefits that: Mmapped space can always be individually released
+ back to the system, which helps keep the system level memory demands
+ of a long-lived program low. Also, mapped memory doesn't become
+ `locked' between other chunks, as can happen with normally allocated
+ chunks, which means that even trimming via malloc_trim would not
+ release them. However, it has the disadvantage that the space
+ cannot be reclaimed, consolidated, and then used to service later
+ requests, as happens with normal chunks. The advantages of mmap
+ nearly always outweigh disadvantages for "large" chunks, but the
+ value of "large" may vary across systems. The default is an
+ empirically derived value that works well in most systems. You can
+ disable mmap by setting to MAX_SIZE_T.
+
+MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
+ The number of consolidated frees between checks to release
+ unused segments when freeing. When using non-contiguous segments,
+ especially with multiple mspaces, checking only for topmost space
+ doesn't always suffice to trigger trimming. To compensate for this,
+ free() will, with a period of MAX_RELEASE_CHECK_RATE (or the
+ current number of segments, if greater) try to release unused
+ segments to the OS when freeing chunks that result in
+ consolidation. The best value for this parameter is a compromise
+ between slowing down frees with relatively costly checks that
+ rarely trigger versus holding on to unused memory. To effectively
+ disable, set to MAX_SIZE_T. This may lead to a very slight speed
+ improvement at the expense of carrying around more memory.
+*/
+
+/* Version identifier to allow people to support multiple versions */
+#ifndef DLMALLOC_VERSION
+#define DLMALLOC_VERSION 20804
+#endif /* DLMALLOC_VERSION */
+
+#ifndef WIN32
+#ifdef _WIN32
+#define WIN32 1
+#endif /* _WIN32 */
+#ifdef _WIN32_WCE
+#define LACKS_FCNTL_H
+#define WIN32 1
+#endif /* _WIN32_WCE */
+#endif /* WIN32 */
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#define HAVE_MMAP 1
+#define HAVE_MORECORE 0
+#define LACKS_UNISTD_H
+#define LACKS_SYS_PARAM_H
+#define LACKS_SYS_MMAN_H
+#define LACKS_STRING_H
+#define LACKS_STRINGS_H
+#define LACKS_SYS_TYPES_H
+#define LACKS_ERRNO_H
+#ifndef MALLOC_FAILURE_ACTION
+#define MALLOC_FAILURE_ACTION
+#endif /* MALLOC_FAILURE_ACTION */
+#ifdef _WIN32_WCE /* WINCE reportedly does not clear */
+#define MMAP_CLEARS 0
+#else
+#define MMAP_CLEARS 1
+#endif /* _WIN32_WCE */
+#endif /* WIN32 */
+
+#if defined(DARWIN) || defined(_DARWIN)
+/* Mac OSX docs advise not to use sbrk; it seems better to use mmap */
+#ifndef HAVE_MORECORE
+#define HAVE_MORECORE 0
+#define HAVE_MMAP 1
+/* OSX allocators provide 16 byte alignment */
+#ifndef MALLOC_ALIGNMENT
+#define MALLOC_ALIGNMENT ((size_t)16U)
+#endif
+#endif /* HAVE_MORECORE */
+#endif /* DARWIN */
+
+#ifndef LACKS_SYS_TYPES_H
+#include <sys/types.h> /* For size_t */
+#endif /* LACKS_SYS_TYPES_H */
+
+#if (defined(__GNUC__) && ((defined(__i386__) || defined(__x86_64__)))) || (defined(_MSC_VER) && _MSC_VER>=1310)
+#define SPIN_LOCKS_AVAILABLE 1
+#else
+#define SPIN_LOCKS_AVAILABLE 0
+#endif
+
+/* The maximum possible size_t value has all bits set */
+#define MAX_SIZE_T (~(size_t)0)
+
+#ifndef ONLY_MSPACES
+#define ONLY_MSPACES 0 /* define to a value */
+#else
+#define ONLY_MSPACES 1
+#endif /* ONLY_MSPACES */
+#ifndef MSPACES
+#if ONLY_MSPACES
+#define MSPACES 1
+#else /* ONLY_MSPACES */
+#define MSPACES 0
+#endif /* ONLY_MSPACES */
+#endif /* MSPACES */
+#ifndef MALLOC_ALIGNMENT
+#define MALLOC_ALIGNMENT ((size_t)8U)
+#endif /* MALLOC_ALIGNMENT */
+#ifndef FOOTERS
+#define FOOTERS 0
+#endif /* FOOTERS */
+#ifndef ABORT
+#define ABORT abort()
+#endif /* ABORT */
+#ifndef ABORT_ON_ASSERT_FAILURE
+#define ABORT_ON_ASSERT_FAILURE 1
+#endif /* ABORT_ON_ASSERT_FAILURE */
+#ifndef PROCEED_ON_ERROR
+#define PROCEED_ON_ERROR 0
+#endif /* PROCEED_ON_ERROR */
+#ifndef USE_LOCKS
+#define USE_LOCKS 0
+#endif /* USE_LOCKS */
+#ifndef USE_SPIN_LOCKS
+#if USE_LOCKS && SPIN_LOCKS_AVAILABLE
+#define USE_SPIN_LOCKS 1
+#else
+#define USE_SPIN_LOCKS 0
+#endif /* USE_LOCKS && SPIN_LOCKS_AVAILABLE. */
+#endif /* USE_SPIN_LOCKS */
+#ifndef INSECURE
+#define INSECURE 0
+#endif /* INSECURE */
+#ifndef HAVE_MMAP
+/* XXX Emscripten
+ * mmap uses malloc, so malloc can't use mmap
+ */
+#define HAVE_MMAP 0
+#endif /* HAVE_MMAP */
+#ifndef MMAP_CLEARS
+#define MMAP_CLEARS 1
+#endif /* MMAP_CLEARS */
+#ifndef HAVE_MREMAP
+#ifdef linux
+#define HAVE_MREMAP 1
+#else /* linux */
+#define HAVE_MREMAP 0
+#endif /* linux */
+#endif /* HAVE_MREMAP */
+#ifndef MALLOC_FAILURE_ACTION
+#define MALLOC_FAILURE_ACTION errno = ENOMEM;
+#endif /* MALLOC_FAILURE_ACTION */
+#ifndef HAVE_MORECORE
+#if ONLY_MSPACES
+#define HAVE_MORECORE 0
+#else /* ONLY_MSPACES */
+#define HAVE_MORECORE 1
+#endif /* ONLY_MSPACES */
+#endif /* HAVE_MORECORE */
+#if !HAVE_MORECORE
+#define MORECORE_CONTIGUOUS 0
+#else /* !HAVE_MORECORE */
+#define MORECORE_DEFAULT sbrk
+#ifndef MORECORE_CONTIGUOUS
+#define MORECORE_CONTIGUOUS 1
+#endif /* MORECORE_CONTIGUOUS */
+#endif /* HAVE_MORECORE */
+#ifndef DEFAULT_GRANULARITY
+#if (MORECORE_CONTIGUOUS || defined(WIN32))
+#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */
+#else /* MORECORE_CONTIGUOUS */
+#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U)
+#endif /* MORECORE_CONTIGUOUS */
+#endif /* DEFAULT_GRANULARITY */
+#ifndef DEFAULT_TRIM_THRESHOLD
+#ifndef MORECORE_CANNOT_TRIM
+#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U)
+#else /* MORECORE_CANNOT_TRIM */
+#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T
+#endif /* MORECORE_CANNOT_TRIM */
+#endif /* DEFAULT_TRIM_THRESHOLD */
+#ifndef DEFAULT_MMAP_THRESHOLD
+#if HAVE_MMAP
+#define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U)
+#else /* HAVE_MMAP */
+#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T
+#endif /* HAVE_MMAP */
+#endif /* DEFAULT_MMAP_THRESHOLD */
+#ifndef MAX_RELEASE_CHECK_RATE
+#if HAVE_MMAP
+#define MAX_RELEASE_CHECK_RATE 4095
+#else
+#define MAX_RELEASE_CHECK_RATE MAX_SIZE_T
+#endif /* HAVE_MMAP */
+#endif /* MAX_RELEASE_CHECK_RATE */
+#ifndef USE_BUILTIN_FFS
+#define USE_BUILTIN_FFS 0
+#endif /* USE_BUILTIN_FFS */
+#ifndef USE_DEV_RANDOM
+#define USE_DEV_RANDOM 0
+#endif /* USE_DEV_RANDOM */
+#ifndef NO_MALLINFO
+#define NO_MALLINFO 0
+#endif /* NO_MALLINFO */
+#ifndef MALLINFO_FIELD_TYPE
+#define MALLINFO_FIELD_TYPE size_t
+#endif /* MALLINFO_FIELD_TYPE */
+#ifndef NO_SEGMENT_TRAVERSAL
+#define NO_SEGMENT_TRAVERSAL 0
+#endif /* NO_SEGMENT_TRAVERSAL */
+
+/*
+ mallopt tuning options. SVID/XPG defines four standard parameter
+ numbers for mallopt, normally defined in malloc.h. None of these
+ are used in this malloc, so setting them has no effect. But this
+ malloc does support the following options.
+*/
+
+#define M_TRIM_THRESHOLD (-1)
+#define M_GRANULARITY (-2)
+#define M_MMAP_THRESHOLD (-3)
+
+/* ------------------------ Mallinfo declarations ------------------------ */
+
+#if !NO_MALLINFO
+/*
+ This version of malloc supports the standard SVID/XPG mallinfo
+ routine that returns a struct containing usage properties and
+ statistics. It should work on any system that has a
+ /usr/include/malloc.h defining struct mallinfo. The main
+ declaration needed is the mallinfo struct that is returned (by-copy)
+ by mallinfo(). The malloinfo struct contains a bunch of fields that
+ are not even meaningful in this version of malloc. These fields are
+ are instead filled by mallinfo() with other numbers that might be of
+ interest.
+
+ HAVE_USR_INCLUDE_MALLOC_H should be set if you have a
+ /usr/include/malloc.h file that includes a declaration of struct
+ mallinfo. If so, it is included; else a compliant version is
+ declared below. These must be precisely the same for mallinfo() to
+ work. The original SVID version of this struct, defined on most
+ systems with mallinfo, declares all fields as ints. But some others
+ define as unsigned long. If your system defines the fields using a
+ type of different width than listed here, you MUST #include your
+ system version and #define HAVE_USR_INCLUDE_MALLOC_H.
+*/
+
+/* #define HAVE_USR_INCLUDE_MALLOC_H */
+
+#ifdef HAVE_USR_INCLUDE_MALLOC_H
+#include "/usr/include/malloc.h"
+#else /* HAVE_USR_INCLUDE_MALLOC_H */
+#ifndef STRUCT_MALLINFO_DECLARED
+#define STRUCT_MALLINFO_DECLARED 1
+struct mallinfo {
+ MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */
+ MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */
+ MALLINFO_FIELD_TYPE smblks; /* always 0 */
+ MALLINFO_FIELD_TYPE hblks; /* always 0 */
+ MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */
+ MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */
+ MALLINFO_FIELD_TYPE fsmblks; /* always 0 */
+ MALLINFO_FIELD_TYPE uordblks; /* total allocated space */
+ MALLINFO_FIELD_TYPE fordblks; /* total free space */
+ MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */
+};
+#endif /* STRUCT_MALLINFO_DECLARED */
+#endif /* HAVE_USR_INCLUDE_MALLOC_H */
+#endif /* NO_MALLINFO */
+
+/*
+ Try to persuade compilers to inline. The most critical functions for
+ inlining are defined as macros, so these aren't used for them.
+*/
+
+#ifndef FORCEINLINE
+ #if defined(__GNUC__)
+#define FORCEINLINE __inline __attribute__ ((always_inline))
+ #elif defined(_MSC_VER)
+ #define FORCEINLINE __forceinline
+ #endif
+#endif
+#ifndef NOINLINE
+ #if defined(__GNUC__)
+ #define NOINLINE __attribute__ ((noinline))
+ #elif defined(_MSC_VER)
+ #define NOINLINE __declspec(noinline)
+ #else
+ #define NOINLINE
+ #endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#ifndef FORCEINLINE
+ #define FORCEINLINE inline
+#endif
+#endif /* __cplusplus */
+#ifndef FORCEINLINE
+ #define FORCEINLINE
+#endif
+
+#if !ONLY_MSPACES
+
+/* ------------------- Declarations of public routines ------------------- */
+
+#ifndef USE_DL_PREFIX
+#define dlcalloc calloc
+#define dlfree free
+#define dlmalloc malloc
+#define dlmemalign memalign
+#define dlrealloc realloc
+#define dlvalloc valloc
+#define dlpvalloc pvalloc
+#define dlmallinfo mallinfo
+#define dlmallopt mallopt
+#define dlmalloc_trim malloc_trim
+#define dlmalloc_stats malloc_stats
+#define dlmalloc_usable_size malloc_usable_size
+#define dlmalloc_footprint malloc_footprint
+#define dlmalloc_max_footprint malloc_max_footprint
+#define dlindependent_calloc independent_calloc
+#define dlindependent_comalloc independent_comalloc
+#endif /* USE_DL_PREFIX */
+
+
+/*
+ malloc(size_t n)
+ Returns a pointer to a newly allocated chunk of at least n bytes, or
+ null if no space is available, in which case errno is set to ENOMEM
+ on ANSI C systems.
+
+ If n is zero, malloc returns a minimum-sized chunk. (The minimum
+ size is 16 bytes on most 32bit systems, and 32 bytes on 64bit
+ systems.) Note that size_t is an unsigned type, so calls with
+ arguments that would be negative if signed are interpreted as
+ requests for huge amounts of space, which will often fail. The
+ maximum supported value of n differs across systems, but is in all
+ cases less than the maximum representable value of a size_t.
+*/
+void* dlmalloc(size_t) __THROW __attribute_malloc__ __wur;
+
+/*
+ free(void* p)
+ Releases the chunk of memory pointed to by p, that had been previously
+ allocated using malloc or a related routine such as realloc.
+ It has no effect if p is null. If p was not malloced or already
+ freed, free(p) will by default cause the current program to abort.
+*/
+void dlfree(void*) __THROW __wur;
+
+/*
+ calloc(size_t n_elements, size_t element_size);
+ Returns a pointer to n_elements * element_size bytes, with all locations
+ set to zero.
+*/
+void* dlcalloc(size_t, size_t) __THROW __attribute_malloc__ __wur;
+
+/*
+ realloc(void* p, size_t n)
+ Returns a pointer to a chunk of size n that contains the same data
+ as does chunk p up to the minimum of (n, p's size) bytes, or null
+ if no space is available.
+
+ The returned pointer may or may not be the same as p. The algorithm
+ prefers extending p in most cases when possible, otherwise it
+ employs the equivalent of a malloc-copy-free sequence.
+
+ If p is null, realloc is equivalent to malloc.
+
+ If space is not available, realloc returns null, errno is set (if on
+ ANSI) and p is NOT freed.
+
+ if n is for fewer bytes than already held by p, the newly unused
+ space is lopped off and freed if possible. realloc with a size
+ argument of zero (re)allocates a minimum-sized chunk.
+
+ The old unix realloc convention of allowing the last-free'd chunk
+ to be used as an argument to realloc is not supported.
+*/
+
+void* dlrealloc(void*, size_t) __THROW __attribute_malloc__ __wur;
+
+/*
+ memalign(size_t alignment, size_t n);
+ Returns a pointer to a newly allocated chunk of n bytes, aligned
+ in accord with the alignment argument.
+
+ The alignment argument should be a power of two. If the argument is
+ not a power of two, the nearest greater power is used.
+ 8-byte alignment is guaranteed by normal malloc calls, so don't
+ bother calling memalign with an argument of 8 or less.
+
+ Overreliance on memalign is a sure way to fragment space.
+*/
+void* dlmemalign(size_t, size_t);
+
+/*
+ valloc(size_t n);
+ Equivalent to memalign(pagesize, n), where pagesize is the page
+ size of the system. If the pagesize is unknown, 4096 is used.
+*/
+void* dlvalloc(size_t) __THROW __attribute_malloc__ __wur;
+
+/*
+ mallopt(int parameter_number, int parameter_value)
+ Sets tunable parameters The format is to provide a
+ (parameter-number, parameter-value) pair. mallopt then sets the
+ corresponding parameter to the argument value if it can (i.e., so
+ long as the value is meaningful), and returns 1 if successful else
+ 0. To workaround the fact that mallopt is specified to use int,
+ not size_t parameters, the value -1 is specially treated as the
+ maximum unsigned size_t value.
+
+ SVID/XPG/ANSI defines four standard param numbers for mallopt,
+ normally defined in malloc.h. None of these are use in this malloc,
+ so setting them has no effect. But this malloc also supports other
+ options in mallopt. See below for details. Briefly, supported
+ parameters are as follows (listed defaults are for "typical"
+ configurations).
+
+ Symbol param # default allowed param values
+ M_TRIM_THRESHOLD -1 2*1024*1024 any (-1 disables)
+ M_GRANULARITY -2 page size any power of 2 >= page size
+ M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support)
+*/
+int dlmallopt(int, int);
+
+/*
+ malloc_footprint();
+ Returns the number of bytes obtained from the system. The total
+ number of bytes allocated by malloc, realloc etc., is less than this
+ value. Unlike mallinfo, this function returns only a precomputed
+ result, so can be called frequently to monitor memory consumption.
+ Even if locks are otherwise defined, this function does not use them,
+ so results might not be up to date.
+*/
+size_t dlmalloc_footprint(void);
+
+/*
+ malloc_max_footprint();
+ Returns the maximum number of bytes obtained from the system. This
+ value will be greater than current footprint if deallocated space
+ has been reclaimed by the system. The peak number of bytes allocated
+ by malloc, realloc etc., is less than this value. Unlike mallinfo,
+ this function returns only a precomputed result, so can be called
+ frequently to monitor memory consumption. Even if locks are
+ otherwise defined, this function does not use them, so results might
+ not be up to date.
+*/
+size_t dlmalloc_max_footprint(void);
+
+#if !NO_MALLINFO
+/*
+ mallinfo()
+ Returns (by copy) a struct containing various summary statistics:
+
+ arena: current total non-mmapped bytes allocated from system
+ ordblks: the number of free chunks
+ smblks: always zero.
+ hblks: current number of mmapped regions
+ hblkhd: total bytes held in mmapped regions
+ usmblks: the maximum total allocated space. This will be greater
+ than current total if trimming has occurred.
+ fsmblks: always zero
+ uordblks: current total allocated space (normal or mmapped)
+ fordblks: total free space
+ keepcost: the maximum number of bytes that could ideally be released
+ back to system via malloc_trim. ("ideally" means that
+ it ignores page restrictions etc.)
+
+ Because these fields are ints, but internal bookkeeping may
+ be kept as longs, the reported values may wrap around zero and
+ thus be inaccurate.
+*/
+struct mallinfo dlmallinfo(void);
+#endif /* NO_MALLINFO */
+
+/*
+ independent_calloc(size_t n_elements, size_t element_size, void* chunks[]);
+
+ independent_calloc is similar to calloc, but instead of returning a
+ single cleared space, it returns an array of pointers to n_elements
+ independent elements that can hold contents of size elem_size, each
+ of which starts out cleared, and can be independently freed,
+ realloc'ed etc. The elements are guaranteed to be adjacently
+ allocated (this is not guaranteed to occur with multiple callocs or
+ mallocs), which may also improve cache locality in some
+ applications.
+
+ The "chunks" argument is optional (i.e., may be null, which is
+ probably the most typical usage). If it is null, the returned array
+ is itself dynamically allocated and should also be freed when it is
+ no longer needed. Otherwise, the chunks array must be of at least
+ n_elements in length. It is filled in with the pointers to the
+ chunks.
+
+ In either case, independent_calloc returns this pointer array, or
+ null if the allocation failed. If n_elements is zero and "chunks"
+ is null, it returns a chunk representing an array with zero elements
+ (which should be freed if not wanted).
+
+ Each element must be individually freed when it is no longer
+ needed. If you'd like to instead be able to free all at once, you
+ should instead use regular calloc and assign pointers into this
+ space to represent elements. (In this case though, you cannot
+ independently free elements.)
+
+ independent_calloc simplifies and speeds up implementations of many
+ kinds of pools. It may also be useful when constructing large data
+ structures that initially have a fixed number of fixed-sized nodes,
+ but the number is not known at compile time, and some of the nodes
+ may later need to be freed. For example:
+
+ struct Node { int item; struct Node* next; };
+
+ struct Node* build_list() {
+ struct Node** pool;
+ int n = read_number_of_nodes_needed();
+ if (n <= 0) return 0;
+ pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0);
+ if (pool == 0) die();
+ // organize into a linked list...
+ struct Node* first = pool[0];
+ for (i = 0; i < n-1; ++i)
+ pool[i]->next = pool[i+1];
+ free(pool); // Can now free the array (or not, if it is needed later)
+ return first;
+ }
+*/
+void** dlindependent_calloc(size_t, size_t, void**);
+
+/*
+ independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]);
+
+ independent_comalloc allocates, all at once, a set of n_elements
+ chunks with sizes indicated in the "sizes" array. It returns
+ an array of pointers to these elements, each of which can be
+ independently freed, realloc'ed etc. The elements are guaranteed to
+ be adjacently allocated (this is not guaranteed to occur with
+ multiple callocs or mallocs), which may also improve cache locality
+ in some applications.
+
+ The "chunks" argument is optional (i.e., may be null). If it is null
+ the returned array is itself dynamically allocated and should also
+ be freed when it is no longer needed. Otherwise, the chunks array
+ must be of at least n_elements in length. It is filled in with the
+ pointers to the chunks.
+
+ In either case, independent_comalloc returns this pointer array, or
+ null if the allocation failed. If n_elements is zero and chunks is
+ null, it returns a chunk representing an array with zero elements
+ (which should be freed if not wanted).
+
+ Each element must be individually freed when it is no longer
+ needed. If you'd like to instead be able to free all at once, you
+ should instead use a single regular malloc, and assign pointers at
+ particular offsets in the aggregate space. (In this case though, you
+ cannot independently free elements.)
+
+ independent_comallac differs from independent_calloc in that each
+ element may have a different size, and also that it does not
+ automatically clear elements.
+
+ independent_comalloc can be used to speed up allocation in cases
+ where several structs or objects must always be allocated at the
+ same time. For example:
+
+ struct Head { ... }
+ struct Foot { ... }
+
+ void send_message(char* msg) {
+ int msglen = strlen(msg);
+ size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) };
+ void* chunks[3];
+ if (independent_comalloc(3, sizes, chunks) == 0)
+ die();
+ struct Head* head = (struct Head*)(chunks[0]);
+ char* body = (char*)(chunks[1]);
+ struct Foot* foot = (struct Foot*)(chunks[2]);
+ // ...
+ }
+
+ In general though, independent_comalloc is worth using only for
+ larger values of n_elements. For small values, you probably won't
+ detect enough difference from series of malloc calls to bother.
+
+ Overuse of independent_comalloc can increase overall memory usage,
+ since it cannot reuse existing noncontiguous small chunks that
+ might be available for some of the elements.
+*/
+void** dlindependent_comalloc(size_t, size_t*, void**);
+
+
+/*
+ pvalloc(size_t n);
+ Equivalent to valloc(minimum-page-that-holds(n)), that is,
+ round up n to nearest pagesize.
+ */
+void* dlpvalloc(size_t);
+
+/*
+ malloc_trim(size_t pad);
+
+ If possible, gives memory back to the system (via negative arguments
+ to sbrk) if there is unused memory at the `high' end of the malloc
+ pool or in unused MMAP segments. You can call this after freeing
+ large blocks of memory to potentially reduce the system-level memory
+ requirements of a program. However, it cannot guarantee to reduce
+ memory. Under some allocation patterns, some large free blocks of
+ memory will be locked between two used chunks, so they cannot be
+ given back to the system.
+
+ The `pad' argument to malloc_trim represents the amount of free
+ trailing space to leave untrimmed. If this argument is zero, only
+ the minimum amount of memory to maintain internal data structures
+ will be left. Non-zero arguments can be supplied to maintain enough
+ trailing space to service future expected allocations without having
+ to re-obtain memory from the system.
+
+ Malloc_trim returns 1 if it actually released any memory, else 0.
+*/
+int dlmalloc_trim(size_t);
+
+/*
+ malloc_stats();
+ Prints on stderr the amount of space obtained from the system (both
+ via sbrk and mmap), the maximum amount (which may be more than
+ current if malloc_trim and/or munmap got called), and the current
+ number of bytes allocated via malloc (or realloc, etc) but not yet
+ freed. Note that this is the number of bytes allocated, not the
+ number requested. It will be larger than the number requested
+ because of alignment and bookkeeping overhead. Because it includes
+ alignment wastage as being in use, this figure may be greater than
+ zero even when no user-level chunks are allocated.
+
+ The reported current and maximum system memory can be inaccurate if
+ a program makes other calls to system memory allocation functions
+ (normally sbrk) outside of malloc.
+
+ malloc_stats prints only the most commonly interesting statistics.
+ More information can be obtained by calling mallinfo.
+*/
+void dlmalloc_stats(void);
+
+#endif /* ONLY_MSPACES */
+
+/*
+ malloc_usable_size(void* p);
+
+ Returns the number of bytes you can actually use in
+ an allocated chunk, which may be more than you requested (although
+ often not) due to alignment and minimum size constraints.
+ You can use this many bytes without worrying about
+ overwriting other allocated objects. This is not a particularly great
+ programming practice. malloc_usable_size can be more useful in
+ debugging and assertions, for example:
+
+ p = malloc(n);
+ assert(malloc_usable_size(p) >= 256);
+*/
+size_t dlmalloc_usable_size(void*);
+
+
+#if MSPACES
+
+/*
+ mspace is an opaque type representing an independent
+ region of space that supports mspace_malloc, etc.
+*/
+typedef void* mspace;
+
+/*
+ create_mspace creates and returns a new independent space with the
+ given initial capacity, or, if 0, the default granularity size. It
+ returns null if there is no system memory available to create the
+ space. If argument locked is non-zero, the space uses a separate
+ lock to control access. The capacity of the space will grow
+ dynamically as needed to service mspace_malloc requests. You can
+ control the sizes of incremental increases of this space by
+ compiling with a different DEFAULT_GRANULARITY or dynamically
+ setting with mallopt(M_GRANULARITY, value).
+*/
+mspace create_mspace(size_t capacity, int locked);
+
+/*
+ destroy_mspace destroys the given space, and attempts to return all
+ of its memory back to the system, returning the total number of
+ bytes freed. After destruction, the results of access to all memory
+ used by the space become undefined.
+*/
+size_t destroy_mspace(mspace msp);
+
+/*
+ create_mspace_with_base uses the memory supplied as the initial base
+ of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this
+ space is used for bookkeeping, so the capacity must be at least this
+ large. (Otherwise 0 is returned.) When this initial space is
+ exhausted, additional memory will be obtained from the system.
+ Destroying this space will deallocate all additionally allocated
+ space (if possible) but not the initial base.
+*/
+mspace create_mspace_with_base(void* base, size_t capacity, int locked);
+
+/*
+ mspace_track_large_chunks controls whether requests for large chunks
+ are allocated in their own untracked mmapped regions, separate from
+ others in this mspace. By default large chunks are not tracked,
+ which reduces fragmentation. However, such chunks are not
+ necessarily released to the system upon destroy_mspace. Enabling
+ tracking by setting to true may increase fragmentation, but avoids
+ leakage when relying on destroy_mspace to release all memory
+ allocated using this space. The function returns the previous
+ setting.
+*/
+int mspace_track_large_chunks(mspace msp, int enable);
+
+
+/*
+ mspace_malloc behaves as malloc, but operates within
+ the given space.
+*/
+void* mspace_malloc(mspace msp, size_t bytes);
+
+/*
+ mspace_free behaves as free, but operates within
+ the given space.
+
+ If compiled with FOOTERS==1, mspace_free is not actually needed.
+ free may be called instead of mspace_free because freed chunks from
+ any space are handled by their originating spaces.
+*/
+void mspace_free(mspace msp, void* mem);
+
+/*
+ mspace_realloc behaves as realloc, but operates within
+ the given space.
+
+ If compiled with FOOTERS==1, mspace_realloc is not actually
+ needed. realloc may be called instead of mspace_realloc because
+ realloced chunks from any space are handled by their originating
+ spaces.
+*/
+void* mspace_realloc(mspace msp, void* mem, size_t newsize);
+
+/*
+ mspace_calloc behaves as calloc, but operates within
+ the given space.
+*/
+void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size);
+
+/*
+ mspace_memalign behaves as memalign, but operates within
+ the given space.
+*/
+void* mspace_memalign(mspace msp, size_t alignment, size_t bytes);
+
+/*
+ mspace_independent_calloc behaves as independent_calloc, but
+ operates within the given space.
+*/
+void** mspace_independent_calloc(mspace msp, size_t n_elements,
+ size_t elem_size, void* chunks[]);
+
+/*
+ mspace_independent_comalloc behaves as independent_comalloc, but
+ operates within the given space.
+*/
+void** mspace_independent_comalloc(mspace msp, size_t n_elements,
+ size_t sizes[], void* chunks[]);
+
+/*
+ mspace_footprint() returns the number of bytes obtained from the
+ system for this space.
+*/
+size_t mspace_footprint(mspace msp);
+
+/*
+ mspace_max_footprint() returns the peak number of bytes obtained from the
+ system for this space.
+*/
+size_t mspace_max_footprint(mspace msp);
+
+
+#if !NO_MALLINFO
+/*
+ mspace_mallinfo behaves as mallinfo, but reports properties of
+ the given space.
+*/
+struct mallinfo mspace_mallinfo(mspace msp);
+#endif /* NO_MALLINFO */
+
+/*
+ malloc_usable_size(void* p) behaves the same as malloc_usable_size;
+*/
+ size_t mspace_usable_size(void* mem);
+
+/*
+ mspace_malloc_stats behaves as malloc_stats, but reports
+ properties of the given space.
+*/
+void mspace_malloc_stats(mspace msp);
+
+/*
+ mspace_trim behaves as malloc_trim, but
+ operates within the given space.
+*/
+int mspace_trim(mspace msp, size_t pad);
+
+/*
+ An alias for mallopt.
+*/
+int mspace_mallopt(int, int);
+
+#endif /* MSPACES */
+
+#ifdef __cplusplus
+}; /* end of extern "C" */
+#endif /* __cplusplus */
+
+/*
+ ========================================================================
+ To make a fully customizable malloc.h header file, cut everything
+ above this line, put into file malloc.h, edit to suit, and #include it
+ on the next line, as well as in programs that use this malloc.
+ ========================================================================
+*/
+
+/* #include "malloc.h" */
+
+/*------------------------------ internal #includes ---------------------- */
+
+#ifdef WIN32
+#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
+#endif /* WIN32 */
+
+#include <stdio.h> /* for printing in malloc_stats */
+#include <time.h> /* for magic initialization */
+
+#ifndef LACKS_ERRNO_H
+#include <errno.h> /* for MALLOC_FAILURE_ACTION */
+#endif /* LACKS_ERRNO_H */
+#if FOOTERS || DEBUG
+#include <time.h> /* for magic initialization */
+#endif /* FOOTERS */
+#ifndef LACKS_STDLIB_H
+#include <stdlib.h> /* for abort() */
+#endif /* LACKS_STDLIB_H */
+#ifdef DEBUG
+#if ABORT_ON_ASSERT_FAILURE
+#undef assert
+#define assert(x) if(!(x)) ABORT
+#else /* ABORT_ON_ASSERT_FAILURE */
+#include <assert.h>
+#endif /* ABORT_ON_ASSERT_FAILURE */
+#else /* DEBUG */
+#ifndef assert
+#define assert(x)
+#endif
+#define DEBUG 0
+#endif /* DEBUG */
+#ifndef LACKS_STRING_H
+#include <string.h> /* for memset etc */
+#endif /* LACKS_STRING_H */
+#if USE_BUILTIN_FFS
+#ifndef LACKS_STRINGS_H
+#include <strings.h> /* for ffs */
+#endif /* LACKS_STRINGS_H */
+#endif /* USE_BUILTIN_FFS */
+#if HAVE_MMAP
+#ifndef LACKS_SYS_MMAN_H
+/* On some versions of linux, mremap decl in mman.h needs __USE_GNU set */
+#if (defined(linux) && !defined(__USE_GNU))
+#define __USE_GNU 1
+#include <sys/mman.h> /* for mmap */
+#undef __USE_GNU
+#else
+#include <sys/mman.h> /* for mmap */
+#endif /* linux */
+#endif /* LACKS_SYS_MMAN_H */
+#ifndef LACKS_FCNTL_H
+#include <fcntl.h>
+#endif /* LACKS_FCNTL_H */
+#endif /* HAVE_MMAP */
+#ifndef LACKS_UNISTD_H
+#include <unistd.h> /* for sbrk, sysconf */
+#else /* LACKS_UNISTD_H */
+#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+extern void* sbrk(ptrdiff_t);
+#endif /* FreeBSD etc */
+#endif /* LACKS_UNISTD_H */
+
+/* Declarations for locking */
+#if USE_LOCKS
+#ifndef WIN32
+#include <pthread.h>
+#if defined (__SVR4) && defined (__sun) /* solaris */
+#include <thread.h>
+#endif /* solaris */
+#else
+#ifndef _M_AMD64
+/* These are already defined on AMD64 builds */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+LONG __cdecl _InterlockedCompareExchange(LONG volatile *Dest, LONG Exchange, LONG Comp);
+LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _M_AMD64 */
+#pragma intrinsic (_InterlockedCompareExchange)
+#pragma intrinsic (_InterlockedExchange)
+#define interlockedcompareexchange _InterlockedCompareExchange
+#define interlockedexchange _InterlockedExchange
+#endif /* Win32 */
+#endif /* USE_LOCKS */
+
+/* Declarations for bit scanning on win32 */
+#if defined(_MSC_VER) && _MSC_VER>=1300
+#ifndef BitScanForward /* Try to avoid pulling in WinNT.h */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+unsigned char _BitScanForward(unsigned long *index, unsigned long mask);
+unsigned char _BitScanReverse(unsigned long *index, unsigned long mask);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#define BitScanForward _BitScanForward
+#define BitScanReverse _BitScanReverse
+#pragma intrinsic(_BitScanForward)
+#pragma intrinsic(_BitScanReverse)
+#endif /* BitScanForward */
+#endif /* defined(_MSC_VER) && _MSC_VER>=1300 */
+
+#ifndef WIN32
+#ifndef malloc_getpagesize
+# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */
+# ifndef _SC_PAGE_SIZE
+# define _SC_PAGE_SIZE _SC_PAGESIZE
+# endif
+# endif
+# ifdef _SC_PAGE_SIZE
+# define malloc_getpagesize sysconf(_SC_PAGE_SIZE)
+# else
+# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
+ extern size_t getpagesize();
+# define malloc_getpagesize getpagesize()
+# else
+# ifdef WIN32 /* use supplied emulation of getpagesize */
+# define malloc_getpagesize getpagesize()
+# else
+# ifndef LACKS_SYS_PARAM_H
+# include <sys/param.h>
+# endif
+# ifdef EXEC_PAGESIZE
+# define malloc_getpagesize EXEC_PAGESIZE
+# else
+# ifdef NBPG
+# ifndef CLSIZE
+# define malloc_getpagesize NBPG
+# else
+# define malloc_getpagesize (NBPG * CLSIZE)
+# endif
+# else
+# ifdef NBPC
+# define malloc_getpagesize NBPC
+# else
+# ifdef PAGESIZE
+# define malloc_getpagesize PAGESIZE
+# else /* just guess */
+# define malloc_getpagesize ((size_t)4096U)
+# endif
+# endif
+# endif
+# endif
+# endif
+# endif
+# endif
+#endif
+#endif
+
+
+
+/* ------------------- size_t and alignment properties -------------------- */
+
+/* The byte and bit size of a size_t */
+#define SIZE_T_SIZE (sizeof(size_t))
+#define SIZE_T_BITSIZE (sizeof(size_t) << 3)
+
+/* Some constants coerced to size_t */
+/* Annoying but necessary to avoid errors on some platforms */
+#define SIZE_T_ZERO ((size_t)0)
+#define SIZE_T_ONE ((size_t)1)
+#define SIZE_T_TWO ((size_t)2)
+#define SIZE_T_FOUR ((size_t)4)
+#define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1)
+#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2)
+#define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES)
+#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U)
+
+/* The bit mask value corresponding to MALLOC_ALIGNMENT */
+#define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE)
+
+/* True if address a has acceptable alignment */
+#define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0)
+
+/* the number of bytes to offset an address to align it */
+#define align_offset(A)\
+ ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
+ ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK))
+
+/* -------------------------- MMAP preliminaries ------------------------- */
+
+/*
+ If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and
+ checks to fail so compiler optimizer can delete code rather than
+ using so many "#if"s.
+*/
+
+
+/* MORECORE and MMAP must return MFAIL on failure */
+#define MFAIL ((void*)(MAX_SIZE_T))
+#define CMFAIL ((char*)(MFAIL)) /* defined for convenience */
+
+#if HAVE_MMAP
+
+#ifndef WIN32
+#define MUNMAP_DEFAULT(a, s) munmap((a), (s))
+#define MMAP_PROT (PROT_READ|PROT_WRITE)
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#define MAP_ANONYMOUS MAP_ANON
+#endif /* MAP_ANON */
+#ifdef MAP_ANONYMOUS
+#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS)
+#define MMAP_DEFAULT(s) mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0)
+#else /* MAP_ANONYMOUS */
+/*
+ Nearly all versions of mmap support MAP_ANONYMOUS, so the following
+ is unlikely to be needed, but is supplied just in case.
+*/
+#define MMAP_FLAGS (MAP_PRIVATE)
+static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
+#define MMAP_DEFAULT(s) ((dev_zero_fd < 0) ? \
+ (dev_zero_fd = open("/dev/zero", O_RDWR), \
+ mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \
+ mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0))
+#endif /* MAP_ANONYMOUS */
+
+#define DIRECT_MMAP_DEFAULT(s) MMAP_DEFAULT(s)
+
+#else /* WIN32 */
+
+/* Win32 MMAP via VirtualAlloc */
+static FORCEINLINE void* win32mmap(size_t size) {
+ void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
+ return (ptr != 0)? ptr: MFAIL;
+}
+
+/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */
+static FORCEINLINE void* win32direct_mmap(size_t size) {
+ void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN,
+ PAGE_READWRITE);
+ return (ptr != 0)? ptr: MFAIL;
+}
+
+/* This function supports releasing coalesed segments */
+static FORCEINLINE int win32munmap(void* ptr, size_t size) {
+ MEMORY_BASIC_INFORMATION minfo;
+ char* cptr = (char*)ptr;
+ while (size) {
+ if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0)
+ return -1;
+ if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr ||
+ minfo.State != MEM_COMMIT || minfo.RegionSize > size)
+ return -1;
+ if (VirtualFree(cptr, 0, MEM_RELEASE) == 0)
+ return -1;
+ cptr += minfo.RegionSize;
+ size -= minfo.RegionSize;
+ }
+ return 0;
+}
+
+#define MMAP_DEFAULT(s) win32mmap(s)
+#define MUNMAP_DEFAULT(a, s) win32munmap((a), (s))
+#define DIRECT_MMAP_DEFAULT(s) win32direct_mmap(s)
+#endif /* WIN32 */
+#endif /* HAVE_MMAP */
+
+#if HAVE_MREMAP
+#ifndef WIN32
+#define MREMAP_DEFAULT(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
+#endif /* WIN32 */
+#endif /* HAVE_MREMAP */
+
+
+/**
+ * Define CALL_MORECORE
+ */
+#if HAVE_MORECORE
+ #ifdef MORECORE
+ #define CALL_MORECORE(S) MORECORE(S)
+ #else /* MORECORE */
+ #define CALL_MORECORE(S) MORECORE_DEFAULT(S)
+ #endif /* MORECORE */
+#else /* HAVE_MORECORE */
+ #define CALL_MORECORE(S) MFAIL
+#endif /* HAVE_MORECORE */
+
+/**
+ * Define CALL_MMAP/CALL_MUNMAP/CALL_DIRECT_MMAP
+ */
+#if HAVE_MMAP
+ #define USE_MMAP_BIT (SIZE_T_ONE)
+
+ #ifdef MMAP
+ #define CALL_MMAP(s) MMAP(s)
+ #else /* MMAP */
+ #define CALL_MMAP(s) MMAP_DEFAULT(s)
+ #endif /* MMAP */
+ #ifdef MUNMAP
+ #define CALL_MUNMAP(a, s) MUNMAP((a), (s))
+ #else /* MUNMAP */
+ #define CALL_MUNMAP(a, s) MUNMAP_DEFAULT((a), (s))
+ #endif /* MUNMAP */
+ #ifdef DIRECT_MMAP
+ #define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s)
+ #else /* DIRECT_MMAP */
+ #define CALL_DIRECT_MMAP(s) DIRECT_MMAP_DEFAULT(s)
+ #endif /* DIRECT_MMAP */
+#else /* HAVE_MMAP */
+ #define USE_MMAP_BIT (SIZE_T_ZERO)
+
+ #define MMAP(s) MFAIL
+ #define MUNMAP(a, s) (-1)
+ #define DIRECT_MMAP(s) MFAIL
+ #define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s)
+ #define CALL_MMAP(s) MMAP(s)
+ #define CALL_MUNMAP(a, s) MUNMAP((a), (s))
+#endif /* HAVE_MMAP */
+
+/**
+ * Define CALL_MREMAP
+ */
+#if HAVE_MMAP && HAVE_MREMAP
+ #ifdef MREMAP
+ #define CALL_MREMAP(addr, osz, nsz, mv) MREMAP((addr), (osz), (nsz), (mv))
+ #else /* MREMAP */
+ #define CALL_MREMAP(addr, osz, nsz, mv) MREMAP_DEFAULT((addr), (osz), (nsz), (mv))
+ #endif /* MREMAP */
+#else /* HAVE_MMAP && HAVE_MREMAP */
+ #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
+#endif /* HAVE_MMAP && HAVE_MREMAP */
+
+/* mstate bit set if continguous morecore disabled or failed */
+#define USE_NONCONTIGUOUS_BIT (4U)
+
+/* segment bit set in create_mspace_with_base */
+#define EXTERN_BIT (8U)
+
+
+/* --------------------------- Lock preliminaries ------------------------ */
+
+/*
+ When locks are defined, there is one global lock, plus
+ one per-mspace lock.
+
+ The global lock_ensures that mparams.magic and other unique
+ mparams values are initialized only once. It also protects
+ sequences of calls to MORECORE. In many cases sys_alloc requires
+ two calls, that should not be interleaved with calls by other
+ threads. This does not protect against direct calls to MORECORE
+ by other threads not using this lock, so there is still code to
+ cope the best we can on interference.
+
+ Per-mspace locks surround calls to malloc, free, etc. To enable use
+ in layered extensions, per-mspace locks are reentrant.
+
+ Because lock-protected regions generally have bounded times, it is
+ OK to use the supplied simple spinlocks in the custom versions for
+ x86. Spinlocks are likely to improve performance for lightly
+ contended applications, but worsen performance under heavy
+ contention.
+
+ If USE_LOCKS is > 1, the definitions of lock routines here are
+ bypassed, in which case you will need to define the type MLOCK_T,
+ and at least INITIAL_LOCK, ACQUIRE_LOCK, RELEASE_LOCK and possibly
+ TRY_LOCK (which is not used in this malloc, but commonly needed in
+ extensions.) You must also declare a
+ static MLOCK_T malloc_global_mutex = { initialization values };.
+
+*/
+
+#if USE_LOCKS == 1
+
+#if USE_SPIN_LOCKS && SPIN_LOCKS_AVAILABLE
+#ifndef WIN32
+
+/* Custom pthread-style spin locks on x86 and x64 for gcc */
+struct pthread_mlock_t {
+ volatile unsigned int l;
+ unsigned int c;
+ pthread_t threadid;
+};
+#define MLOCK_T struct pthread_mlock_t
+#define CURRENT_THREAD pthread_self()
+#define INITIAL_LOCK(sl) ((sl)->threadid = 0, (sl)->l = (sl)->c = 0, 0)
+#define ACQUIRE_LOCK(sl) pthread_acquire_lock(sl)
+#define RELEASE_LOCK(sl) pthread_release_lock(sl)
+#define TRY_LOCK(sl) pthread_try_lock(sl)
+#define SPINS_PER_YIELD 63
+
+static MLOCK_T malloc_global_mutex = { 0, 0, 0};
+
+static FORCEINLINE int pthread_acquire_lock (MLOCK_T *sl) {
+ int spins = 0;
+ volatile unsigned int* lp = &sl->l;
+ for (;;) {
+ if (*lp != 0) {
+ if (sl->threadid == CURRENT_THREAD) {
+ ++sl->c;
+ return 0;
+ }
+ }
+ else {
+ /* place args to cmpxchgl in locals to evade oddities in some gccs */
+ int cmp = 0;
+ int val = 1;
+ int ret;
+ __asm__ __volatile__ ("lock; cmpxchgl %1, %2"
+ : "=a" (ret)
+ : "r" (val), "m" (*(lp)), "0"(cmp)
+ : "memory", "cc");
+ if (!ret) {
+ assert(!sl->threadid);
+ sl->threadid = CURRENT_THREAD;
+ sl->c = 1;
+ return 0;
+ }
+ }
+ if ((++spins & SPINS_PER_YIELD) == 0) {
+#if defined (__SVR4) && defined (__sun) /* solaris */
+ thr_yield();
+#else
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
+ sched_yield();
+#else /* no-op yield on unknown systems */
+ ;
+#endif /* __linux__ || __FreeBSD__ || __APPLE__ */
+#endif /* solaris */
+ }
+ }
+}
+
+static FORCEINLINE void pthread_release_lock (MLOCK_T *sl) {
+ volatile unsigned int* lp = &sl->l;
+ assert(*lp != 0);
+ assert(sl->threadid == CURRENT_THREAD);
+ if (--sl->c == 0) {
+ sl->threadid = 0;
+ int prev = 0;
+ int ret;
+ __asm__ __volatile__ ("lock; xchgl %0, %1"
+ : "=r" (ret)
+ : "m" (*(lp)), "0"(prev)
+ : "memory");
+ }
+}
+
+static FORCEINLINE int pthread_try_lock (MLOCK_T *sl) {
+ volatile unsigned int* lp = &sl->l;
+ if (*lp != 0) {
+ if (sl->threadid == CURRENT_THREAD) {
+ ++sl->c;
+ return 1;
+ }
+ }
+ else {
+ int cmp = 0;
+ int val = 1;
+ int ret;
+ __asm__ __volatile__ ("lock; cmpxchgl %1, %2"
+ : "=a" (ret)
+ : "r" (val), "m" (*(lp)), "0"(cmp)
+ : "memory", "cc");
+ if (!ret) {
+ assert(!sl->threadid);
+ sl->threadid = CURRENT_THREAD;
+ sl->c = 1;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+
+#else /* WIN32 */
+/* Custom win32-style spin locks on x86 and x64 for MSC */
+struct win32_mlock_t {
+ volatile long l;
+ unsigned int c;
+ long threadid;
+};
+
+#define MLOCK_T struct win32_mlock_t
+#define CURRENT_THREAD GetCurrentThreadId()
+#define INITIAL_LOCK(sl) ((sl)->threadid = 0, (sl)->l = (sl)->c = 0, 0)
+#define ACQUIRE_LOCK(sl) win32_acquire_lock(sl)
+#define RELEASE_LOCK(sl) win32_release_lock(sl)
+#define TRY_LOCK(sl) win32_try_lock(sl)
+#define SPINS_PER_YIELD 63
+
+static MLOCK_T malloc_global_mutex = { 0, 0, 0};
+
+static FORCEINLINE int win32_acquire_lock (MLOCK_T *sl) {
+ int spins = 0;
+ for (;;) {
+ if (sl->l != 0) {
+ if (sl->threadid == CURRENT_THREAD) {
+ ++sl->c;
+ return 0;
+ }
+ }
+ else {
+ if (!interlockedexchange(&sl->l, 1)) {
+ assert(!sl->threadid);
+ sl->threadid = CURRENT_THREAD;
+ sl->c = 1;
+ return 0;
+ }
+ }
+ if ((++spins & SPINS_PER_YIELD) == 0)
+ SleepEx(0, FALSE);
+ }
+}
+
+static FORCEINLINE void win32_release_lock (MLOCK_T *sl) {
+ assert(sl->threadid == CURRENT_THREAD);
+ assert(sl->l != 0);
+ if (--sl->c == 0) {
+ sl->threadid = 0;
+ interlockedexchange (&sl->l, 0);
+ }
+}
+
+static FORCEINLINE int win32_try_lock (MLOCK_T *sl) {
+ if (sl->l != 0) {
+ if (sl->threadid == CURRENT_THREAD) {
+ ++sl->c;
+ return 1;
+ }
+ }
+ else {
+ if (!interlockedexchange(&sl->l, 1)){
+ assert(!sl->threadid);
+ sl->threadid = CURRENT_THREAD;
+ sl->c = 1;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+#endif /* WIN32 */
+#else /* USE_SPIN_LOCKS */
+
+#ifndef WIN32
+/* pthreads-based locks */
+
+#define MLOCK_T pthread_mutex_t
+#define CURRENT_THREAD pthread_self()
+#define INITIAL_LOCK(sl) pthread_init_lock(sl)
+#define ACQUIRE_LOCK(sl) pthread_mutex_lock(sl)
+#define RELEASE_LOCK(sl) pthread_mutex_unlock(sl)
+#define TRY_LOCK(sl) (!pthread_mutex_trylock(sl))
+
+static MLOCK_T malloc_global_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* Cope with old-style linux recursive lock initialization by adding */
+/* skipped internal declaration from pthread.h */
+#ifdef linux
+#ifndef PTHREAD_MUTEX_RECURSIVE
+extern int pthread_mutexattr_setkind_np __P ((pthread_mutexattr_t *__attr,
+ int __kind));
+#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
+#define pthread_mutexattr_settype(x,y) pthread_mutexattr_setkind_np(x,y)
+#endif
+#endif
+
+static int pthread_init_lock (MLOCK_T *sl) {
+ pthread_mutexattr_t attr;
+ if (pthread_mutexattr_init(&attr)) return 1;
+ if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)) return 1;
+ if (pthread_mutex_init(sl, &attr)) return 1;
+ if (pthread_mutexattr_destroy(&attr)) return 1;
+ return 0;
+}
+
+#else /* WIN32 */
+/* Win32 critical sections */
+#define MLOCK_T CRITICAL_SECTION
+#define CURRENT_THREAD GetCurrentThreadId()
+#define INITIAL_LOCK(s) (!InitializeCriticalSectionAndSpinCount((s), 0x80000000|4000))
+#define ACQUIRE_LOCK(s) (EnterCriticalSection(sl), 0)
+#define RELEASE_LOCK(s) LeaveCriticalSection(sl)
+#define TRY_LOCK(s) TryEnterCriticalSection(sl)
+#define NEED_GLOBAL_LOCK_INIT
+
+static MLOCK_T malloc_global_mutex;
+static volatile long malloc_global_mutex_status;
+
+/* Use spin loop to initialize global lock */
+static void init_malloc_global_mutex() {
+ for (;;) {
+ long stat = malloc_global_mutex_status;
+ if (stat > 0)
+ return;
+ /* transition to < 0 while initializing, then to > 0) */
+ if (stat == 0 &&
+ interlockedcompareexchange(&malloc_global_mutex_status, -1, 0) == 0) {
+ InitializeCriticalSection(&malloc_global_mutex);
+ interlockedexchange(&malloc_global_mutex_status,1);
+ return;
+ }
+ SleepEx(0, FALSE);
+ }
+}
+
+#endif /* WIN32 */
+#endif /* USE_SPIN_LOCKS */
+#endif /* USE_LOCKS == 1 */
+
+/* ----------------------- User-defined locks ------------------------ */
+
+#if USE_LOCKS > 1
+/* Define your own lock implementation here */
+/* #define INITIAL_LOCK(sl) ... */
+/* #define ACQUIRE_LOCK(sl) ... */
+/* #define RELEASE_LOCK(sl) ... */
+/* #define TRY_LOCK(sl) ... */
+/* static MLOCK_T malloc_global_mutex = ... */
+#endif /* USE_LOCKS > 1 */
+
+/* ----------------------- Lock-based state ------------------------ */
+
+#if USE_LOCKS
+#define USE_LOCK_BIT (2U)
+#else /* USE_LOCKS */
+#define USE_LOCK_BIT (0U)
+#define INITIAL_LOCK(l)
+#endif /* USE_LOCKS */
+
+#if USE_LOCKS
+#ifndef ACQUIRE_MALLOC_GLOBAL_LOCK
+#define ACQUIRE_MALLOC_GLOBAL_LOCK() ACQUIRE_LOCK(&malloc_global_mutex);
+#endif
+#ifndef RELEASE_MALLOC_GLOBAL_LOCK
+#define RELEASE_MALLOC_GLOBAL_LOCK() RELEASE_LOCK(&malloc_global_mutex);
+#endif
+#else /* USE_LOCKS */
+#define ACQUIRE_MALLOC_GLOBAL_LOCK()
+#define RELEASE_MALLOC_GLOBAL_LOCK()
+#endif /* USE_LOCKS */
+
+
+/* ----------------------- Chunk representations ------------------------ */
+
+/*
+ (The following includes lightly edited explanations by Colin Plumb.)
+
+ The malloc_chunk declaration below is misleading (but accurate and
+ necessary). It declares a "view" into memory allowing access to
+ necessary fields at known offsets from a given base.
+
+ Chunks of memory are maintained using a `boundary tag' method as
+ originally described by Knuth. (See the paper by Paul Wilson
+ ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such
+ techniques.) Sizes of free chunks are stored both in the front of
+ each chunk and at the end. This makes consolidating fragmented
+ chunks into bigger chunks fast. The head fields also hold bits
+ representing whether chunks are free or in use.
+
+ Here are some pictures to make it clearer. They are "exploded" to
+ show that the state of a chunk can be thought of as extending from
+ the high 31 bits of the head field of its header through the
+ prev_foot and PINUSE_BIT bit of the following chunk header.
+
+ A chunk that's in use looks like:
+
+ chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Size of previous chunk (if P = 0) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P|
+ | Size of this chunk 1| +-+
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | |
+ +- -+
+ | |
+ +- -+
+ | :
+ +- size - sizeof(size_t) available payload bytes -+
+ : |
+ chunk-> +- -+
+ | |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1|
+ | Size of next chunk (may or may not be in use) | +-+
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ And if it's free, it looks like this:
+
+ chunk-> +- -+
+ | User payload (must be in use, or we would have merged!) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P|
+ | Size of this chunk 0| +-+
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Next pointer |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Prev pointer |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | :
+ +- size - sizeof(struct chunk) unused bytes -+
+ : |
+ chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Size of this chunk |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0|
+ | Size of next chunk (must be in use, or we would have merged)| +-+
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | :
+ +- User payload -+
+ : |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ |0|
+ +-+
+ Note that since we always merge adjacent free chunks, the chunks
+ adjacent to a free chunk must be in use.
+
+ Given a pointer to a chunk (which can be derived trivially from the
+ payload pointer) we can, in O(1) time, find out whether the adjacent
+ chunks are free, and if so, unlink them from the lists that they
+ are on and merge them with the current chunk.
+
+ Chunks always begin on even word boundaries, so the mem portion
+ (which is returned to the user) is also on an even word boundary, and
+ thus at least double-word aligned.
+
+ The P (PINUSE_BIT) bit, stored in the unused low-order bit of the
+ chunk size (which is always a multiple of two words), is an in-use
+ bit for the *previous* chunk. If that bit is *clear*, then the
+ word before the current chunk size contains the previous chunk
+ size, and can be used to find the front of the previous chunk.
+ The very first chunk allocated always has this bit set, preventing
+ access to non-existent (or non-owned) memory. If pinuse is set for
+ any given chunk, then you CANNOT determine the size of the
+ previous chunk, and might even get a memory addressing fault when
+ trying to do so.
+
+ The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of
+ the chunk size redundantly records whether the current chunk is
+ inuse (unless the chunk is mmapped). This redundancy enables usage
+ checks within free and realloc, and reduces indirection when freeing
+ and consolidating chunks.
+
+ Each freshly allocated chunk must have both cinuse and pinuse set.
+ That is, each allocated chunk borders either a previously allocated
+ and still in-use chunk, or the base of its memory arena. This is
+ ensured by making all allocations from the the `lowest' part of any
+ found chunk. Further, no free chunk physically borders another one,
+ so each free chunk is known to be preceded and followed by either
+ inuse chunks or the ends of memory.
+
+ Note that the `foot' of the current chunk is actually represented
+ as the prev_foot of the NEXT chunk. This makes it easier to
+ deal with alignments etc but can be very confusing when trying
+ to extend or adapt this code.
+
+ The exceptions to all this are
+
+ 1. The special chunk `top' is the top-most available chunk (i.e.,
+ the one bordering the end of available memory). It is treated
+ specially. Top is never included in any bin, is used only if
+ no other chunk is available, and is released back to the
+ system if it is very large (see M_TRIM_THRESHOLD). In effect,
+ the top chunk is treated as larger (and thus less well
+ fitting) than any other available chunk. The top chunk
+ doesn't update its trailing size field since there is no next
+ contiguous chunk that would have to index off it. However,
+ space is still allocated for it (TOP_FOOT_SIZE) to enable
+ separation or merging when space is extended.
+
+ 3. Chunks allocated via mmap, have both cinuse and pinuse bits
+ cleared in their head fields. Because they are allocated
+ one-by-one, each must carry its own prev_foot field, which is
+ also used to hold the offset this chunk has within its mmapped
+ region, which is needed to preserve alignment. Each mmapped
+ chunk is trailed by the first two fields of a fake next-chunk
+ for sake of usage checks.
+
+*/
+
+struct malloc_chunk {
+ size_t prev_foot; /* Size of previous chunk (if free). */
+ size_t head; /* Size and inuse bits. */
+ struct malloc_chunk* fd; /* double links -- used only if free. */
+ struct malloc_chunk* bk;
+};
+
+typedef struct malloc_chunk mchunk;
+typedef struct malloc_chunk* mchunkptr;
+typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */
+typedef unsigned int bindex_t; /* Described below */
+typedef unsigned int binmap_t; /* Described below */
+typedef unsigned int flag_t; /* The type of various bit flag sets */
+
+/* ------------------- Chunks sizes and alignments ----------------------- */
+
+#define MCHUNK_SIZE (sizeof(mchunk))
+
+#if FOOTERS
+#define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
+#else /* FOOTERS */
+#define CHUNK_OVERHEAD (SIZE_T_SIZE)
+#endif /* FOOTERS */
+
+/* MMapped chunks need a second word of overhead ... */
+#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
+/* ... and additional padding for fake next-chunk at foot */
+#define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES)
+
+/* The smallest size we can malloc is an aligned minimal chunk */
+#define MIN_CHUNK_SIZE\
+ ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
+
+/* conversion from malloc headers to user pointers, and back */
+#define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES))
+#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES))
+/* chunk associated with aligned address A */
+#define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A)))
+
+/* Bounds on request (not chunk) sizes. */
+#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2)
+#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)
+
+/* pad request bytes into a usable size */
+#define pad_request(req) \
+ (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
+
+/* pad request, checking for minimum (but not maximum) */
+#define request2size(req) \
+ (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req))
+
+
+/* ------------------ Operations on head and foot fields ----------------- */
+
+/*
+ The head field of a chunk is or'ed with PINUSE_BIT when previous
+ adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in
+ use, unless mmapped, in which case both bits are cleared.
+
+ FLAG4_BIT is not used by this malloc, but might be useful in extensions.
+*/
+
+#define PINUSE_BIT (SIZE_T_ONE)
+#define CINUSE_BIT (SIZE_T_TWO)
+#define FLAG4_BIT (SIZE_T_FOUR)
+#define INUSE_BITS (PINUSE_BIT|CINUSE_BIT)
+#define FLAG_BITS (PINUSE_BIT|CINUSE_BIT|FLAG4_BIT)
+
+/* Head value for fenceposts */
+#define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE)
+
+/* extraction of fields from head words */
+#define cinuse(p) ((p)->head & CINUSE_BIT)
+#define pinuse(p) ((p)->head & PINUSE_BIT)
+#define is_inuse(p) (((p)->head & INUSE_BITS) != PINUSE_BIT)
+#define is_mmapped(p) (((p)->head & INUSE_BITS) == 0)
+
+#define chunksize(p) ((p)->head & ~(FLAG_BITS))
+
+#define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT)
+
+/* Treat space at ptr +/- offset as a chunk */
+#define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s)))
+#define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s)))
+
+/* Ptr to next or previous physical malloc_chunk. */
+#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~FLAG_BITS)))
+#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) ))
+
+/* extract next chunk's pinuse bit */
+#define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT)
+
+/* Get/set size at footer */
+#define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot)
+#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s))
+
+/* Set size, pinuse bit, and foot */
+#define set_size_and_pinuse_of_free_chunk(p, s)\
+ ((p)->head = (s|PINUSE_BIT), set_foot(p, s))
+
+/* Set size, pinuse bit, foot, and clear next pinuse */
+#define set_free_with_pinuse(p, s, n)\
+ (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s))
+
+/* Get the internal overhead associated with chunk p */
+#define overhead_for(p)\
+ (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD)
+
+/* Return true if malloced space is not necessarily cleared */
+#if MMAP_CLEARS
+#define calloc_must_clear(p) (!is_mmapped(p))
+#else /* MMAP_CLEARS */
+#define calloc_must_clear(p) (1)
+#endif /* MMAP_CLEARS */
+
+/* ---------------------- Overlaid data structures ----------------------- */
+
+/*
+ When chunks are not in use, they are treated as nodes of either
+ lists or trees.
+
+ "Small" chunks are stored in circular doubly-linked lists, and look
+ like this:
+
+ chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Size of previous chunk |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ `head:' | Size of chunk, in bytes |P|
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Forward pointer to next chunk in list |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Back pointer to previous chunk in list |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Unused space (may be 0 bytes long) .
+ . .
+ . |
+nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ `foot:' | Size of chunk, in bytes |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ Larger chunks are kept in a form of bitwise digital trees (aka
+ tries) keyed on chunksizes. Because malloc_tree_chunks are only for
+ free chunks greater than 256 bytes, their size doesn't impose any
+ constraints on user chunk sizes. Each node looks like:
+
+ chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Size of previous chunk |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ `head:' | Size of chunk, in bytes |P|
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Forward pointer to next chunk of same size |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Back pointer to previous chunk of same size |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Pointer to left child (child[0]) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Pointer to right child (child[1]) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Pointer to parent |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | bin index of this chunk |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Unused space .
+ . |
+nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ `foot:' | Size of chunk, in bytes |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ Each tree holding treenodes is a tree of unique chunk sizes. Chunks
+ of the same size are arranged in a circularly-linked list, with only
+ the oldest chunk (the next to be used, in our FIFO ordering)
+ actually in the tree. (Tree members are distinguished by a non-null
+ parent pointer.) If a chunk with the same size an an existing node
+ is inserted, it is linked off the existing node using pointers that
+ work in the same way as fd/bk pointers of small chunks.
+
+ Each tree contains a power of 2 sized range of chunk sizes (the
+ smallest is 0x100 <= x < 0x180), which is is divided in half at each
+ tree level, with the chunks in the smaller half of the range (0x100
+ <= x < 0x140 for the top nose) in the left subtree and the larger
+ half (0x140 <= x < 0x180) in the right subtree. This is, of course,
+ done by inspecting individual bits.
+
+ Using these rules, each node's left subtree contains all smaller
+ sizes than its right subtree. However, the node at the root of each
+ subtree has no particular ordering relationship to either. (The
+ dividing line between the subtree sizes is based on trie relation.)
+ If we remove the last chunk of a given size from the interior of the
+ tree, we need to replace it with a leaf node. The tree ordering
+ rules permit a node to be replaced by any leaf below it.
+
+ The smallest chunk in a tree (a common operation in a best-fit
+ allocator) can be found by walking a path to the leftmost leaf in
+ the tree. Unlike a usual binary tree, where we follow left child
+ pointers until we reach a null, here we follow the right child
+ pointer any time the left one is null, until we reach a leaf with
+ both child pointers null. The smallest chunk in the tree will be
+ somewhere along that path.
+
+ The worst case number of steps to add, find, or remove a node is
+ bounded by the number of bits differentiating chunks within
+ bins. Under current bin calculations, this ranges from 6 up to 21
+ (for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case
+ is of course much better.
+*/
+
+struct malloc_tree_chunk {
+ /* The first four fields must be compatible with malloc_chunk */
+ size_t prev_foot;
+ size_t head;
+ struct malloc_tree_chunk* fd;
+ struct malloc_tree_chunk* bk;
+
+ struct malloc_tree_chunk* child[2];
+ struct malloc_tree_chunk* parent;
+ bindex_t index;
+};
+
+typedef struct malloc_tree_chunk tchunk;
+typedef struct malloc_tree_chunk* tchunkptr;
+typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */
+
+/* A little helper macro for trees */
+#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1])
+
+/* ----------------------------- Segments -------------------------------- */
+
+/*
+ Each malloc space may include non-contiguous segments, held in a
+ list headed by an embedded malloc_segment record representing the
+ top-most space. Segments also include flags holding properties of
+ the space. Large chunks that are directly allocated by mmap are not
+ included in this list. They are instead independently created and
+ destroyed without otherwise keeping track of them.
+
+ Segment management mainly comes into play for spaces allocated by
+ MMAP. Any call to MMAP might or might not return memory that is
+ adjacent to an existing segment. MORECORE normally contiguously
+ extends the current space, so this space is almost always adjacent,
+ which is simpler and faster to deal with. (This is why MORECORE is
+ used preferentially to MMAP when both are available -- see
+ sys_alloc.) When allocating using MMAP, we don't use any of the
+ hinting mechanisms (inconsistently) supported in various
+ implementations of unix mmap, or distinguish reserving from
+ committing memory. Instead, we just ask for space, and exploit
+ contiguity when we get it. It is probably possible to do
+ better than this on some systems, but no general scheme seems
+ to be significantly better.
+
+ Management entails a simpler variant of the consolidation scheme
+ used for chunks to reduce fragmentation -- new adjacent memory is
+ normally prepended or appended to an existing segment. However,
+ there are limitations compared to chunk consolidation that mostly
+ reflect the fact that segment processing is relatively infrequent
+ (occurring only when getting memory from system) and that we
+ don't expect to have huge numbers of segments:
+
+ * Segments are not indexed, so traversal requires linear scans. (It
+ would be possible to index these, but is not worth the extra
+ overhead and complexity for most programs on most platforms.)
+ * New segments are only appended to old ones when holding top-most
+ memory; if they cannot be prepended to others, they are held in
+ different segments.
+
+ Except for the top-most segment of an mstate, each segment record
+ is kept at the tail of its segment. Segments are added by pushing
+ segment records onto the list headed by &mstate.seg for the
+ containing mstate.
+
+ Segment flags control allocation/merge/deallocation policies:
+ * If EXTERN_BIT set, then we did not allocate this segment,
+ and so should not try to deallocate or merge with others.
+ (This currently holds only for the initial segment passed
+ into create_mspace_with_base.)
+ * If USE_MMAP_BIT set, the segment may be merged with
+ other surrounding mmapped segments and trimmed/de-allocated
+ using munmap.
+ * If neither bit is set, then the segment was obtained using
+ MORECORE so can be merged with surrounding MORECORE'd segments
+ and deallocated/trimmed using MORECORE with negative arguments.
+*/
+
+struct malloc_segment {
+ char* base; /* base address */
+ size_t size; /* allocated size */
+ struct malloc_segment* next; /* ptr to next segment */
+ flag_t sflags; /* mmap and extern flag */
+};
+
+#define is_mmapped_segment(S) ((S)->sflags & USE_MMAP_BIT)
+#define is_extern_segment(S) ((S)->sflags & EXTERN_BIT)
+
+typedef struct malloc_segment msegment;
+typedef struct malloc_segment* msegmentptr;
+
+/* ---------------------------- malloc_state ----------------------------- */
+
+/*
+ A malloc_state holds all of the bookkeeping for a space.
+ The main fields are:
+
+ Top
+ The topmost chunk of the currently active segment. Its size is
+ cached in topsize. The actual size of topmost space is
+ topsize+TOP_FOOT_SIZE, which includes space reserved for adding
+ fenceposts and segment records if necessary when getting more
+ space from the system. The size at which to autotrim top is
+ cached from mparams in trim_check, except that it is disabled if
+ an autotrim fails.
+
+ Designated victim (dv)
+ This is the preferred chunk for servicing small requests that
+ don't have exact fits. It is normally the chunk split off most
+ recently to service another small request. Its size is cached in
+ dvsize. The link fields of this chunk are not maintained since it
+ is not kept in a bin.
+
+ SmallBins
+ An array of bin headers for free chunks. These bins hold chunks
+ with sizes less than MIN_LARGE_SIZE bytes. Each bin contains
+ chunks of all the same size, spaced 8 bytes apart. To simplify
+ use in double-linked lists, each bin header acts as a malloc_chunk
+ pointing to the real first node, if it exists (else pointing to
+ itself). This avoids special-casing for headers. But to avoid
+ waste, we allocate only the fd/bk pointers of bins, and then use
+ repositioning tricks to treat these as the fields of a chunk.
+
+ TreeBins
+ Treebins are pointers to the roots of trees holding a range of
+ sizes. There are 2 equally spaced treebins for each power of two
+ from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything
+ larger.
+
+ Bin maps
+ There is one bit map for small bins ("smallmap") and one for
+ treebins ("treemap). Each bin sets its bit when non-empty, and
+ clears the bit when empty. Bit operations are then used to avoid
+ bin-by-bin searching -- nearly all "search" is done without ever
+ looking at bins that won't be selected. The bit maps
+ conservatively use 32 bits per map word, even if on 64bit system.
+ For a good description of some of the bit-based techniques used
+ here, see Henry S. Warren Jr's book "Hacker's Delight" (and
+ supplement at http://hackersdelight.org/). Many of these are
+ intended to reduce the branchiness of paths through malloc etc, as
+ well as to reduce the number of memory locations read or written.
+
+ Segments
+ A list of segments headed by an embedded malloc_segment record
+ representing the initial space.
+
+ Address check support
+ The least_addr field is the least address ever obtained from
+ MORECORE or MMAP. Attempted frees and reallocs of any address less
+ than this are trapped (unless INSECURE is defined).
+
+ Magic tag
+ A cross-check field that should always hold same value as mparams.magic.
+
+ Flags
+ Bits recording whether to use MMAP, locks, or contiguous MORECORE
+
+ Statistics
+ Each space keeps track of current and maximum system memory
+ obtained via MORECORE or MMAP.
+
+ Trim support
+ Fields holding the amount of unused topmost memory that should trigger
+ timming, and a counter to force periodic scanning to release unused
+ non-topmost segments.
+
+ Locking
+ If USE_LOCKS is defined, the "mutex" lock is acquired and released
+ around every public call using this mspace.
+
+ Extension support
+ A void* pointer and a size_t field that can be used to help implement
+ extensions to this malloc.
+*/
+
+/* Bin types, widths and sizes */
+#define NSMALLBINS (32U)
+#define NTREEBINS (32U)
+#define SMALLBIN_SHIFT (3U)
+#define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT)
+#define TREEBIN_SHIFT (8U)
+#define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT)
+#define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE)
+#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD)
+
+struct malloc_state {
+ binmap_t smallmap;
+ binmap_t treemap;
+ size_t dvsize;
+ size_t topsize;
+ char* least_addr;
+ mchunkptr dv;
+ mchunkptr top;
+ size_t trim_check;
+ size_t release_checks;
+ size_t magic;
+ mchunkptr smallbins[(NSMALLBINS+1)*2];
+ tbinptr treebins[NTREEBINS];
+ size_t footprint;
+ size_t max_footprint;
+ flag_t mflags;
+#if USE_LOCKS
+ MLOCK_T mutex; /* locate lock among fields that rarely change */
+#endif /* USE_LOCKS */
+ msegment seg;
+ void* extp; /* Unused but available for extensions */
+ size_t exts;
+};
+
+typedef struct malloc_state* mstate;
+
+/* ------------- Global malloc_state and malloc_params ------------------- */
+
+/*
+ malloc_params holds global properties, including those that can be
+ dynamically set using mallopt. There is a single instance, mparams,
+ initialized in init_mparams. Note that the non-zeroness of "magic"
+ also serves as an initialization flag.
+*/
+
+struct malloc_params {
+ volatile size_t magic;
+ size_t page_size;
+ size_t granularity;
+ size_t mmap_threshold;
+ size_t trim_threshold;
+ flag_t default_mflags;
+};
+
+static struct malloc_params mparams;
+
+/* Ensure mparams initialized */
+#define ensure_initialization() (void)(mparams.magic != 0 || init_mparams())
+
+#if !ONLY_MSPACES
+
+/* The global malloc_state used for all non-"mspace" calls */
+static struct malloc_state _gm_;
+#define gm (&_gm_)
+#define is_global(M) ((M) == &_gm_)
+
+#endif /* !ONLY_MSPACES */
+
+#define is_initialized(M) ((M)->top != 0)
+
+/* -------------------------- system alloc setup ------------------------- */
+
+/* Operations on mflags */
+
+#define use_lock(M) ((M)->mflags & USE_LOCK_BIT)
+#define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT)
+#define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT)
+
+#define use_mmap(M) ((M)->mflags & USE_MMAP_BIT)
+#define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT)
+#define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT)
+
+#define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT)
+#define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT)
+
+#define set_lock(M,L)\
+ ((M)->mflags = (L)?\
+ ((M)->mflags | USE_LOCK_BIT) :\
+ ((M)->mflags & ~USE_LOCK_BIT))
+
+/* page-align a size */
+#define page_align(S)\
+ (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))
+
+/* granularity-align a size */
+#define granularity_align(S)\
+ (((S) + (mparams.granularity - SIZE_T_ONE))\
+ & ~(mparams.granularity - SIZE_T_ONE))
+
+
+/* For mmap, use granularity alignment on windows, else page-align */
+#ifdef WIN32
+#define mmap_align(S) granularity_align(S)
+#else
+#define mmap_align(S) page_align(S)
+#endif
+
+/* For sys_alloc, enough padding to ensure can malloc request on success */
+#define SYS_ALLOC_PADDING (TOP_FOOT_SIZE + MALLOC_ALIGNMENT)
+
+#define is_page_aligned(S)\
+ (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0)
+#define is_granularity_aligned(S)\
+ (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0)
+
+/* True if segment S holds address A */
+#define segment_holds(S, A)\
+ ((char*)(A) >= S->base && (char*)(A) < S->base + S->size)
+
+/* Return segment holding given address */
+static msegmentptr segment_holding(mstate m, char* addr) {
+ msegmentptr sp = &m->seg;
+ for (;;) {
+ if (addr >= sp->base && addr < sp->base + sp->size)
+ return sp;
+ if ((sp = sp->next) == 0)
+ return 0;
+ }
+}
+
+/* Return true if segment contains a segment link */
+static int has_segment_link(mstate m, msegmentptr ss) {
+ msegmentptr sp = &m->seg;
+ for (;;) {
+ if ((char*)sp >= ss->base && (char*)sp < ss->base + ss->size)
+ return 1;
+ if ((sp = sp->next) == 0)
+ return 0;
+ }
+}
+
+#ifndef MORECORE_CANNOT_TRIM
+#define should_trim(M,s) ((s) > (M)->trim_check)
+#else /* MORECORE_CANNOT_TRIM */
+#define should_trim(M,s) (0)
+#endif /* MORECORE_CANNOT_TRIM */
+
+/*
+ TOP_FOOT_SIZE is padding at the end of a segment, including space
+ that may be needed to place segment records and fenceposts when new
+ noncontiguous segments are added.
+*/
+#define TOP_FOOT_SIZE\
+ (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
+
+
+/* ------------------------------- Hooks -------------------------------- */
+
+/*
+ PREACTION should be defined to return 0 on success, and nonzero on
+ failure. If you are not using locking, you can redefine these to do
+ anything you like.
+*/
+
+#if USE_LOCKS
+
+#define PREACTION(M) ((use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0)
+#define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); }
+#else /* USE_LOCKS */
+
+#ifndef PREACTION
+#define PREACTION(M) (0)
+#endif /* PREACTION */
+
+#ifndef POSTACTION
+#define POSTACTION(M)
+#endif /* POSTACTION */
+
+#endif /* USE_LOCKS */
+
+/*
+ CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses.
+ USAGE_ERROR_ACTION is triggered on detected bad frees and
+ reallocs. The argument p is an address that might have triggered the
+ fault. It is ignored by the two predefined actions, but might be
+ useful in custom actions that try to help diagnose errors.
+*/
+
+#if PROCEED_ON_ERROR
+
+/* A count of the number of corruption errors causing resets */
+int malloc_corruption_error_count;
+
+/* default corruption action */
+static void reset_on_error(mstate m);
+
+#define CORRUPTION_ERROR_ACTION(m) reset_on_error(m)
+#define USAGE_ERROR_ACTION(m, p)
+
+#else /* PROCEED_ON_ERROR */
+
+#ifndef CORRUPTION_ERROR_ACTION
+#define CORRUPTION_ERROR_ACTION(m) ABORT
+#endif /* CORRUPTION_ERROR_ACTION */
+
+#ifndef USAGE_ERROR_ACTION
+#define USAGE_ERROR_ACTION(m,p) ABORT
+#endif /* USAGE_ERROR_ACTION */
+
+#endif /* PROCEED_ON_ERROR */
+
+/* -------------------------- Debugging setup ---------------------------- */
+
+#if ! DEBUG
+
+#define check_free_chunk(M,P)
+#define check_inuse_chunk(M,P)
+#define check_malloced_chunk(M,P,N)
+#define check_mmapped_chunk(M,P)
+#define check_malloc_state(M)
+#define check_top_chunk(M,P)
+
+#else /* DEBUG */
+#define check_free_chunk(M,P) do_check_free_chunk(M,P)
+#define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P)
+#define check_top_chunk(M,P) do_check_top_chunk(M,P)
+#define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N)
+#define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P)
+#define check_malloc_state(M) do_check_malloc_state(M)
+
+static void do_check_any_chunk(mstate m, mchunkptr p);
+static void do_check_top_chunk(mstate m, mchunkptr p);
+static void do_check_mmapped_chunk(mstate m, mchunkptr p);
+static void do_check_inuse_chunk(mstate m, mchunkptr p);
+static void do_check_free_chunk(mstate m, mchunkptr p);
+static void do_check_malloced_chunk(mstate m, void* mem, size_t s);
+static void do_check_tree(mstate m, tchunkptr t);
+static void do_check_treebin(mstate m, bindex_t i);
+static void do_check_smallbin(mstate m, bindex_t i);
+static void do_check_malloc_state(mstate m);
+static int bin_find(mstate m, mchunkptr x);
+static size_t traverse_and_check(mstate m);
+#endif /* DEBUG */
+
+/* ---------------------------- Indexing Bins ---------------------------- */
+
+#define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS)
+#define small_index(s) ((s) >> SMALLBIN_SHIFT)
+#define small_index2size(i) ((i) << SMALLBIN_SHIFT)
+#define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE))
+
+/* addressing by index. See above about smallbin repositioning */
+#define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1])))
+#define treebin_at(M,i) (&((M)->treebins[i]))
+
+/* assign tree index for size S to variable I. Use x86 asm if possible */
+#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
+#define compute_tree_index(S, I)\
+{\
+ unsigned int X = S >> TREEBIN_SHIFT;\
+ if (X == 0)\
+ I = 0;\
+ else if (X > 0xFFFF)\
+ I = NTREEBINS-1;\
+ else {\
+ unsigned int K;\
+ __asm__("bsrl\t%1, %0\n\t" : "=r" (K) : "g" (X));\
+ I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
+ }\
+}
+
+#elif defined (__INTEL_COMPILER)
+#define compute_tree_index(S, I)\
+{\
+ size_t X = S >> TREEBIN_SHIFT;\
+ if (X == 0)\
+ I = 0;\
+ else if (X > 0xFFFF)\
+ I = NTREEBINS-1;\
+ else {\
+ unsigned int K = _bit_scan_reverse (X); \
+ I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
+ }\
+}
+
+#elif defined(_MSC_VER) && _MSC_VER>=1300
+#define compute_tree_index(S, I)\
+{\
+ size_t X = S >> TREEBIN_SHIFT;\
+ if (X == 0)\
+ I = 0;\
+ else if (X > 0xFFFF)\
+ I = NTREEBINS-1;\
+ else {\
+ unsigned int K;\
+ _BitScanReverse((DWORD *) &K, X);\
+ I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
+ }\
+}
+
+#else /* GNUC */
+#define compute_tree_index(S, I)\
+{\
+ size_t X = S >> TREEBIN_SHIFT;\
+ if (X == 0)\
+ I = 0;\
+ else if (X > 0xFFFF)\
+ I = NTREEBINS-1;\
+ else {\
+ unsigned int Y = (unsigned int)X;\
+ unsigned int N = ((Y - 0x100) >> 16) & 8;\
+ unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\
+ N += K;\
+ N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\
+ K = 14 - N + ((Y <<= K) >> 15);\
+ I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\
+ }\
+}
+#endif /* GNUC */
+
+/* Bit representing maximum resolved size in a treebin at i */
+#define bit_for_tree_index(i) \
+ (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2)
+
+/* Shift placing maximum resolved bit in a treebin at i as sign bit */
+#define leftshift_for_tree_index(i) \
+ ((i == NTREEBINS-1)? 0 : \
+ ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2)))
+
+/* The size of the smallest chunk held in bin with index i */
+#define minsize_for_tree_index(i) \
+ ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \
+ (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1)))
+
+
+/* ------------------------ Operations on bin maps ----------------------- */
+
+/* bit corresponding to given index */
+#define idx2bit(i) ((binmap_t)(1) << (i))
+
+/* Mark/Clear bits with given index */
+#define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i))
+#define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i))
+#define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i))
+
+#define mark_treemap(M,i) ((M)->treemap |= idx2bit(i))
+#define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i))
+#define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i))
+
+/* isolate the least set bit of a bitmap */
+#define least_bit(x) ((x) & -(x))
+
+/* mask with all bits to left of least bit of x on */
+#define left_bits(x) ((x<<1) | -(x<<1))
+
+/* mask with all bits to left of or equal to least bit of x on */
+#define same_or_left_bits(x) ((x) | -(x))
+
+/* index corresponding to given bit. Use x86 asm if possible */
+
+#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
+#define compute_bit2idx(X, I)\
+{\
+ unsigned int J;\
+ __asm__("bsfl\t%1, %0\n\t" : "=r" (J) : "g" (X));\
+ I = (bindex_t)J;\
+}
+
+#elif defined (__INTEL_COMPILER)
+#define compute_bit2idx(X, I)\
+{\
+ unsigned int J;\
+ J = _bit_scan_forward (X); \
+ I = (bindex_t)J;\
+}
+
+#elif defined(_MSC_VER) && _MSC_VER>=1300
+#define compute_bit2idx(X, I)\
+{\
+ unsigned int J;\
+ _BitScanForward((DWORD *) &J, X);\
+ I = (bindex_t)J;\
+}
+
+#elif USE_BUILTIN_FFS
+#define compute_bit2idx(X, I) I = ffs(X)-1
+
+#else
+#define compute_bit2idx(X, I)\
+{\
+ unsigned int Y = X - 1;\
+ unsigned int K = Y >> (16-4) & 16;\
+ unsigned int N = K; Y >>= K;\
+ N += K = Y >> (8-3) & 8; Y >>= K;\
+ N += K = Y >> (4-2) & 4; Y >>= K;\
+ N += K = Y >> (2-1) & 2; Y >>= K;\
+ N += K = Y >> (1-0) & 1; Y >>= K;\
+ I = (bindex_t)(N + Y);\
+}
+#endif /* GNUC */
+
+
+/* ----------------------- Runtime Check Support ------------------------- */
+
+/*
+ For security, the main invariant is that malloc/free/etc never
+ writes to a static address other than malloc_state, unless static
+ malloc_state itself has been corrupted, which cannot occur via
+ malloc (because of these checks). In essence this means that we
+ believe all pointers, sizes, maps etc held in malloc_state, but
+ check all of those linked or offsetted from other embedded data
+ structures. These checks are interspersed with main code in a way
+ that tends to minimize their run-time cost.
+
+ When FOOTERS is defined, in addition to range checking, we also
+ verify footer fields of inuse chunks, which can be used guarantee
+ that the mstate controlling malloc/free is intact. This is a
+ streamlined version of the approach described by William Robertson
+ et al in "Run-time Detection of Heap-based Overflows" LISA'03
+ http://www.usenix.org/events/lisa03/tech/robertson.html The footer
+ of an inuse chunk holds the xor of its mstate and a random seed,
+ that is checked upon calls to free() and realloc(). This is
+ (probablistically) unguessable from outside the program, but can be
+ computed by any code successfully malloc'ing any chunk, so does not
+ itself provide protection against code that has already broken
+ security through some other means. Unlike Robertson et al, we
+ always dynamically check addresses of all offset chunks (previous,
+ next, etc). This turns out to be cheaper than relying on hashes.
+*/
+
+#if !INSECURE
+/* Check if address a is at least as high as any from MORECORE or MMAP */
+#define ok_address(M, a) ((char*)(a) >= (M)->least_addr)
+/* Check if address of next chunk n is higher than base chunk p */
+#define ok_next(p, n) ((char*)(p) < (char*)(n))
+/* Check if p has inuse status */
+#define ok_inuse(p) is_inuse(p)
+/* Check if p has its pinuse bit on */
+#define ok_pinuse(p) pinuse(p)
+
+#else /* !INSECURE */
+#define ok_address(M, a) (1)
+#define ok_next(b, n) (1)
+#define ok_inuse(p) (1)
+#define ok_pinuse(p) (1)
+#endif /* !INSECURE */
+
+#if (FOOTERS && !INSECURE)
+/* Check if (alleged) mstate m has expected magic field */
+#define ok_magic(M) ((M)->magic == mparams.magic)
+#else /* (FOOTERS && !INSECURE) */
+#define ok_magic(M) (1)
+#endif /* (FOOTERS && !INSECURE) */
+
+
+/* In gcc, use __builtin_expect to minimize impact of checks */
+#if !INSECURE
+#if defined(__GNUC__) && __GNUC__ >= 3
+#define RTCHECK(e) __builtin_expect(e, 1)
+#else /* GNUC */
+#define RTCHECK(e) (e)
+#endif /* GNUC */
+#else /* !INSECURE */
+#define RTCHECK(e) (1)
+#endif /* !INSECURE */
+
+/* macros to set up inuse chunks with or without footers */
+
+#if !FOOTERS
+
+#define mark_inuse_foot(M,p,s)
+
+/* Macros for setting head/foot of non-mmapped chunks */
+
+/* Set cinuse bit and pinuse bit of next chunk */
+#define set_inuse(M,p,s)\
+ ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
+ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
+
+/* Set cinuse and pinuse of this chunk and pinuse of next chunk */
+#define set_inuse_and_pinuse(M,p,s)\
+ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
+ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
+
+/* Set size, cinuse and pinuse bit of this chunk */
+#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
+ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT))
+
+#else /* FOOTERS */
+
+/* Set foot of inuse chunk to be xor of mstate and seed */
+#define mark_inuse_foot(M,p,s)\
+ (((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic))
+
+#define get_mstate_for(p)\
+ ((mstate)(((mchunkptr)((char*)(p) +\
+ (chunksize(p))))->prev_foot ^ mparams.magic))
+
+#define set_inuse(M,p,s)\
+ ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
+ (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \
+ mark_inuse_foot(M,p,s))
+
+#define set_inuse_and_pinuse(M,p,s)\
+ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
+ (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\
+ mark_inuse_foot(M,p,s))
+
+#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
+ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
+ mark_inuse_foot(M, p, s))
+
+#endif /* !FOOTERS */
+
+/* ---------------------------- setting mparams -------------------------- */
+
+/* Initialize mparams */
+static int init_mparams(void) {
+#ifdef NEED_GLOBAL_LOCK_INIT
+ if (malloc_global_mutex_status <= 0)
+ init_malloc_global_mutex();
+#endif
+
+ ACQUIRE_MALLOC_GLOBAL_LOCK();
+ if (mparams.magic == 0) {
+ size_t magic;
+ size_t psize;
+ size_t gsize;
+
+#ifndef WIN32
+ psize = malloc_getpagesize;
+ gsize = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : psize);
+#else /* WIN32 */
+ {
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ psize = system_info.dwPageSize;
+ gsize = ((DEFAULT_GRANULARITY != 0)?
+ DEFAULT_GRANULARITY : system_info.dwAllocationGranularity);
+ }
+#endif /* WIN32 */
+
+ /* Sanity-check configuration:
+ size_t must be unsigned and as wide as pointer type.
+ ints must be at least 4 bytes.
+ alignment must be at least 8.
+ Alignment, min chunk size, and page size must all be powers of 2.
+ */
+ if ((sizeof(size_t) != sizeof(char*)) ||
+ (MAX_SIZE_T < MIN_CHUNK_SIZE) ||
+ (sizeof(int) < 4) ||
+ (MALLOC_ALIGNMENT < (size_t)8U) ||
+ ((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-SIZE_T_ONE)) != 0) ||
+ ((MCHUNK_SIZE & (MCHUNK_SIZE-SIZE_T_ONE)) != 0) ||
+ ((gsize & (gsize-SIZE_T_ONE)) != 0) ||
+ ((psize & (psize-SIZE_T_ONE)) != 0))
+ ABORT;
+
+ mparams.granularity = gsize;
+ mparams.page_size = psize;
+ mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
+ mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD;
+#if MORECORE_CONTIGUOUS
+ mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT;
+#else /* MORECORE_CONTIGUOUS */
+ mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT;
+#endif /* MORECORE_CONTIGUOUS */
+
+#if !ONLY_MSPACES
+ /* Set up lock for main malloc area */
+ gm->mflags = mparams.default_mflags;
+ INITIAL_LOCK(&gm->mutex);
+#endif
+
+ {
+#if USE_DEV_RANDOM
+ int fd;
+ unsigned char buf[sizeof(size_t)];
+ /* Try to use /dev/urandom, else fall back on using time */
+ if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 &&
+ read(fd, buf, sizeof(buf)) == sizeof(buf)) {
+ magic = *((size_t *) buf);
+ close(fd);
+ }
+ else
+#endif /* USE_DEV_RANDOM */
+#ifdef WIN32
+ magic = (size_t)(GetTickCount() ^ (size_t)0x55555555U);
+#else
+ magic = (size_t)(time(0) ^ (size_t)0x55555555U);
+#endif
+ magic |= (size_t)8U; /* ensure nonzero */
+ magic &= ~(size_t)7U; /* improve chances of fault for bad values */
+ mparams.magic = magic;
+ }
+ }
+
+ RELEASE_MALLOC_GLOBAL_LOCK();
+ return 1;
+}
+
+/* support for mallopt */
+static int change_mparam(int param_number, int value) {
+ size_t val;
+ ensure_initialization();
+ val = (value == -1)? MAX_SIZE_T : (size_t)value;
+ switch(param_number) {
+ case M_TRIM_THRESHOLD:
+ mparams.trim_threshold = val;
+ return 1;
+ case M_GRANULARITY:
+ if (val >= mparams.page_size && ((val & (val-1)) == 0)) {
+ mparams.granularity = val;
+ return 1;
+ }
+ else
+ return 0;
+ case M_MMAP_THRESHOLD:
+ mparams.mmap_threshold = val;
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+#if DEBUG
+/* ------------------------- Debugging Support --------------------------- */
+
+/* Check properties of any chunk, whether free, inuse, mmapped etc */
+static void do_check_any_chunk(mstate m, mchunkptr p) {
+ assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
+ assert(ok_address(m, p));
+}
+
+/* Check properties of top chunk */
+static void do_check_top_chunk(mstate m, mchunkptr p) {
+ msegmentptr sp = segment_holding(m, (char*)p);
+ size_t sz = p->head & ~INUSE_BITS; /* third-lowest bit can be set! */
+ assert(sp != 0);
+ assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
+ assert(ok_address(m, p));
+ assert(sz == m->topsize);
+ assert(sz > 0);
+ assert(sz == ((sp->base + sp->size) - (char*)p) - TOP_FOOT_SIZE);
+ assert(pinuse(p));
+ assert(!pinuse(chunk_plus_offset(p, sz)));
+}
+
+/* Check properties of (inuse) mmapped chunks */
+static void do_check_mmapped_chunk(mstate m, mchunkptr p) {
+ size_t sz = chunksize(p);
+ size_t len = (sz + (p->prev_foot) + MMAP_FOOT_PAD);
+ assert(is_mmapped(p));
+ assert(use_mmap(m));
+ assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
+ assert(ok_address(m, p));
+ assert(!is_small(sz));
+ assert((len & (mparams.page_size-SIZE_T_ONE)) == 0);
+ assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD);
+ assert(chunk_plus_offset(p, sz+SIZE_T_SIZE)->head == 0);
+}
+
+/* Check properties of inuse chunks */
+static void do_check_inuse_chunk(mstate m, mchunkptr p) {
+ do_check_any_chunk(m, p);
+ assert(is_inuse(p));
+ assert(next_pinuse(p));
+ /* If not pinuse and not mmapped, previous chunk has OK offset */
+ assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p);
+ if (is_mmapped(p))
+ do_check_mmapped_chunk(m, p);
+}
+
+/* Check properties of free chunks */
+static void do_check_free_chunk(mstate m, mchunkptr p) {
+ size_t sz = chunksize(p);
+ mchunkptr next = chunk_plus_offset(p, sz);
+ do_check_any_chunk(m, p);
+ assert(!is_inuse(p));
+ assert(!next_pinuse(p));
+ assert (!is_mmapped(p));
+ if (p != m->dv && p != m->top) {
+ if (sz >= MIN_CHUNK_SIZE) {
+ assert((sz & CHUNK_ALIGN_MASK) == 0);
+ assert(is_aligned(chunk2mem(p)));
+ assert(next->prev_foot == sz);
+ assert(pinuse(p));
+ assert (next == m->top || is_inuse(next));
+ assert(p->fd->bk == p);
+ assert(p->bk->fd == p);
+ }
+ else /* markers are always of size SIZE_T_SIZE */
+ assert(sz == SIZE_T_SIZE);
+ }
+}
+
+/* Check properties of malloced chunks at the point they are malloced */
+static void do_check_malloced_chunk(mstate m, void* mem, size_t s) {
+ if (mem != 0) {
+ mchunkptr p = mem2chunk(mem);
+ size_t sz = p->head & ~INUSE_BITS;
+ do_check_inuse_chunk(m, p);
+ assert((sz & CHUNK_ALIGN_MASK) == 0);
+ assert(sz >= MIN_CHUNK_SIZE);
+ assert(sz >= s);
+ /* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */
+ assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE));
+ }
+}
+
+/* Check a tree and its subtrees. */
+static void do_check_tree(mstate m, tchunkptr t) {
+ tchunkptr head = 0;
+ tchunkptr u = t;
+ bindex_t tindex = t->index;
+ size_t tsize = chunksize(t);
+ bindex_t idx;
+ compute_tree_index(tsize, idx);
+ assert(tindex == idx);
+ assert(tsize >= MIN_LARGE_SIZE);
+ assert(tsize >= minsize_for_tree_index(idx));
+ assert((idx == NTREEBINS-1) || (tsize < minsize_for_tree_index((idx+1))));
+
+ do { /* traverse through chain of same-sized nodes */
+ do_check_any_chunk(m, ((mchunkptr)u));
+ assert(u->index == tindex);
+ assert(chunksize(u) == tsize);
+ assert(!is_inuse(u));
+ assert(!next_pinuse(u));
+ assert(u->fd->bk == u);
+ assert(u->bk->fd == u);
+ if (u->parent == 0) {
+ assert(u->child[0] == 0);
+ assert(u->child[1] == 0);
+ }
+ else {
+ assert(head == 0); /* only one node on chain has parent */
+ head = u;
+ assert(u->parent != u);
+ assert (u->parent->child[0] == u ||
+ u->parent->child[1] == u ||
+ *((tbinptr*)(u->parent)) == u);
+ if (u->child[0] != 0) {
+ assert(u->child[0]->parent == u);
+ assert(u->child[0] != u);
+ do_check_tree(m, u->child[0]);
+ }
+ if (u->child[1] != 0) {
+ assert(u->child[1]->parent == u);
+ assert(u->child[1] != u);
+ do_check_tree(m, u->child[1]);
+ }
+ if (u->child[0] != 0 && u->child[1] != 0) {
+ assert(chunksize(u->child[0]) < chunksize(u->child[1]));
+ }
+ }
+ u = u->fd;
+ } while (u != t);
+ assert(head != 0);
+}
+
+/* Check all the chunks in a treebin. */
+static void do_check_treebin(mstate m, bindex_t i) {
+ tbinptr* tb = treebin_at(m, i);
+ tchunkptr t = *tb;
+ int empty = (m->treemap & (1U << i)) == 0;
+ if (t == 0)
+ assert(empty);
+ if (!empty)
+ do_check_tree(m, t);
+}
+
+/* Check all the chunks in a smallbin. */
+static void do_check_smallbin(mstate m, bindex_t i) {
+ sbinptr b = smallbin_at(m, i);
+ mchunkptr p = b->bk;
+ unsigned int empty = (m->smallmap & (1U << i)) == 0;
+ if (p == b)
+ assert(empty);
+ if (!empty) {
+ for (; p != b; p = p->bk) {
+ size_t size = chunksize(p);
+ mchunkptr q;
+ /* each chunk claims to be free */
+ do_check_free_chunk(m, p);
+ /* chunk belongs in bin */
+ assert(small_index(size) == i);
+ assert(p->bk == b || chunksize(p->bk) == chunksize(p));
+ /* chunk is followed by an inuse chunk */
+ q = next_chunk(p);
+ if (q->head != FENCEPOST_HEAD)
+ do_check_inuse_chunk(m, q);
+ }
+ }
+}
+
+/* Find x in a bin. Used in other check functions. */
+static int bin_find(mstate m, mchunkptr x) {
+ size_t size = chunksize(x);
+ if (is_small(size)) {
+ bindex_t sidx = small_index(size);
+ sbinptr b = smallbin_at(m, sidx);
+ if (smallmap_is_marked(m, sidx)) {
+ mchunkptr p = b;
+ do {
+ if (p == x)
+ return 1;
+ } while ((p = p->fd) != b);
+ }
+ }
+ else {
+ bindex_t tidx;
+ compute_tree_index(size, tidx);
+ if (treemap_is_marked(m, tidx)) {
+ tchunkptr t = *treebin_at(m, tidx);
+ size_t sizebits = size << leftshift_for_tree_index(tidx);
+ while (t != 0 && chunksize(t) != size) {
+ t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1];
+ sizebits <<= 1;
+ }
+ if (t != 0) {
+ tchunkptr u = t;
+ do {
+ if (u == (tchunkptr)x)
+ return 1;
+ } while ((u = u->fd) != t);
+ }
+ }
+ }
+ return 0;
+}
+
+/* Traverse each chunk and check it; return total */
+static size_t traverse_and_check(mstate m) {
+ size_t sum = 0;
+ if (is_initialized(m)) {
+ msegmentptr s = &m->seg;
+ sum += m->topsize + TOP_FOOT_SIZE;
+ while (s != 0) {
+ mchunkptr q = align_as_chunk(s->base);
+ mchunkptr lastq = 0;
+ assert(pinuse(q));
+ while (segment_holds(s, q) &&
+ q != m->top && q->head != FENCEPOST_HEAD) {
+ sum += chunksize(q);
+ if (is_inuse(q)) {
+ assert(!bin_find(m, q));
+ do_check_inuse_chunk(m, q);
+ }
+ else {
+ assert(q == m->dv || bin_find(m, q));
+ assert(lastq == 0 || is_inuse(lastq)); /* Not 2 consecutive free */
+ do_check_free_chunk(m, q);
+ }
+ lastq = q;
+ q = next_chunk(q);
+ }
+ s = s->next;
+ }
+ }
+ return sum;
+}
+
+/* Check all properties of malloc_state. */
+static void do_check_malloc_state(mstate m) {
+ bindex_t i;
+ size_t total;
+ /* check bins */
+ for (i = 0; i < NSMALLBINS; ++i)
+ do_check_smallbin(m, i);
+ for (i = 0; i < NTREEBINS; ++i)
+ do_check_treebin(m, i);
+
+ if (m->dvsize != 0) { /* check dv chunk */
+ do_check_any_chunk(m, m->dv);
+ assert(m->dvsize == chunksize(m->dv));
+ assert(m->dvsize >= MIN_CHUNK_SIZE);
+ assert(bin_find(m, m->dv) == 0);
+ }
+
+ if (m->top != 0) { /* check top chunk */
+ do_check_top_chunk(m, m->top);
+ /*assert(m->topsize == chunksize(m->top)); redundant */
+ assert(m->topsize > 0);
+ assert(bin_find(m, m->top) == 0);
+ }
+
+ total = traverse_and_check(m);
+ assert(total <= m->footprint);
+ assert(m->footprint <= m->max_footprint);
+}
+#endif /* DEBUG */
+
+/* ----------------------------- statistics ------------------------------ */
+
+#if !NO_MALLINFO
+static struct mallinfo internal_mallinfo(mstate m) {
+ struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ ensure_initialization();
+ if (!PREACTION(m)) {
+ check_malloc_state(m);
+ if (is_initialized(m)) {
+ size_t nfree = SIZE_T_ONE; /* top always free */
+ size_t mfree = m->topsize + TOP_FOOT_SIZE;
+ size_t sum = mfree;
+ msegmentptr s = &m->seg;
+ while (s != 0) {
+ mchunkptr q = align_as_chunk(s->base);
+ while (segment_holds(s, q) &&
+ q != m->top && q->head != FENCEPOST_HEAD) {
+ size_t sz = chunksize(q);
+ sum += sz;
+ if (!is_inuse(q)) {
+ mfree += sz;
+ ++nfree;
+ }
+ q = next_chunk(q);
+ }
+ s = s->next;
+ }
+
+ nm.arena = sum;
+ nm.ordblks = nfree;
+ nm.hblkhd = m->footprint - sum;
+ nm.usmblks = m->max_footprint;
+ nm.uordblks = m->footprint - mfree;
+ nm.fordblks = mfree;
+ nm.keepcost = m->topsize;
+ }
+
+ POSTACTION(m);
+ }
+ return nm;
+}
+#endif /* !NO_MALLINFO */
+
+static void internal_malloc_stats(mstate m) {
+ ensure_initialization();
+ if (!PREACTION(m)) {
+ size_t maxfp = 0;
+ size_t fp = 0;
+ size_t used = 0;
+ check_malloc_state(m);
+ if (is_initialized(m)) {
+ msegmentptr s = &m->seg;
+ maxfp = m->max_footprint;
+ fp = m->footprint;
+ used = fp - (m->topsize + TOP_FOOT_SIZE);
+
+ while (s != 0) {
+ mchunkptr q = align_as_chunk(s->base);
+ while (segment_holds(s, q) &&
+ q != m->top && q->head != FENCEPOST_HEAD) {
+ if (!is_inuse(q))
+ used -= chunksize(q);
+ q = next_chunk(q);
+ }
+ s = s->next;
+ }
+ }
+
+ fprintf(stderr, "max system bytes = %10lu\n", (unsigned long)(maxfp));
+ fprintf(stderr, "system bytes = %10lu\n", (unsigned long)(fp));
+ fprintf(stderr, "in use bytes = %10lu\n", (unsigned long)(used));
+
+ POSTACTION(m);
+ }
+}
+
+/* ----------------------- Operations on smallbins ----------------------- */
+
+/*
+ Various forms of linking and unlinking are defined as macros. Even
+ the ones for trees, which are very long but have very short typical
+ paths. This is ugly but reduces reliance on inlining support of
+ compilers.
+*/
+
+/* Link a free chunk into a smallbin */
+#define insert_small_chunk(M, P, S) {\
+ bindex_t I = small_index(S);\
+ mchunkptr B = smallbin_at(M, I);\
+ mchunkptr F = B;\
+ assert(S >= MIN_CHUNK_SIZE);\
+ if (!smallmap_is_marked(M, I))\
+ mark_smallmap(M, I);\
+ else if (RTCHECK(ok_address(M, B->fd)))\
+ F = B->fd;\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ B->fd = P;\
+ F->bk = P;\
+ P->fd = F;\
+ P->bk = B;\
+}
+
+/* Unlink a chunk from a smallbin */
+#define unlink_small_chunk(M, P, S) {\
+ mchunkptr F = P->fd;\
+ mchunkptr B = P->bk;\
+ bindex_t I = small_index(S);\
+ assert(P != B);\
+ assert(P != F);\
+ assert(chunksize(P) == small_index2size(I));\
+ if (F == B)\
+ clear_smallmap(M, I);\
+ else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&\
+ (B == smallbin_at(M,I) || ok_address(M, B)))) {\
+ F->bk = B;\
+ B->fd = F;\
+ }\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+}
+
+/* Unlink the first chunk from a smallbin */
+#define unlink_first_small_chunk(M, B, P, I) {\
+ mchunkptr F = P->fd;\
+ assert(P != B);\
+ assert(P != F);\
+ assert(chunksize(P) == small_index2size(I));\
+ if (B == F)\
+ clear_smallmap(M, I);\
+ else if (RTCHECK(ok_address(M, F))) {\
+ B->fd = F;\
+ F->bk = B;\
+ }\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+}
+
+
+
+/* Replace dv node, binning the old one */
+/* Used only when dvsize known to be small */
+#define replace_dv(M, P, S) {\
+ size_t DVS = M->dvsize;\
+ if (DVS != 0) {\
+ mchunkptr DV = M->dv;\
+ assert(is_small(DVS));\
+ insert_small_chunk(M, DV, DVS);\
+ }\
+ M->dvsize = S;\
+ M->dv = P;\
+}
+
+/* ------------------------- Operations on trees ------------------------- */
+
+/* Insert chunk into tree */
+#define insert_large_chunk(M, X, S) {\
+ tbinptr* H;\
+ bindex_t I;\
+ compute_tree_index(S, I);\
+ H = treebin_at(M, I);\
+ X->index = I;\
+ X->child[0] = X->child[1] = 0;\
+ if (!treemap_is_marked(M, I)) {\
+ mark_treemap(M, I);\
+ *H = X;\
+ X->parent = (tchunkptr)H;\
+ X->fd = X->bk = X;\
+ }\
+ else {\
+ tchunkptr T = *H;\
+ size_t K = S << leftshift_for_tree_index(I);\
+ for (;;) {\
+ if (chunksize(T) != S) {\
+ tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\
+ K <<= 1;\
+ if (*C != 0)\
+ T = *C;\
+ else if (RTCHECK(ok_address(M, C))) {\
+ *C = X;\
+ X->parent = T;\
+ X->fd = X->bk = X;\
+ break;\
+ }\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ break;\
+ }\
+ }\
+ else {\
+ tchunkptr F = T->fd;\
+ if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\
+ T->fd = F->bk = X;\
+ X->fd = F;\
+ X->bk = T;\
+ X->parent = 0;\
+ break;\
+ }\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ break;\
+ }\
+ }\
+ }\
+ }\
+}
+
+/*
+ Unlink steps:
+
+ 1. If x is a chained node, unlink it from its same-sized fd/bk links
+ and choose its bk node as its replacement.
+ 2. If x was the last node of its size, but not a leaf node, it must
+ be replaced with a leaf node (not merely one with an open left or
+ right), to make sure that lefts and rights of descendents
+ correspond properly to bit masks. We use the rightmost descendent
+ of x. We could use any other leaf, but this is easy to locate and
+ tends to counteract removal of leftmosts elsewhere, and so keeps
+ paths shorter than minimally guaranteed. This doesn't loop much
+ because on average a node in a tree is near the bottom.
+ 3. If x is the base of a chain (i.e., has parent links) relink
+ x's parent and children to x's replacement (or null if none).
+*/
+
+#define unlink_large_chunk(M, X) {\
+ tchunkptr XP = X->parent;\
+ tchunkptr R;\
+ if (X->bk != X) {\
+ tchunkptr F = X->fd;\
+ R = X->bk;\
+ if (RTCHECK(ok_address(M, F))) {\
+ F->bk = R;\
+ R->fd = F;\
+ }\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ }\
+ else {\
+ tchunkptr* RP;\
+ if (((R = *(RP = &(X->child[1]))) != 0) ||\
+ ((R = *(RP = &(X->child[0]))) != 0)) {\
+ tchunkptr* CP;\
+ while ((*(CP = &(R->child[1])) != 0) ||\
+ (*(CP = &(R->child[0])) != 0)) {\
+ R = *(RP = CP);\
+ }\
+ if (RTCHECK(ok_address(M, RP)))\
+ *RP = 0;\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ }\
+ }\
+ if (XP != 0) {\
+ tbinptr* H = treebin_at(M, X->index);\
+ if (X == *H) {\
+ if ((*H = R) == 0) \
+ clear_treemap(M, X->index);\
+ }\
+ else if (RTCHECK(ok_address(M, XP))) {\
+ if (XP->child[0] == X) \
+ XP->child[0] = R;\
+ else \
+ XP->child[1] = R;\
+ }\
+ else\
+ CORRUPTION_ERROR_ACTION(M);\
+ if (R != 0) {\
+ if (RTCHECK(ok_address(M, R))) {\
+ tchunkptr C0, C1;\
+ R->parent = XP;\
+ if ((C0 = X->child[0]) != 0) {\
+ if (RTCHECK(ok_address(M, C0))) {\
+ R->child[0] = C0;\
+ C0->parent = R;\
+ }\
+ else\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ if ((C1 = X->child[1]) != 0) {\
+ if (RTCHECK(ok_address(M, C1))) {\
+ R->child[1] = C1;\
+ C1->parent = R;\
+ }\
+ else\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ }\
+ else\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ }\
+}
+
+/* Relays to large vs small bin operations */
+
+#define insert_chunk(M, P, S)\
+ if (is_small(S)) insert_small_chunk(M, P, S)\
+ else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); }
+
+#define unlink_chunk(M, P, S)\
+ if (is_small(S)) unlink_small_chunk(M, P, S)\
+ else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); }
+
+
+/* Relays to internal calls to malloc/free from realloc, memalign etc */
+
+#if ONLY_MSPACES
+#define internal_malloc(m, b) mspace_malloc(m, b)
+#define internal_free(m, mem) mspace_free(m,mem);
+#else /* ONLY_MSPACES */
+#if MSPACES
+#define internal_malloc(m, b)\
+ (m == gm)? dlmalloc(b) : mspace_malloc(m, b)
+#define internal_free(m, mem)\
+ if (m == gm) dlfree(mem); else mspace_free(m,mem);
+#else /* MSPACES */
+#define internal_malloc(m, b) dlmalloc(b)
+#define internal_free(m, mem) dlfree(mem)
+#endif /* MSPACES */
+#endif /* ONLY_MSPACES */
+
+/* ----------------------- Direct-mmapping chunks ----------------------- */
+
+/*
+ Directly mmapped chunks are set up with an offset to the start of
+ the mmapped region stored in the prev_foot field of the chunk. This
+ allows reconstruction of the required argument to MUNMAP when freed,
+ and also allows adjustment of the returned chunk to meet alignment
+ requirements (especially in memalign).
+*/
+
+/* Malloc using mmap */
+static void* mmap_alloc(mstate m, size_t nb) {
+ size_t mmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
+ if (mmsize > nb) { /* Check for wrap around 0 */
+ char* mm = (char*)(CALL_DIRECT_MMAP(mmsize));
+ if (mm != CMFAIL) {
+ size_t offset = align_offset(chunk2mem(mm));
+ size_t psize = mmsize - offset - MMAP_FOOT_PAD;
+ mchunkptr p = (mchunkptr)(mm + offset);
+ p->prev_foot = offset;
+ p->head = psize;
+ mark_inuse_foot(m, p, psize);
+ chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD;
+ chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0;
+
+ if (m->least_addr == 0 || mm < m->least_addr)
+ m->least_addr = mm;
+ if ((m->footprint += mmsize) > m->max_footprint)
+ m->max_footprint = m->footprint;
+ assert(is_aligned(chunk2mem(p)));
+ check_mmapped_chunk(m, p);
+ return chunk2mem(p);
+ }
+ }
+ return 0;
+}
+
+/* Realloc using mmap */
+static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb) {
+ size_t oldsize = chunksize(oldp);
+ if (is_small(nb)) /* Can't shrink mmap regions below small size */
+ return 0;
+ /* Keep old chunk if big enough but not too big */
+ if (oldsize >= nb + SIZE_T_SIZE &&
+ (oldsize - nb) <= (mparams.granularity << 1))
+ return oldp;
+ else {
+ size_t offset = oldp->prev_foot;
+ size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD;
+ size_t newmmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
+ char* cp = (char*)CALL_MREMAP((char*)oldp - offset,
+ oldmmsize, newmmsize, 1);
+ if (cp != CMFAIL) {
+ mchunkptr newp = (mchunkptr)(cp + offset);
+ size_t psize = newmmsize - offset - MMAP_FOOT_PAD;
+ newp->head = psize;
+ mark_inuse_foot(m, newp, psize);
+ chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD;
+ chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0;
+
+ if (cp < m->least_addr)
+ m->least_addr = cp;
+ if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint)
+ m->max_footprint = m->footprint;
+ check_mmapped_chunk(m, newp);
+ return newp;
+ }
+ }
+ return 0;
+}
+
+/* -------------------------- mspace management -------------------------- */
+
+/* Initialize top chunk and its size */
+static void init_top(mstate m, mchunkptr p, size_t psize) {
+ /* Ensure alignment */
+ size_t offset = align_offset(chunk2mem(p));
+ p = (mchunkptr)((char*)p + offset);
+ psize -= offset;
+
+ m->top = p;
+ m->topsize = psize;
+ p->head = psize | PINUSE_BIT;
+ /* set size of fake trailing chunk holding overhead space only once */
+ chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE;
+ m->trim_check = mparams.trim_threshold; /* reset on each update */
+}
+
+/* Initialize bins for a new mstate that is otherwise zeroed out */
+static void init_bins(mstate m) {
+ /* Establish circular links for smallbins */
+ bindex_t i;
+ for (i = 0; i < NSMALLBINS; ++i) {
+ sbinptr bin = smallbin_at(m,i);
+ bin->fd = bin->bk = bin;
+ }
+}
+
+#if PROCEED_ON_ERROR
+
+/* default corruption action */
+static void reset_on_error(mstate m) {
+ int i;
+ ++malloc_corruption_error_count;
+ /* Reinitialize fields to forget about all memory */
+ m->smallbins = m->treebins = 0;
+ m->dvsize = m->topsize = 0;
+ m->seg.base = 0;
+ m->seg.size = 0;
+ m->seg.next = 0;
+ m->top = m->dv = 0;
+ for (i = 0; i < NTREEBINS; ++i)
+ *treebin_at(m, i) = 0;
+ init_bins(m);
+}
+#endif /* PROCEED_ON_ERROR */
+
+/* Allocate chunk and prepend remainder with chunk in successor base. */
+static void* prepend_alloc(mstate m, char* newbase, char* oldbase,
+ size_t nb) {
+ mchunkptr p = align_as_chunk(newbase);
+ mchunkptr oldfirst = align_as_chunk(oldbase);
+ size_t psize = (char*)oldfirst - (char*)p;
+ mchunkptr q = chunk_plus_offset(p, nb);
+ size_t qsize = psize - nb;
+ set_size_and_pinuse_of_inuse_chunk(m, p, nb);
+
+ assert((char*)oldfirst > (char*)q);
+ assert(pinuse(oldfirst));
+ assert(qsize >= MIN_CHUNK_SIZE);
+
+ /* consolidate remainder with first chunk of old base */
+ if (oldfirst == m->top) {
+ size_t tsize = m->topsize += qsize;
+ m->top = q;
+ q->head = tsize | PINUSE_BIT;
+ check_top_chunk(m, q);
+ }
+ else if (oldfirst == m->dv) {
+ size_t dsize = m->dvsize += qsize;
+ m->dv = q;
+ set_size_and_pinuse_of_free_chunk(q, dsize);
+ }
+ else {
+ if (!is_inuse(oldfirst)) {
+ size_t nsize = chunksize(oldfirst);
+ unlink_chunk(m, oldfirst, nsize);
+ oldfirst = chunk_plus_offset(oldfirst, nsize);
+ qsize += nsize;
+ }
+ set_free_with_pinuse(q, qsize, oldfirst);
+ insert_chunk(m, q, qsize);
+ check_free_chunk(m, q);
+ }
+
+ check_malloced_chunk(m, chunk2mem(p), nb);
+ return chunk2mem(p);
+}
+
+/* Add a segment to hold a new noncontiguous region */
+static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) {
+ /* Determine locations and sizes of segment, fenceposts, old top */
+ char* old_top = (char*)m->top;
+ msegmentptr oldsp = segment_holding(m, old_top);
+ char* old_end = oldsp->base + oldsp->size;
+ size_t ssize = pad_request(sizeof(struct malloc_segment));
+ char* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
+ size_t offset = align_offset(chunk2mem(rawsp));
+ char* asp = rawsp + offset;
+ char* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp;
+ mchunkptr sp = (mchunkptr)csp;
+ msegmentptr ss = (msegmentptr)(chunk2mem(sp));
+ mchunkptr tnext = chunk_plus_offset(sp, ssize);
+ mchunkptr p = tnext;
+ int nfences = 0;
+
+ /* reset top to new space */
+ init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
+
+ /* Set up segment record */
+ assert(is_aligned(ss));
+ set_size_and_pinuse_of_inuse_chunk(m, sp, ssize);
+ *ss = m->seg; /* Push current record */
+ m->seg.base = tbase;
+ m->seg.size = tsize;
+ m->seg.sflags = mmapped;
+ m->seg.next = ss;
+
+ /* Insert trailing fenceposts */
+ for (;;) {
+ mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE);
+ p->head = FENCEPOST_HEAD;
+ ++nfences;
+ if ((char*)(&(nextp->head)) < old_end)
+ p = nextp;
+ else
+ break;
+ }
+ assert(nfences >= 2);
+
+ /* Insert the rest of old top into a bin as an ordinary free chunk */
+ if (csp != old_top) {
+ mchunkptr q = (mchunkptr)old_top;
+ size_t psize = csp - old_top;
+ mchunkptr tn = chunk_plus_offset(q, psize);
+ set_free_with_pinuse(q, psize, tn);
+ insert_chunk(m, q, psize);
+ }
+
+ check_top_chunk(m, m->top);
+}
+
+/* -------------------------- System allocation -------------------------- */
+
+/* Get memory from system using MORECORE or MMAP */
+static void* sys_alloc(mstate m, size_t nb) {
+ char* tbase = CMFAIL;
+ size_t tsize = 0;
+ flag_t mmap_flag = 0;
+
+ ensure_initialization();
+
+ /* Directly map large chunks, but only if already initialized */
+ if (use_mmap(m) && nb >= mparams.mmap_threshold && m->topsize != 0) {
+ void* mem = mmap_alloc(m, nb);
+ if (mem != 0)
+ return mem;
+ }
+
+ /*
+ Try getting memory in any of three ways (in most-preferred to
+ least-preferred order):
+ 1. A call to MORECORE that can normally contiguously extend memory.
+ (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or
+ or main space is mmapped or a previous contiguous call failed)
+ 2. A call to MMAP new space (disabled if not HAVE_MMAP).
+ Note that under the default settings, if MORECORE is unable to
+ fulfill a request, and HAVE_MMAP is true, then mmap is
+ used as a noncontiguous system allocator. This is a useful backup
+ strategy for systems with holes in address spaces -- in this case
+ sbrk cannot contiguously expand the heap, but mmap may be able to
+ find space.
+ 3. A call to MORECORE that cannot usually contiguously extend memory.
+ (disabled if not HAVE_MORECORE)
+
+ In all cases, we need to request enough bytes from system to ensure
+ we can malloc nb bytes upon success, so pad with enough space for
+ top_foot, plus alignment-pad to make sure we don't lose bytes if
+ not on boundary, and round this up to a granularity unit.
+ */
+
+ if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) {
+ char* br = CMFAIL;
+ msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (char*)m->top);
+ size_t asize = 0;
+ ACQUIRE_MALLOC_GLOBAL_LOCK();
+
+ if (ss == 0) { /* First time through or recovery */
+ char* base = (char*)CALL_MORECORE(0);
+ if (base != CMFAIL) {
+ asize = granularity_align(nb + SYS_ALLOC_PADDING);
+ /* Adjust to end on a page boundary */
+ if (!is_page_aligned(base))
+ asize += (page_align((size_t)base) - (size_t)base);
+ /* Can't call MORECORE if size is negative when treated as signed */
+ if (asize < HALF_MAX_SIZE_T &&
+ (br = (char*)(CALL_MORECORE(asize))) == base) {
+ tbase = base;
+ tsize = asize;
+ }
+ }
+ }
+ else {
+ /* Subtract out existing available top space from MORECORE request. */
+ asize = granularity_align(nb - m->topsize + SYS_ALLOC_PADDING);
+ /* Use mem here only if it did continuously extend old space */
+ if (asize < HALF_MAX_SIZE_T &&
+ (br = (char*)(CALL_MORECORE(asize))) == ss->base+ss->size) {
+ tbase = br;
+ tsize = asize;
+ }
+ }
+
+ if (tbase == CMFAIL) { /* Cope with partial failure */
+ if (br != CMFAIL) { /* Try to use/extend the space we did get */
+ if (asize < HALF_MAX_SIZE_T &&
+ asize < nb + SYS_ALLOC_PADDING) {
+ size_t esize = granularity_align(nb + SYS_ALLOC_PADDING - asize);
+ if (esize < HALF_MAX_SIZE_T) {
+ char* end = (char*)CALL_MORECORE(esize);
+ if (end != CMFAIL)
+ asize += esize;
+ else { /* Can't use; try to release */
+ (void) CALL_MORECORE(-asize);
+ br = CMFAIL;
+ }
+ }
+ }
+ }
+ if (br != CMFAIL) { /* Use the space we did get */
+ tbase = br;
+ tsize = asize;
+ }
+ else
+ disable_contiguous(m); /* Don't try contiguous path in the future */
+ }
+
+ RELEASE_MALLOC_GLOBAL_LOCK();
+ }
+
+ if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */
+ size_t rsize = granularity_align(nb + SYS_ALLOC_PADDING);
+ if (rsize > nb) { /* Fail if wraps around zero */
+ char* mp = (char*)(CALL_MMAP(rsize));
+ if (mp != CMFAIL) {
+ tbase = mp;
+ tsize = rsize;
+ mmap_flag = USE_MMAP_BIT;
+ }
+ }
+ }
+
+ if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */
+ size_t asize = granularity_align(nb + SYS_ALLOC_PADDING);
+ if (asize < HALF_MAX_SIZE_T) {
+ char* br = CMFAIL;
+ char* end = CMFAIL;
+ ACQUIRE_MALLOC_GLOBAL_LOCK();
+ br = (char*)(CALL_MORECORE(asize));
+ end = (char*)(CALL_MORECORE(0));
+ RELEASE_MALLOC_GLOBAL_LOCK();
+ if (br != CMFAIL && end != CMFAIL && br < end) {
+ size_t ssize = end - br;
+ if (ssize > nb + TOP_FOOT_SIZE) {
+ tbase = br;
+ tsize = ssize;
+ }
+ }
+ }
+ }
+
+ if (tbase != CMFAIL) {
+
+ if ((m->footprint += tsize) > m->max_footprint)
+ m->max_footprint = m->footprint;
+
+ if (!is_initialized(m)) { /* first-time initialization */
+ if (m->least_addr == 0 || tbase < m->least_addr)
+ m->least_addr = tbase;
+ m->seg.base = tbase;
+ m->seg.size = tsize;
+ m->seg.sflags = mmap_flag;
+ m->magic = mparams.magic;
+ m->release_checks = MAX_RELEASE_CHECK_RATE;
+ init_bins(m);
+#if !ONLY_MSPACES
+ if (is_global(m))
+ init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
+ else
+#endif
+ {
+ /* Offset top by embedded malloc_state */
+ mchunkptr mn = next_chunk(mem2chunk(m));
+ init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) -TOP_FOOT_SIZE);
+ }
+ }
+
+ else {
+ /* Try to merge with an existing segment */
+ msegmentptr sp = &m->seg;
+ /* Only consider most recent segment if traversal suppressed */
+ while (sp != 0 && tbase != sp->base + sp->size)
+ sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next;
+ if (sp != 0 &&
+ !is_extern_segment(sp) &&
+ (sp->sflags & USE_MMAP_BIT) == mmap_flag &&
+ segment_holds(sp, m->top)) { /* append */
+ sp->size += tsize;
+ init_top(m, m->top, m->topsize + tsize);
+ }
+ else {
+ if (tbase < m->least_addr)
+ m->least_addr = tbase;
+ sp = &m->seg;
+ while (sp != 0 && sp->base != tbase + tsize)
+ sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next;
+ if (sp != 0 &&
+ !is_extern_segment(sp) &&
+ (sp->sflags & USE_MMAP_BIT) == mmap_flag) {
+ char* oldbase = sp->base;
+ sp->base = tbase;
+ sp->size += tsize;
+ return prepend_alloc(m, tbase, oldbase, nb);
+ }
+ else
+ add_segment(m, tbase, tsize, mmap_flag);
+ }
+ }
+
+ if (nb < m->topsize) { /* Allocate from new or extended top space */
+ size_t rsize = m->topsize -= nb;
+ mchunkptr p = m->top;
+ mchunkptr r = m->top = chunk_plus_offset(p, nb);
+ r->head = rsize | PINUSE_BIT;
+ set_size_and_pinuse_of_inuse_chunk(m, p, nb);
+ check_top_chunk(m, m->top);
+ check_malloced_chunk(m, chunk2mem(p), nb);
+ return chunk2mem(p);
+ }
+ }
+
+ MALLOC_FAILURE_ACTION;
+ return 0;
+}
+
+/* ----------------------- system deallocation -------------------------- */
+
+/* Unmap and unlink any mmapped segments that don't contain used chunks */
+static size_t release_unused_segments(mstate m) {
+ size_t released = 0;
+ int nsegs = 0;
+ msegmentptr pred = &m->seg;
+ msegmentptr sp = pred->next;
+ while (sp != 0) {
+ char* base = sp->base;
+ size_t size = sp->size;
+ msegmentptr next = sp->next;
+ ++nsegs;
+ if (is_mmapped_segment(sp) && !is_extern_segment(sp)) {
+ mchunkptr p = align_as_chunk(base);
+ size_t psize = chunksize(p);
+ /* Can unmap if first chunk holds entire segment and not pinned */
+ if (!is_inuse(p) && (char*)p + psize >= base + size - TOP_FOOT_SIZE) {
+ tchunkptr tp = (tchunkptr)p;
+ assert(segment_holds(sp, (char*)sp));
+ if (p == m->dv) {
+ m->dv = 0;
+ m->dvsize = 0;
+ }
+ else {
+ unlink_large_chunk(m, tp);
+ }
+ if (CALL_MUNMAP(base, size) == 0) {
+ released += size;
+ m->footprint -= size;
+ /* unlink obsoleted record */
+ sp = pred;
+ sp->next = next;
+ }
+ else { /* back out if cannot unmap */
+ insert_large_chunk(m, tp, psize);
+ }
+ }
+ }
+ if (NO_SEGMENT_TRAVERSAL) /* scan only first segment */
+ break;
+ pred = sp;
+ sp = next;
+ }
+ /* Reset check counter */
+ m->release_checks = ((nsegs > MAX_RELEASE_CHECK_RATE)?
+ nsegs : MAX_RELEASE_CHECK_RATE);
+ return released;
+}
+
+static int sys_trim(mstate m, size_t pad) {
+ size_t released = 0;
+ ensure_initialization();
+ if (pad < MAX_REQUEST && is_initialized(m)) {
+ pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */
+
+ if (m->topsize > pad) {
+ /* Shrink top space in granularity-size units, keeping at least one */
+ size_t unit = mparams.granularity;
+ size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit -
+ SIZE_T_ONE) * unit;
+ msegmentptr sp = segment_holding(m, (char*)m->top);
+
+ if (!is_extern_segment(sp)) {
+ if (is_mmapped_segment(sp)) {
+ if (HAVE_MMAP &&
+ sp->size >= extra &&
+ !has_segment_link(m, sp)) { /* can't shrink if pinned */
+ size_t newsize = sp->size - extra;
+ /* Prefer mremap, fall back to munmap */
+ if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) ||
+ (CALL_MUNMAP(sp->base + newsize, extra) == 0)) {
+ released = extra;
+ }
+ }
+ }
+ else if (HAVE_MORECORE) {
+ if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */
+ extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit;
+ ACQUIRE_MALLOC_GLOBAL_LOCK();
+ {
+ /* Make sure end of memory is where we last set it. */
+ char* old_br = (char*)(CALL_MORECORE(0));
+ if (old_br == sp->base + sp->size) {
+ char* rel_br = (char*)(CALL_MORECORE(-extra));
+ char* new_br = (char*)(CALL_MORECORE(0));
+ if (rel_br != CMFAIL && new_br < old_br)
+ released = old_br - new_br;
+ }
+ }
+ RELEASE_MALLOC_GLOBAL_LOCK();
+ }
+ }
+
+ if (released != 0) {
+ sp->size -= released;
+ m->footprint -= released;
+ init_top(m, m->top, m->topsize - released);
+ check_top_chunk(m, m->top);
+ }
+ }
+
+ /* Unmap any unused mmapped segments */
+ if (HAVE_MMAP)
+ released += release_unused_segments(m);
+
+ /* On failure, disable autotrim to avoid repeated failed future calls */
+ if (released == 0 && m->topsize > m->trim_check)
+ m->trim_check = MAX_SIZE_T;
+ }
+
+ return (released != 0)? 1 : 0;
+}
+
+
+/* ---------------------------- malloc support --------------------------- */
+
+/* allocate a large request from the best fitting chunk in a treebin */
+static void* tmalloc_large(mstate m, size_t nb) {
+ tchunkptr v = 0;
+ size_t rsize = -nb; /* Unsigned negation */
+ tchunkptr t;
+ bindex_t idx;
+ compute_tree_index(nb, idx);
+ if ((t = *treebin_at(m, idx)) != 0) {
+ /* Traverse tree for this bin looking for node with size == nb */
+ size_t sizebits = nb << leftshift_for_tree_index(idx);
+ tchunkptr rst = 0; /* The deepest untaken right subtree */
+ for (;;) {
+ tchunkptr rt;
+ size_t trem = chunksize(t) - nb;
+ if (trem < rsize) {
+ v = t;
+ if ((rsize = trem) == 0)
+ break;
+ }
+ rt = t->child[1];
+ t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1];
+ if (rt != 0 && rt != t)
+ rst = rt;
+ if (t == 0) {
+ t = rst; /* set t to least subtree holding sizes > nb */
+ break;
+ }
+ sizebits <<= 1;
+ }
+ }
+ if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */
+ binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap;
+ if (leftbits != 0) {
+ bindex_t i;
+ binmap_t leastbit = least_bit(leftbits);
+ compute_bit2idx(leastbit, i);
+ t = *treebin_at(m, i);
+ }
+ }
+
+ while (t != 0) { /* find smallest of tree or subtree */
+ size_t trem = chunksize(t) - nb;
+ if (trem < rsize) {
+ rsize = trem;
+ v = t;
+ }
+ t = leftmost_child(t);
+ }
+
+ /* If dv is a better fit, return 0 so malloc will use it */
+ if (v != 0 && rsize < (size_t)(m->dvsize - nb)) {
+ if (RTCHECK(ok_address(m, v))) { /* split */
+ mchunkptr r = chunk_plus_offset(v, nb);
+ assert(chunksize(v) == rsize + nb);
+ if (RTCHECK(ok_next(v, r))) {
+ unlink_large_chunk(m, v);
+ if (rsize < MIN_CHUNK_SIZE)
+ set_inuse_and_pinuse(m, v, (rsize + nb));
+ else {
+ set_size_and_pinuse_of_inuse_chunk(m, v, nb);
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ insert_chunk(m, r, rsize);
+ }
+ return chunk2mem(v);
+ }
+ }
+ CORRUPTION_ERROR_ACTION(m);
+ }
+ return 0;
+}
+
+/* allocate a small request from the best fitting chunk in a treebin */
+static void* tmalloc_small(mstate m, size_t nb) {
+ tchunkptr t, v;
+ size_t rsize;
+ bindex_t i;
+ binmap_t leastbit = least_bit(m->treemap);
+ compute_bit2idx(leastbit, i);
+ v = t = *treebin_at(m, i);
+ rsize = chunksize(t) - nb;
+
+ while ((t = leftmost_child(t)) != 0) {
+ size_t trem = chunksize(t) - nb;
+ if (trem < rsize) {
+ rsize = trem;
+ v = t;
+ }
+ }
+
+ if (RTCHECK(ok_address(m, v))) {
+ mchunkptr r = chunk_plus_offset(v, nb);
+ assert(chunksize(v) == rsize + nb);
+ if (RTCHECK(ok_next(v, r))) {
+ unlink_large_chunk(m, v);
+ if (rsize < MIN_CHUNK_SIZE)
+ set_inuse_and_pinuse(m, v, (rsize + nb));
+ else {
+ set_size_and_pinuse_of_inuse_chunk(m, v, nb);
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ replace_dv(m, r, rsize);
+ }
+ return chunk2mem(v);
+ }
+ }
+
+ CORRUPTION_ERROR_ACTION(m);
+ return 0;
+}
+
+/* --------------------------- realloc support --------------------------- */
+
+static void* internal_realloc(mstate m, void* oldmem, size_t bytes) {
+ if (bytes >= MAX_REQUEST) {
+ MALLOC_FAILURE_ACTION;
+ return 0;
+ }
+ if (!PREACTION(m)) {
+ mchunkptr oldp = mem2chunk(oldmem);
+ size_t oldsize = chunksize(oldp);
+ mchunkptr next = chunk_plus_offset(oldp, oldsize);
+ mchunkptr newp = 0;
+ void* extra = 0;
+
+ /* Try to either shrink or extend into top. Else malloc-copy-free */
+
+ if (RTCHECK(ok_address(m, oldp) && ok_inuse(oldp) &&
+ ok_next(oldp, next) && ok_pinuse(next))) {
+ size_t nb = request2size(bytes);
+ if (is_mmapped(oldp))
+ newp = mmap_resize(m, oldp, nb);
+ else if (oldsize >= nb) { /* already big enough */
+ size_t rsize = oldsize - nb;
+ newp = oldp;
+ if (rsize >= MIN_CHUNK_SIZE) {
+ mchunkptr remainder = chunk_plus_offset(newp, nb);
+ set_inuse(m, newp, nb);
+ set_inuse_and_pinuse(m, remainder, rsize);
+ extra = chunk2mem(remainder);
+ }
+ }
+ else if (next == m->top && oldsize + m->topsize > nb) {
+ /* Expand into top */
+ size_t newsize = oldsize + m->topsize;
+ size_t newtopsize = newsize - nb;
+ mchunkptr newtop = chunk_plus_offset(oldp, nb);
+ set_inuse(m, oldp, nb);
+ newtop->head = newtopsize |PINUSE_BIT;
+ m->top = newtop;
+ m->topsize = newtopsize;
+ newp = oldp;
+ }
+ }
+ else {
+ USAGE_ERROR_ACTION(m, oldmem);
+ POSTACTION(m);
+ return 0;
+ }
+#if DEBUG
+ if (newp != 0) {
+ check_inuse_chunk(m, newp); /* Check requires lock */
+ }
+#endif
+
+ POSTACTION(m);
+
+ if (newp != 0) {
+ if (extra != 0) {
+ internal_free(m, extra);
+ }
+ return chunk2mem(newp);
+ }
+ else {
+ void* newmem = internal_malloc(m, bytes);
+ if (newmem != 0) {
+ size_t oc = oldsize - overhead_for(oldp);
+ memcpy(newmem, oldmem, (oc < bytes)? oc : bytes);
+ internal_free(m, oldmem);
+ }
+ return newmem;
+ }
+ }
+ return 0;
+}
+
+/* --------------------------- memalign support -------------------------- */
+
+static void* internal_memalign(mstate m, size_t alignment, size_t bytes) {
+ if (alignment <= MALLOC_ALIGNMENT) /* Can just use malloc */
+ return internal_malloc(m, bytes);
+ if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */
+ alignment = MIN_CHUNK_SIZE;
+ if ((alignment & (alignment-SIZE_T_ONE)) != 0) {/* Ensure a power of 2 */
+ size_t a = MALLOC_ALIGNMENT << 1;
+ while (a < alignment) a <<= 1;
+ alignment = a;
+ }
+
+ if (bytes >= MAX_REQUEST - alignment) {
+ if (m != 0) { /* Test isn't needed but avoids compiler warning */
+ MALLOC_FAILURE_ACTION;
+ }
+ }
+ else {
+ size_t nb = request2size(bytes);
+ size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD;
+ char* mem = (char*)internal_malloc(m, req);
+ if (mem != 0) {
+ void* leader = 0;
+ void* trailer = 0;
+ mchunkptr p = mem2chunk(mem);
+
+ if (PREACTION(m)) return 0;
+ if ((((size_t)(mem)) % alignment) != 0) { /* misaligned */
+ /*
+ Find an aligned spot inside chunk. Since we need to give
+ back leading space in a chunk of at least MIN_CHUNK_SIZE, if
+ the first calculation places us at a spot with less than
+ MIN_CHUNK_SIZE leader, we can move to the next aligned spot.
+ We've allocated enough total room so that this is always
+ possible.
+ */
+ char* br = (char*)mem2chunk((size_t)(((size_t)(mem +
+ alignment -
+ SIZE_T_ONE)) &
+ -alignment));
+ char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE)?
+ br : br+alignment;
+ mchunkptr newp = (mchunkptr)pos;
+ size_t leadsize = pos - (char*)(p);
+ size_t newsize = chunksize(p) - leadsize;
+
+ if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */
+ newp->prev_foot = p->prev_foot + leadsize;
+ newp->head = newsize;
+ }
+ else { /* Otherwise, give back leader, use the rest */
+ set_inuse(m, newp, newsize);
+ set_inuse(m, p, leadsize);
+ leader = chunk2mem(p);
+ }
+ p = newp;
+ }
+
+ /* Give back spare room at the end */
+ if (!is_mmapped(p)) {
+ size_t size = chunksize(p);
+ if (size > nb + MIN_CHUNK_SIZE) {
+ size_t remainder_size = size - nb;
+ mchunkptr remainder = chunk_plus_offset(p, nb);
+ set_inuse(m, p, nb);
+ set_inuse(m, remainder, remainder_size);
+ trailer = chunk2mem(remainder);
+ }
+ }
+
+ assert (chunksize(p) >= nb);
+ assert((((size_t)(chunk2mem(p))) % alignment) == 0);
+ check_inuse_chunk(m, p);
+ POSTACTION(m);
+ if (leader != 0) {
+ internal_free(m, leader);
+ }
+ if (trailer != 0) {
+ internal_free(m, trailer);
+ }
+ return chunk2mem(p);
+ }
+ }
+ return 0;
+}
+
+/* ------------------------ comalloc/coalloc support --------------------- */
+
+static void** ialloc(mstate m,
+ size_t n_elements,
+ size_t* sizes,
+ int opts,
+ void* chunks[]) {
+ /*
+ This provides common support for independent_X routines, handling
+ all of the combinations that can result.
+
+ The opts arg has:
+ bit 0 set if all elements are same size (using sizes[0])
+ bit 1 set if elements should be zeroed
+ */
+
+ size_t element_size; /* chunksize of each element, if all same */
+ size_t contents_size; /* total size of elements */
+ size_t array_size; /* request size of pointer array */
+ void* mem; /* malloced aggregate space */
+ mchunkptr p; /* corresponding chunk */
+ size_t remainder_size; /* remaining bytes while splitting */
+ void** marray; /* either "chunks" or malloced ptr array */
+ mchunkptr array_chunk; /* chunk for malloced ptr array */
+ flag_t was_enabled; /* to disable mmap */
+ size_t size;
+ size_t i;
+
+ ensure_initialization();
+ /* compute array length, if needed */
+ if (chunks != 0) {
+ if (n_elements == 0)
+ return chunks; /* nothing to do */
+ marray = chunks;
+ array_size = 0;
+ }
+ else {
+ /* if empty req, must still return chunk representing empty array */
+ if (n_elements == 0)
+ return (void**)internal_malloc(m, 0);
+ marray = 0;
+ array_size = request2size(n_elements * (sizeof(void*)));
+ }
+
+ /* compute total element size */
+ if (opts & 0x1) { /* all-same-size */
+ element_size = request2size(*sizes);
+ contents_size = n_elements * element_size;
+ }
+ else { /* add up all the sizes */
+ element_size = 0;
+ contents_size = 0;
+ for (i = 0; i != n_elements; ++i)
+ contents_size += request2size(sizes[i]);
+ }
+
+ size = contents_size + array_size;
+
+ /*
+ Allocate the aggregate chunk. First disable direct-mmapping so
+ malloc won't use it, since we would not be able to later
+ free/realloc space internal to a segregated mmap region.
+ */
+ was_enabled = use_mmap(m);
+ disable_mmap(m);
+ mem = internal_malloc(m, size - CHUNK_OVERHEAD);
+ if (was_enabled)
+ enable_mmap(m);
+ if (mem == 0)
+ return 0;
+
+ if (PREACTION(m)) return 0;
+ p = mem2chunk(mem);
+ remainder_size = chunksize(p);
+
+ assert(!is_mmapped(p));
+
+ if (opts & 0x2) { /* optionally clear the elements */
+ memset((size_t*)mem, 0, remainder_size - SIZE_T_SIZE - array_size);
+ }
+
+ /* If not provided, allocate the pointer array as final part of chunk */
+ if (marray == 0) {
+ size_t array_chunk_size;
+ array_chunk = chunk_plus_offset(p, contents_size);
+ array_chunk_size = remainder_size - contents_size;
+ marray = (void**) (chunk2mem(array_chunk));
+ set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size);
+ remainder_size = contents_size;
+ }
+
+ /* split out elements */
+ for (i = 0; ; ++i) {
+ marray[i] = chunk2mem(p);
+ if (i != n_elements-1) {
+ if (element_size != 0)
+ size = element_size;
+ else
+ size = request2size(sizes[i]);
+ remainder_size -= size;
+ set_size_and_pinuse_of_inuse_chunk(m, p, size);
+ p = chunk_plus_offset(p, size);
+ }
+ else { /* the final element absorbs any overallocation slop */
+ set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size);
+ break;
+ }
+ }
+
+#if DEBUG
+ if (marray != chunks) {
+ /* final element must have exactly exhausted chunk */
+ if (element_size != 0) {
+ assert(remainder_size == element_size);
+ }
+ else {
+ assert(remainder_size == request2size(sizes[i]));
+ }
+ check_inuse_chunk(m, mem2chunk(marray));
+ }
+ for (i = 0; i != n_elements; ++i)
+ check_inuse_chunk(m, mem2chunk(marray[i]));
+
+#endif /* DEBUG */
+
+ POSTACTION(m);
+ return marray;
+}
+
+
+/* -------------------------- public routines ---------------------------- */
+
+#if !ONLY_MSPACES
+
+void* dlmalloc(size_t bytes) {
+ /*
+ Basic algorithm:
+ If a small request (< 256 bytes minus per-chunk overhead):
+ 1. If one exists, use a remainderless chunk in associated smallbin.
+ (Remainderless means that there are too few excess bytes to
+ represent as a chunk.)
+ 2. If it is big enough, use the dv chunk, which is normally the
+ chunk adjacent to the one used for the most recent small request.
+ 3. If one exists, split the smallest available chunk in a bin,
+ saving remainder in dv.
+ 4. If it is big enough, use the top chunk.
+ 5. If available, get memory from system and use it
+ Otherwise, for a large request:
+ 1. Find the smallest available binned chunk that fits, and use it
+ if it is better fitting than dv chunk, splitting if necessary.
+ 2. If better fitting than any binned chunk, use the dv chunk.
+ 3. If it is big enough, use the top chunk.
+ 4. If request size >= mmap threshold, try to directly mmap this chunk.
+ 5. If available, get memory from system and use it
+
+ The ugly goto's here ensure that postaction occurs along all paths.
+ */
+
+#if USE_LOCKS
+ ensure_initialization(); /* initialize in sys_alloc if not using locks */
+#endif
+
+ if (!PREACTION(gm)) {
+ void* mem;
+ size_t nb;
+ if (bytes <= MAX_SMALL_REQUEST) {
+ bindex_t idx;
+ binmap_t smallbits;
+ nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes);
+ idx = small_index(nb);
+ smallbits = gm->smallmap >> idx;
+
+ if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
+ mchunkptr b, p;
+ idx += ~smallbits & 1; /* Uses next bin if idx empty */
+ b = smallbin_at(gm, idx);
+ p = b->fd;
+ assert(chunksize(p) == small_index2size(idx));
+ unlink_first_small_chunk(gm, b, p, idx);
+ set_inuse_and_pinuse(gm, p, small_index2size(idx));
+ mem = chunk2mem(p);
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+
+ else if (nb > gm->dvsize) {
+ if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
+ mchunkptr b, p, r;
+ size_t rsize;
+ bindex_t i;
+ binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx));
+ binmap_t leastbit = least_bit(leftbits);
+ compute_bit2idx(leastbit, i);
+ b = smallbin_at(gm, i);
+ p = b->fd;
+ assert(chunksize(p) == small_index2size(i));
+ unlink_first_small_chunk(gm, b, p, i);
+ rsize = small_index2size(i) - nb;
+ /* Fit here cannot be remainderless if 4byte sizes */
+ if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
+ set_inuse_and_pinuse(gm, p, small_index2size(i));
+ else {
+ set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
+ r = chunk_plus_offset(p, nb);
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ replace_dv(gm, r, rsize);
+ }
+ mem = chunk2mem(p);
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+
+ else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) {
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+ }
+ }
+ else if (bytes >= MAX_REQUEST)
+ nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
+ else {
+ nb = pad_request(bytes);
+ if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) {
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+ }
+
+ if (nb <= gm->dvsize) {
+ size_t rsize = gm->dvsize - nb;
+ mchunkptr p = gm->dv;
+ if (rsize >= MIN_CHUNK_SIZE) { /* split dv */
+ mchunkptr r = gm->dv = chunk_plus_offset(p, nb);
+ gm->dvsize = rsize;
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
+ }
+ else { /* exhaust dv */
+ size_t dvs = gm->dvsize;
+ gm->dvsize = 0;
+ gm->dv = 0;
+ set_inuse_and_pinuse(gm, p, dvs);
+ }
+ mem = chunk2mem(p);
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+
+ else if (nb < gm->topsize) { /* Split top */
+ size_t rsize = gm->topsize -= nb;
+ mchunkptr p = gm->top;
+ mchunkptr r = gm->top = chunk_plus_offset(p, nb);
+ r->head = rsize | PINUSE_BIT;
+ set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
+ mem = chunk2mem(p);
+ check_top_chunk(gm, gm->top);
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+
+ mem = sys_alloc(gm, nb);
+
+ postaction:
+ POSTACTION(gm);
+ return mem;
+ }
+
+ return 0;
+}
+
+void dlfree(void* mem) {
+ /*
+ Consolidate freed chunks with preceeding or succeeding bordering
+ free chunks, if they exist, and then place in a bin. Intermixed
+ with special cases for top, dv, mmapped chunks, and usage errors.
+ */
+
+ if (mem != 0) {
+ mchunkptr p = mem2chunk(mem);
+#if FOOTERS
+ mstate fm = get_mstate_for(p);
+ if (!ok_magic(fm)) {
+ USAGE_ERROR_ACTION(fm, p);
+ return;
+ }
+#else /* FOOTERS */
+#define fm gm
+#endif /* FOOTERS */
+ if (!PREACTION(fm)) {
+ check_inuse_chunk(fm, p);
+ if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) {
+ size_t psize = chunksize(p);
+ mchunkptr next = chunk_plus_offset(p, psize);
+ if (!pinuse(p)) {
+ size_t prevsize = p->prev_foot;
+ if (is_mmapped(p)) {
+ psize += prevsize + MMAP_FOOT_PAD;
+ if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
+ fm->footprint -= psize;
+ goto postaction;
+ }
+ else {
+ mchunkptr prev = chunk_minus_offset(p, prevsize);
+ psize += prevsize;
+ p = prev;
+ if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */
+ if (p != fm->dv) {
+ unlink_chunk(fm, p, prevsize);
+ }
+ else if ((next->head & INUSE_BITS) == INUSE_BITS) {
+ fm->dvsize = psize;
+ set_free_with_pinuse(p, psize, next);
+ goto postaction;
+ }
+ }
+ else
+ goto erroraction;
+ }
+ }
+
+ if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) {
+ if (!cinuse(next)) { /* consolidate forward */
+ if (next == fm->top) {
+ size_t tsize = fm->topsize += psize;
+ fm->top = p;
+ p->head = tsize | PINUSE_BIT;
+ if (p == fm->dv) {
+ fm->dv = 0;
+ fm->dvsize = 0;
+ }
+ if (should_trim(fm, tsize))
+ sys_trim(fm, 0);
+ goto postaction;
+ }
+ else if (next == fm->dv) {
+ size_t dsize = fm->dvsize += psize;
+ fm->dv = p;
+ set_size_and_pinuse_of_free_chunk(p, dsize);
+ goto postaction;
+ }
+ else {
+ size_t nsize = chunksize(next);
+ psize += nsize;
+ unlink_chunk(fm, next, nsize);
+ set_size_and_pinuse_of_free_chunk(p, psize);
+ if (p == fm->dv) {
+ fm->dvsize = psize;
+ goto postaction;
+ }
+ }
+ }
+ else
+ set_free_with_pinuse(p, psize, next);
+
+ if (is_small(psize)) {
+ insert_small_chunk(fm, p, psize);
+ check_free_chunk(fm, p);
+ }
+ else {
+ tchunkptr tp = (tchunkptr)p;
+ insert_large_chunk(fm, tp, psize);
+ check_free_chunk(fm, p);
+ if (--fm->release_checks == 0)
+ release_unused_segments(fm);
+ }
+ goto postaction;
+ }
+ }
+ erroraction:
+ USAGE_ERROR_ACTION(fm, p);
+ postaction:
+ POSTACTION(fm);
+ }
+ }
+#if !FOOTERS
+#undef fm
+#endif /* FOOTERS */
+}
+
+void* dlcalloc(size_t n_elements, size_t elem_size) {
+ void* mem;
+ size_t req = 0;
+ if (n_elements != 0) {
+ req = n_elements * elem_size;
+ if (((n_elements | elem_size) & ~(size_t)0xffff) &&
+ (req / n_elements != elem_size))
+ req = MAX_SIZE_T; /* force downstream failure on overflow */
+ }
+ mem = dlmalloc(req);
+ if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
+ memset(mem, 0, req);
+ return mem;
+}
+
+void* dlrealloc(void* oldmem, size_t bytes) {
+ if (oldmem == 0)
+ return dlmalloc(bytes);
+#ifdef REALLOC_ZERO_BYTES_FREES
+ if (bytes == 0) {
+ dlfree(oldmem);
+ return 0;
+ }
+#endif /* REALLOC_ZERO_BYTES_FREES */
+ else {
+#if ! FOOTERS
+ mstate m = gm;
+#else /* FOOTERS */
+ mstate m = get_mstate_for(mem2chunk(oldmem));
+ if (!ok_magic(m)) {
+ USAGE_ERROR_ACTION(m, oldmem);
+ return 0;
+ }
+#endif /* FOOTERS */
+ return internal_realloc(m, oldmem, bytes);
+ }
+}
+
+void* dlmemalign(size_t alignment, size_t bytes) {
+ return internal_memalign(gm, alignment, bytes);
+}
+
+void** dlindependent_calloc(size_t n_elements, size_t elem_size,
+ void* chunks[]) {
+ size_t sz = elem_size; /* serves as 1-element array */
+ return ialloc(gm, n_elements, &sz, 3, chunks);
+}
+
+void** dlindependent_comalloc(size_t n_elements, size_t sizes[],
+ void* chunks[]) {
+ return ialloc(gm, n_elements, sizes, 0, chunks);
+}
+
+void* dlvalloc(size_t bytes) {
+ size_t pagesz;
+ ensure_initialization();
+ pagesz = mparams.page_size;
+ return dlmemalign(pagesz, bytes);
+}
+
+void* dlpvalloc(size_t bytes) {
+ size_t pagesz;
+ ensure_initialization();
+ pagesz = mparams.page_size;
+ return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE));
+}
+
+int dlmalloc_trim(size_t pad) {
+ int result = 0;
+ ensure_initialization();
+ if (!PREACTION(gm)) {
+ result = sys_trim(gm, pad);
+ POSTACTION(gm);
+ }
+ return result;
+}
+
+size_t dlmalloc_footprint(void) {
+ return gm->footprint;
+}
+
+size_t dlmalloc_max_footprint(void) {
+ return gm->max_footprint;
+}
+
+#if !NO_MALLINFO
+struct mallinfo dlmallinfo(void) {
+ return internal_mallinfo(gm);
+}
+#endif /* NO_MALLINFO */
+
+void dlmalloc_stats() {
+ internal_malloc_stats(gm);
+}
+
+int dlmallopt(int param_number, int value) {
+ return change_mparam(param_number, value);
+}
+
+#endif /* !ONLY_MSPACES */
+
+size_t dlmalloc_usable_size(void* mem) {
+ if (mem != 0) {
+ mchunkptr p = mem2chunk(mem);
+ if (is_inuse(p))
+ return chunksize(p) - overhead_for(p);
+ }
+ return 0;
+}
+
+/* ----------------------------- user mspaces ---------------------------- */
+
+#if MSPACES
+
+static mstate init_user_mstate(char* tbase, size_t tsize) {
+ size_t msize = pad_request(sizeof(struct malloc_state));
+ mchunkptr mn;
+ mchunkptr msp = align_as_chunk(tbase);
+ mstate m = (mstate)(chunk2mem(msp));
+ memset(m, 0, msize);
+ INITIAL_LOCK(&m->mutex);
+ msp->head = (msize|INUSE_BITS);
+ m->seg.base = m->least_addr = tbase;
+ m->seg.size = m->footprint = m->max_footprint = tsize;
+ m->magic = mparams.magic;
+ m->release_checks = MAX_RELEASE_CHECK_RATE;
+ m->mflags = mparams.default_mflags;
+ m->extp = 0;
+ m->exts = 0;
+ disable_contiguous(m);
+ init_bins(m);
+ mn = next_chunk(mem2chunk(m));
+ init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE);
+ check_top_chunk(m, m->top);
+ return m;
+}
+
+mspace create_mspace(size_t capacity, int locked) {
+ mstate m = 0;
+ size_t msize;
+ ensure_initialization();
+ msize = pad_request(sizeof(struct malloc_state));
+ if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) {
+ size_t rs = ((capacity == 0)? mparams.granularity :
+ (capacity + TOP_FOOT_SIZE + msize));
+ size_t tsize = granularity_align(rs);
+ char* tbase = (char*)(CALL_MMAP(tsize));
+ if (tbase != CMFAIL) {
+ m = init_user_mstate(tbase, tsize);
+ m->seg.sflags = USE_MMAP_BIT;
+ set_lock(m, locked);
+ }
+ }
+ return (mspace)m;
+}
+
+mspace create_mspace_with_base(void* base, size_t capacity, int locked) {
+ mstate m = 0;
+ size_t msize;
+ ensure_initialization();
+ msize = pad_request(sizeof(struct malloc_state));
+ if (capacity > msize + TOP_FOOT_SIZE &&
+ capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) {
+ m = init_user_mstate((char*)base, capacity);
+ m->seg.sflags = EXTERN_BIT;
+ set_lock(m, locked);
+ }
+ return (mspace)m;
+}
+
+int mspace_track_large_chunks(mspace msp, int enable) {
+ int ret = 0;
+ mstate ms = (mstate)msp;
+ if (!PREACTION(ms)) {
+ if (!use_mmap(ms))
+ ret = 1;
+ if (!enable)
+ enable_mmap(ms);
+ else
+ disable_mmap(ms);
+ POSTACTION(ms);
+ }
+ return ret;
+}
+
+size_t destroy_mspace(mspace msp) {
+ size_t freed = 0;
+ mstate ms = (mstate)msp;
+ if (ok_magic(ms)) {
+ msegmentptr sp = &ms->seg;
+ while (sp != 0) {
+ char* base = sp->base;
+ size_t size = sp->size;
+ flag_t flag = sp->sflags;
+ sp = sp->next;
+ if ((flag & USE_MMAP_BIT) && !(flag & EXTERN_BIT) &&
+ CALL_MUNMAP(base, size) == 0)
+ freed += size;
+ }
+ }
+ else {
+ USAGE_ERROR_ACTION(ms,ms);
+ }
+ return freed;
+}
+
+/*
+ mspace versions of routines are near-clones of the global
+ versions. This is not so nice but better than the alternatives.
+*/
+
+
+void* mspace_malloc(mspace msp, size_t bytes) {
+ mstate ms = (mstate)msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms,ms);
+ return 0;
+ }
+ if (!PREACTION(ms)) {
+ void* mem;
+ size_t nb;
+ if (bytes <= MAX_SMALL_REQUEST) {
+ bindex_t idx;
+ binmap_t smallbits;
+ nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes);
+ idx = small_index(nb);
+ smallbits = ms->smallmap >> idx;
+
+ if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
+ mchunkptr b, p;
+ idx += ~smallbits & 1; /* Uses next bin if idx empty */
+ b = smallbin_at(ms, idx);
+ p = b->fd;
+ assert(chunksize(p) == small_index2size(idx));
+ unlink_first_small_chunk(ms, b, p, idx);
+ set_inuse_and_pinuse(ms, p, small_index2size(idx));
+ mem = chunk2mem(p);
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+
+ else if (nb > ms->dvsize) {
+ if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
+ mchunkptr b, p, r;
+ size_t rsize;
+ bindex_t i;
+ binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx));
+ binmap_t leastbit = least_bit(leftbits);
+ compute_bit2idx(leastbit, i);
+ b = smallbin_at(ms, i);
+ p = b->fd;
+ assert(chunksize(p) == small_index2size(i));
+ unlink_first_small_chunk(ms, b, p, i);
+ rsize = small_index2size(i) - nb;
+ /* Fit here cannot be remainderless if 4byte sizes */
+ if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
+ set_inuse_and_pinuse(ms, p, small_index2size(i));
+ else {
+ set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
+ r = chunk_plus_offset(p, nb);
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ replace_dv(ms, r, rsize);
+ }
+ mem = chunk2mem(p);
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+
+ else if (ms->treemap != 0 && (mem = tmalloc_small(ms, nb)) != 0) {
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+ }
+ }
+ else if (bytes >= MAX_REQUEST)
+ nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
+ else {
+ nb = pad_request(bytes);
+ if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) {
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+ }
+
+ if (nb <= ms->dvsize) {
+ size_t rsize = ms->dvsize - nb;
+ mchunkptr p = ms->dv;
+ if (rsize >= MIN_CHUNK_SIZE) { /* split dv */
+ mchunkptr r = ms->dv = chunk_plus_offset(p, nb);
+ ms->dvsize = rsize;
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
+ }
+ else { /* exhaust dv */
+ size_t dvs = ms->dvsize;
+ ms->dvsize = 0;
+ ms->dv = 0;
+ set_inuse_and_pinuse(ms, p, dvs);
+ }
+ mem = chunk2mem(p);
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+
+ else if (nb < ms->topsize) { /* Split top */
+ size_t rsize = ms->topsize -= nb;
+ mchunkptr p = ms->top;
+ mchunkptr r = ms->top = chunk_plus_offset(p, nb);
+ r->head = rsize | PINUSE_BIT;
+ set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
+ mem = chunk2mem(p);
+ check_top_chunk(ms, ms->top);
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+
+ mem = sys_alloc(ms, nb);
+
+ postaction:
+ POSTACTION(ms);
+ return mem;
+ }
+
+ return 0;
+}
+
+void mspace_free(mspace msp, void* mem) {
+ if (mem != 0) {
+ mchunkptr p = mem2chunk(mem);
+#if FOOTERS
+ mstate fm = get_mstate_for(p);
+ msp = msp; /* placate people compiling -Wunused */
+#else /* FOOTERS */
+ mstate fm = (mstate)msp;
+#endif /* FOOTERS */
+ if (!ok_magic(fm)) {
+ USAGE_ERROR_ACTION(fm, p);
+ return;
+ }
+ if (!PREACTION(fm)) {
+ check_inuse_chunk(fm, p);
+ if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) {
+ size_t psize = chunksize(p);
+ mchunkptr next = chunk_plus_offset(p, psize);
+ if (!pinuse(p)) {
+ size_t prevsize = p->prev_foot;
+ if (is_mmapped(p)) {
+ psize += prevsize + MMAP_FOOT_PAD;
+ if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
+ fm->footprint -= psize;
+ goto postaction;
+ }
+ else {
+ mchunkptr prev = chunk_minus_offset(p, prevsize);
+ psize += prevsize;
+ p = prev;
+ if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */
+ if (p != fm->dv) {
+ unlink_chunk(fm, p, prevsize);
+ }
+ else if ((next->head & INUSE_BITS) == INUSE_BITS) {
+ fm->dvsize = psize;
+ set_free_with_pinuse(p, psize, next);
+ goto postaction;
+ }
+ }
+ else
+ goto erroraction;
+ }
+ }
+
+ if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) {
+ if (!cinuse(next)) { /* consolidate forward */
+ if (next == fm->top) {
+ size_t tsize = fm->topsize += psize;
+ fm->top = p;
+ p->head = tsize | PINUSE_BIT;
+ if (p == fm->dv) {
+ fm->dv = 0;
+ fm->dvsize = 0;
+ }
+ if (should_trim(fm, tsize))
+ sys_trim(fm, 0);
+ goto postaction;
+ }
+ else if (next == fm->dv) {
+ size_t dsize = fm->dvsize += psize;
+ fm->dv = p;
+ set_size_and_pinuse_of_free_chunk(p, dsize);
+ goto postaction;
+ }
+ else {
+ size_t nsize = chunksize(next);
+ psize += nsize;
+ unlink_chunk(fm, next, nsize);
+ set_size_and_pinuse_of_free_chunk(p, psize);
+ if (p == fm->dv) {
+ fm->dvsize = psize;
+ goto postaction;
+ }
+ }
+ }
+ else
+ set_free_with_pinuse(p, psize, next);
+
+ if (is_small(psize)) {
+ insert_small_chunk(fm, p, psize);
+ check_free_chunk(fm, p);
+ }
+ else {
+ tchunkptr tp = (tchunkptr)p;
+ insert_large_chunk(fm, tp, psize);
+ check_free_chunk(fm, p);
+ if (--fm->release_checks == 0)
+ release_unused_segments(fm);
+ }
+ goto postaction;
+ }
+ }
+ erroraction:
+ USAGE_ERROR_ACTION(fm, p);
+ postaction:
+ POSTACTION(fm);
+ }
+ }
+}
+
+void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size) {
+ void* mem;
+ size_t req = 0;
+ mstate ms = (mstate)msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms,ms);
+ return 0;
+ }
+ if (n_elements != 0) {
+ req = n_elements * elem_size;
+ if (((n_elements | elem_size) & ~(size_t)0xffff) &&
+ (req / n_elements != elem_size))
+ req = MAX_SIZE_T; /* force downstream failure on overflow */
+ }
+ mem = internal_malloc(ms, req);
+ if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
+ memset(mem, 0, req);
+ return mem;
+}
+
+void* mspace_realloc(mspace msp, void* oldmem, size_t bytes) {
+ if (oldmem == 0)
+ return mspace_malloc(msp, bytes);
+#ifdef REALLOC_ZERO_BYTES_FREES
+ if (bytes == 0) {
+ mspace_free(msp, oldmem);
+ return 0;
+ }
+#endif /* REALLOC_ZERO_BYTES_FREES */
+ else {
+#if FOOTERS
+ mchunkptr p = mem2chunk(oldmem);
+ mstate ms = get_mstate_for(p);
+#else /* FOOTERS */
+ mstate ms = (mstate)msp;
+#endif /* FOOTERS */
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms,ms);
+ return 0;
+ }
+ return internal_realloc(ms, oldmem, bytes);
+ }
+}
+
+void* mspace_memalign(mspace msp, size_t alignment, size_t bytes) {
+ mstate ms = (mstate)msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms,ms);
+ return 0;
+ }
+ return internal_memalign(ms, alignment, bytes);
+}
+
+void** mspace_independent_calloc(mspace msp, size_t n_elements,
+ size_t elem_size, void* chunks[]) {
+ size_t sz = elem_size; /* serves as 1-element array */
+ mstate ms = (mstate)msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms,ms);
+ return 0;
+ }
+ return ialloc(ms, n_elements, &sz, 3, chunks);
+}
+
+void** mspace_independent_comalloc(mspace msp, size_t n_elements,
+ size_t sizes[], void* chunks[]) {
+ mstate ms = (mstate)msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms,ms);
+ return 0;
+ }
+ return ialloc(ms, n_elements, sizes, 0, chunks);
+}
+
+int mspace_trim(mspace msp, size_t pad) {
+ int result = 0;
+ mstate ms = (mstate)msp;
+ if (ok_magic(ms)) {
+ if (!PREACTION(ms)) {
+ result = sys_trim(ms, pad);
+ POSTACTION(ms);
+ }
+ }
+ else {
+ USAGE_ERROR_ACTION(ms,ms);
+ }
+ return result;
+}
+
+void mspace_malloc_stats(mspace msp) {
+ mstate ms = (mstate)msp;
+ if (ok_magic(ms)) {
+ internal_malloc_stats(ms);
+ }
+ else {
+ USAGE_ERROR_ACTION(ms,ms);
+ }
+}
+
+size_t mspace_footprint(mspace msp) {
+ size_t result = 0;
+ mstate ms = (mstate)msp;
+ if (ok_magic(ms)) {
+ result = ms->footprint;
+ }
+ else {
+ USAGE_ERROR_ACTION(ms,ms);
+ }
+ return result;
+}
+
+
+size_t mspace_max_footprint(mspace msp) {
+ size_t result = 0;
+ mstate ms = (mstate)msp;
+ if (ok_magic(ms)) {
+ result = ms->max_footprint;
+ }
+ else {
+ USAGE_ERROR_ACTION(ms,ms);
+ }
+ return result;
+}
+
+
+#if !NO_MALLINFO
+struct mallinfo mspace_mallinfo(mspace msp) {
+ mstate ms = (mstate)msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms,ms);
+ }
+ return internal_mallinfo(ms);
+}
+#endif /* NO_MALLINFO */
+
+size_t mspace_usable_size(void* mem) {
+ if (mem != 0) {
+ mchunkptr p = mem2chunk(mem);
+ if (is_inuse(p))
+ return chunksize(p) - overhead_for(p);
+ }
+ return 0;
+}
+
+int mspace_mallopt(int param_number, int value) {
+ return change_mparam(param_number, value);
+}
+
+#endif /* MSPACES */
+
+
+/* -------------------- Alternative MORECORE functions ------------------- */
+
+/*
+ Guidelines for creating a custom version of MORECORE:
+
+ * For best performance, MORECORE should allocate in multiples of pagesize.
+ * MORECORE may allocate more memory than requested. (Or even less,
+ but this will usually result in a malloc failure.)
+ * MORECORE must not allocate memory when given argument zero, but
+ instead return one past the end address of memory from previous
+ nonzero call.
+ * For best performance, consecutive calls to MORECORE with positive
+ arguments should return increasing addresses, indicating that
+ space has been contiguously extended.
+ * Even though consecutive calls to MORECORE need not return contiguous
+ addresses, it must be OK for malloc'ed chunks to span multiple
+ regions in those cases where they do happen to be contiguous.
+ * MORECORE need not handle negative arguments -- it may instead
+ just return MFAIL when given negative arguments.
+ Negative arguments are always multiples of pagesize. MORECORE
+ must not misinterpret negative args as large positive unsigned
+ args. You can suppress all such calls from even occurring by defining
+ MORECORE_CANNOT_TRIM,
+
+ As an example alternative MORECORE, here is a custom allocator
+ kindly contributed for pre-OSX macOS. It uses virtually but not
+ necessarily physically contiguous non-paged memory (locked in,
+ present and won't get swapped out). You can use it by uncommenting
+ this section, adding some #includes, and setting up the appropriate
+ defines above:
+
+ #define MORECORE osMoreCore
+
+ There is also a shutdown routine that should somehow be called for
+ cleanup upon program exit.
+
+ #define MAX_POOL_ENTRIES 100
+ #define MINIMUM_MORECORE_SIZE (64 * 1024U)
+ static int next_os_pool;
+ void *our_os_pools[MAX_POOL_ENTRIES];
+
+ void *osMoreCore(int size)
+ {
+ void *ptr = 0;
+ static void *sbrk_top = 0;
+
+ if (size > 0)
+ {
+ if (size < MINIMUM_MORECORE_SIZE)
+ size = MINIMUM_MORECORE_SIZE;
+ if (CurrentExecutionLevel() == kTaskLevel)
+ ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0);
+ if (ptr == 0)
+ {
+ return (void *) MFAIL;
+ }
+ // save ptrs so they can be freed during cleanup
+ our_os_pools[next_os_pool] = ptr;
+ next_os_pool++;
+ ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK);
+ sbrk_top = (char *) ptr + size;
+ return ptr;
+ }
+ else if (size < 0)
+ {
+ // we don't currently support shrink behavior
+ return (void *) MFAIL;
+ }
+ else
+ {
+ return sbrk_top;
+ }
+ }
+
+ // cleanup any allocated memory pools
+ // called as last thing before shutting down driver
+
+ void osCleanupMem(void)
+ {
+ void **ptr;
+
+ for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++)
+ if (*ptr)
+ {
+ PoolDeallocate(*ptr);
+ *ptr = 0;
+ }
+ }
+
+*/
+
+
+/* -----------------------------------------------------------------------
+History:
+ V2.8.4 Wed May 27 09:56:23 2009 Doug Lea (dl at gee)
+ * Use zeros instead of prev foot for is_mmapped
+ * Add mspace_track_large_chunks; thanks to Jean Brouwers
+ * Fix set_inuse in internal_realloc; thanks to Jean Brouwers
+ * Fix insufficient sys_alloc padding when using 16byte alignment
+ * Fix bad error check in mspace_footprint
+ * Adaptations for ptmalloc; thanks to Wolfram Gloger.
+ * Reentrant spin locks; thanks to Earl Chew and others
+ * Win32 improvements; thanks to Niall Douglas and Earl Chew
+ * Add NO_SEGMENT_TRAVERSAL and MAX_RELEASE_CHECK_RATE options
+ * Extension hook in malloc_state
+ * Various small adjustments to reduce warnings on some compilers
+ * Various configuration extensions/changes for more platforms. Thanks
+ to all who contributed these.
+
+ V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee)
+ * Add max_footprint functions
+ * Ensure all appropriate literals are size_t
+ * Fix conditional compilation problem for some #define settings
+ * Avoid concatenating segments with the one provided
+ in create_mspace_with_base
+ * Rename some variables to avoid compiler shadowing warnings
+ * Use explicit lock initialization.
+ * Better handling of sbrk interference.
+ * Simplify and fix segment insertion, trimming and mspace_destroy
+ * Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x
+ * Thanks especially to Dennis Flanagan for help on these.
+
+ V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee)
+ * Fix memalign brace error.
+
+ V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee)
+ * Fix improper #endif nesting in C++
+ * Add explicit casts needed for C++
+
+ V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee)
+ * Use trees for large bins
+ * Support mspaces
+ * Use segments to unify sbrk-based and mmap-based system allocation,
+ removing need for emulation on most platforms without sbrk.
+ * Default safety checks
+ * Optional footer checks. Thanks to William Robertson for the idea.
+ * Internal code refactoring
+ * Incorporate suggestions and platform-specific changes.
+ Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas,
+ Aaron Bachmann, Emery Berger, and others.
+ * Speed up non-fastbin processing enough to remove fastbins.
+ * Remove useless cfree() to avoid conflicts with other apps.
+ * Remove internal memcpy, memset. Compilers handle builtins better.
+ * Remove some options that no one ever used and rename others.
+
+ V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee)
+ * Fix malloc_state bitmap array misdeclaration
+
+ V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee)
+ * Allow tuning of FIRST_SORTED_BIN_SIZE
+ * Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte.
+ * Better detection and support for non-contiguousness of MORECORE.
+ Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger
+ * Bypass most of malloc if no frees. Thanks To Emery Berger.
+ * Fix freeing of old top non-contiguous chunk im sysmalloc.
+ * Raised default trim and map thresholds to 256K.
+ * Fix mmap-related #defines. Thanks to Lubos Lunak.
+ * Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield.
+ * Branch-free bin calculation
+ * Default trim and mmap thresholds now 256K.
+
+ V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee)
+ * Introduce independent_comalloc and independent_calloc.
+ Thanks to Michael Pachos for motivation and help.
+ * Make optional .h file available
+ * Allow > 2GB requests on 32bit systems.
+ * new WIN32 sbrk, mmap, munmap, lock code from <Walter@GeNeSys-e.de>.
+ Thanks also to Andreas Mueller <a.mueller at paradatec.de>,
+ and Anonymous.
+ * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for
+ helping test this.)
+ * memalign: check alignment arg
+ * realloc: don't try to shift chunks backwards, since this
+ leads to more fragmentation in some programs and doesn't
+ seem to help in any others.
+ * Collect all cases in malloc requiring system memory into sysmalloc
+ * Use mmap as backup to sbrk
+ * Place all internal state in malloc_state
+ * Introduce fastbins (although similar to 2.5.1)
+ * Many minor tunings and cosmetic improvements
+ * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK
+ * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS
+ Thanks to Tony E. Bennett <tbennett@nvidia.com> and others.
+ * Include errno.h to support default failure action.
+
+ V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee)
+ * return null for negative arguments
+ * Added Several WIN32 cleanups from Martin C. Fong <mcfong at yahoo.com>
+ * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h'
+ (e.g. WIN32 platforms)
+ * Cleanup header file inclusion for WIN32 platforms
+ * Cleanup code to avoid Microsoft Visual C++ compiler complaints
+ * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing
+ memory allocation routines
+ * Set 'malloc_getpagesize' for WIN32 platforms (needs more work)
+ * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to
+ usage of 'assert' in non-WIN32 code
+ * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to
+ avoid infinite loop
+ * Always call 'fREe()' rather than 'free()'
+
+ V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee)
+ * Fixed ordering problem with boundary-stamping
+
+ V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee)
+ * Added pvalloc, as recommended by H.J. Liu
+ * Added 64bit pointer support mainly from Wolfram Gloger
+ * Added anonymously donated WIN32 sbrk emulation
+ * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen
+ * malloc_extend_top: fix mask error that caused wastage after
+ foreign sbrks
+ * Add linux mremap support code from HJ Liu
+
+ V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee)
+ * Integrated most documentation with the code.
+ * Add support for mmap, with help from
+ Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
+ * Use last_remainder in more cases.
+ * Pack bins using idea from colin@nyx10.cs.du.edu
+ * Use ordered bins instead of best-fit threshhold
+ * Eliminate block-local decls to simplify tracing and debugging.
+ * Support another case of realloc via move into top
+ * Fix error occuring when initial sbrk_base not word-aligned.
+ * Rely on page size for units instead of SBRK_UNIT to
+ avoid surprises about sbrk alignment conventions.
+ * Add mallinfo, mallopt. Thanks to Raymond Nijssen
+ (raymond@es.ele.tue.nl) for the suggestion.
+ * Add `pad' argument to malloc_trim and top_pad mallopt parameter.
+ * More precautions for cases where other routines call sbrk,
+ courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
+ * Added macros etc., allowing use in linux libc from
+ H.J. Lu (hjl@gnu.ai.mit.edu)
+ * Inverted this history list
+
+ V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee)
+ * Re-tuned and fixed to behave more nicely with V2.6.0 changes.
+ * Removed all preallocation code since under current scheme
+ the work required to undo bad preallocations exceeds
+ the work saved in good cases for most test programs.
+ * No longer use return list or unconsolidated bins since
+ no scheme using them consistently outperforms those that don't
+ given above changes.
+ * Use best fit for very large chunks to prevent some worst-cases.
+ * Added some support for debugging
+
+ V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee)
+ * Removed footers when chunks are in use. Thanks to
+ Paul Wilson (wilson@cs.texas.edu) for the suggestion.
+
+ V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee)
+ * Added malloc_trim, with help from Wolfram Gloger
+ (wmglo@Dent.MED.Uni-Muenchen.DE).
+
+ V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g)
+
+ V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g)
+ * realloc: try to expand in both directions
+ * malloc: swap order of clean-bin strategy;
+ * realloc: only conditionally expand backwards
+ * Try not to scavenge used bins
+ * Use bin counts as a guide to preallocation
+ * Occasionally bin return list chunks in first scan
+ * Add a few optimizations from colin@nyx10.cs.du.edu
+
+ V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g)
+ * faster bin computation & slightly different binning
+ * merged all consolidations to one part of malloc proper
+ (eliminating old malloc_find_space & malloc_clean_bin)
+ * Scan 2 returns chunks (not just 1)
+ * Propagate failure in realloc if malloc returns 0
+ * Add stuff to allow compilation on non-ANSI compilers
+ from kpv@research.att.com
+
+ V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu)
+ * removed potential for odd address access in prev_chunk
+ * removed dependency on getpagesize.h
+ * misc cosmetics and a bit more internal documentation
+ * anticosmetics: mangled names in macros to evade debugger strangeness
+ * tested on sparc, hp-700, dec-mips, rs6000
+ with gcc & native cc (hp, dec only) allowing
+ Detlefs & Zorn comparison study (in SIGPLAN Notices.)
+
+ Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu)
+ * Based loosely on libg++-1.2X malloc. (It retains some of the overall
+ structure of old version, but most details differ.)
+
+*/
diff --git a/system/lib/dlmalloc.symbols b/system/lib/dlmalloc.symbols
new file mode 100644
index 00000000..d41f4140
--- /dev/null
+++ b/system/lib/dlmalloc.symbols
@@ -0,0 +1,50 @@
+malloc
+free
+calloc
+memalign
+realloc
+valloc
+pvalloc
+mallinfo
+mallopt
+malloc_trim
+malloc_stats
+malloc_usable_size
+malloc_footprint
+malloc_max_footprint
+independent_calloc
+independent_comalloc
+_Znwj
+_Znaj
+_Znam
+_Znwm
+_ZdaPv
+_ZdaPvRKSt9nothrow_t
+_ZdlPv
+_ZdlPvRKSt9nothrow_t
+_Znaj
+_ZnajRKSt9nothrow_t
+_Znwj
+_ZnwjRKSt9nothrow_t
+_ZL13__new_handler
+_ZSt15get_new_handlerv
+_ZSt15set_new_handlerPFvvE
+_ZTVSt9bad_alloc
+_ZTSSt9bad_alloc
+_ZNKSt9bad_alloc4whatEv
+_ZNSt9bad_allocC1Ev
+_ZNSt9bad_allocC2Ev
+_ZNSt9bad_allocD0Ev
+_ZNSt9bad_allocD1Ev
+_ZNSt9bad_allocD2Ev
+_ZSt17__throw_bad_allocv
+_ZTISt9bad_alloc
+_ZTVSt20bad_array_new_length
+_ZTSSt20bad_array_new_length
+_ZTISt20bad_array_new_length
+_ZNKSt20bad_array_new_length4whatEv
+_ZNSt20bad_array_new_lengthC1Ev
+_ZNSt20bad_array_new_lengthC2Ev
+_ZNSt20bad_array_new_lengthD0Ev
+_ZNSt20bad_array_new_lengthD1Ev
+_ZNSt20bad_array_new_lengthD2Ev
diff --git a/system/lib/libcxx/LICENSE.txt b/system/lib/libcxx/LICENSE.txt
new file mode 100644
index 00000000..926f0676
--- /dev/null
+++ b/system/lib/libcxx/LICENSE.txt
@@ -0,0 +1,76 @@
+==============================================================================
+libc++ License
+==============================================================================
+
+The libc++ library is dual licensed under both the University of Illinois
+"BSD-Like" license and the MIT license. As a user of this code you may choose
+to use it under either license. As a contributor, you agree to allow your code
+to be used under both.
+
+Full text of the relevant licenses is included below.
+
+==============================================================================
+
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+
+==============================================================================
+
+Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/system/lib/libcxx/Makefile b/system/lib/libcxx/Makefile
new file mode 100644
index 00000000..98a5974d
--- /dev/null
+++ b/system/lib/libcxx/Makefile
@@ -0,0 +1,34 @@
+OBJECTS = \
+ algorithm.bc \
+ condition_variable.bc \
+ future.bc \
+ iostream.bc \
+ memory.bc \
+ random.bc \
+ stdexcept.bc \
+ system_error.bc \
+ utility.bc \
+ bind.bc \
+ debug.bc \
+ hash.bc \
+ mutex.bc \
+ readme.txt \
+ string.bc \
+ thread.bc \
+ valarray.bc \
+ chrono.bc \
+ exception.bc \
+ ios.bc \
+ locale.bc \
+ regex.bc \
+ strstream.bc \
+ typeinfo.bc
+
+all: libcxx.bc
+
+%.bc: %.cpp
+ $(CXX) $< -o $@
+
+libcxx.bc: $(OBJECTS)
+ $(CXX) $(OBJECTS) -o libcxx.bc
+
diff --git a/system/lib/libcxx/algorithm.cpp b/system/lib/libcxx/algorithm.cpp
new file mode 100644
index 00000000..6d5cf7c0
--- /dev/null
+++ b/system/lib/libcxx/algorithm.cpp
@@ -0,0 +1,83 @@
+//===----------------------- algorithm.cpp --------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "algorithm"
+#include "random"
+#include "mutex"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
+template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
+template void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
+template void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
+template void __sort<__less<short>&, short*>(short*, short*, __less<short>&);
+template void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
+template void __sort<__less<int>&, int*>(int*, int*, __less<int>&);
+template void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
+template void __sort<__less<long>&, long*>(long*, long*, __less<long>&);
+template void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
+template void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
+template void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
+template void __sort<__less<float>&, float*>(float*, float*, __less<float>&);
+template void __sort<__less<double>&, double*>(double*, double*, __less<double>&);
+template void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
+
+template bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&);
+template bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
+template bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
+template bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
+template bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&);
+template bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
+template bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&);
+template bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
+template bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&);
+template bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
+template bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
+template bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
+template bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&);
+template bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&);
+template bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
+
+template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&);
+
+static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER;
+unsigned __rs_default::__c_ = 0;
+
+__rs_default::__rs_default()
+{
+ pthread_mutex_lock(&__rs_mut);
+ __c_ = 1;
+}
+
+__rs_default::__rs_default(const __rs_default&)
+{
+ ++__c_;
+}
+
+__rs_default::~__rs_default()
+{
+ if (--__c_ == 0)
+ pthread_mutex_unlock(&__rs_mut);
+}
+
+__rs_default::result_type
+__rs_default::operator()()
+{
+ static mt19937 __rs_g;
+ return __rs_g();
+}
+
+__rs_default
+__rs_get()
+{
+ return __rs_default();
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/bind.cpp b/system/lib/libcxx/bind.cpp
new file mode 100644
index 00000000..cab0b7c0
--- /dev/null
+++ b/system/lib/libcxx/bind.cpp
@@ -0,0 +1,30 @@
+//===-------------------------- bind.cpp ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "functional"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace placeholders
+{
+
+__ph<1> _1;
+__ph<2> _2;
+__ph<3> _3;
+__ph<4> _4;
+__ph<5> _5;
+__ph<6> _6;
+__ph<7> _7;
+__ph<8> _8;
+__ph<9> _9;
+__ph<10> _10;
+
+} // placeholders
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/chrono.cpp b/system/lib/libcxx/chrono.cpp
new file mode 100644
index 00000000..416b9501
--- /dev/null
+++ b/system/lib/libcxx/chrono.cpp
@@ -0,0 +1,128 @@
+//===------------------------- chrono.cpp ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "chrono"
+#include <sys/time.h> //for gettimeofday and timeval
+#if __APPLE__
+#include <mach/mach_time.h> // mach_absolute_time, mach_timebase_info_data_t
+#else /* !__APPLE__ */
+#include <cerrno> // errno
+#include <system_error> // __throw_system_error
+#include <time.h> // clock_gettime, CLOCK_MONOTONIC
+#endif // __APPLE__
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono
+{
+
+// system_clock
+
+system_clock::time_point
+system_clock::now() _NOEXCEPT
+{
+ timeval tv;
+ gettimeofday(&tv, 0);
+ return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
+}
+
+time_t
+system_clock::to_time_t(const time_point& t) _NOEXCEPT
+{
+ return time_t(duration_cast<seconds>(t.time_since_epoch()).count());
+}
+
+system_clock::time_point
+system_clock::from_time_t(time_t t) _NOEXCEPT
+{
+ return system_clock::time_point(seconds(t));
+}
+
+// steady_clock
+
+#if __APPLE__
+// mach_absolute_time() * MachInfo.numer / MachInfo.denom is the number of
+// nanoseconds since the computer booted up. MachInfo.numer and MachInfo.denom
+// are run time constants supplied by the OS. This clock has no relationship
+// to the Gregorian calendar. It's main use is as a high resolution timer.
+
+// MachInfo.numer / MachInfo.denom is often 1 on the latest equipment. Specialize
+// for that case as an optimization.
+
+#pragma GCC visibility push(hidden)
+
+static
+steady_clock::rep
+steady_simplified()
+{
+ return mach_absolute_time();
+}
+
+static
+double
+compute_steady_factor()
+{
+ mach_timebase_info_data_t MachInfo;
+ mach_timebase_info(&MachInfo);
+ return static_cast<double>(MachInfo.numer) / MachInfo.denom;
+}
+
+static
+steady_clock::rep
+steady_full()
+{
+ static const double factor = compute_steady_factor();
+ return static_cast<steady_clock::rep>(mach_absolute_time() * factor);
+}
+
+typedef steady_clock::rep (*FP)();
+
+static
+FP
+init_steady_clock()
+{
+ mach_timebase_info_data_t MachInfo;
+ mach_timebase_info(&MachInfo);
+ if (MachInfo.numer == MachInfo.denom)
+ return &steady_simplified;
+ return &steady_full;
+}
+
+#pragma GCC visibility pop
+
+steady_clock::time_point
+steady_clock::now() _NOEXCEPT
+{
+ static FP fp = init_steady_clock();
+ return time_point(duration(fp()));
+}
+
+#else // __APPLE__
+// FIXME: We assume that clock_gettime(CLOCK_MONOTONIC) works on
+// non-apple systems. Instead, we should check _POSIX_TIMERS and
+// _POSIX_MONOTONIC_CLOCK and fall back to something else if those
+// don't exist.
+
+// Warning: If this is not truly steady, then it is non-conforming. It is
+// better for it to not exist and have the rest of libc++ use system_clock
+// instead.
+
+steady_clock::time_point
+steady_clock::now() _NOEXCEPT
+{
+ struct timespec tp;
+ if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
+ __throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
+ return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
+}
+#endif // __APPLE__
+
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/condition_variable.cpp b/system/lib/libcxx/condition_variable.cpp
new file mode 100644
index 00000000..ca1dca32
--- /dev/null
+++ b/system/lib/libcxx/condition_variable.cpp
@@ -0,0 +1,70 @@
+//===-------------------- condition_variable.cpp --------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "condition_variable"
+#include "thread"
+#include "system_error"
+#include "cassert"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+condition_variable::~condition_variable()
+{
+ int e = pthread_cond_destroy(&__cv_);
+// assert(e == 0);
+}
+
+void
+condition_variable::notify_one()
+{
+ pthread_cond_signal(&__cv_);
+}
+
+void
+condition_variable::notify_all()
+{
+ pthread_cond_broadcast(&__cv_);
+}
+
+void
+condition_variable::wait(unique_lock<mutex>& lk)
+{
+ if (!lk.owns_lock())
+ __throw_system_error(EPERM,
+ "condition_variable::wait: mutex not locked");
+ int ec = pthread_cond_wait(&__cv_, lk.mutex()->native_handle());
+ if (ec)
+ __throw_system_error(ec, "condition_variable wait failed");
+}
+
+void
+condition_variable::__do_timed_wait(unique_lock<mutex>& lk,
+ chrono::time_point<chrono::system_clock, chrono::nanoseconds> tp)
+{
+ using namespace chrono;
+ if (!lk.owns_lock())
+ __throw_system_error(EPERM,
+ "condition_variable::timed wait: mutex not locked");
+ nanoseconds d = tp.time_since_epoch();
+ timespec ts;
+ seconds s = duration_cast<seconds>(d);
+ ts.tv_sec = static_cast<decltype(ts.tv_sec)>(s.count());
+ ts.tv_nsec = static_cast<decltype(ts.tv_nsec)>((d - s).count());
+ int ec = pthread_cond_timedwait(&__cv_, lk.mutex()->native_handle(), &ts);
+ if (ec != 0 && ec != ETIMEDOUT)
+ __throw_system_error(ec, "condition_variable timed_wait failed");
+}
+
+void
+notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk)
+{
+ __thread_local_data()->notify_all_at_thread_exit(&cond, lk.release());
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/debug.cpp b/system/lib/libcxx/debug.cpp
new file mode 100644
index 00000000..2d2d6432
--- /dev/null
+++ b/system/lib/libcxx/debug.cpp
@@ -0,0 +1,473 @@
+//===-------------------------- debug.cpp ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#define _LIBCPP_DEBUG2 1
+#include "__config"
+#include "__debug"
+#include "functional"
+#include "algorithm"
+#include "__hash_table"
+#include "mutex"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+_LIBCPP_VISIBLE
+__libcpp_db*
+__get_db()
+{
+ static __libcpp_db db;
+ return &db;
+};
+
+_LIBCPP_VISIBLE
+const __libcpp_db*
+__get_const_db()
+{
+ return __get_db();
+}
+
+namespace
+{
+
+typedef mutex mutex_type;
+typedef lock_guard<mutex_type> WLock;
+typedef lock_guard<mutex_type> RLock;
+
+mutex_type&
+mut()
+{
+ static mutex_type m;
+ return m;
+}
+
+} // unnamed namespace
+
+__i_node::~__i_node()
+{
+ if (__next_)
+ {
+ __next_->~__i_node();
+ free(__next_);
+ }
+}
+
+__c_node::~__c_node()
+{
+ free(beg_);
+ if (__next_)
+ {
+ __next_->~__c_node();
+ free(__next_);
+ }
+}
+
+__libcpp_db::__libcpp_db()
+ : __cbeg_(nullptr),
+ __cend_(nullptr),
+ __csz_(0),
+ __ibeg_(nullptr),
+ __iend_(nullptr),
+ __isz_(0)
+{
+}
+
+__libcpp_db::~__libcpp_db()
+{
+ if (__cbeg_)
+ {
+ for (__c_node** p = __cbeg_; p != __cend_; ++p)
+ {
+ if (*p != nullptr)
+ {
+ (*p)->~__c_node();
+ free(*p);
+ }
+ }
+ free(__cbeg_);
+ }
+ if (__ibeg_)
+ {
+ for (__i_node** p = __ibeg_; p != __iend_; ++p)
+ {
+ if (*p != nullptr)
+ {
+ (*p)->~__i_node();
+ free(*p);
+ }
+ }
+ free(__ibeg_);
+ }
+}
+
+void*
+__libcpp_db::__find_c_from_i(void* __i) const
+{
+ RLock _(mut());
+ __i_node* i = __find_iterator(__i);
+ _LIBCPP_ASSERT(i != nullptr, "iterator constructed in translation unit with debug mode not enabled."
+ " #define _LIBCPP_DEBUG2 1 for that translation unit.");
+ return i->__c_ != nullptr ? i->__c_->__c_ : nullptr;
+}
+
+void
+__libcpp_db::__insert_ic(void* __i, const void* __c)
+{
+ WLock _(mut());
+ __i_node* i = __insert_iterator(__i);
+ _LIBCPP_ASSERT(__cbeg_ != __cend_, "Container constructed in a translation unit with debug mode disabled."
+ " But it is being used in a translation unit with debug mode enabled."
+ " Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1");
+ size_t hc = hash<const void*>()(__c) % (__cend_ - __cbeg_);
+ __c_node* c = __cbeg_[hc];
+ _LIBCPP_ASSERT(c != nullptr, "Container constructed in a translation unit with debug mode disabled."
+ " But it is being used in a translation unit with debug mode enabled."
+ " Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1");
+ while (c->__c_ != __c)
+ {
+ c = c->__next_;
+ _LIBCPP_ASSERT(c != nullptr, "Container constructed in a translation unit with debug mode disabled."
+ " But it is being used in a translation unit with debug mode enabled."
+ " Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1");
+ }
+ c->__add(i);
+ i->__c_ = c;
+}
+
+__c_node*
+__libcpp_db::__insert_c(void* __c)
+{
+ WLock _(mut());
+ if (__csz_ + 1 > __cend_ - __cbeg_)
+ {
+ size_t nc = __next_prime(2*(__cend_ - __cbeg_) + 1);
+ __c_node** cbeg = (__c_node**)calloc(nc, sizeof(void*));
+ if (cbeg == nullptr)
+ throw bad_alloc();
+ for (__c_node** p = __cbeg_; p != __cend_; ++p)
+ {
+ __c_node* q = *p;
+ while (q != nullptr)
+ {
+ size_t h = hash<void*>()(q->__c_) % nc;
+ __c_node* r = q->__next_;
+ q->__next_ = cbeg[h];
+ cbeg[h] = q;
+ q = r;
+ }
+ }
+ free(__cbeg_);
+ __cbeg_ = cbeg;
+ __cend_ = __cbeg_ + nc;
+ }
+ size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
+ __c_node* p = __cbeg_[hc];
+ __c_node* r = __cbeg_[hc] = (__c_node*)malloc(sizeof(__c_node));
+ if (__cbeg_[hc] == nullptr)
+ throw bad_alloc();
+ r->__c_ = __c;
+ r->__next_ = p;
+ ++__csz_;
+ return r;
+}
+
+void
+__libcpp_db::__erase_i(void* __i)
+{
+ WLock _(mut());
+ if (__ibeg_ != __iend_)
+ {
+ size_t hi = hash<void*>()(__i) % (__iend_ - __ibeg_);
+ __i_node* p = __ibeg_[hi];
+ if (p != nullptr)
+ {
+ __i_node* q = nullptr;
+ while (p->__i_ != __i)
+ {
+ q = p;
+ p = p->__next_;
+ if (p == nullptr)
+ return;
+ }
+ if (q == nullptr)
+ __ibeg_[hi] = p->__next_;
+ else
+ q->__next_ = p->__next_;
+ __c_node* c = p->__c_;
+ free(p);
+ --__isz_;
+ if (c != nullptr)
+ c->__remove(p);
+ }
+ }
+}
+
+void
+__libcpp_db::__invalidate_all(void* __c)
+{
+ WLock _(mut());
+ size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
+ __c_node* p = __cbeg_[hc];
+ _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __invalidate_all A");
+ while (p->__c_ != __c)
+ {
+ p = p->__next_;
+ _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __invalidate_all B");
+ }
+ while (p->end_ != p->beg_)
+ {
+ --p->end_;
+ (*p->end_)->__c_ = nullptr;
+ }
+}
+
+__c_node*
+__libcpp_db::__find_c_and_lock(void* __c) const
+{
+ mut().lock();
+ size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
+ __c_node* p = __cbeg_[hc];
+ _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c_and_lock A");
+ while (p->__c_ != __c)
+ {
+ p = p->__next_;
+ _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c_and_lock B");
+ }
+ return p;
+}
+
+void
+__libcpp_db::unlock() const
+{
+ mut().unlock();
+}
+
+void
+__libcpp_db::__erase_c(void* __c)
+{
+ WLock _(mut());
+ size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
+ __c_node* p = __cbeg_[hc];
+ __c_node* q = nullptr;
+ _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c A");
+ while (p->__c_ != __c)
+ {
+ q = p;
+ p = p->__next_;
+ _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c B");
+ }
+ if (q == nullptr)
+ __cbeg_[hc] = p->__next_;
+ else
+ q->__next_ = p->__next_;
+ while (p->end_ != p->beg_)
+ {
+ --p->end_;
+ (*p->end_)->__c_ = nullptr;
+ }
+ free(p->beg_);
+ free(p);
+ --__csz_;
+}
+
+void
+__libcpp_db::__iterator_copy(void* __i, const void* __i0)
+{
+ WLock _(mut());
+ __i_node* i = __find_iterator(__i);
+ __i_node* i0 = __find_iterator(__i0);
+ __c_node* c0 = i0 != nullptr ? i0->__c_ : nullptr;
+ if (i == nullptr && c0 != nullptr)
+ i = __insert_iterator(__i);
+ __c_node* c = i != nullptr ? i->__c_ : nullptr;
+ if (c != c0)
+ {
+ if (c != nullptr)
+ c->__remove(i);
+ if (i != nullptr)
+ {
+ i->__c_ = nullptr;
+ if (c0 != nullptr)
+ {
+ i->__c_ = c0;
+ i->__c_->__add(i);
+ }
+ }
+ }
+}
+
+bool
+__libcpp_db::__dereferenceable(const void* __i) const
+{
+ RLock _(mut());
+ __i_node* i = __find_iterator(__i);
+ return i != nullptr && i->__c_ != nullptr && i->__c_->__dereferenceable(__i);
+}
+
+bool
+__libcpp_db::__decrementable(const void* __i) const
+{
+ RLock _(mut());
+ __i_node* i = __find_iterator(__i);
+ return i != nullptr && i->__c_ != nullptr && i->__c_->__decrementable(__i);
+}
+
+bool
+__libcpp_db::__addable(const void* __i, ptrdiff_t __n) const
+{
+ RLock _(mut());
+ __i_node* i = __find_iterator(__i);
+ return i != nullptr && i->__c_ != nullptr && i->__c_->__addable(__i, __n);
+}
+
+bool
+__libcpp_db::__subscriptable(const void* __i, ptrdiff_t __n) const
+{
+ RLock _(mut());
+ __i_node* i = __find_iterator(__i);
+ return i != nullptr && i->__c_ != nullptr && i->__c_->__subscriptable(__i, __n);
+}
+
+bool
+__libcpp_db::__comparable(const void* __i, const void* __j) const
+{
+ RLock _(mut());
+ __i_node* i = __find_iterator(__i);
+ __i_node* j = __find_iterator(__j);
+ __c_node* ci = i != nullptr ? i->__c_ : nullptr;
+ __c_node* cj = j != nullptr ? j->__c_ : nullptr;
+ return ci != nullptr && ci == cj;
+}
+
+void
+__libcpp_db::swap(void* c1, void* c2)
+{
+ WLock _(mut());
+ size_t hc = hash<void*>()(c1) % (__cend_ - __cbeg_);
+ __c_node* p1 = __cbeg_[hc];
+ _LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap A");
+ while (p1->__c_ != c1)
+ {
+ p1 = p1->__next_;
+ _LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap B");
+ }
+ hc = hash<void*>()(c2) % (__cend_ - __cbeg_);
+ __c_node* p2 = __cbeg_[hc];
+ _LIBCPP_ASSERT(p2 != nullptr, "debug mode internal logic error swap C");
+ while (p2->__c_ != c2)
+ {
+ p2 = p2->__next_;
+ _LIBCPP_ASSERT(p2 != nullptr, "debug mode internal logic error swap D");
+ }
+ std::swap(p1->beg_, p2->beg_);
+ std::swap(p1->end_, p2->end_);
+ std::swap(p1->cap_, p2->cap_);
+ for (__i_node** p = p1->beg_; p != p1->end_; ++p)
+ (*p)->__c_ = p1;
+ for (__i_node** p = p2->beg_; p != p2->end_; ++p)
+ (*p)->__c_ = p2;
+}
+
+void
+__libcpp_db::__insert_i(void* __i)
+{
+ WLock _(mut());
+ __insert_iterator(__i);
+}
+
+// private api
+
+_LIBCPP_HIDDEN
+__i_node*
+__libcpp_db::__insert_iterator(void* __i)
+{
+ if (__isz_ + 1 > __iend_ - __ibeg_)
+ {
+ size_t nc = __next_prime(2*(__iend_ - __ibeg_) + 1);
+ __i_node** ibeg = (__i_node**)calloc(nc, sizeof(void*));
+ if (ibeg == nullptr)
+ throw bad_alloc();
+ for (__i_node** p = __ibeg_; p != __iend_; ++p)
+ {
+ __i_node* q = *p;
+ while (q != nullptr)
+ {
+ size_t h = hash<void*>()(q->__i_) % nc;
+ __i_node* r = q->__next_;
+ q->__next_ = ibeg[h];
+ ibeg[h] = q;
+ q = r;
+ }
+ }
+ free(__ibeg_);
+ __ibeg_ = ibeg;
+ __iend_ = __ibeg_ + nc;
+ }
+ size_t hi = hash<void*>()(__i) % (__iend_ - __ibeg_);
+ __i_node* p = __ibeg_[hi];
+ __i_node* r = __ibeg_[hi] = (__i_node*)malloc(sizeof(__i_node));
+ if (r == nullptr)
+ throw bad_alloc();
+ ::new(r) __i_node(__i, p, nullptr);
+ ++__isz_;
+ return r;
+}
+
+_LIBCPP_HIDDEN
+__i_node*
+__libcpp_db::__find_iterator(const void* __i) const
+{
+ __i_node* r = nullptr;
+ if (__ibeg_ != __iend_)
+ {
+ size_t h = hash<const void*>()(__i) % (__iend_ - __ibeg_);
+ for (__i_node* nd = __ibeg_[h]; nd != nullptr; nd = nd->__next_)
+ {
+ if (nd->__i_ == __i)
+ {
+ r = nd;
+ break;
+ }
+ }
+ }
+ return r;
+}
+
+_LIBCPP_HIDDEN
+void
+__c_node::__add(__i_node* i)
+{
+ if (end_ == cap_)
+ {
+ size_t nc = 2*(cap_ - beg_);
+ if (nc == 0)
+ nc = 1;
+ __i_node** beg = (__i_node**)malloc(nc * sizeof(__i_node*));
+ if (beg == nullptr)
+ throw bad_alloc();
+ if (nc > 1)
+ memcpy(beg, beg_, nc/2*sizeof(__i_node*));
+ free(beg_);
+ beg_ = beg;
+ end_ = beg_ + nc/2;
+ cap_ = beg_ + nc;
+ }
+ *end_++ = i;
+}
+
+_LIBCPP_HIDDEN
+void
+__c_node::__remove(__i_node* p)
+{
+ __i_node** r = find(beg_, end_, p);
+ _LIBCPP_ASSERT(r != end_, "debug mode internal logic error __c_node::__remove");
+ if (--end_ != r)
+ memmove(r, r+1, (end_ - r)*sizeof(__i_node*));
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/exception.cpp b/system/lib/libcxx/exception.cpp
new file mode 100644
index 00000000..26d97a96
--- /dev/null
+++ b/system/lib/libcxx/exception.cpp
@@ -0,0 +1,206 @@
+//===------------------------ exception.cpp -------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdlib.h>
+
+#include "exception"
+
+#if __APPLE__
+ #include <cxxabi.h>
+ using namespace __cxxabiv1;
+ using namespace __cxxabiapple;
+ // On Darwin, there are two STL shared libraries and a lower level ABI
+ // shared libray. The globals holding the current terminate handler and
+ // current unexpected handler are in the ABI library.
+ #define __terminate_handler __cxxabiapple::__cxa_terminate_handler
+ #define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
+ #define HAVE_DEPENDENT_EH_ABI 1
+#elif defined(LIBCXXRT)
+ #include <cxxabi.h>
+ using namespace __cxxabiv1;
+ #define HAVE_DEPENDENT_EH_ABI 1
+#else // __APPLE__
+ static std::terminate_handler __terminate_handler;
+ static std::unexpected_handler __unexpected_handler;
+#endif // __APPLE__
+
+#ifndef LIBCXXRT
+// libcxxrt provides implementations of these functions itself.
+std::unexpected_handler
+std::set_unexpected(std::unexpected_handler func) _NOEXCEPT
+{
+ return __sync_lock_test_and_set(&__unexpected_handler, func);
+}
+
+std::unexpected_handler
+std::get_unexpected() _NOEXCEPT
+{
+ return __sync_fetch_and_add(&__unexpected_handler, (std::unexpected_handler)0);
+}
+
+_ATTRIBUTE(noreturn)
+void
+std::unexpected()
+{
+ (*std::get_unexpected())();
+ // unexpected handler should not return
+ std::terminate();
+}
+
+std::terminate_handler
+std::set_terminate(std::terminate_handler func) _NOEXCEPT
+{
+ return __sync_lock_test_and_set(&__terminate_handler, func);
+}
+
+std::terminate_handler
+std::get_terminate() _NOEXCEPT
+{
+ return __sync_fetch_and_add(&__terminate_handler, (std::terminate_handler)0);
+}
+
+_ATTRIBUTE(noreturn)
+void
+std::terminate() _NOEXCEPT
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ (*std::get_terminate())();
+ // handler should not return
+ ::abort ();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ // handler should not throw exception
+ ::abort ();
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+#endif // LIBCXXRT
+
+bool std::uncaught_exception() _NOEXCEPT
+{
+#if __APPLE__
+ // on Darwin, there is a helper function so __cxa_get_globals is private
+ return __cxxabiapple::__cxa_uncaught_exception();
+#elif LIBCXXRT
+ __cxa_eh_globals * globals = __cxa_get_globals();
+ return (globals->uncaughtExceptions != 0);
+#else // __APPLE__
+ #warning uncaught_exception not yet implemented
+ ::abort();
+#endif // __APPLE__
+}
+
+namespace std
+{
+
+exception::~exception() _NOEXCEPT
+{
+}
+
+bad_exception::~bad_exception() _NOEXCEPT
+{
+}
+
+const char* exception::what() const _NOEXCEPT
+{
+ return "std::exception";
+}
+
+const char* bad_exception::what() const _NOEXCEPT
+{
+ return "std::bad_exception";
+}
+
+exception_ptr::~exception_ptr() _NOEXCEPT
+{
+#if HAVE_DEPENDENT_EH_ABI
+ __cxa_decrement_exception_refcount(__ptr_);
+#else
+ #warning exception_ptr not yet implemented
+ ::abort();
+#endif // __APPLE__
+}
+
+exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
+ : __ptr_(other.__ptr_)
+{
+#if HAVE_DEPENDENT_EH_ABI
+ __cxa_increment_exception_refcount(__ptr_);
+#else
+ #warning exception_ptr not yet implemented
+ ::abort();
+#endif // __APPLE__
+}
+
+exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
+{
+#if HAVE_DEPENDENT_EH_ABI
+ if (__ptr_ != other.__ptr_)
+ {
+ __cxa_increment_exception_refcount(other.__ptr_);
+ __cxa_decrement_exception_refcount(__ptr_);
+ __ptr_ = other.__ptr_;
+ }
+ return *this;
+#else // __APPLE__
+ #warning exception_ptr not yet implemented
+ ::abort();
+#endif // __APPLE__
+}
+
+nested_exception::nested_exception() _NOEXCEPT
+ : __ptr_(current_exception())
+{
+}
+
+nested_exception::~nested_exception() _NOEXCEPT
+{
+}
+
+_ATTRIBUTE(noreturn)
+void
+nested_exception::rethrow_nested() const
+{
+ if (__ptr_ == nullptr)
+ terminate();
+ rethrow_exception(__ptr_);
+}
+
+} // std
+
+std::exception_ptr std::current_exception() _NOEXCEPT
+{
+#if HAVE_DEPENDENT_EH_ABI
+ // be nicer if there was a constructor that took a ptr, then
+ // this whole function would be just:
+ // return exception_ptr(__cxa_current_primary_exception());
+ std::exception_ptr ptr;
+ ptr.__ptr_ = __cxa_current_primary_exception();
+ return ptr;
+#else // __APPLE__
+ #warning exception_ptr not yet implemented
+ ::abort();
+#endif // __APPLE__
+}
+
+void std::rethrow_exception(exception_ptr p)
+{
+#if HAVE_DEPENDENT_EH_ABI
+ __cxa_rethrow_primary_exception(p.__ptr_);
+ // if p.__ptr_ is NULL, above returns so we terminate
+ terminate();
+#else // __APPLE__
+ #warning exception_ptr not yet implemented
+ ::abort();
+#endif // __APPLE__
+}
diff --git a/system/lib/libcxx/future.cpp b/system/lib/libcxx/future.cpp
new file mode 100644
index 00000000..ff591105
--- /dev/null
+++ b/system/lib/libcxx/future.cpp
@@ -0,0 +1,285 @@
+//===------------------------- future.cpp ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "future"
+#include "string"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+class _LIBCPP_HIDDEN __future_error_category
+ : public __do_message
+{
+public:
+ virtual const char* name() const _NOEXCEPT;
+ virtual string message(int ev) const;
+};
+
+const char*
+__future_error_category::name() const _NOEXCEPT
+{
+ return "future";
+}
+
+string
+__future_error_category::message(int ev) const
+{
+ switch (ev)
+ {
+ case future_errc::broken_promise:
+ return string("The associated promise has been destructed prior "
+ "to the associated state becoming ready.");
+ case future_errc::future_already_retrieved:
+ return string("The future has already been retrieved from "
+ "the promise or packaged_task.");
+ case future_errc::promise_already_satisfied:
+ return string("The state of the promise has already been set.");
+ case future_errc::no_state:
+ return string("Operation not permitted on an object without "
+ "an associated state.");
+ }
+ return string("unspecified future_errc value\n");
+}
+
+const error_category&
+future_category()
+{
+ static __future_error_category __f;
+ return __f;
+}
+
+future_error::future_error(error_code __ec)
+ : logic_error(__ec.message()),
+ __ec_(__ec)
+{
+}
+
+future_error::~future_error() _NOEXCEPT
+{
+}
+
+void
+__assoc_sub_state::__on_zero_shared() _NOEXCEPT
+{
+ delete this;
+}
+
+void
+__assoc_sub_state::set_value()
+{
+ unique_lock<mutex> __lk(__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__has_value())
+ throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
+ __state_ |= __constructed | ready;
+ __lk.unlock();
+ __cv_.notify_all();
+}
+
+void
+__assoc_sub_state::set_value_at_thread_exit()
+{
+ unique_lock<mutex> __lk(__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__has_value())
+ throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
+ __state_ |= __constructed;
+ __thread_local_data()->__make_ready_at_thread_exit(this);
+ __lk.unlock();
+}
+
+void
+__assoc_sub_state::set_exception(exception_ptr __p)
+{
+ unique_lock<mutex> __lk(__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__has_value())
+ throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
+ __exception_ = __p;
+ __state_ |= ready;
+ __lk.unlock();
+ __cv_.notify_all();
+}
+
+void
+__assoc_sub_state::set_exception_at_thread_exit(exception_ptr __p)
+{
+ unique_lock<mutex> __lk(__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__has_value())
+ throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
+ __exception_ = __p;
+ __thread_local_data()->__make_ready_at_thread_exit(this);
+ __lk.unlock();
+}
+
+void
+__assoc_sub_state::__make_ready()
+{
+ unique_lock<mutex> __lk(__mut_);
+ __state_ |= ready;
+ __lk.unlock();
+ __cv_.notify_all();
+}
+
+void
+__assoc_sub_state::copy()
+{
+ unique_lock<mutex> __lk(__mut_);
+ __sub_wait(__lk);
+ if (__exception_ != nullptr)
+ rethrow_exception(__exception_);
+}
+
+void
+__assoc_sub_state::wait()
+{
+ unique_lock<mutex> __lk(__mut_);
+ __sub_wait(__lk);
+}
+
+void
+__assoc_sub_state::__sub_wait(unique_lock<mutex>& __lk)
+{
+ if (!__is_ready())
+ {
+ if (__state_ & deferred)
+ {
+ __state_ &= ~deferred;
+ __lk.unlock();
+ __execute();
+ }
+ else
+ while (!__is_ready())
+ __cv_.wait(__lk);
+ }
+}
+
+void
+__assoc_sub_state::__execute()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw future_error(make_error_code(future_errc::no_state));
+#endif
+}
+
+future<void>::future(__assoc_sub_state* __state)
+ : __state_(__state)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__state_->__has_future_attached())
+ throw future_error(make_error_code(future_errc::future_already_retrieved));
+#endif
+ __state_->__add_shared();
+ __state_->__set_future_attached();
+}
+
+future<void>::~future()
+{
+ if (__state_)
+ __state_->__release_shared();
+}
+
+void
+future<void>::get()
+{
+ unique_ptr<__shared_count, __release_shared_count> __(__state_);
+ __assoc_sub_state* __s = __state_;
+ __state_ = nullptr;
+ __s->copy();
+}
+
+promise<void>::promise()
+ : __state_(new __assoc_sub_state)
+{
+}
+
+promise<void>::~promise()
+{
+ if (__state_)
+ {
+ if (!__state_->__has_value() && __state_->use_count() > 1)
+ __state_->set_exception(make_exception_ptr(
+ future_error(make_error_code(future_errc::broken_promise))
+ ));
+ __state_->__release_shared();
+ }
+}
+
+future<void>
+promise<void>::get_future()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__state_ == nullptr)
+ throw future_error(make_error_code(future_errc::no_state));
+#endif
+ return future<void>(__state_);
+}
+
+void
+promise<void>::set_value()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__state_ == nullptr)
+ throw future_error(make_error_code(future_errc::no_state));
+#endif
+ __state_->set_value();
+}
+
+void
+promise<void>::set_exception(exception_ptr __p)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__state_ == nullptr)
+ throw future_error(make_error_code(future_errc::no_state));
+#endif
+ __state_->set_exception(__p);
+}
+
+void
+promise<void>::set_value_at_thread_exit()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__state_ == nullptr)
+ throw future_error(make_error_code(future_errc::no_state));
+#endif
+ __state_->set_value_at_thread_exit();
+}
+
+void
+promise<void>::set_exception_at_thread_exit(exception_ptr __p)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__state_ == nullptr)
+ throw future_error(make_error_code(future_errc::no_state));
+#endif
+ __state_->set_exception_at_thread_exit(__p);
+}
+
+shared_future<void>::~shared_future()
+{
+ if (__state_)
+ __state_->__release_shared();
+}
+
+shared_future<void>&
+shared_future<void>::operator=(const shared_future& __rhs)
+{
+ if (__rhs.__state_)
+ __rhs.__state_->__add_shared();
+ if (__state_)
+ __state_->__release_shared();
+ __state_ = __rhs.__state_;
+ return *this;
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/hash.cpp b/system/lib/libcxx/hash.cpp
new file mode 100644
index 00000000..728b9bd3
--- /dev/null
+++ b/system/lib/libcxx/hash.cpp
@@ -0,0 +1,559 @@
+//===-------------------------- hash.cpp ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "__hash_table"
+#include "algorithm"
+#include "stdexcept"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace {
+
+// handle all next_prime(i) for i in [1, 210), special case 0
+const unsigned small_primes[] =
+{
+ 0,
+ 2,
+ 3,
+ 5,
+ 7,
+ 11,
+ 13,
+ 17,
+ 19,
+ 23,
+ 29,
+ 31,
+ 37,
+ 41,
+ 43,
+ 47,
+ 53,
+ 59,
+ 61,
+ 67,
+ 71,
+ 73,
+ 79,
+ 83,
+ 89,
+ 97,
+ 101,
+ 103,
+ 107,
+ 109,
+ 113,
+ 127,
+ 131,
+ 137,
+ 139,
+ 149,
+ 151,
+ 157,
+ 163,
+ 167,
+ 173,
+ 179,
+ 181,
+ 191,
+ 193,
+ 197,
+ 199,
+ 211
+};
+
+// potential primes = 210*k + indices[i], k >= 1
+// these numbers are not divisible by 2, 3, 5 or 7
+// (or any integer 2 <= j <= 10 for that matter).
+const unsigned indices[] =
+{
+ 1,
+ 11,
+ 13,
+ 17,
+ 19,
+ 23,
+ 29,
+ 31,
+ 37,
+ 41,
+ 43,
+ 47,
+ 53,
+ 59,
+ 61,
+ 67,
+ 71,
+ 73,
+ 79,
+ 83,
+ 89,
+ 97,
+ 101,
+ 103,
+ 107,
+ 109,
+ 113,
+ 121,
+ 127,
+ 131,
+ 137,
+ 139,
+ 143,
+ 149,
+ 151,
+ 157,
+ 163,
+ 167,
+ 169,
+ 173,
+ 179,
+ 181,
+ 187,
+ 191,
+ 193,
+ 197,
+ 199,
+ 209
+};
+
+}
+
+// Returns: If n == 0, returns 0. Else returns the lowest prime number that
+// is greater than or equal to n.
+//
+// The algorithm creates a list of small primes, plus an open-ended list of
+// potential primes. All prime numbers are potential prime numbers. However
+// some potential prime numbers are not prime. In an ideal world, all potential
+// prime numbers would be prime. Candiate prime numbers are chosen as the next
+// highest potential prime. Then this number is tested for prime by dividing it
+// by all potential prime numbers less than the sqrt of the candidate.
+//
+// This implementation defines potential primes as those numbers not divisible
+// by 2, 3, 5, and 7. Other (common) implementations define potential primes
+// as those not divisible by 2. A few other implementations define potential
+// primes as those not divisible by 2 or 3. By raising the number of small
+// primes which the potential prime is not divisible by, the set of potential
+// primes more closely approximates the set of prime numbers. And thus there
+// are fewer potential primes to search, and fewer potential primes to divide
+// against.
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__check_for_overflow(size_t N, integral_constant<size_t, 32>)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (N > 0xFFFFFFFB)
+ throw overflow_error("__next_prime overflow");
+#endif
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__check_for_overflow(size_t N, integral_constant<size_t, 64>)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (N > 0xFFFFFFFFFFFFFFC5ull)
+ throw overflow_error("__next_prime overflow");
+#endif
+}
+
+size_t
+__next_prime(size_t n)
+{
+ const size_t L = 210;
+ const size_t N = sizeof(small_primes) / sizeof(small_primes[0]);
+ // If n is small enough, search in small_primes
+ if (n <= small_primes[N-1])
+ return *std::lower_bound(small_primes, small_primes + N, n);
+ // Else n > largest small_primes
+ // Check for overflow
+ __check_for_overflow(n, integral_constant<size_t,
+ sizeof(n) * __CHAR_BIT__>());
+ // Start searching list of potential primes: L * k0 + indices[in]
+ const size_t M = sizeof(indices) / sizeof(indices[0]);
+ // Select first potential prime >= n
+ // Known a-priori n >= L
+ size_t k0 = n / L;
+ size_t in = std::lower_bound(indices, indices + M, n - k0 * L) - indices;
+ n = L * k0 + indices[in];
+ while (true)
+ {
+ // Divide n by all primes or potential primes (i) until:
+ // 1. The division is even, so try next potential prime.
+ // 2. The i > sqrt(n), in which case n is prime.
+ // It is known a-priori that n is not divisible by 2, 3, 5 or 7,
+ // so don't test those (j == 5 -> divide by 11 first). And the
+ // potential primes start with 211, so don't test against the last
+ // small prime.
+ for (size_t j = 5; j < N - 1; ++j)
+ {
+ const std::size_t p = small_primes[j];
+ const std::size_t q = n / p;
+ if (q < p)
+ return n;
+ if (n == q * p)
+ goto next;
+ }
+ // n wasn't divisible by small primes, try potential primes
+ {
+ size_t i = 211;
+ while (true)
+ {
+ std::size_t q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 10;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 8;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 8;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 10;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ // This will loop i to the next "plane" of potential primes
+ i += 2;
+ }
+ }
+next:
+ // n is not prime. Increment n to next potential prime.
+ if (++in == M)
+ {
+ ++k0;
+ in = 0;
+ }
+ n = L * k0 + indices[in];
+ }
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/ios.cpp b/system/lib/libcxx/ios.cpp
new file mode 100644
index 00000000..80917a04
--- /dev/null
+++ b/system/lib/libcxx/ios.cpp
@@ -0,0 +1,455 @@
+//===-------------------------- ios.cpp -----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "ios"
+#include "streambuf"
+#include "istream"
+#include "string"
+#include "__locale"
+#include "algorithm"
+#include "memory"
+#include "new"
+#include "limits"
+#include <stdlib.h>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template class basic_ios<char>;
+template class basic_ios<wchar_t>;
+
+template class basic_streambuf<char>;
+template class basic_streambuf<wchar_t>;
+
+template class basic_istream<char>;
+template class basic_istream<wchar_t>;
+
+template class basic_ostream<char>;
+template class basic_ostream<wchar_t>;
+
+template class basic_iostream<char>;
+
+class _LIBCPP_HIDDEN __iostream_category
+ : public __do_message
+{
+public:
+ virtual const char* name() const _NOEXCEPT;
+ virtual string message(int ev) const;
+};
+
+const char*
+__iostream_category::name() const _NOEXCEPT
+{
+ return "iostream";
+}
+
+string
+__iostream_category::message(int ev) const
+{
+ if (ev != static_cast<int>(io_errc::stream)
+#ifdef ELAST
+ && ev <= ELAST
+#endif
+ )
+ return __do_message::message(ev);
+ return string("unspecified iostream_category error");
+}
+
+const error_category&
+iostream_category()
+{
+ static __iostream_category s;
+ return s;
+}
+
+// ios_base::failure
+
+ios_base::failure::failure(const string& msg, const error_code& ec)
+ : system_error(ec, msg)
+{
+}
+
+ios_base::failure::failure(const char* msg, const error_code& ec)
+ : system_error(ec, msg)
+{
+}
+
+ios_base::failure::~failure() throw()
+{
+}
+
+// ios_base locale
+
+const ios_base::fmtflags ios_base::boolalpha;
+const ios_base::fmtflags ios_base::dec;
+const ios_base::fmtflags ios_base::fixed;
+const ios_base::fmtflags ios_base::hex;
+const ios_base::fmtflags ios_base::internal;
+const ios_base::fmtflags ios_base::left;
+const ios_base::fmtflags ios_base::oct;
+const ios_base::fmtflags ios_base::right;
+const ios_base::fmtflags ios_base::scientific;
+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;
+
+const ios_base::iostate ios_base::badbit;
+const ios_base::iostate ios_base::eofbit;
+const ios_base::iostate ios_base::failbit;
+const ios_base::iostate ios_base::goodbit;
+
+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;
+
+void
+ios_base::__call_callbacks(event ev)
+{
+ for (size_t i = __event_size_; i;)
+ {
+ --i;
+ __fn_[i](ev, *this, __index_[i]);
+ }
+}
+
+// locale
+
+locale
+ios_base::imbue(const locale& newloc)
+{
+ static_assert(sizeof(locale) == sizeof(__loc_), "");
+ locale& loc_storage = *(locale*)&__loc_;
+ locale oldloc = loc_storage;
+ loc_storage = newloc;
+ __call_callbacks(imbue_event);
+ return oldloc;
+}
+
+locale
+ios_base::getloc() const
+{
+ const locale& loc_storage = *(locale*)&__loc_;
+ return loc_storage;
+}
+
+// xalloc
+
+int ios_base::__xindex_ = 0;
+
+int
+ios_base::xalloc()
+{
+ return __xindex_++;
+}
+
+long&
+ios_base::iword(int index)
+{
+ size_t req_size = static_cast<size_t>(index)+1;
+ if (req_size > __iarray_cap_)
+ {
+ size_t newcap;
+ const size_t mx = std::numeric_limits<size_t>::max();
+ if (req_size < mx/2)
+ newcap = _VSTD::max(2 * __iarray_cap_, req_size);
+ else
+ newcap = mx;
+ long* iarray = (long*)realloc(__iarray_, newcap * sizeof(long));
+ if (iarray == 0)
+ {
+ setstate(badbit);
+ static long error;
+ error = 0;
+ return error;
+ }
+ __iarray_ = iarray;
+ for (long* p = __iarray_ + __iarray_size_; __iarray_cap_ < newcap; ++__iarray_cap_, ++p)
+ *p = 0;
+ }
+ __iarray_size_ = max<size_t>(__iarray_size_, req_size);
+ return __iarray_[index];
+}
+
+void*&
+ios_base::pword(int index)
+{
+ size_t req_size = static_cast<size_t>(index)+1;
+ if (req_size > __parray_cap_)
+ {
+ size_t newcap;
+ const size_t mx = std::numeric_limits<size_t>::max();
+ if (req_size < mx/2)
+ newcap = _VSTD::max(2 * __parray_cap_, req_size);
+ else
+ newcap = mx;
+ void** parray = (void**)realloc(__parray_, newcap * sizeof(void*));
+ if (parray == 0)
+ {
+ setstate(badbit);
+ static void* error;
+ error = 0;
+ return error;
+ }
+ __parray_ = parray;
+ for (void** p = __parray_ + __parray_size_; __parray_cap_ < newcap; ++__parray_cap_, ++p)
+ *p = 0;
+ }
+ __parray_size_ = max<size_t>(__parray_size_, req_size);
+ return __parray_[index];
+}
+
+// register_callback
+
+void
+ios_base::register_callback(event_callback fn, int index)
+{
+ size_t req_size = __event_size_ + 1;
+ if (req_size > __event_cap_)
+ {
+ size_t newcap;
+ const size_t mx = std::numeric_limits<size_t>::max();
+ if (req_size < mx/2)
+ newcap = _VSTD::max(2 * __event_cap_, req_size);
+ else
+ newcap = mx;
+ event_callback* fns = (event_callback*)realloc(__fn_, newcap * sizeof(event_callback));
+ if (fns == 0)
+ setstate(badbit);
+ __fn_ = fns;
+ int* indxs = (int*)realloc(__index_, newcap * sizeof(int));
+ if (indxs == 0)
+ setstate(badbit);
+ __index_ = indxs;
+ }
+ __fn_[__event_size_] = fn;
+ __index_[__event_size_] = index;
+ ++__event_size_;
+}
+
+ios_base::~ios_base()
+{
+ __call_callbacks(erase_event);
+ locale& loc_storage = *(locale*)&__loc_;
+ loc_storage.~locale();
+ free(__fn_);
+ free(__index_);
+ free(__iarray_);
+ free(__parray_);
+}
+
+// iostate
+
+void
+ios_base::clear(iostate state)
+{
+ if (__rdbuf_)
+ __rdstate_ = state;
+ else
+ __rdstate_ = state | badbit;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (((state | (__rdbuf_ ? goodbit : badbit)) & __exceptions_) != 0)
+ throw failure("ios_base::clear");
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+// init
+
+void
+ios_base::init(void* sb)
+{
+ __rdbuf_ = sb;
+ __rdstate_ = __rdbuf_ ? goodbit : badbit;
+ __exceptions_ = goodbit;
+ __fmtflags_ = skipws | dec;
+ __width_ = 0;
+ __precision_ = 6;
+ __fn_ = 0;
+ __index_ = 0;
+ __event_size_ = 0;
+ __event_cap_ = 0;
+ __iarray_ = 0;
+ __iarray_size_ = 0;
+ __iarray_cap_ = 0;
+ __parray_ = 0;
+ __parray_size_ = 0;
+ __parray_cap_ = 0;
+ ::new(&__loc_) locale;
+}
+
+void
+ios_base::copyfmt(const ios_base& rhs)
+{
+ // If we can't acquire the needed resources, throw bad_alloc (can't set badbit)
+ // Don't alter *this until all needed resources are aquired
+ unique_ptr<event_callback, void (*)(void*)> new_callbacks(0, free);
+ unique_ptr<int, void (*)(void*)> new_ints(0, free);
+ unique_ptr<long, void (*)(void*)> new_longs(0, free);
+ unique_ptr<void*, void (*)(void*)> new_pointers(0, free);
+ if (__event_cap_ < rhs.__event_size_)
+ {
+ new_callbacks.reset((event_callback*)malloc(sizeof(event_callback) * rhs.__event_size_));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (!new_callbacks)
+ throw bad_alloc();
+#endif // _LIBCPP_NO_EXCEPTIONS
+ new_ints.reset((int*)malloc(sizeof(int) * rhs.__event_size_));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (!new_ints)
+ throw bad_alloc();
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (__iarray_cap_ < rhs.__iarray_size_)
+ {
+ new_longs.reset((long*)malloc(sizeof(long) * rhs.__iarray_size_));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (!new_longs)
+ throw bad_alloc();
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (__parray_cap_ < rhs.__parray_size_)
+ {
+ new_pointers.reset((void**)malloc(sizeof(void*) * rhs.__parray_size_));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (!new_pointers)
+ throw bad_alloc();
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ // Got everything we need. Copy everything but __rdstate_, __rdbuf_ and __exceptions_
+ __fmtflags_ = rhs.__fmtflags_;
+ __precision_ = rhs.__precision_;
+ __width_ = rhs.__width_;
+ locale& lhs_loc = *(locale*)&__loc_;
+ locale& rhs_loc = *(locale*)&rhs.__loc_;
+ lhs_loc = rhs_loc;
+ if (__event_cap_ < rhs.__event_size_)
+ {
+ free(__fn_);
+ __fn_ = new_callbacks.release();
+ free(__index_);
+ __index_ = new_ints.release();
+ __event_cap_ = rhs.__event_size_;
+ }
+ for (__event_size_ = 0; __event_size_ < rhs.__event_size_; ++__event_size_)
+ {
+ __fn_[__event_size_] = rhs.__fn_[__event_size_];
+ __index_[__event_size_] = rhs.__index_[__event_size_];
+ }
+ if (__iarray_cap_ < rhs.__iarray_size_)
+ {
+ free(__iarray_);
+ __iarray_ = new_longs.release();
+ __iarray_cap_ = rhs.__iarray_size_;
+ }
+ for (__iarray_size_ = 0; __iarray_size_ < rhs.__iarray_size_; ++__iarray_size_)
+ __iarray_[__iarray_size_] = rhs.__iarray_[__iarray_size_];
+ if (__parray_cap_ < rhs.__parray_size_)
+ {
+ free(__parray_);
+ __parray_ = new_pointers.release();
+ __parray_cap_ = rhs.__parray_size_;
+ }
+ for (__parray_size_ = 0; __parray_size_ < rhs.__parray_size_; ++__parray_size_)
+ __parray_[__parray_size_] = rhs.__parray_[__parray_size_];
+}
+
+void
+ios_base::move(ios_base& rhs)
+{
+ // *this is uninitialized
+ __fmtflags_ = rhs.__fmtflags_;
+ __precision_ = rhs.__precision_;
+ __width_ = rhs.__width_;
+ __rdstate_ = rhs.__rdstate_;
+ __exceptions_ = rhs.__exceptions_;
+ __rdbuf_ = 0;
+ locale& rhs_loc = *(locale*)&rhs.__loc_;
+ ::new(&__loc_) locale(rhs_loc);
+ __fn_ = rhs.__fn_;
+ rhs.__fn_ = 0;
+ __index_ = rhs.__index_;
+ rhs.__index_ = 0;
+ __event_size_ = rhs.__event_size_;
+ rhs.__event_size_ = 0;
+ __event_cap_ = rhs.__event_cap_;
+ rhs.__event_cap_ = 0;
+ __iarray_ = rhs.__iarray_;
+ rhs.__iarray_ = 0;
+ __iarray_size_ = rhs.__iarray_size_;
+ rhs.__iarray_size_ = 0;
+ __iarray_cap_ = rhs.__iarray_cap_;
+ rhs.__iarray_cap_ = 0;
+ __parray_ = rhs.__parray_;
+ rhs.__parray_ = 0;
+ __parray_size_ = rhs.__parray_size_;
+ rhs.__parray_size_ = 0;
+ __parray_cap_ = rhs.__parray_cap_;
+ rhs.__parray_cap_ = 0;
+}
+
+void
+ios_base::swap(ios_base& rhs)
+{
+ _VSTD::swap(__fmtflags_, rhs.__fmtflags_);
+ _VSTD::swap(__precision_, rhs.__precision_);
+ _VSTD::swap(__width_, rhs.__width_);
+ _VSTD::swap(__rdstate_, rhs.__rdstate_);
+ _VSTD::swap(__exceptions_, rhs.__exceptions_);
+ locale& lhs_loc = *(locale*)&__loc_;
+ locale& rhs_loc = *(locale*)&rhs.__loc_;
+ _VSTD::swap(lhs_loc, rhs_loc);
+ _VSTD::swap(__fn_, rhs.__fn_);
+ _VSTD::swap(__index_, rhs.__index_);
+ _VSTD::swap(__event_size_, rhs.__event_size_);
+ _VSTD::swap(__event_cap_, rhs.__event_cap_);
+ _VSTD::swap(__iarray_, rhs.__iarray_);
+ _VSTD::swap(__iarray_size_, rhs.__iarray_size_);
+ _VSTD::swap(__iarray_cap_, rhs.__iarray_cap_);
+ _VSTD::swap(__parray_, rhs.__parray_);
+ _VSTD::swap(__parray_size_, rhs.__parray_size_);
+ _VSTD::swap(__parray_cap_, rhs.__parray_cap_);
+}
+
+void
+ios_base::__set_badbit_and_consider_rethrow()
+{
+ __rdstate_ |= badbit;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__exceptions_ & badbit)
+ throw;
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+void
+ios_base::__set_failbit_and_consider_rethrow()
+{
+ __rdstate_ |= failbit;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__exceptions_ & failbit)
+ throw;
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+bool
+ios_base::sync_with_stdio(bool sync)
+{
+ static bool previous_state = true;
+ bool r = previous_state;
+ previous_state = sync;
+ return r;
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/iostream.cpp b/system/lib/libcxx/iostream.cpp
new file mode 100644
index 00000000..157c3977
--- /dev/null
+++ b/system/lib/libcxx/iostream.cpp
@@ -0,0 +1,53 @@
+//===------------------------ iostream.cpp --------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "__std_stream"
+#include "string"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+static __stdinbuf<char> __cin(stdin);
+static __stdoutbuf<char> __cout(stdout);
+static __stdoutbuf<char> __cerr(stderr);
+static __stdinbuf<wchar_t> __wcin(stdin);
+static __stdoutbuf<wchar_t> __wcout(stdout);
+static __stdoutbuf<wchar_t> __wcerr(stderr);
+
+istream cin(&__cin);
+ostream cout(&__cout);
+ostream cerr(&__cerr);
+ostream clog(&__cerr);
+wistream wcin(&__wcin);
+wostream wcout(&__wcout);
+wostream wcerr(&__wcerr);
+wostream wclog(&__wcerr);
+
+ios_base::Init __start_std_streams;
+
+ios_base::Init::Init()
+{
+ cin.tie(&cout);
+ _VSTD::unitbuf(cerr);
+ cerr.tie(&cout);
+
+ wcin.tie(&wcout);
+ _VSTD::unitbuf(wcerr);
+ wcerr.tie(&wcout);
+}
+
+ios_base::Init::~Init()
+{
+ cout.flush();
+ clog.flush();
+
+ wcout.flush();
+ wclog.flush();
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/locale.cpp b/system/lib/libcxx/locale.cpp
new file mode 100644
index 00000000..388660d2
--- /dev/null
+++ b/system/lib/libcxx/locale.cpp
@@ -0,0 +1,5838 @@
+//===------------------------- locale.cpp ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "string"
+#include "locale"
+#include "codecvt"
+#include "vector"
+#include "algorithm"
+#include "algorithm"
+#include "typeinfo"
+#include "type_traits"
+#include "clocale"
+#include "cstring"
+#include "cwctype"
+#include "__sso_allocator"
+#if _WIN32
+#include <locale.h>
+#else // _WIN32
+#include <langinfo.h>
+#endif // _!WIN32
+#include <stdlib.h>
+
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+namespace {
+ decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
+ inline _LIBCPP_INLINE_VISIBILITY
+ mb_cur_max_l(locale_t loc)
+ {
+ return MB_CUR_MAX_L(loc);
+ }
+}
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifndef _LIBCPP_STABLE_APPLE_ABI
+locale_t __cloc() {
+ // In theory this could create a race condition. In practice
+ // the race condition is non-fatal since it will just create
+ // a little resource leak. Better approach would be appreciated.
+#ifdef __APPLE__
+ return 0;
+#else
+ static locale_t result = newlocale(LC_ALL_MASK, "C", 0);
+ return result;
+#endif
+}
+#endif // _LIBCPP_STABLE_APPLE_ABI
+
+namespace {
+
+struct release
+{
+ void operator()(locale::facet* p) {p->__release_shared();}
+};
+
+template <class T, class A0>
+inline
+T&
+make(A0 a0)
+{
+ static typename aligned_storage<sizeof(T)>::type buf;
+ ::new (&buf) T(a0);
+ return *(T*)&buf;
+}
+
+template <class T, class A0, class A1>
+inline
+T&
+make(A0 a0, A1 a1)
+{
+ static typename aligned_storage<sizeof(T)>::type buf;
+ ::new (&buf) T(a0, a1);
+ return *(T*)&buf;
+}
+
+template <class T, class A0, class A1, class A2>
+inline
+T&
+make(A0 a0, A1 a1, A2 a2)
+{
+ static typename aligned_storage<sizeof(T)>::type buf;
+ ::new (&buf) T(a0, a1, a2);
+ return *(T*)&buf;
+}
+
+}
+
+class _LIBCPP_HIDDEN locale::__imp
+ : public facet
+{
+ enum {N = 28};
+ string name_;
+ vector<facet*, __sso_allocator<facet*, N> > facets_;
+public:
+ explicit __imp(size_t refs = 0);
+ explicit __imp(const string& name, size_t refs = 0);
+ __imp(const __imp&);
+ __imp(const __imp&, const string&, locale::category c);
+ __imp(const __imp& other, const __imp& one, locale::category c);
+ __imp(const __imp&, facet* f, long id);
+ ~__imp();
+
+ const string& name() const {return name_;}
+ bool has_facet(long id) const {return id < facets_.size() && facets_[id];}
+ const locale::facet* use_facet(long id) const;
+
+ static const locale& make_classic();
+ static locale& make_global();
+private:
+ void install(facet* f, long id);
+ template <class F> void install(F* f) {install(f, f->id.__get());}
+ template <class F> void install_from(const __imp& other);
+};
+
+locale::__imp::__imp(size_t refs)
+ : facet(refs),
+ name_("C"),
+ facets_(N)
+{
+ facets_.clear();
+ install(&make<_VSTD::collate<char> >(1));
+ install(&make<_VSTD::collate<wchar_t> >(1));
+ install(&make<_VSTD::ctype<char> >((ctype_base::mask*)0, false, 1));
+ install(&make<_VSTD::ctype<wchar_t> >(1));
+ install(&make<codecvt<char, char, mbstate_t> >(1));
+ install(&make<codecvt<wchar_t, char, mbstate_t> >(1));
+ install(&make<codecvt<char16_t, char, mbstate_t> >(1));
+ install(&make<codecvt<char32_t, char, mbstate_t> >(1));
+ install(&make<numpunct<char> >(1));
+ install(&make<numpunct<wchar_t> >(1));
+ install(&make<num_get<char> >(1));
+ install(&make<num_get<wchar_t> >(1));
+ install(&make<num_put<char> >(1));
+ install(&make<num_put<wchar_t> >(1));
+ install(&make<moneypunct<char, false> >(1));
+ install(&make<moneypunct<char, true> >(1));
+ install(&make<moneypunct<wchar_t, false> >(1));
+ install(&make<moneypunct<wchar_t, true> >(1));
+ install(&make<money_get<char> >(1));
+ install(&make<money_get<wchar_t> >(1));
+ install(&make<money_put<char> >(1));
+ install(&make<money_put<wchar_t> >(1));
+ install(&make<time_get<char> >(1));
+ install(&make<time_get<wchar_t> >(1));
+ install(&make<time_put<char> >(1));
+ install(&make<time_put<wchar_t> >(1));
+ install(&make<_VSTD::messages<char> >(1));
+ install(&make<_VSTD::messages<wchar_t> >(1));
+}
+
+locale::__imp::__imp(const string& name, size_t refs)
+ : facet(refs),
+ name_(name),
+ facets_(N)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ facets_ = locale::classic().__locale_->facets_;
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__add_shared();
+ install(new collate_byname<char>(name_));
+ install(new collate_byname<wchar_t>(name_));
+ install(new ctype_byname<char>(name_));
+ install(new ctype_byname<wchar_t>(name_));
+ install(new codecvt_byname<char, char, mbstate_t>(name_));
+ install(new codecvt_byname<wchar_t, char, mbstate_t>(name_));
+ install(new codecvt_byname<char16_t, char, mbstate_t>(name_));
+ install(new codecvt_byname<char32_t, char, mbstate_t>(name_));
+ install(new numpunct_byname<char>(name_));
+ install(new numpunct_byname<wchar_t>(name_));
+ install(new moneypunct_byname<char, false>(name_));
+ install(new moneypunct_byname<char, true>(name_));
+ install(new moneypunct_byname<wchar_t, false>(name_));
+ install(new moneypunct_byname<wchar_t, true>(name_));
+ install(new time_get_byname<char>(name_));
+ install(new time_get_byname<wchar_t>(name_));
+ install(new time_put_byname<char>(name_));
+ install(new time_put_byname<wchar_t>(name_));
+ install(new messages_byname<char>(name_));
+ install(new messages_byname<wchar_t>(name_));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__release_shared();
+ throw;
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+locale::__imp::__imp(const __imp& other)
+ : name_(other.name_),
+ facets_(max<size_t>(N, other.facets_.size()))
+{
+ facets_ = other.facets_;
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__add_shared();
+}
+
+locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
+ : name_("*"),
+ facets_(N)
+{
+ facets_ = other.facets_;
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__add_shared();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ if (c & locale::collate)
+ {
+ install(new collate_byname<char>(name));
+ install(new collate_byname<wchar_t>(name));
+ }
+ if (c & locale::ctype)
+ {
+ install(new ctype_byname<char>(name));
+ install(new ctype_byname<wchar_t>(name));
+ install(new codecvt_byname<char, char, mbstate_t>(name));
+ install(new codecvt_byname<wchar_t, char, mbstate_t>(name));
+ install(new codecvt_byname<char16_t, char, mbstate_t>(name));
+ install(new codecvt_byname<char32_t, char, mbstate_t>(name));
+ }
+ if (c & locale::monetary)
+ {
+ install(new moneypunct_byname<char, false>(name));
+ install(new moneypunct_byname<char, true>(name));
+ install(new moneypunct_byname<wchar_t, false>(name));
+ install(new moneypunct_byname<wchar_t, true>(name));
+ }
+ if (c & locale::numeric)
+ {
+ install(new numpunct_byname<char>(name));
+ install(new numpunct_byname<wchar_t>(name));
+ }
+ if (c & locale::time)
+ {
+ install(new time_get_byname<char>(name));
+ install(new time_get_byname<wchar_t>(name));
+ install(new time_put_byname<char>(name));
+ install(new time_put_byname<wchar_t>(name));
+ }
+ if (c & locale::messages)
+ {
+ install(new messages_byname<char>(name));
+ install(new messages_byname<wchar_t>(name));
+ }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__release_shared();
+ throw;
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+template<class F>
+inline
+void
+locale::__imp::install_from(const locale::__imp& one)
+{
+ long id = F::id.__get();
+ install(const_cast<F*>(static_cast<const F*>(one.use_facet(id))), id);
+}
+
+locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
+ : name_("*"),
+ facets_(N)
+{
+ facets_ = other.facets_;
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__add_shared();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ if (c & locale::collate)
+ {
+ install_from<_VSTD::collate<char> >(one);
+ install_from<_VSTD::collate<wchar_t> >(one);
+ }
+ if (c & locale::ctype)
+ {
+ install_from<_VSTD::ctype<char> >(one);
+ install_from<_VSTD::ctype<wchar_t> >(one);
+ install_from<_VSTD::codecvt<char, char, mbstate_t> >(one);
+ install_from<_VSTD::codecvt<char16_t, char, mbstate_t> >(one);
+ install_from<_VSTD::codecvt<char32_t, char, mbstate_t> >(one);
+ install_from<_VSTD::codecvt<wchar_t, char, mbstate_t> >(one);
+ }
+ if (c & locale::monetary)
+ {
+ install_from<moneypunct<char, false> >(one);
+ install_from<moneypunct<char, true> >(one);
+ install_from<moneypunct<wchar_t, false> >(one);
+ install_from<moneypunct<wchar_t, true> >(one);
+ install_from<money_get<char> >(one);
+ install_from<money_get<wchar_t> >(one);
+ install_from<money_put<char> >(one);
+ install_from<money_put<wchar_t> >(one);
+ }
+ if (c & locale::numeric)
+ {
+ install_from<numpunct<char> >(one);
+ install_from<numpunct<wchar_t> >(one);
+ install_from<num_get<char> >(one);
+ install_from<num_get<wchar_t> >(one);
+ install_from<num_put<char> >(one);
+ install_from<num_put<wchar_t> >(one);
+ }
+ if (c & locale::time)
+ {
+ install_from<time_get<char> >(one);
+ install_from<time_get<wchar_t> >(one);
+ install_from<time_put<char> >(one);
+ install_from<time_put<wchar_t> >(one);
+ }
+ if (c & locale::messages)
+ {
+ install_from<_VSTD::messages<char> >(one);
+ install_from<_VSTD::messages<wchar_t> >(one);
+ }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__release_shared();
+ throw;
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+locale::__imp::__imp(const __imp& other, facet* f, long id)
+ : name_("*"),
+ facets_(max<size_t>(N, other.facets_.size()+1))
+{
+ f->__add_shared();
+ unique_ptr<facet, release> hold(f);
+ facets_ = other.facets_;
+ for (unsigned i = 0; i < other.facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__add_shared();
+ install(hold.get(), id);
+}
+
+locale::__imp::~__imp()
+{
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__release_shared();
+}
+
+void
+locale::__imp::install(facet* f, long id)
+{
+ f->__add_shared();
+ unique_ptr<facet, release> hold(f);
+ if (id >= facets_.size())
+ facets_.resize(id+1);
+ if (facets_[id])
+ facets_[id]->__release_shared();
+ facets_[id] = hold.release();
+}
+
+const locale::facet*
+locale::__imp::use_facet(long id) const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (!has_facet(id))
+ throw bad_cast();
+#endif // _LIBCPP_NO_EXCEPTIONS
+ return facets_[id];
+}
+
+// locale
+
+const locale&
+locale::__imp::make_classic()
+{
+ // only one thread can get in here and it only gets in once
+ static aligned_storage<sizeof(locale)>::type buf;
+ locale* c = (locale*)&buf;
+ c->__locale_ = &make<__imp>(1);
+ return *c;
+}
+
+const locale&
+locale::classic()
+{
+ static const locale& c = __imp::make_classic();
+ return c;
+}
+
+locale&
+locale::__imp::make_global()
+{
+ // only one thread can get in here and it only gets in once
+ static aligned_storage<sizeof(locale)>::type buf;
+ locale* g = (locale*)&buf;
+ ::new (&buf) locale(locale::classic());
+ return *(locale*)&buf;
+}
+
+locale&
+locale::__global()
+{
+ static locale& g = __imp::make_global();
+ return g;
+}
+
+locale::locale() _NOEXCEPT
+ : __locale_(__global().__locale_)
+{
+ __locale_->__add_shared();
+}
+
+locale::locale(const locale& l) _NOEXCEPT
+ : __locale_(l.__locale_)
+{
+ __locale_->__add_shared();
+}
+
+locale::~locale()
+{
+ __locale_->__release_shared();
+}
+
+const locale&
+locale::operator=(const locale& other) _NOEXCEPT
+{
+ other.__locale_->__add_shared();
+ __locale_->__release_shared();
+ __locale_ = other.__locale_;
+ return *this;
+}
+
+locale::locale(const char* name)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ : __locale_(name ? new __imp(name)
+ : throw runtime_error("locale constructed with null"))
+#else // _LIBCPP_NO_EXCEPTIONS
+ : __locale_(new __imp(name))
+#endif
+{
+ __locale_->__add_shared();
+}
+
+locale::locale(const string& name)
+ : __locale_(new __imp(name))
+{
+ __locale_->__add_shared();
+}
+
+locale::locale(const locale& other, const char* name, category c)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ : __locale_(name ? new __imp(*other.__locale_, name, c)
+ : throw runtime_error("locale constructed with null"))
+#else // _LIBCPP_NO_EXCEPTIONS
+ : __locale_(new __imp(*other.__locale_, name, c))
+#endif
+{
+ __locale_->__add_shared();
+}
+
+locale::locale(const locale& other, const string& name, category c)
+ : __locale_(new __imp(*other.__locale_, name, c))
+{
+ __locale_->__add_shared();
+}
+
+locale::locale(const locale& other, const locale& one, category c)
+ : __locale_(new __imp(*other.__locale_, *one.__locale_, c))
+{
+ __locale_->__add_shared();
+}
+
+string
+locale::name() const
+{
+ return __locale_->name();
+}
+
+void
+locale::__install_ctor(const locale& other, facet* f, long id)
+{
+ if (f)
+ __locale_ = new __imp(*other.__locale_, f, id);
+ else
+ __locale_ = other.__locale_;
+ __locale_->__add_shared();
+}
+
+locale
+locale::global(const locale& loc)
+{
+ locale& g = __global();
+ locale r = g;
+ g = loc;
+ if (g.name() != "*")
+ setlocale(LC_ALL, g.name().c_str());
+ return r;
+}
+
+bool
+locale::has_facet(id& x) const
+{
+ return __locale_->has_facet(x.__get());
+}
+
+const locale::facet*
+locale::use_facet(id& x) const
+{
+ return __locale_->use_facet(x.__get());
+}
+
+bool
+locale::operator==(const locale& y) const
+{
+ return (__locale_ == y.__locale_)
+ || (__locale_->name() != "*" && __locale_->name() == y.__locale_->name());
+}
+
+// locale::facet
+
+locale::facet::~facet()
+{
+}
+
+void
+locale::facet::__on_zero_shared() _NOEXCEPT
+{
+ delete this;
+}
+
+// locale::id
+
+int32_t locale::id::__next_id = 0;
+
+namespace
+{
+
+class __fake_bind
+{
+ locale::id* id_;
+ void (locale::id::* pmf_)();
+public:
+ __fake_bind(void (locale::id::* pmf)(), locale::id* id)
+ : id_(id), pmf_(pmf) {}
+
+ void operator()() const
+ {
+ (id_->*pmf_)();
+ }
+};
+
+}
+
+long
+locale::id::__get()
+{
+ call_once(__flag_, __fake_bind(&locale::id::__init, this));
+ return __id_ - 1;
+}
+
+void
+locale::id::__init()
+{
+ __id_ = __sync_add_and_fetch(&__next_id, 1);
+}
+
+// template <> class collate_byname<char>
+
+collate_byname<char>::collate_byname(const char* n, size_t refs)
+ : collate<char>(refs),
+ __l(newlocale(LC_ALL_MASK, n, 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__l == 0)
+ throw runtime_error("collate_byname<char>::collate_byname"
+ " failed to construct for " + string(n));
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+collate_byname<char>::collate_byname(const string& name, size_t refs)
+ : collate<char>(refs),
+ __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__l == 0)
+ throw runtime_error("collate_byname<char>::collate_byname"
+ " failed to construct for " + name);
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+collate_byname<char>::~collate_byname()
+{
+ freelocale(__l);
+}
+
+int
+collate_byname<char>::do_compare(const char_type* __lo1, const char_type* __hi1,
+ const char_type* __lo2, const char_type* __hi2) const
+{
+ string_type lhs(__lo1, __hi1);
+ string_type rhs(__lo2, __hi2);
+ int r = strcoll_l(lhs.c_str(), rhs.c_str(), __l);
+ if (r < 0)
+ return -1;
+ if (r > 0)
+ return 1;
+ return r;
+}
+
+collate_byname<char>::string_type
+collate_byname<char>::do_transform(const char_type* lo, const char_type* hi) const
+{
+ const string_type in(lo, hi);
+ string_type out(strxfrm_l(0, in.c_str(), 0, __l), char());
+ strxfrm_l(const_cast<char*>(out.c_str()), in.c_str(), out.size()+1, __l);
+ return out;
+}
+
+// template <> class collate_byname<wchar_t>
+
+collate_byname<wchar_t>::collate_byname(const char* n, size_t refs)
+ : collate<wchar_t>(refs),
+ __l(newlocale(LC_ALL_MASK, n, 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__l == 0)
+ throw runtime_error("collate_byname<wchar_t>::collate_byname(size_t refs)"
+ " failed to construct for " + string(n));
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+collate_byname<wchar_t>::collate_byname(const string& name, size_t refs)
+ : collate<wchar_t>(refs),
+ __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__l == 0)
+ throw runtime_error("collate_byname<wchar_t>::collate_byname(size_t refs)"
+ " failed to construct for " + name);
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+collate_byname<wchar_t>::~collate_byname()
+{
+ freelocale(__l);
+}
+
+int
+collate_byname<wchar_t>::do_compare(const char_type* __lo1, const char_type* __hi1,
+ const char_type* __lo2, const char_type* __hi2) const
+{
+ string_type lhs(__lo1, __hi1);
+ string_type rhs(__lo2, __hi2);
+ int r = wcscoll_l(lhs.c_str(), rhs.c_str(), __l);
+ if (r < 0)
+ return -1;
+ if (r > 0)
+ return 1;
+ return r;
+}
+
+collate_byname<wchar_t>::string_type
+collate_byname<wchar_t>::do_transform(const char_type* lo, const char_type* hi) const
+{
+ const string_type in(lo, hi);
+ string_type out(wcsxfrm_l(0, in.c_str(), 0, __l), wchar_t());
+ wcsxfrm_l(const_cast<wchar_t*>(out.c_str()), in.c_str(), out.size()+1, __l);
+ return out;
+}
+
+// template <> class ctype<wchar_t>;
+
+locale::id ctype<wchar_t>::id;
+
+ctype<wchar_t>::~ctype()
+{
+}
+
+bool
+ctype<wchar_t>::do_is(mask m, char_type c) const
+{
+ return isascii(c) ? ctype<char>::classic_table()[c] & m : false;
+}
+
+const wchar_t*
+ctype<wchar_t>::do_is(const char_type* low, const char_type* high, mask* vec) const
+{
+ for (; low != high; ++low, ++vec)
+ *vec = static_cast<mask>(isascii(*low) ?
+ ctype<char>::classic_table()[*low] : 0);
+ return low;
+}
+
+const wchar_t*
+ctype<wchar_t>::do_scan_is(mask m, const char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+ if (isascii(*low) && (ctype<char>::classic_table()[*low] & m))
+ break;
+ return low;
+}
+
+const wchar_t*
+ctype<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+ if (!(isascii(*low) && (ctype<char>::classic_table()[*low] & m)))
+ break;
+ return low;
+}
+
+wchar_t
+ctype<wchar_t>::do_toupper(char_type c) const
+{
+#if !(defined(_LIBCPP_STABLE_APPLE_ABI) || defined(__FreeBSD__))
+ return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
+#else
+ return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
+#endif
+}
+
+const wchar_t*
+ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+#if !(defined(_LIBCPP_STABLE_APPLE_ABI) || defined(__FreeBSD__))
+ *low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
+ : *low;
+#else
+ *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
+#endif
+ return low;
+}
+
+wchar_t
+ctype<wchar_t>::do_tolower(char_type c) const
+{
+#ifndef _LIBCPP_STABLE_APPLE_ABI
+ return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
+#else
+ return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
+#endif
+}
+
+const wchar_t*
+ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+#ifndef _LIBCPP_STABLE_APPLE_ABI
+ *low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
+ : *low;
+#else
+ *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
+#endif
+ return low;
+}
+
+wchar_t
+ctype<wchar_t>::do_widen(char c) const
+{
+ return c;
+}
+
+const char*
+ctype<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const
+{
+ for (; low != high; ++low, ++dest)
+ *dest = *low;
+ return low;
+}
+
+char
+ctype<wchar_t>::do_narrow(char_type c, char dfault) const
+{
+ if (isascii(c))
+ return static_cast<char>(c);
+ return dfault;
+}
+
+const wchar_t*
+ctype<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const
+{
+ for (; low != high; ++low, ++dest)
+ if (isascii(*low))
+ *dest = *low;
+ else
+ *dest = dfault;
+ return low;
+}
+
+// template <> class ctype<char>;
+
+locale::id ctype<char>::id;
+
+ctype<char>::ctype(const mask* tab, bool del, size_t refs)
+ : locale::facet(refs),
+ __tab_(tab),
+ __del_(del)
+{
+ if (__tab_ == 0)
+ __tab_ = classic_table();
+}
+
+ctype<char>::~ctype()
+{
+ if (__tab_ && __del_)
+ delete [] __tab_;
+}
+
+char
+ctype<char>::do_toupper(char_type c) const
+{
+#ifndef _LIBCPP_STABLE_APPLE_ABI
+ return isascii(c) ? __classic_upper_table()[c] : c;
+#else
+ return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
+#endif
+}
+
+const char*
+ctype<char>::do_toupper(char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+#ifndef _LIBCPP_STABLE_APPLE_ABI
+ *low = isascii(*low) ? __classic_upper_table()[*low] : *low;
+#else
+ *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
+#endif
+ return low;
+}
+
+char
+ctype<char>::do_tolower(char_type c) const
+{
+#ifndef _LIBCPP_STABLE_APPLE_ABI
+ return isascii(c) ? __classic_lower_table()[c] : c;
+#else
+ return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
+#endif
+}
+
+const char*
+ctype<char>::do_tolower(char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+#ifndef _LIBCPP_STABLE_APPLE_ABI
+ *low = isascii(*low) ? __classic_lower_table()[*low] : *low;
+#else
+ *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
+#endif
+ return low;
+}
+
+char
+ctype<char>::do_widen(char c) const
+{
+ return c;
+}
+
+const char*
+ctype<char>::do_widen(const char* low, const char* high, char_type* dest) const
+{
+ for (; low != high; ++low, ++dest)
+ *dest = *low;
+ return low;
+}
+
+char
+ctype<char>::do_narrow(char_type c, char dfault) const
+{
+ if (isascii(c))
+ return static_cast<char>(c);
+ return dfault;
+}
+
+const char*
+ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const
+{
+ for (; low != high; ++low, ++dest)
+ if (isascii(*low))
+ *dest = *low;
+ else
+ *dest = dfault;
+ return low;
+}
+
+const ctype<char>::mask*
+ctype<char>::classic_table() _NOEXCEPT
+{
+#if defined(__APPLE__) || defined(__FreeBSD__)
+ return _DefaultRuneLocale.__runetype;
+#elif defined(__GLIBC__)
+ return __cloc()->__ctype_b;
+// This is assumed to be safe, which is a nonsense assumption because we're
+// going to end up dereferencing it later...
+#else
+ return NULL;
+#endif
+}
+
+#ifndef _LIBCPP_STABLE_APPLE_ABI
+const int*
+ctype<char>::__classic_lower_table() _NOEXCEPT
+{
+#if defined(__APPLE__) || defined(__FreeBSD__)
+ return _DefaultRuneLocale.__maplower;
+#elif defined(__GLIBC__)
+ return __cloc()->__ctype_tolower;
+#else
+ return NULL;
+#endif
+}
+
+const int*
+ctype<char>::__classic_upper_table() _NOEXCEPT
+{
+#if defined(__APPLE__) || defined(__FreeBSD__)
+ return _DefaultRuneLocale.__mapupper;
+#elif defined(__GLIBC__)
+ return __cloc()->__ctype_toupper;
+#else
+ return NULL;
+#endif
+}
+#endif // _LIBCPP_STABLE_APPLE_ABI
+
+// template <> class ctype_byname<char>
+
+ctype_byname<char>::ctype_byname(const char* name, size_t refs)
+ : ctype<char>(0, false, refs),
+ __l(newlocale(LC_ALL_MASK, name, 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__l == 0)
+ throw runtime_error("ctype_byname<char>::ctype_byname"
+ " failed to construct for " + string(name));
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+ctype_byname<char>::ctype_byname(const string& name, size_t refs)
+ : ctype<char>(0, false, refs),
+ __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__l == 0)
+ throw runtime_error("ctype_byname<char>::ctype_byname"
+ " failed to construct for " + name);
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+ctype_byname<char>::~ctype_byname()
+{
+ freelocale(__l);
+}
+
+char
+ctype_byname<char>::do_toupper(char_type c) const
+{
+ return toupper_l(c, __l);
+}
+
+const char*
+ctype_byname<char>::do_toupper(char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+ *low = toupper_l(*low, __l);
+ return low;
+}
+
+char
+ctype_byname<char>::do_tolower(char_type c) const
+{
+ return tolower_l(c, __l);
+}
+
+const char*
+ctype_byname<char>::do_tolower(char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+ *low = tolower_l(*low, __l);
+ return low;
+}
+
+// template <> class ctype_byname<wchar_t>
+
+ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs)
+ : ctype<wchar_t>(refs),
+ __l(newlocale(LC_ALL_MASK, name, 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__l == 0)
+ throw runtime_error("ctype_byname<wchar_t>::ctype_byname"
+ " failed to construct for " + string(name));
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+ctype_byname<wchar_t>::ctype_byname(const string& name, size_t refs)
+ : ctype<wchar_t>(refs),
+ __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__l == 0)
+ throw runtime_error("ctype_byname<wchar_t>::ctype_byname"
+ " failed to construct for " + name);
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+ctype_byname<wchar_t>::~ctype_byname()
+{
+ freelocale(__l);
+}
+
+bool
+ctype_byname<wchar_t>::do_is(mask m, char_type c) const
+{
+#ifdef _LIBCPP_WCTYPE_IS_MASK
+ return static_cast<bool>(iswctype_l(c, m, __l));
+#else
+ // FIXME: This is broken for things that test more than one flag.
+ if (m & space && !iswspace_l(c, __l)) return false;
+ if (m & print && !iswprint_l(c, __l)) return false;
+ if (m & cntrl && !iswcntrl_l(c, __l)) return false;
+ if (m & upper && !iswupper_l(c, __l)) return false;
+ if (m & lower && !iswlower_l(c, __l)) return false;
+ if (m & alpha && !iswalpha_l(c, __l)) return false;
+ if (m & digit && !iswdigit_l(c, __l)) return false;
+ if (m & punct && !iswpunct_l(c, __l)) return false;
+ if (m & xdigit && !iswxdigit_l(c, __l)) return false;
+ if (m & blank && !iswblank_l(c, __l)) return false;
+ return true;
+#endif
+}
+
+const wchar_t*
+ctype_byname<wchar_t>::do_is(const char_type* low, const char_type* high, mask* vec) const
+{
+ for (; low != high; ++low, ++vec)
+ {
+ if (isascii(*low))
+ *vec = static_cast<mask>(ctype<char>::classic_table()[*low]);
+ else
+ {
+ *vec = 0;
+ if (iswspace_l(*low, __l))
+ *vec |= space;
+ if (iswprint_l(*low, __l))
+ *vec |= print;
+ if (iswcntrl_l(*low, __l))
+ *vec |= cntrl;
+ if (iswupper_l(*low, __l))
+ *vec |= upper;
+ if (iswlower_l(*low, __l))
+ *vec |= lower;
+ if (iswalpha_l(*low, __l))
+ *vec |= alpha;
+ if (iswdigit_l(*low, __l))
+ *vec |= digit;
+ if (iswpunct_l(*low, __l))
+ *vec |= punct;
+ if (iswxdigit_l(*low, __l))
+ *vec |= xdigit;
+ }
+ }
+ return low;
+}
+
+const wchar_t*
+ctype_byname<wchar_t>::do_scan_is(mask m, const char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+ {
+#ifdef _LIBCPP_WCTYPE_IS_MASK
+ if (iswctype_l(*low, m, __l))
+ break;
+#else
+ if (m & space && !iswspace_l(*low, __l)) continue;
+ if (m & print && !iswprint_l(*low, __l)) continue;
+ if (m & cntrl && !iswcntrl_l(*low, __l)) continue;
+ if (m & upper && !iswupper_l(*low, __l)) continue;
+ if (m & lower && !iswlower_l(*low, __l)) continue;
+ if (m & alpha && !iswalpha_l(*low, __l)) continue;
+ if (m & digit && !iswdigit_l(*low, __l)) continue;
+ if (m & punct && !iswpunct_l(*low, __l)) continue;
+ if (m & xdigit && !iswxdigit_l(*low, __l)) continue;
+ if (m & blank && !iswblank_l(*low, __l)) continue;
+ break;
+#endif
+ }
+ return low;
+}
+
+const wchar_t*
+ctype_byname<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+ {
+#ifdef _LIBCPP_WCTYPE_IS_MASK
+ if (!iswctype_l(*low, m, __l))
+ break;
+#else
+ if (m & space && iswspace_l(*low, __l)) continue;
+ if (m & print && iswprint_l(*low, __l)) continue;
+ if (m & cntrl && iswcntrl_l(*low, __l)) continue;
+ if (m & upper && iswupper_l(*low, __l)) continue;
+ if (m & lower && iswlower_l(*low, __l)) continue;
+ if (m & alpha && iswalpha_l(*low, __l)) continue;
+ if (m & digit && iswdigit_l(*low, __l)) continue;
+ if (m & punct && iswpunct_l(*low, __l)) continue;
+ if (m & xdigit && iswxdigit_l(*low, __l)) continue;
+ if (m & blank && iswblank_l(*low, __l)) continue;
+ break;
+#endif
+ }
+ return low;
+}
+
+wchar_t
+ctype_byname<wchar_t>::do_toupper(char_type c) const
+{
+ return towupper_l(c, __l);
+}
+
+const wchar_t*
+ctype_byname<wchar_t>::do_toupper(char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+ *low = towupper_l(*low, __l);
+ return low;
+}
+
+wchar_t
+ctype_byname<wchar_t>::do_tolower(char_type c) const
+{
+ return towlower_l(c, __l);
+}
+
+const wchar_t*
+ctype_byname<wchar_t>::do_tolower(char_type* low, const char_type* high) const
+{
+ for (; low != high; ++low)
+ *low = towlower_l(*low, __l);
+ return low;
+}
+
+wchar_t
+ctype_byname<wchar_t>::do_widen(char c) const
+{
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ return btowc_l(c, __l);
+#else
+ return __btowc_l(c, __l);
+#endif
+}
+
+const char*
+ctype_byname<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const
+{
+ for (; low != high; ++low, ++dest)
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ *dest = btowc_l(*low, __l);
+#else
+ *dest = __btowc_l(*low, __l);
+#endif
+ return low;
+}
+
+char
+ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const
+{
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ int r = wctob_l(c, __l);
+#else
+ int r = __wctob_l(c, __l);
+#endif
+ return r != WEOF ? static_cast<char>(r) : dfault;
+}
+
+const wchar_t*
+ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const
+{
+ for (; low != high; ++low, ++dest)
+ {
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ int r = wctob_l(*low, __l);
+#else
+ int r = __wctob_l(*low, __l);
+#endif
+ *dest = r != WEOF ? static_cast<char>(r) : dfault;
+ }
+ return low;
+}
+
+// template <> class codecvt<char, char, mbstate_t>
+
+locale::id codecvt<char, char, mbstate_t>::id;
+
+codecvt<char, char, mbstate_t>::~codecvt()
+{
+}
+
+codecvt<char, char, mbstate_t>::result
+codecvt<char, char, mbstate_t>::do_out(state_type&,
+ const intern_type* frm, const intern_type*, const intern_type*& frm_nxt,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ return noconv;
+}
+
+codecvt<char, char, mbstate_t>::result
+codecvt<char, char, mbstate_t>::do_in(state_type&,
+ const extern_type* frm, const extern_type*, const extern_type*& frm_nxt,
+ intern_type* to, intern_type*, intern_type*& to_nxt) const
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ return noconv;
+}
+
+codecvt<char, char, mbstate_t>::result
+codecvt<char, char, mbstate_t>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+codecvt<char, char, mbstate_t>::do_encoding() const _NOEXCEPT
+{
+ return 1;
+}
+
+bool
+codecvt<char, char, mbstate_t>::do_always_noconv() const _NOEXCEPT
+{
+ return true;
+}
+
+int
+codecvt<char, char, mbstate_t>::do_length(state_type&,
+ const extern_type* frm, const extern_type* end, size_t mx) const
+{
+ return static_cast<int>(min<size_t>(mx, end-frm));
+}
+
+int
+codecvt<char, char, mbstate_t>::do_max_length() const _NOEXCEPT
+{
+ return 1;
+}
+
+// template <> class codecvt<wchar_t, char, mbstate_t>
+
+locale::id codecvt<wchar_t, char, mbstate_t>::id;
+
+codecvt<wchar_t, char, mbstate_t>::codecvt(size_t refs)
+ : locale::facet(refs),
+ __l(0)
+{
+}
+
+codecvt<wchar_t, char, mbstate_t>::codecvt(const char* nm, size_t refs)
+ : locale::facet(refs),
+ __l(newlocale(LC_ALL_MASK, nm, 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__l == 0)
+ throw runtime_error("codecvt_byname<wchar_t, char, mbstate_t>::codecvt_byname"
+ " failed to construct for " + string(nm));
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+codecvt<wchar_t, char, mbstate_t>::~codecvt()
+{
+ if (__l != 0)
+ freelocale(__l);
+}
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ // look for first internal null in frm
+ const intern_type* fend = frm;
+ for (; fend != frm_end; ++fend)
+ if (*fend == 0)
+ break;
+ // loop over all null-terminated sequences in frm
+ to_nxt = to;
+ for (frm_nxt = frm; frm != frm_end && to != to_end; frm = frm_nxt, to = to_nxt)
+ {
+ // save state in case needed to reover to_nxt on error
+ mbstate_t save_state = st;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ size_t n = wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
+#else
+ size_t n = __wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
+#endif
+ if (n == size_t(-1))
+ {
+ // need to recover to_nxt
+ for (to_nxt = to; frm != frm_nxt; ++frm)
+ {
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ n = wcrtomb_l(to_nxt, *frm, &save_state, __l);
+#else
+ n = __wcrtomb_l(to_nxt, *frm, &save_state, __l);
+#endif
+ if (n == size_t(-1))
+ break;
+ to_nxt += n;
+ }
+ frm_nxt = frm;
+ return error;
+ }
+ if (n == 0)
+ return partial;
+ to_nxt += n;
+ if (to_nxt == to_end)
+ break;
+ if (fend != frm_end) // set up next null terminated sequence
+ {
+ // Try to write the terminating null
+ extern_type tmp[MB_LEN_MAX];
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ n = wcrtomb_l(tmp, intern_type(), &st, __l);
+#else
+ n = __wcrtomb_l(tmp, intern_type(), &st, __l);
+#endif
+ if (n == size_t(-1)) // on error
+ return error;
+ if (n > to_end-to_nxt) // is there room?
+ return partial;
+ for (extern_type* p = tmp; n; --n) // write it
+ *to_nxt++ = *p++;
+ ++frm_nxt;
+ // look for next null in frm
+ for (fend = frm_nxt; fend != frm_end; ++fend)
+ if (*fend == 0)
+ break;
+ }
+ }
+ return frm_nxt == frm_end ? ok : partial;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ // look for first internal null in frm
+ const extern_type* fend = frm;
+ for (; fend != frm_end; ++fend)
+ if (*fend == 0)
+ break;
+ // loop over all null-terminated sequences in frm
+ to_nxt = to;
+ for (frm_nxt = frm; frm != frm_end && to != to_end; frm = frm_nxt, to = to_nxt)
+ {
+ // save state in case needed to reover to_nxt on error
+ mbstate_t save_state = st;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ size_t n = mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
+#else
+ size_t n = __mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
+#endif
+ if (n == size_t(-1))
+ {
+ // need to recover to_nxt
+ for (to_nxt = to; frm != frm_nxt; ++to_nxt)
+ {
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ n = mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
+#else
+ n = __mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
+#endif
+ switch (n)
+ {
+ case 0:
+ ++frm;
+ break;
+ case -1:
+ frm_nxt = frm;
+ return error;
+ case -2:
+ frm_nxt = frm;
+ return partial;
+ default:
+ frm += n;
+ break;
+ }
+ }
+ frm_nxt = frm;
+ return frm_nxt == frm_end ? ok : partial;
+ }
+ if (n == 0)
+ return error;
+ to_nxt += n;
+ if (to_nxt == to_end)
+ break;
+ if (fend != frm_end) // set up next null terminated sequence
+ {
+ // Try to write the terminating null
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ n = mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
+#else
+ n = __mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
+#endif
+ if (n != 0) // on error
+ return error;
+ ++to_nxt;
+ ++frm_nxt;
+ // look for next null in frm
+ for (fend = frm_nxt; fend != frm_end; ++fend)
+ if (*fend == 0)
+ break;
+ }
+ }
+ return frm_nxt == frm_end ? ok : partial;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ extern_type tmp[MB_LEN_MAX];
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ size_t n = wcrtomb_l(tmp, intern_type(), &st, __l);
+#else
+ size_t n = __wcrtomb_l(tmp, intern_type(), &st, __l);
+#endif
+ if (n == size_t(-1) || n == 0) // on error
+ return error;
+ --n;
+ if (n > to_end-to_nxt) // is there room?
+ return partial;
+ for (extern_type* p = tmp; n; --n) // write it
+ *to_nxt++ = *p++;
+ return ok;
+}
+
+int
+codecvt<wchar_t, char, mbstate_t>::do_encoding() const _NOEXCEPT
+{
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ if (mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
+#else
+ if (__mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
+#endif
+ {
+ // stateless encoding
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ if (__l == 0 || MB_CUR_MAX_L(__l) == 1) // there are no known constant length encodings
+#else
+ if (__l == 0 || __mb_cur_max_l(__l) == 1) // there are no known constant length encodings
+#endif
+ return 1; // which take more than 1 char to form a wchar_t
+ return 0;
+ }
+ return -1;
+}
+
+bool
+codecvt<wchar_t, char, mbstate_t>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ int nbytes = 0;
+ for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t)
+ {
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ size_t n = mbrlen_l(frm, frm_end-frm, &st, __l);
+#else
+ size_t n = __mbrlen_l(frm, frm_end-frm, &st, __l);
+#endif
+ switch (n)
+ {
+ case 0:
+ ++nbytes;
+ ++frm;
+ break;
+ case -1:
+ case -2:
+ return nbytes;
+ default:
+ nbytes += n;
+ frm += n;
+ break;
+ }
+ }
+ return nbytes;
+}
+
+int
+codecvt<wchar_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
+{
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ return __l == 0 ? 1 : MB_CUR_MAX_L(__l);
+#else
+ return __l == 0 ? 1 : __mb_cur_max_l(__l);
+#endif
+}
+
+// Valid UTF ranges
+// UTF-32 UTF-16 UTF-8 # of code points
+// first second first second third fourth
+// 000000 - 00007F 0000 - 007F 00 - 7F 127
+// 000080 - 0007FF 0080 - 07FF C2 - DF, 80 - BF 1920
+// 000800 - 000FFF 0800 - 0FFF E0 - E0, A0 - BF, 80 - BF 2048
+// 001000 - 00CFFF 1000 - CFFF E1 - EC, 80 - BF, 80 - BF 49152
+// 00D000 - 00D7FF D000 - D7FF ED - ED, 80 - 9F, 80 - BF 2048
+// 00D800 - 00DFFF invalid
+// 00E000 - 00FFFF E000 - FFFF EE - EF, 80 - BF, 80 - BF 8192
+// 010000 - 03FFFF D800 - D8BF, DC00 - DFFF F0 - F0, 90 - BF, 80 - BF, 80 - BF 196608
+// 040000 - 0FFFFF D8C0 - DBBF, DC00 - DFFF F1 - F3, 80 - BF, 80 - BF, 80 - BF 786432
+// 100000 - 10FFFF DBC0 - DBFF, DC00 - DFFF F4 - F4, 80 - 8F, 80 - BF, 80 - BF 65536
+
+static
+codecvt_base::result
+utf16_to_utf8(const uint16_t* frm, const uint16_t* frm_end, const uint16_t*& frm_nxt,
+ uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header)
+ {
+ if (to_end-to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xEF);
+ *to_nxt++ = static_cast<uint8_t>(0xBB);
+ *to_nxt++ = static_cast<uint8_t>(0xBF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt)
+ {
+ uint16_t wc1 = *frm_nxt;
+ if (wc1 > Maxcode)
+ return codecvt_base::error;
+ if (wc1 < 0x0080)
+ {
+ if (to_end-to_nxt < 1)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc1);
+ }
+ else if (wc1 < 0x0800)
+ {
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc1 >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x03F));
+ }
+ else if (wc1 < 0xD800)
+ {
+ if (to_end-to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
+ }
+ else if (wc1 < 0xDC00)
+ {
+ if (frm_end-frm_nxt < 2)
+ return codecvt_base::partial;
+ uint16_t wc2 = frm_nxt[1];
+ if ((wc2 & 0xFC00) != 0xDC00)
+ return codecvt_base::error;
+ if (to_end-to_nxt < 4)
+ return codecvt_base::partial;
+ if ((((((unsigned long)wc1 & 0x03C0) >> 6) + 1) << 16) +
+ (((unsigned long)wc1 & 0x003F) << 10) + (wc2 & 0x03FF) > Maxcode)
+ return codecvt_base::error;
+ ++frm_nxt;
+ uint8_t z = ((wc1 & 0x03C0) >> 6) + 1;
+ *to_nxt++ = static_cast<uint8_t>(0xF0 | (z >> 2));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((z & 0x03) << 4) | ((wc1 & 0x003C) >> 2));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0003) << 4) | ((wc2 & 0x03C0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc2 & 0x003F));
+ }
+ else if (wc1 < 0xE000)
+ {
+ return codecvt_base::error;
+ }
+ else
+ {
+ if (to_end-to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
+ }
+ }
+ return codecvt_base::ok;
+}
+
+static
+codecvt_base::result
+utf16_to_utf8(const uint32_t* frm, const uint32_t* frm_end, const uint32_t*& frm_nxt,
+ uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header)
+ {
+ if (to_end-to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xEF);
+ *to_nxt++ = static_cast<uint8_t>(0xBB);
+ *to_nxt++ = static_cast<uint8_t>(0xBF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt)
+ {
+ uint16_t wc1 = static_cast<uint16_t>(*frm_nxt);
+ if (wc1 > Maxcode)
+ return codecvt_base::error;
+ if (wc1 < 0x0080)
+ {
+ if (to_end-to_nxt < 1)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc1);
+ }
+ else if (wc1 < 0x0800)
+ {
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc1 >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x03F));
+ }
+ else if (wc1 < 0xD800)
+ {
+ if (to_end-to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
+ }
+ else if (wc1 < 0xDC00)
+ {
+ if (frm_end-frm_nxt < 2)
+ return codecvt_base::partial;
+ uint16_t wc2 = static_cast<uint16_t>(frm_nxt[1]);
+ if ((wc2 & 0xFC00) != 0xDC00)
+ return codecvt_base::error;
+ if (to_end-to_nxt < 4)
+ return codecvt_base::partial;
+ if ((((((unsigned long)wc1 & 0x03C0) >> 6) + 1) << 16) +
+ (((unsigned long)wc1 & 0x003F) << 10) + (wc2 & 0x03FF) > Maxcode)
+ return codecvt_base::error;
+ ++frm_nxt;
+ uint8_t z = ((wc1 & 0x03C0) >> 6) + 1;
+ *to_nxt++ = static_cast<uint8_t>(0xF0 | (z >> 2));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((z & 0x03) << 4) | ((wc1 & 0x003C) >> 2));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0003) << 4) | ((wc2 & 0x03C0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc2 & 0x003F));
+ }
+ else if (wc1 < 0xE000)
+ {
+ return codecvt_base::error;
+ }
+ else
+ {
+ if (to_end-to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
+ }
+ }
+ return codecvt_base::ok;
+}
+
+static
+codecvt_base::result
+utf8_to_utf16(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
+ uint16_t* to, uint16_t* to_end, uint16_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
+ frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt)
+ {
+ uint8_t c1 = *frm_nxt;
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ if (c1 < 0x80)
+ {
+ *to_nxt = static_cast<uint16_t>(c1);
+ ++frm_nxt;
+ }
+ else if (c1 < 0xC2)
+ {
+ return codecvt_base::error;
+ }
+ else if (c1 < 0xE0)
+ {
+ if (frm_end-frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6) | (c2 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 2;
+ }
+ else if (c1 < 0xF0)
+ {
+ if (frm_end-frm_nxt < 3)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ switch (c1)
+ {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return codecvt_base::error;
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12)
+ | ((c2 & 0x3F) << 6)
+ | (c3 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 3;
+ }
+ else if (c1 < 0xF5)
+ {
+ if (frm_end-frm_nxt < 4)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ uint8_t c4 = frm_nxt[3];
+ switch (c1)
+ {
+ case 0xF0:
+ if (!(0x90 <= c2 && c2 <= 0xBF))
+ return codecvt_base::error;
+ break;
+ case 0xF4:
+ if ((c2 & 0xF0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ if (((((unsigned long)c1 & 7) << 18) +
+ (((unsigned long)c2 & 0x3F) << 12) +
+ (((unsigned long)c3 & 0x3F) << 6) + (c4 & 0x3F)) > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint16_t>(
+ 0xD800
+ | (((((c1 & 0x07) << 2) | ((c2 & 0x30) >> 4)) - 1) << 6)
+ | ((c2 & 0x0F) << 2)
+ | ((c3 & 0x30) >> 4));
+ *++to_nxt = static_cast<uint16_t>(
+ 0xDC00
+ | ((c3 & 0x0F) << 6)
+ | (c4 & 0x3F));
+ frm_nxt += 4;
+ }
+ else
+ {
+ return codecvt_base::error;
+ }
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static
+codecvt_base::result
+utf8_to_utf16(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
+ uint32_t* to, uint32_t* to_end, uint32_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
+ frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt)
+ {
+ uint8_t c1 = *frm_nxt;
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ if (c1 < 0x80)
+ {
+ *to_nxt = static_cast<uint32_t>(c1);
+ ++frm_nxt;
+ }
+ else if (c1 < 0xC2)
+ {
+ return codecvt_base::error;
+ }
+ else if (c1 < 0xE0)
+ {
+ if (frm_end-frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6) | (c2 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(t);
+ frm_nxt += 2;
+ }
+ else if (c1 < 0xF0)
+ {
+ if (frm_end-frm_nxt < 3)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ switch (c1)
+ {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return codecvt_base::error;
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12)
+ | ((c2 & 0x3F) << 6)
+ | (c3 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(t);
+ frm_nxt += 3;
+ }
+ else if (c1 < 0xF5)
+ {
+ if (frm_end-frm_nxt < 4)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ uint8_t c4 = frm_nxt[3];
+ switch (c1)
+ {
+ case 0xF0:
+ if (!(0x90 <= c2 && c2 <= 0xBF))
+ return codecvt_base::error;
+ break;
+ case 0xF4:
+ if ((c2 & 0xF0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ if (((((unsigned long)c1 & 7) << 18) +
+ (((unsigned long)c2 & 0x3F) << 12) +
+ (((unsigned long)c3 & 0x3F) << 6) + (c4 & 0x3F)) > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(
+ 0xD800
+ | (((((c1 & 0x07) << 2) | ((c2 & 0x30) >> 4)) - 1) << 6)
+ | ((c2 & 0x0F) << 2)
+ | ((c3 & 0x30) >> 4));
+ *++to_nxt = static_cast<uint32_t>(
+ 0xDC00
+ | ((c3 & 0x0F) << 6)
+ | (c4 & 0x3F));
+ frm_nxt += 4;
+ }
+ else
+ {
+ return codecvt_base::error;
+ }
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static
+int
+utf8_to_utf16_length(const uint8_t* frm, const uint8_t* frm_end,
+ size_t mx, unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0))
+{
+ const uint8_t* frm_nxt = frm;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
+ frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (size_t nchar16_t = 0; frm_nxt < frm_end && nchar16_t < mx; ++nchar16_t)
+ {
+ uint8_t c1 = *frm_nxt;
+ if (c1 > Maxcode)
+ break;
+ if (c1 < 0x80)
+ {
+ ++frm_nxt;
+ }
+ else if (c1 < 0xC2)
+ {
+ break;
+ }
+ else if (c1 < 0xE0)
+ {
+ if ((frm_end-frm_nxt < 2) || (frm_nxt[1] & 0xC0) != 0x80)
+ break;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6) | (frm_nxt[1] & 0x3F));
+ if (t > Maxcode)
+ break;
+ frm_nxt += 2;
+ }
+ else if (c1 < 0xF0)
+ {
+ if (frm_end-frm_nxt < 3)
+ break;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12)
+ | ((c2 & 0x3F) << 6)
+ | (c3 & 0x3F));
+ switch (c1)
+ {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80)
+ break;
+ if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode)
+ break;
+ frm_nxt += 3;
+ }
+ else if (c1 < 0xF5)
+ {
+ if (frm_end-frm_nxt < 4 || mx-nchar16_t < 2)
+ break;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ uint8_t c4 = frm_nxt[3];
+ switch (c1)
+ {
+ case 0xF0:
+ if (!(0x90 <= c2 && c2 <= 0xBF))
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ case 0xF4:
+ if ((c2 & 0xF0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
+ break;
+ if (((((unsigned long)c1 & 7) << 18) +
+ (((unsigned long)c2 & 0x3F) << 12) +
+ (((unsigned long)c3 & 0x3F) << 6) + (c4 & 0x3F)) > Maxcode)
+ break;
+ ++nchar16_t;
+ frm_nxt += 4;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static
+codecvt_base::result
+ucs4_to_utf8(const uint32_t* frm, const uint32_t* frm_end, const uint32_t*& frm_nxt,
+ uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header)
+ {
+ if (to_end-to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xEF);
+ *to_nxt++ = static_cast<uint8_t>(0xBB);
+ *to_nxt++ = static_cast<uint8_t>(0xBF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt)
+ {
+ uint32_t wc = *frm_nxt;
+ if ((wc & 0xFFFFF800) == 0x00D800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (wc < 0x000080)
+ {
+ if (to_end-to_nxt < 1)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ }
+ else if (wc < 0x000800)
+ {
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x03F));
+ }
+ else if (wc < 0x010000)
+ {
+ if (to_end-to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x003F));
+ }
+ else // if (wc < 0x110000)
+ {
+ if (to_end-to_nxt < 4)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xF0 | (wc >> 18));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x03F000) >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x000FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x00003F));
+ }
+ }
+ return codecvt_base::ok;
+}
+
+static
+codecvt_base::result
+utf8_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
+ uint32_t* to, uint32_t* to_end, uint32_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
+ frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt)
+ {
+ uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
+ if (c1 < 0x80)
+ {
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(c1);
+ ++frm_nxt;
+ }
+ else if (c1 < 0xC2)
+ {
+ return codecvt_base::error;
+ }
+ else if (c1 < 0xE0)
+ {
+ if (frm_end-frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint32_t t = static_cast<uint32_t>(((c1 & 0x1F) << 6)
+ | (c2 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 2;
+ }
+ else if (c1 < 0xF0)
+ {
+ if (frm_end-frm_nxt < 3)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ switch (c1)
+ {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return codecvt_base::error;
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint32_t t = static_cast<uint32_t>(((c1 & 0x0F) << 12)
+ | ((c2 & 0x3F) << 6)
+ | (c3 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 3;
+ }
+ else if (c1 < 0xF5)
+ {
+ if (frm_end-frm_nxt < 4)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ uint8_t c4 = frm_nxt[3];
+ switch (c1)
+ {
+ case 0xF0:
+ if (!(0x90 <= c2 && c2 <= 0xBF))
+ return codecvt_base::error;
+ break;
+ case 0xF4:
+ if ((c2 & 0xF0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint32_t t = static_cast<uint32_t>(((c1 & 0x07) << 18)
+ | ((c2 & 0x3F) << 12)
+ | ((c3 & 0x3F) << 6)
+ | (c4 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 4;
+ }
+ else
+ {
+ return codecvt_base::error;
+ }
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static
+int
+utf8_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
+ size_t mx, unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0))
+{
+ const uint8_t* frm_nxt = frm;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
+ frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (size_t nchar32_t = 0; frm_nxt < frm_end && nchar32_t < mx; ++nchar32_t)
+ {
+ uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
+ if (c1 < 0x80)
+ {
+ if (c1 > Maxcode)
+ break;
+ ++frm_nxt;
+ }
+ else if (c1 < 0xC2)
+ {
+ break;
+ }
+ else if (c1 < 0xE0)
+ {
+ if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80))
+ break;
+ if ((((c1 & 0x1F) << 6) | (frm_nxt[1] & 0x3F)) > Maxcode)
+ break;
+ frm_nxt += 2;
+ }
+ else if (c1 < 0xF0)
+ {
+ if (frm_end-frm_nxt < 3)
+ break;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ switch (c1)
+ {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80)
+ break;
+ if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode)
+ break;
+ frm_nxt += 3;
+ }
+ else if (c1 < 0xF5)
+ {
+ if (frm_end-frm_nxt < 4)
+ break;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ uint8_t c4 = frm_nxt[3];
+ switch (c1)
+ {
+ case 0xF0:
+ if (!(0x90 <= c2 && c2 <= 0xBF))
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ case 0xF4:
+ if ((c2 & 0xF0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
+ break;
+ uint32_t t = static_cast<uint32_t>(((c1 & 0x07) << 18)
+ | ((c2 & 0x3F) << 12)
+ | ((c3 & 0x3F) << 6)
+ | (c4 & 0x3F));
+ if ((((c1 & 0x07) << 18) | ((c2 & 0x3F) << 12) |
+ ((c3 & 0x3F) << 6) | (c4 & 0x3F)) > Maxcode)
+ break;
+ frm_nxt += 4;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static
+codecvt_base::result
+ucs2_to_utf8(const uint16_t* frm, const uint16_t* frm_end, const uint16_t*& frm_nxt,
+ uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header)
+ {
+ if (to_end-to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xEF);
+ *to_nxt++ = static_cast<uint8_t>(0xBB);
+ *to_nxt++ = static_cast<uint8_t>(0xBF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt)
+ {
+ uint16_t wc = *frm_nxt;
+ if ((wc & 0xF800) == 0xD800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (wc < 0x0080)
+ {
+ if (to_end-to_nxt < 1)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ }
+ else if (wc < 0x0800)
+ {
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x03F));
+ }
+ else // if (wc <= 0xFFFF)
+ {
+ if (to_end-to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x003F));
+ }
+ }
+ return codecvt_base::ok;
+}
+
+static
+codecvt_base::result
+utf8_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
+ uint16_t* to, uint16_t* to_end, uint16_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
+ frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt)
+ {
+ uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
+ if (c1 < 0x80)
+ {
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint16_t>(c1);
+ ++frm_nxt;
+ }
+ else if (c1 < 0xC2)
+ {
+ return codecvt_base::error;
+ }
+ else if (c1 < 0xE0)
+ {
+ if (frm_end-frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6)
+ | (c2 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 2;
+ }
+ else if (c1 < 0xF0)
+ {
+ if (frm_end-frm_nxt < 3)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ switch (c1)
+ {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return codecvt_base::error;
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12)
+ | ((c2 & 0x3F) << 6)
+ | (c3 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 3;
+ }
+ else
+ {
+ return codecvt_base::error;
+ }
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static
+int
+utf8_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
+ size_t mx, unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0))
+{
+ const uint8_t* frm_nxt = frm;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
+ frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (size_t nchar32_t = 0; frm_nxt < frm_end && nchar32_t < mx; ++nchar32_t)
+ {
+ uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
+ if (c1 < 0x80)
+ {
+ if (c1 > Maxcode)
+ break;
+ ++frm_nxt;
+ }
+ else if (c1 < 0xC2)
+ {
+ break;
+ }
+ else if (c1 < 0xE0)
+ {
+ if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80))
+ break;
+ if ((((c1 & 0x1F) << 6) | (frm_nxt[1] & 0x3F)) > Maxcode)
+ break;
+ frm_nxt += 2;
+ }
+ else if (c1 < 0xF0)
+ {
+ if (frm_end-frm_nxt < 3)
+ break;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ switch (c1)
+ {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80)
+ break;
+ if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode)
+ break;
+ frm_nxt += 3;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static
+codecvt_base::result
+ucs4_to_utf16be(const uint32_t* frm, const uint32_t* frm_end, const uint32_t*& frm_nxt,
+ uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header)
+ {
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xFE);
+ *to_nxt++ = static_cast<uint8_t>(0xFF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt)
+ {
+ uint32_t wc = *frm_nxt;
+ if ((wc & 0xFFFFF800) == 0x00D800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (wc < 0x010000)
+ {
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc >> 8);
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ }
+ else
+ {
+ if (to_end-to_nxt < 4)
+ return codecvt_base::partial;
+ uint16_t t = static_cast<uint16_t>(
+ 0xD800
+ | ((((wc & 0x1F0000) >> 16) - 1) << 6)
+ | ((wc & 0x00FC00) >> 10));
+ *to_nxt++ = static_cast<uint8_t>(t >> 8);
+ *to_nxt++ = static_cast<uint8_t>(t);
+ t = static_cast<uint16_t>(0xDC00 | (wc & 0x03FF));
+ *to_nxt++ = static_cast<uint8_t>(t >> 8);
+ *to_nxt++ = static_cast<uint8_t>(t);
+ }
+ }
+ return codecvt_base::ok;
+}
+
+static
+codecvt_base::result
+utf16be_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
+ uint32_t* to, uint32_t* to_end, uint32_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
+ frm_nxt += 2;
+ }
+ for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
+ {
+ uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1];
+ if ((c1 & 0xFC00) == 0xDC00)
+ return codecvt_base::error;
+ if ((c1 & 0xFC00) != 0xD800)
+ {
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(c1);
+ frm_nxt += 2;
+ }
+ else
+ {
+ if (frm_end-frm_nxt < 4)
+ return codecvt_base::partial;
+ uint16_t c2 = frm_nxt[2] << 8 | frm_nxt[3];
+ if ((c2 & 0xFC00) != 0xDC00)
+ return codecvt_base::error;
+ uint32_t t = static_cast<uint32_t>(
+ ((((c1 & 0x03C0) >> 6) + 1) << 16)
+ | ((c1 & 0x003F) << 10)
+ | (c2 & 0x03FF));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 4;
+ }
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static
+int
+utf16be_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
+ size_t mx, unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0))
+{
+ const uint8_t* frm_nxt = frm;
+ frm_nxt = frm;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
+ frm_nxt += 2;
+ }
+ for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t)
+ {
+ uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1];
+ if ((c1 & 0xFC00) == 0xDC00)
+ break;
+ if ((c1 & 0xFC00) != 0xD800)
+ {
+ if (c1 > Maxcode)
+ break;
+ frm_nxt += 2;
+ }
+ else
+ {
+ if (frm_end-frm_nxt < 4)
+ break;
+ uint16_t c2 = frm_nxt[2] << 8 | frm_nxt[3];
+ if ((c2 & 0xFC00) != 0xDC00)
+ break;
+ uint32_t t = static_cast<uint32_t>(
+ ((((c1 & 0x03C0) >> 6) + 1) << 16)
+ | ((c1 & 0x003F) << 10)
+ | (c2 & 0x03FF));
+ if (t > Maxcode)
+ break;
+ frm_nxt += 4;
+ }
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static
+codecvt_base::result
+ucs4_to_utf16le(const uint32_t* frm, const uint32_t* frm_end, const uint32_t*& frm_nxt,
+ uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header)
+ {
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xFF);
+ *to_nxt++ = static_cast<uint8_t>(0xFE);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt)
+ {
+ uint32_t wc = *frm_nxt;
+ if ((wc & 0xFFFFF800) == 0x00D800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (wc < 0x010000)
+ {
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ *to_nxt++ = static_cast<uint8_t>(wc >> 8);
+ }
+ else
+ {
+ if (to_end-to_nxt < 4)
+ return codecvt_base::partial;
+ uint16_t t = static_cast<uint16_t>(
+ 0xD800
+ | ((((wc & 0x1F0000) >> 16) - 1) << 6)
+ | ((wc & 0x00FC00) >> 10));
+ *to_nxt++ = static_cast<uint8_t>(t);
+ *to_nxt++ = static_cast<uint8_t>(t >> 8);
+ t = static_cast<uint16_t>(0xDC00 | (wc & 0x03FF));
+ *to_nxt++ = static_cast<uint8_t>(t);
+ *to_nxt++ = static_cast<uint8_t>(t >> 8);
+ }
+ }
+ return codecvt_base::ok;
+}
+
+static
+codecvt_base::result
+utf16le_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
+ uint32_t* to, uint32_t* to_end, uint32_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
+ frm_nxt += 2;
+ }
+ for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
+ {
+ uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0];
+ if ((c1 & 0xFC00) == 0xDC00)
+ return codecvt_base::error;
+ if ((c1 & 0xFC00) != 0xD800)
+ {
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(c1);
+ frm_nxt += 2;
+ }
+ else
+ {
+ if (frm_end-frm_nxt < 4)
+ return codecvt_base::partial;
+ uint16_t c2 = frm_nxt[3] << 8 | frm_nxt[2];
+ if ((c2 & 0xFC00) != 0xDC00)
+ return codecvt_base::error;
+ uint32_t t = static_cast<uint32_t>(
+ ((((c1 & 0x03C0) >> 6) + 1) << 16)
+ | ((c1 & 0x003F) << 10)
+ | (c2 & 0x03FF));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 4;
+ }
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static
+int
+utf16le_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
+ size_t mx, unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0))
+{
+ const uint8_t* frm_nxt = frm;
+ frm_nxt = frm;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
+ frm_nxt += 2;
+ }
+ for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t)
+ {
+ uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0];
+ if ((c1 & 0xFC00) == 0xDC00)
+ break;
+ if ((c1 & 0xFC00) != 0xD800)
+ {
+ if (c1 > Maxcode)
+ break;
+ frm_nxt += 2;
+ }
+ else
+ {
+ if (frm_end-frm_nxt < 4)
+ break;
+ uint16_t c2 = frm_nxt[3] << 8 | frm_nxt[2];
+ if ((c2 & 0xFC00) != 0xDC00)
+ break;
+ uint32_t t = static_cast<uint32_t>(
+ ((((c1 & 0x03C0) >> 6) + 1) << 16)
+ | ((c1 & 0x003F) << 10)
+ | (c2 & 0x03FF));
+ if (t > Maxcode)
+ break;
+ frm_nxt += 4;
+ }
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static
+codecvt_base::result
+ucs2_to_utf16be(const uint16_t* frm, const uint16_t* frm_end, const uint16_t*& frm_nxt,
+ uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header)
+ {
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xFE);
+ *to_nxt++ = static_cast<uint8_t>(0xFF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt)
+ {
+ uint16_t wc = *frm_nxt;
+ if ((wc & 0xF800) == 0xD800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc >> 8);
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ }
+ return codecvt_base::ok;
+}
+
+static
+codecvt_base::result
+utf16be_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
+ uint16_t* to, uint16_t* to_end, uint16_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
+ frm_nxt += 2;
+ }
+ for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
+ {
+ uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1];
+ if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = c1;
+ frm_nxt += 2;
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static
+int
+utf16be_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
+ size_t mx, unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0))
+{
+ const uint8_t* frm_nxt = frm;
+ frm_nxt = frm;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
+ frm_nxt += 2;
+ }
+ for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t)
+ {
+ uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1];
+ if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
+ break;
+ frm_nxt += 2;
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static
+codecvt_base::result
+ucs2_to_utf16le(const uint16_t* frm, const uint16_t* frm_end, const uint16_t*& frm_nxt,
+ uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header)
+ {
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xFF);
+ *to_nxt++ = static_cast<uint8_t>(0xFE);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt)
+ {
+ uint16_t wc = *frm_nxt;
+ if ((wc & 0xF800) == 0xD800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (to_end-to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ *to_nxt++ = static_cast<uint8_t>(wc >> 8);
+ }
+ return codecvt_base::ok;
+}
+
+static
+codecvt_base::result
+utf16le_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
+ uint16_t* to, uint16_t* to_end, uint16_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
+{
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
+ frm_nxt += 2;
+ }
+ for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
+ {
+ uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0];
+ if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = c1;
+ frm_nxt += 2;
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static
+int
+utf16le_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
+ size_t mx, unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0))
+{
+ const uint8_t* frm_nxt = frm;
+ frm_nxt = frm;
+ if (mode & consume_header)
+ {
+ if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
+ frm_nxt += 2;
+ }
+ for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t)
+ {
+ uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0];
+ if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
+ break;
+ frm_nxt += 2;
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+// template <> class codecvt<char16_t, char, mbstate_t>
+
+locale::id codecvt<char16_t, char, mbstate_t>::id;
+
+codecvt<char16_t, char, mbstate_t>::~codecvt()
+{
+}
+
+codecvt<char16_t, char, mbstate_t>::result
+codecvt<char16_t, char, mbstate_t>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+codecvt<char16_t, char, mbstate_t>::result
+codecvt<char16_t, char, mbstate_t>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+codecvt<char16_t, char, mbstate_t>::result
+codecvt<char16_t, char, mbstate_t>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+codecvt<char16_t, char, mbstate_t>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+codecvt<char16_t, char, mbstate_t>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+codecvt<char16_t, char, mbstate_t>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_utf16_length(_frm, _frm_end, mx);
+}
+
+int
+codecvt<char16_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
+{
+ return 4;
+}
+
+// template <> class codecvt<char32_t, char, mbstate_t>
+
+locale::id codecvt<char32_t, char, mbstate_t>::id;
+
+codecvt<char32_t, char, mbstate_t>::~codecvt()
+{
+}
+
+codecvt<char32_t, char, mbstate_t>::result
+codecvt<char32_t, char, mbstate_t>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+codecvt<char32_t, char, mbstate_t>::result
+codecvt<char32_t, char, mbstate_t>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+codecvt<char32_t, char, mbstate_t>::result
+codecvt<char32_t, char, mbstate_t>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+codecvt<char32_t, char, mbstate_t>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+codecvt<char32_t, char, mbstate_t>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+codecvt<char32_t, char, mbstate_t>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_ucs4_length(_frm, _frm_end, mx);
+}
+
+int
+codecvt<char32_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
+{
+ return 4;
+}
+
+// __codecvt_utf8<wchar_t>
+
+__codecvt_utf8<wchar_t>::result
+__codecvt_utf8<wchar_t>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8<wchar_t>::result
+__codecvt_utf8<wchar_t>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8<wchar_t>::result
+__codecvt_utf8<wchar_t>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf8<wchar_t>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf8<wchar_t>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf8<wchar_t>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf8<wchar_t>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 7;
+ return 4;
+}
+
+// __codecvt_utf8<char16_t>
+
+__codecvt_utf8<char16_t>::result
+__codecvt_utf8<char16_t>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs2_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8<char16_t>::result
+__codecvt_utf8<char16_t>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf8_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8<char16_t>::result
+__codecvt_utf8<char16_t>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf8<char16_t>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf8<char16_t>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf8<char16_t>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf8<char16_t>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 6;
+ return 3;
+}
+
+// __codecvt_utf8<char32_t>
+
+__codecvt_utf8<char32_t>::result
+__codecvt_utf8<char32_t>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8<char32_t>::result
+__codecvt_utf8<char32_t>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8<char32_t>::result
+__codecvt_utf8<char32_t>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf8<char32_t>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf8<char32_t>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf8<char32_t>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf8<char32_t>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 7;
+ return 4;
+}
+
+// __codecvt_utf16<wchar_t, false>
+
+__codecvt_utf16<wchar_t, false>::result
+__codecvt_utf16<wchar_t, false>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<wchar_t, false>::result
+__codecvt_utf16<wchar_t, false>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf16be_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<wchar_t, false>::result
+__codecvt_utf16<wchar_t, false>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf16<wchar_t, false>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf16<wchar_t, false>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf16<wchar_t, false>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf16be_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf16<wchar_t, false>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 6;
+ return 4;
+}
+
+// __codecvt_utf16<wchar_t, true>
+
+__codecvt_utf16<wchar_t, true>::result
+__codecvt_utf16<wchar_t, true>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<wchar_t, true>::result
+__codecvt_utf16<wchar_t, true>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf16le_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<wchar_t, true>::result
+__codecvt_utf16<wchar_t, true>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf16<wchar_t, true>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf16<wchar_t, true>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf16<wchar_t, true>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf16le_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf16<wchar_t, true>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 6;
+ return 4;
+}
+
+// __codecvt_utf16<char16_t, false>
+
+__codecvt_utf16<char16_t, false>::result
+__codecvt_utf16<char16_t, false>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs2_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char16_t, false>::result
+__codecvt_utf16<char16_t, false>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf16be_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char16_t, false>::result
+__codecvt_utf16<char16_t, false>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf16<char16_t, false>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf16<char16_t, false>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf16<char16_t, false>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf16be_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf16<char16_t, false>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 4;
+ return 2;
+}
+
+// __codecvt_utf16<char16_t, true>
+
+__codecvt_utf16<char16_t, true>::result
+__codecvt_utf16<char16_t, true>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs2_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char16_t, true>::result
+__codecvt_utf16<char16_t, true>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf16le_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char16_t, true>::result
+__codecvt_utf16<char16_t, true>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf16<char16_t, true>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf16<char16_t, true>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf16<char16_t, true>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf16le_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf16<char16_t, true>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 4;
+ return 2;
+}
+
+// __codecvt_utf16<char32_t, false>
+
+__codecvt_utf16<char32_t, false>::result
+__codecvt_utf16<char32_t, false>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char32_t, false>::result
+__codecvt_utf16<char32_t, false>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf16be_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char32_t, false>::result
+__codecvt_utf16<char32_t, false>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf16<char32_t, false>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf16<char32_t, false>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf16<char32_t, false>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf16be_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf16<char32_t, false>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 6;
+ return 4;
+}
+
+// __codecvt_utf16<char32_t, true>
+
+__codecvt_utf16<char32_t, true>::result
+__codecvt_utf16<char32_t, true>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char32_t, true>::result
+__codecvt_utf16<char32_t, true>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf16le_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char32_t, true>::result
+__codecvt_utf16<char32_t, true>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf16<char32_t, true>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf16<char32_t, true>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf16<char32_t, true>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf16le_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf16<char32_t, true>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 6;
+ return 4;
+}
+
+// __codecvt_utf8_utf16<wchar_t>
+
+__codecvt_utf8_utf16<wchar_t>::result
+__codecvt_utf8_utf16<wchar_t>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8_utf16<wchar_t>::result
+__codecvt_utf8_utf16<wchar_t>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8_utf16<wchar_t>::result
+__codecvt_utf8_utf16<wchar_t>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf8_utf16<wchar_t>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf8_utf16<wchar_t>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf8_utf16<wchar_t>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_utf16_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf8_utf16<wchar_t>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 7;
+ return 4;
+}
+
+// __codecvt_utf8_utf16<char16_t>
+
+__codecvt_utf8_utf16<char16_t>::result
+__codecvt_utf8_utf16<char16_t>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8_utf16<char16_t>::result
+__codecvt_utf8_utf16<char16_t>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8_utf16<char16_t>::result
+__codecvt_utf8_utf16<char16_t>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf8_utf16<char16_t>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf8_utf16<char16_t>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf8_utf16<char16_t>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_utf16_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf8_utf16<char16_t>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 7;
+ return 4;
+}
+
+// __codecvt_utf8_utf16<char32_t>
+
+__codecvt_utf8_utf16<char32_t>::result
+__codecvt_utf8_utf16<char32_t>::do_out(state_type&,
+ const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
+ extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
+{
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8_utf16<char32_t>::result
+__codecvt_utf8_utf16<char32_t>::do_in(state_type&,
+ const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
+ intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
+ _Maxcode_, _Mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8_utf16<char32_t>::result
+__codecvt_utf8_utf16<char32_t>::do_unshift(state_type&,
+ extern_type* to, extern_type*, extern_type*& to_nxt) const
+{
+ to_nxt = to;
+ return noconv;
+}
+
+int
+__codecvt_utf8_utf16<char32_t>::do_encoding() const _NOEXCEPT
+{
+ return 0;
+}
+
+bool
+__codecvt_utf8_utf16<char32_t>::do_always_noconv() const _NOEXCEPT
+{
+ return false;
+}
+
+int
+__codecvt_utf8_utf16<char32_t>::do_length(state_type&,
+ const extern_type* frm, const extern_type* frm_end, size_t mx) const
+{
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_utf16_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
+}
+
+int
+__codecvt_utf8_utf16<char32_t>::do_max_length() const _NOEXCEPT
+{
+ if (_Mode_ & consume_header)
+ return 7;
+ return 4;
+}
+
+// __narrow_to_utf8<16>
+
+__narrow_to_utf8<16>::~__narrow_to_utf8()
+{
+}
+
+// __narrow_to_utf8<32>
+
+__narrow_to_utf8<32>::~__narrow_to_utf8()
+{
+}
+
+// __widen_from_utf8<16>
+
+__widen_from_utf8<16>::~__widen_from_utf8()
+{
+}
+
+// __widen_from_utf8<32>
+
+__widen_from_utf8<32>::~__widen_from_utf8()
+{
+}
+
+// numpunct<char> && numpunct<wchar_t>
+
+locale::id numpunct< char >::id;
+locale::id numpunct<wchar_t>::id;
+
+numpunct<char>::numpunct(size_t refs)
+ : locale::facet(refs),
+ __decimal_point_('.'),
+ __thousands_sep_(',')
+{
+}
+
+numpunct<wchar_t>::numpunct(size_t refs)
+ : locale::facet(refs),
+ __decimal_point_(L'.'),
+ __thousands_sep_(L',')
+{
+}
+
+numpunct<char>::~numpunct()
+{
+}
+
+numpunct<wchar_t>::~numpunct()
+{
+}
+
+ char numpunct< char >::do_decimal_point() const {return __decimal_point_;}
+wchar_t numpunct<wchar_t>::do_decimal_point() const {return __decimal_point_;}
+
+ char numpunct< char >::do_thousands_sep() const {return __thousands_sep_;}
+wchar_t numpunct<wchar_t>::do_thousands_sep() const {return __thousands_sep_;}
+
+string numpunct< char >::do_grouping() const {return __grouping_;}
+string numpunct<wchar_t>::do_grouping() const {return __grouping_;}
+
+ string numpunct< char >::do_truename() const {return "true";}
+wstring numpunct<wchar_t>::do_truename() const {return L"true";}
+
+ string numpunct< char >::do_falsename() const {return "false";}
+wstring numpunct<wchar_t>::do_falsename() const {return L"false";}
+
+// numpunct_byname<char>
+
+numpunct_byname<char>::numpunct_byname(const char* nm, size_t refs)
+ : numpunct<char>(refs)
+{
+ __init(nm);
+}
+
+numpunct_byname<char>::numpunct_byname(const string& nm, size_t refs)
+ : numpunct<char>(refs)
+{
+ __init(nm.c_str());
+}
+
+numpunct_byname<char>::~numpunct_byname()
+{
+}
+
+void
+numpunct_byname<char>::__init(const char* nm)
+{
+ if (strcmp(nm, "C") != 0)
+ {
+ __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (loc == 0)
+ throw runtime_error("numpunct_byname<char>::numpunct_byname"
+ " failed to construct for " + string(nm));
+#endif // _LIBCPP_NO_EXCEPTIONS
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ lconv* lc = localeconv_l(loc.get());
+#else
+ lconv* lc = __localeconv_l(loc.get());
+#endif
+ if (*lc->decimal_point)
+ __decimal_point_ = *lc->decimal_point;
+ if (*lc->thousands_sep)
+ __thousands_sep_ = *lc->thousands_sep;
+ __grouping_ = lc->grouping;
+ // localization for truename and falsename is not available
+ }
+}
+
+// numpunct_byname<wchar_t>
+
+numpunct_byname<wchar_t>::numpunct_byname(const char* nm, size_t refs)
+ : numpunct<wchar_t>(refs)
+{
+ __init(nm);
+}
+
+numpunct_byname<wchar_t>::numpunct_byname(const string& nm, size_t refs)
+ : numpunct<wchar_t>(refs)
+{
+ __init(nm.c_str());
+}
+
+numpunct_byname<wchar_t>::~numpunct_byname()
+{
+}
+
+void
+numpunct_byname<wchar_t>::__init(const char* nm)
+{
+ if (strcmp(nm, "C") != 0)
+ {
+ __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (loc == 0)
+ throw runtime_error("numpunct_byname<char>::numpunct_byname"
+ " failed to construct for " + string(nm));
+#endif // _LIBCPP_NO_EXCEPTIONS
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ lconv* lc = localeconv_l(loc.get());
+#else
+ lconv* lc = __localeconv_l(loc.get());
+#endif
+ if (*lc->decimal_point)
+ __decimal_point_ = *lc->decimal_point;
+ if (*lc->thousands_sep)
+ __thousands_sep_ = *lc->thousands_sep;
+ __grouping_ = lc->grouping;
+ // locallization for truename and falsename is not available
+ }
+}
+
+// num_get helpers
+
+int
+__num_get_base::__get_base(ios_base& iob)
+{
+ ios_base::fmtflags __basefield = iob.flags() & ios_base::basefield;
+ if (__basefield == ios_base::oct)
+ return 8;
+ else if (__basefield == ios_base::hex)
+ return 16;
+ else if (__basefield == 0)
+ return 0;
+ return 10;
+}
+
+const char __num_get_base::__src[33] = "0123456789abcdefABCDEFxX+-pPiInN";
+
+void
+__check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
+ ios_base::iostate& __err)
+{
+ if (__grouping.size() != 0)
+ {
+ reverse(__g, __g_end);
+ const char* __ig = __grouping.data();
+ const char* __eg = __ig + __grouping.size();
+ for (unsigned* __r = __g; __r < __g_end-1; ++__r)
+ {
+ if (0 < *__ig && *__ig < numeric_limits<char>::max())
+ {
+ if (*__ig != *__r)
+ {
+ __err = ios_base::failbit;
+ return;
+ }
+ }
+ if (__eg - __ig > 1)
+ ++__ig;
+ }
+ if (0 < *__ig && *__ig < numeric_limits<char>::max())
+ {
+ if (*__ig < __g_end[-1] || __g_end[-1] == 0)
+ __err = ios_base::failbit;
+ }
+ }
+}
+
+void
+__num_put_base::__format_int(char* __fmtp, const char* __len, bool __signd,
+ ios_base::fmtflags __flags)
+{
+ if (__flags & ios_base::showpos)
+ *__fmtp++ = '+';
+ if (__flags & ios_base::showbase)
+ *__fmtp++ = '#';
+ while(*__len)
+ *__fmtp++ = *__len++;
+ if ((__flags & ios_base::basefield) == ios_base::oct)
+ *__fmtp = 'o';
+ else if ((__flags & ios_base::basefield) == ios_base::hex)
+ {
+ if (__flags & ios_base::uppercase)
+ *__fmtp = 'X';
+ else
+ *__fmtp = 'x';
+ }
+ else if (__signd)
+ *__fmtp = 'd';
+ else
+ *__fmtp = 'u';
+}
+
+bool
+__num_put_base::__format_float(char* __fmtp, const char* __len,
+ ios_base::fmtflags __flags)
+{
+ bool specify_precision = true;
+ if (__flags & ios_base::showpos)
+ *__fmtp++ = '+';
+ if (__flags & ios_base::showpoint)
+ *__fmtp++ = '#';
+ ios_base::fmtflags floatfield = __flags & ios_base::floatfield;
+ bool uppercase = __flags & ios_base::uppercase;
+ if (floatfield == (ios_base::fixed | ios_base::scientific))
+ specify_precision = false;
+ else
+ {
+ *__fmtp++ = '.';
+ *__fmtp++ = '*';
+ }
+ while(*__len)
+ *__fmtp++ = *__len++;
+ if (floatfield == ios_base::fixed)
+ {
+ if (uppercase)
+ *__fmtp = 'F';
+ else
+ *__fmtp = 'f';
+ }
+ else if (floatfield == ios_base::scientific)
+ {
+ if (uppercase)
+ *__fmtp = 'E';
+ else
+ *__fmtp = 'e';
+ }
+ else if (floatfield == (ios_base::fixed | ios_base::scientific))
+ {
+ if (uppercase)
+ *__fmtp = 'A';
+ else
+ *__fmtp = 'a';
+ }
+ else
+ {
+ if (uppercase)
+ *__fmtp = 'G';
+ else
+ *__fmtp = 'g';
+ }
+ return specify_precision;
+}
+
+char*
+__num_put_base::__identify_padding(char* __nb, char* __ne,
+ const ios_base& __iob)
+{
+ switch (__iob.flags() & ios_base::adjustfield)
+ {
+ case ios_base::internal:
+ if (__nb[0] == '-' || __nb[0] == '+')
+ return __nb+1;
+ if (__ne - __nb >= 2 && __nb[0] == '0'
+ && (__nb[1] == 'x' || __nb[1] == 'X'))
+ return __nb+2;
+ break;
+ case ios_base::left:
+ return __ne;
+ case ios_base::right:
+ default:
+ break;
+ }
+ return __nb;
+}
+
+// time_get
+
+static
+string*
+init_weeks()
+{
+ static string weeks[14];
+ weeks[0] = "Sunday";
+ weeks[1] = "Monday";
+ weeks[2] = "Tuesday";
+ weeks[3] = "Wednesday";
+ weeks[4] = "Thursday";
+ weeks[5] = "Friday";
+ weeks[6] = "Saturday";
+ weeks[7] = "Sun";
+ weeks[8] = "Mon";
+ weeks[9] = "Tue";
+ weeks[10] = "Wed";
+ weeks[11] = "Thu";
+ weeks[12] = "Fri";
+ weeks[13] = "Sat";
+ return weeks;
+}
+
+static
+wstring*
+init_wweeks()
+{
+ static wstring weeks[14];
+ weeks[0] = L"Sunday";
+ weeks[1] = L"Monday";
+ weeks[2] = L"Tuesday";
+ weeks[3] = L"Wednesday";
+ weeks[4] = L"Thursday";
+ weeks[5] = L"Friday";
+ weeks[6] = L"Saturday";
+ weeks[7] = L"Sun";
+ weeks[8] = L"Mon";
+ weeks[9] = L"Tue";
+ weeks[10] = L"Wed";
+ weeks[11] = L"Thu";
+ weeks[12] = L"Fri";
+ weeks[13] = L"Sat";
+ return weeks;
+}
+
+template <>
+const string*
+__time_get_c_storage<char>::__weeks() const
+{
+ static const string* weeks = init_weeks();
+ return weeks;
+}
+
+template <>
+const wstring*
+__time_get_c_storage<wchar_t>::__weeks() const
+{
+ static const wstring* weeks = init_wweeks();
+ return weeks;
+}
+
+static
+string*
+init_months()
+{
+ static string months[24];
+ months[0] = "January";
+ months[1] = "February";
+ months[2] = "March";
+ months[3] = "April";
+ months[4] = "May";
+ months[5] = "June";
+ months[6] = "July";
+ months[7] = "August";
+ months[8] = "September";
+ months[9] = "October";
+ months[10] = "November";
+ months[11] = "December";
+ months[12] = "Jan";
+ months[13] = "Feb";
+ months[14] = "Mar";
+ months[15] = "Apr";
+ months[16] = "May";
+ months[17] = "Jun";
+ months[18] = "Jul";
+ months[19] = "Aug";
+ months[20] = "Sep";
+ months[21] = "Oct";
+ months[22] = "Nov";
+ months[23] = "Dec";
+ return months;
+}
+
+static
+wstring*
+init_wmonths()
+{
+ static wstring months[24];
+ months[0] = L"January";
+ months[1] = L"February";
+ months[2] = L"March";
+ months[3] = L"April";
+ months[4] = L"May";
+ months[5] = L"June";
+ months[6] = L"July";
+ months[7] = L"August";
+ months[8] = L"September";
+ months[9] = L"October";
+ months[10] = L"November";
+ months[11] = L"December";
+ months[12] = L"Jan";
+ months[13] = L"Feb";
+ months[14] = L"Mar";
+ months[15] = L"Apr";
+ months[16] = L"May";
+ months[17] = L"Jun";
+ months[18] = L"Jul";
+ months[19] = L"Aug";
+ months[20] = L"Sep";
+ months[21] = L"Oct";
+ months[22] = L"Nov";
+ months[23] = L"Dec";
+ return months;
+}
+
+template <>
+const string*
+__time_get_c_storage<char>::__months() const
+{
+ static const string* months = init_months();
+ return months;
+}
+
+template <>
+const wstring*
+__time_get_c_storage<wchar_t>::__months() const
+{
+ static const wstring* months = init_wmonths();
+ return months;
+}
+
+static
+string*
+init_am_pm()
+{
+ static string am_pm[24];
+ am_pm[0] = "AM";
+ am_pm[1] = "PM";
+ return am_pm;
+}
+
+static
+wstring*
+init_wam_pm()
+{
+ static wstring am_pm[24];
+ am_pm[0] = L"AM";
+ am_pm[1] = L"PM";
+ return am_pm;
+}
+
+template <>
+const string*
+__time_get_c_storage<char>::__am_pm() const
+{
+ static const string* am_pm = init_am_pm();
+ return am_pm;
+}
+
+template <>
+const wstring*
+__time_get_c_storage<wchar_t>::__am_pm() const
+{
+ static const wstring* am_pm = init_wam_pm();
+ return am_pm;
+}
+
+template <>
+const string&
+__time_get_c_storage<char>::__x() const
+{
+ static string s("%m/%d/%y");
+ return s;
+}
+
+template <>
+const wstring&
+__time_get_c_storage<wchar_t>::__x() const
+{
+ static wstring s(L"%m/%d/%y");
+ return s;
+}
+
+template <>
+const string&
+__time_get_c_storage<char>::__X() const
+{
+ static string s("%H:%M:%S");
+ return s;
+}
+
+template <>
+const wstring&
+__time_get_c_storage<wchar_t>::__X() const
+{
+ static wstring s(L"%H:%M:%S");
+ return s;
+}
+
+template <>
+const string&
+__time_get_c_storage<char>::__c() const
+{
+ static string s("%a %b %d %H:%M:%S %Y");
+ return s;
+}
+
+template <>
+const wstring&
+__time_get_c_storage<wchar_t>::__c() const
+{
+ static wstring s(L"%a %b %d %H:%M:%S %Y");
+ return s;
+}
+
+template <>
+const string&
+__time_get_c_storage<char>::__r() const
+{
+ static string s("%I:%M:%S %p");
+ return s;
+}
+
+template <>
+const wstring&
+__time_get_c_storage<wchar_t>::__r() const
+{
+ static wstring s(L"%I:%M:%S %p");
+ return s;
+}
+
+// time_get_byname
+
+__time_get::__time_get(const char* nm)
+ : __loc_(newlocale(LC_ALL_MASK, nm, 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__loc_ == 0)
+ throw runtime_error("time_get_byname"
+ " failed to construct for " + string(nm));
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+__time_get::__time_get(const string& nm)
+ : __loc_(newlocale(LC_ALL_MASK, nm.c_str(), 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__loc_ == 0)
+ throw runtime_error("time_get_byname"
+ " failed to construct for " + nm);
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+__time_get::~__time_get()
+{
+ freelocale(__loc_);
+}
+
+template <>
+string
+__time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
+{
+ tm t;
+ t.tm_sec = 59;
+ t.tm_min = 55;
+ t.tm_hour = 23;
+ t.tm_mday = 31;
+ t.tm_mon = 11;
+ t.tm_year = 161;
+ t.tm_wday = 6;
+ t.tm_yday = 364;
+ t.tm_isdst = -1;
+ char buf[100];
+ char f[3] = {0};
+ f[0] = '%';
+ f[1] = fmt;
+ size_t n = strftime_l(buf, 100, f, &t, __loc_);
+ char* bb = buf;
+ char* be = buf + n;
+ string result;
+ while (bb != be)
+ {
+ if (ct.is(ctype_base::space, *bb))
+ {
+ result.push_back(' ');
+ for (++bb; bb != be && ct.is(ctype_base::space, *bb); ++bb)
+ ;
+ continue;
+ }
+ char* w = bb;
+ ios_base::iostate err = ios_base::goodbit;
+ int i = __scan_keyword(w, be, this->__weeks_, this->__weeks_+14,
+ ct, err, false)
+ - this->__weeks_;
+ if (i < 14)
+ {
+ result.push_back('%');
+ if (i < 7)
+ result.push_back('A');
+ else
+ result.push_back('a');
+ bb = w;
+ continue;
+ }
+ w = bb;
+ i = __scan_keyword(w, be, this->__months_, this->__months_+24,
+ ct, err, false)
+ - this->__months_;
+ if (i < 24)
+ {
+ result.push_back('%');
+ if (i < 12)
+ result.push_back('B');
+ else
+ result.push_back('b');
+ if (fmt == 'x' && ct.is(ctype_base::digit, this->__months_[i][0]))
+ result.back() = 'm';
+ bb = w;
+ continue;
+ }
+ if (this->__am_pm_[0].size() + this->__am_pm_[1].size() > 0)
+ {
+ w = bb;
+ i = __scan_keyword(w, be, this->__am_pm_, this->__am_pm_+2,
+ ct, err, false) - this->__am_pm_;
+ if (i < 2)
+ {
+ result.push_back('%');
+ result.push_back('p');
+ bb = w;
+ continue;
+ }
+ }
+ w = bb;
+ if (ct.is(ctype_base::digit, *bb))
+ {
+ switch(__get_up_to_n_digits(bb, be, err, ct, 4))
+ {
+ case 6:
+ result.push_back('%');
+ result.push_back('w');
+ break;
+ case 7:
+ result.push_back('%');
+ result.push_back('u');
+ break;
+ case 11:
+ result.push_back('%');
+ result.push_back('I');
+ break;
+ case 12:
+ result.push_back('%');
+ result.push_back('m');
+ break;
+ case 23:
+ result.push_back('%');
+ result.push_back('H');
+ break;
+ case 31:
+ result.push_back('%');
+ result.push_back('d');
+ break;
+ case 55:
+ result.push_back('%');
+ result.push_back('M');
+ break;
+ case 59:
+ result.push_back('%');
+ result.push_back('S');
+ break;
+ case 61:
+ result.push_back('%');
+ result.push_back('y');
+ break;
+ case 364:
+ result.push_back('%');
+ result.push_back('j');
+ break;
+ case 2061:
+ result.push_back('%');
+ result.push_back('Y');
+ break;
+ default:
+ for (; w != bb; ++w)
+ result.push_back(*w);
+ break;
+ }
+ continue;
+ }
+ if (*bb == '%')
+ {
+ result.push_back('%');
+ result.push_back('%');
+ ++bb;
+ continue;
+ }
+ result.push_back(*bb);
+ ++bb;
+ }
+ return result;
+}
+
+template <>
+wstring
+__time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
+{
+ tm t;
+ t.tm_sec = 59;
+ t.tm_min = 55;
+ t.tm_hour = 23;
+ t.tm_mday = 31;
+ t.tm_mon = 11;
+ t.tm_year = 161;
+ t.tm_wday = 6;
+ t.tm_yday = 364;
+ t.tm_isdst = -1;
+ char buf[100];
+ char f[3] = {0};
+ f[0] = '%';
+ f[1] = fmt;
+ size_t be = strftime_l(buf, 100, f, &t, __loc_);
+ wchar_t wbuf[100];
+ wchar_t* wbb = wbuf;
+ mbstate_t mb = {0};
+ const char* bb = buf;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ size_t i = mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#else
+ size_t i = __mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#endif
+ if (i == -1)
+ __throw_runtime_error("locale not supported");
+ wchar_t* wbe = wbb + i;
+ wstring result;
+ while (wbb != wbe)
+ {
+ if (ct.is(ctype_base::space, *wbb))
+ {
+ result.push_back(L' ');
+ for (++wbb; wbb != wbe && ct.is(ctype_base::space, *wbb); ++wbb)
+ ;
+ continue;
+ }
+ wchar_t* w = wbb;
+ ios_base::iostate err = ios_base::goodbit;
+ int i = __scan_keyword(w, wbe, this->__weeks_, this->__weeks_+14,
+ ct, err, false)
+ - this->__weeks_;
+ if (i < 14)
+ {
+ result.push_back(L'%');
+ if (i < 7)
+ result.push_back(L'A');
+ else
+ result.push_back(L'a');
+ wbb = w;
+ continue;
+ }
+ w = wbb;
+ i = __scan_keyword(w, wbe, this->__months_, this->__months_+24,
+ ct, err, false)
+ - this->__months_;
+ if (i < 24)
+ {
+ result.push_back(L'%');
+ if (i < 12)
+ result.push_back(L'B');
+ else
+ result.push_back(L'b');
+ if (fmt == 'x' && ct.is(ctype_base::digit, this->__months_[i][0]))
+ result.back() = L'm';
+ wbb = w;
+ continue;
+ }
+ if (this->__am_pm_[0].size() + this->__am_pm_[1].size() > 0)
+ {
+ w = wbb;
+ i = __scan_keyword(w, wbe, this->__am_pm_, this->__am_pm_+2,
+ ct, err, false) - this->__am_pm_;
+ if (i < 2)
+ {
+ result.push_back(L'%');
+ result.push_back(L'p');
+ wbb = w;
+ continue;
+ }
+ }
+ w = wbb;
+ if (ct.is(ctype_base::digit, *wbb))
+ {
+ switch(__get_up_to_n_digits(wbb, wbe, err, ct, 4))
+ {
+ case 6:
+ result.push_back(L'%');
+ result.push_back(L'w');
+ break;
+ case 7:
+ result.push_back(L'%');
+ result.push_back(L'u');
+ break;
+ case 11:
+ result.push_back(L'%');
+ result.push_back(L'I');
+ break;
+ case 12:
+ result.push_back(L'%');
+ result.push_back(L'm');
+ break;
+ case 23:
+ result.push_back(L'%');
+ result.push_back(L'H');
+ break;
+ case 31:
+ result.push_back(L'%');
+ result.push_back(L'd');
+ break;
+ case 55:
+ result.push_back(L'%');
+ result.push_back(L'M');
+ break;
+ case 59:
+ result.push_back(L'%');
+ result.push_back(L'S');
+ break;
+ case 61:
+ result.push_back(L'%');
+ result.push_back(L'y');
+ break;
+ case 364:
+ result.push_back(L'%');
+ result.push_back(L'j');
+ break;
+ case 2061:
+ result.push_back(L'%');
+ result.push_back(L'Y');
+ break;
+ default:
+ for (; w != wbb; ++w)
+ result.push_back(*w);
+ break;
+ }
+ continue;
+ }
+ if (ct.narrow(*wbb, 0) == '%')
+ {
+ result.push_back(L'%');
+ result.push_back(L'%');
+ ++wbb;
+ continue;
+ }
+ result.push_back(*wbb);
+ ++wbb;
+ }
+ return result;
+}
+
+template <>
+void
+__time_get_storage<char>::init(const ctype<char>& ct)
+{
+ tm t;
+ char buf[100];
+ // __weeks_
+ for (int i = 0; i < 7; ++i)
+ {
+ t.tm_wday = i;
+ strftime_l(buf, 100, "%A", &t, __loc_);
+ __weeks_[i] = buf;
+ strftime_l(buf, 100, "%a", &t, __loc_);
+ __weeks_[i+7] = buf;
+ }
+ // __months_
+ for (int i = 0; i < 12; ++i)
+ {
+ t.tm_mon = i;
+ strftime_l(buf, 100, "%B", &t, __loc_);
+ __months_[i] = buf;
+ strftime_l(buf, 100, "%b", &t, __loc_);
+ __months_[i+12] = buf;
+ }
+ // __am_pm_
+ t.tm_hour = 1;
+ strftime_l(buf, 100, "%p", &t, __loc_);
+ __am_pm_[0] = buf;
+ t.tm_hour = 13;
+ strftime_l(buf, 100, "%p", &t, __loc_);
+ __am_pm_[1] = buf;
+ __c_ = __analyze('c', ct);
+ __r_ = __analyze('r', ct);
+ __x_ = __analyze('x', ct);
+ __X_ = __analyze('X', ct);
+}
+
+template <>
+void
+__time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
+{
+ tm t = {0};
+ char buf[100];
+ size_t be;
+ wchar_t wbuf[100];
+ wchar_t* wbe;
+ mbstate_t mb = {0};
+ // __weeks_
+ for (int i = 0; i < 7; ++i)
+ {
+ t.tm_wday = i;
+ be = strftime_l(buf, 100, "%A", &t, __loc_);
+ mb = mbstate_t();
+ const char* bb = buf;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#else
+ size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __weeks_[i].assign(wbuf, wbe);
+ be = strftime_l(buf, 100, "%a", &t, __loc_);
+ mb = mbstate_t();
+ bb = buf;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#else
+ j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __weeks_[i+7].assign(wbuf, wbe);
+ }
+ // __months_
+ for (int i = 0; i < 12; ++i)
+ {
+ t.tm_mon = i;
+ be = strftime_l(buf, 100, "%B", &t, __loc_);
+ mb = mbstate_t();
+ const char* bb = buf;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#else
+ size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __months_[i].assign(wbuf, wbe);
+ be = strftime_l(buf, 100, "%b", &t, __loc_);
+ mb = mbstate_t();
+ bb = buf;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#else
+ j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __months_[i+12].assign(wbuf, wbe);
+ }
+ // __am_pm_
+ t.tm_hour = 1;
+ be = strftime_l(buf, 100, "%p", &t, __loc_);
+ mb = mbstate_t();
+ const char* bb = buf;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#else
+ size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __am_pm_[0].assign(wbuf, wbe);
+ t.tm_hour = 13;
+ be = strftime_l(buf, 100, "%p", &t, __loc_);
+ mb = mbstate_t();
+ bb = buf;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#else
+ j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __am_pm_[1].assign(wbuf, wbe);
+ __c_ = __analyze('c', ct);
+ __r_ = __analyze('r', ct);
+ __x_ = __analyze('x', ct);
+ __X_ = __analyze('X', ct);
+}
+
+template <class CharT>
+struct _LIBCPP_HIDDEN __time_get_temp
+ : public ctype_byname<CharT>
+{
+ explicit __time_get_temp(const char* nm)
+ : ctype_byname<CharT>(nm, 1) {}
+ explicit __time_get_temp(const string& nm)
+ : ctype_byname<CharT>(nm, 1) {}
+};
+
+template <>
+__time_get_storage<char>::__time_get_storage(const char* __nm)
+ : __time_get(__nm)
+{
+ const __time_get_temp<char> ct(__nm);
+ init(ct);
+}
+
+template <>
+__time_get_storage<char>::__time_get_storage(const string& __nm)
+ : __time_get(__nm)
+{
+ const __time_get_temp<char> ct(__nm);
+ init(ct);
+}
+
+template <>
+__time_get_storage<wchar_t>::__time_get_storage(const char* __nm)
+ : __time_get(__nm)
+{
+ const __time_get_temp<wchar_t> ct(__nm);
+ init(ct);
+}
+
+template <>
+__time_get_storage<wchar_t>::__time_get_storage(const string& __nm)
+ : __time_get(__nm)
+{
+ const __time_get_temp<wchar_t> ct(__nm);
+ init(ct);
+}
+
+template <>
+time_base::dateorder
+__time_get_storage<char>::__do_date_order() const
+{
+ unsigned i;
+ for (i = 0; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ ++i;
+ switch (__x_[i])
+ {
+ case 'y':
+ case 'Y':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ switch (__x_[i])
+ {
+ case 'm':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == 'd')
+ return time_base::ymd;
+ break;
+ case 'd':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == 'm')
+ return time_base::ydm;
+ break;
+ }
+ break;
+ case 'm':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == 'd')
+ {
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == 'y' || __x_[i] == 'Y')
+ return time_base::mdy;
+ break;
+ }
+ break;
+ case 'd':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == 'm')
+ {
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == 'y' || __x_[i] == 'Y')
+ return time_base::dmy;
+ break;
+ }
+ break;
+ }
+ return time_base::no_order;
+}
+
+template <>
+time_base::dateorder
+__time_get_storage<wchar_t>::__do_date_order() const
+{
+ unsigned i;
+ for (i = 0; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ ++i;
+ switch (__x_[i])
+ {
+ case L'y':
+ case L'Y':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ switch (__x_[i])
+ {
+ case L'm':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == L'd')
+ return time_base::ymd;
+ break;
+ case L'd':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == L'm')
+ return time_base::ydm;
+ break;
+ }
+ break;
+ case L'm':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == L'd')
+ {
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == L'y' || __x_[i] == L'Y')
+ return time_base::mdy;
+ break;
+ }
+ break;
+ case L'd':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == L'm')
+ {
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == L'y' || __x_[i] == L'Y')
+ return time_base::dmy;
+ break;
+ }
+ break;
+ }
+ return time_base::no_order;
+}
+
+// time_put
+
+__time_put::__time_put(const char* nm)
+ : __loc_(newlocale(LC_ALL_MASK, nm, 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__loc_ == 0)
+ throw runtime_error("time_put_byname"
+ " failed to construct for " + string(nm));
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+__time_put::__time_put(const string& nm)
+ : __loc_(newlocale(LC_ALL_MASK, nm.c_str(), 0))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (__loc_ == 0)
+ throw runtime_error("time_put_byname"
+ " failed to construct for " + nm);
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+__time_put::~__time_put()
+{
+ if (__loc_)
+ freelocale(__loc_);
+}
+
+void
+__time_put::__do_put(char* __nb, char*& __ne, const tm* __tm,
+ char __fmt, char __mod) const
+{
+ char fmt[] = {'%', __fmt, __mod, 0};
+ if (__mod != 0)
+ swap(fmt[1], fmt[2]);
+ size_t n = strftime_l(__nb, __ne-__nb, fmt, __tm, __loc_);
+ __ne = __nb + n;
+}
+
+void
+__time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
+ char __fmt, char __mod) const
+{
+ char __nar[100];
+ char* __ne = __nar + 100;
+ __do_put(__nar, __ne, __tm, __fmt, __mod);
+ mbstate_t mb = {0};
+ const char* __nb = __nar;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ size_t j = mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
+#else
+ size_t j = __mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ __we = __wb + j;
+}
+
+// moneypunct_byname
+
+static
+void
+__init_pat(money_base::pattern& pat, char cs_precedes, char sep_by_space, char sign_posn)
+{
+ const char sign = static_cast<char>(money_base::sign);
+ const char space = static_cast<char>(money_base::space);
+ const char none = static_cast<char>(money_base::none);
+ const char symbol = static_cast<char>(money_base::symbol);
+ const char value = static_cast<char>(money_base::value);
+ switch (cs_precedes)
+ {
+ case 0:
+ switch (sign_posn)
+ {
+ case 0:
+ pat.field[0] = sign;
+ pat.field[1] = value;
+ pat.field[3] = symbol;
+ switch (sep_by_space)
+ {
+ case 0:
+ pat.field[2] = none;
+ return;
+ case 1:
+ case 2:
+ pat.field[2] = space;
+ return;
+ default:
+ break;
+ }
+ break;
+ case 1:
+ pat.field[0] = sign;
+ pat.field[3] = symbol;
+ switch (sep_by_space)
+ {
+ case 0:
+ pat.field[1] = value;
+ pat.field[2] = none;
+ return;
+ case 1:
+ pat.field[1] = value;
+ pat.field[2] = space;
+ return;
+ case 2:
+ pat.field[1] = space;
+ pat.field[2] = value;
+ return;
+ default:
+ break;
+ }
+ break;
+ case 2:
+ pat.field[0] = value;
+ pat.field[3] = sign;
+ switch (sep_by_space)
+ {
+ case 0:
+ pat.field[1] = none;
+ pat.field[2] = symbol;
+ return;
+ case 1:
+ pat.field[1] = space;
+ pat.field[2] = symbol;
+ return;
+ case 2:
+ pat.field[1] = symbol;
+ pat.field[2] = space;
+ return;
+ default:
+ break;
+ }
+ break;
+ case 3:
+ pat.field[0] = value;
+ pat.field[3] = symbol;
+ switch (sep_by_space)
+ {
+ case 0:
+ pat.field[1] = none;
+ pat.field[2] = sign;
+ return;
+ case 1:
+ pat.field[1] = space;
+ pat.field[2] = sign;
+ return;
+ case 2:
+ pat.field[1] = sign;
+ pat.field[2] = space;
+ return;
+ default:
+ break;
+ }
+ break;
+ case 4:
+ pat.field[0] = value;
+ pat.field[3] = sign;
+ switch (sep_by_space)
+ {
+ case 0:
+ pat.field[1] = none;
+ pat.field[2] = symbol;
+ return;
+ case 1:
+ pat.field[1] = space;
+ pat.field[2] = symbol;
+ return;
+ case 2:
+ pat.field[1] = symbol;
+ pat.field[2] = space;
+ return;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case 1:
+ switch (sign_posn)
+ {
+ case 0:
+ pat.field[0] = sign;
+ pat.field[1] = symbol;
+ pat.field[3] = value;
+ switch (sep_by_space)
+ {
+ case 0:
+ pat.field[2] = none;
+ return;
+ case 1:
+ case 2:
+ pat.field[2] = space;
+ return;
+ default:
+ break;
+ }
+ break;
+ case 1:
+ pat.field[0] = sign;
+ pat.field[3] = value;
+ switch (sep_by_space)
+ {
+ case 0:
+ pat.field[1] = symbol;
+ pat.field[2] = none;
+ return;
+ case 1:
+ pat.field[1] = symbol;
+ pat.field[2] = space;
+ return;
+ case 2:
+ pat.field[1] = space;
+ pat.field[2] = symbol;
+ return;
+ default:
+ break;
+ }
+ break;
+ case 2:
+ pat.field[0] = symbol;
+ pat.field[3] = sign;
+ switch (sep_by_space)
+ {
+ case 0:
+ pat.field[1] = none;
+ pat.field[2] = value;
+ return;
+ case 1:
+ pat.field[1] = space;
+ pat.field[2] = value;
+ return;
+ case 2:
+ pat.field[1] = value;
+ pat.field[2] = space;
+ return;
+ default:
+ break;
+ }
+ break;
+ case 3:
+ pat.field[0] = sign;
+ pat.field[3] = value;
+ switch (sep_by_space)
+ {
+ case 0:
+ pat.field[1] = symbol;
+ pat.field[2] = none;
+ return;
+ case 1:
+ pat.field[1] = symbol;
+ pat.field[2] = space;
+ return;
+ case 2:
+ pat.field[1] = space;
+ pat.field[2] = symbol;
+ return;
+ default:
+ break;
+ }
+ break;
+ case 4:
+ pat.field[0] = symbol;
+ pat.field[3] = value;
+ switch (sep_by_space)
+ {
+ case 0:
+ pat.field[1] = sign;
+ pat.field[2] = none;
+ return;
+ case 1:
+ pat.field[1] = sign;
+ pat.field[2] = space;
+ return;
+ case 2:
+ pat.field[1] = space;
+ pat.field[2] = sign;
+ return;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ pat.field[0] = symbol;
+ pat.field[1] = sign;
+ pat.field[2] = none;
+ pat.field[3] = value;
+}
+
+template<>
+void
+moneypunct_byname<char, false>::init(const char* nm)
+{
+ typedef moneypunct<char, false> base;
+ __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (loc == 0)
+ throw runtime_error("moneypunct_byname"
+ " failed to construct for " + string(nm));
+#endif // _LIBCPP_NO_EXCEPTIONS
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ lconv* lc = localeconv_l(loc.get());
+#else
+ lconv* lc = __localeconv_l(loc.get());
+#endif
+ if (*lc->mon_decimal_point)
+ __decimal_point_ = *lc->mon_decimal_point;
+ else
+ __decimal_point_ = base::do_decimal_point();
+ if (*lc->mon_thousands_sep)
+ __thousands_sep_ = *lc->mon_thousands_sep;
+ else
+ __thousands_sep_ = base::do_thousands_sep();
+ __grouping_ = lc->mon_grouping;
+ __curr_symbol_ = lc->currency_symbol;
+ if (lc->frac_digits != CHAR_MAX)
+ __frac_digits_ = lc->frac_digits;
+ else
+ __frac_digits_ = base::do_frac_digits();
+ if (lc->p_sign_posn == 0)
+ __positive_sign_ = "()";
+ else
+ __positive_sign_ = lc->positive_sign;
+ if (lc->n_sign_posn == 0)
+ __negative_sign_ = "()";
+ else
+ __negative_sign_ = lc->negative_sign;
+ __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
+ __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
+}
+
+template<>
+void
+moneypunct_byname<char, true>::init(const char* nm)
+{
+ typedef moneypunct<char, true> base;
+ __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (loc == 0)
+ throw runtime_error("moneypunct_byname"
+ " failed to construct for " + string(nm));
+#endif // _LIBCPP_NO_EXCEPTIONS
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ lconv* lc = localeconv_l(loc.get());
+#else
+ lconv* lc = __localeconv_l(loc.get());
+#endif
+ if (*lc->mon_decimal_point)
+ __decimal_point_ = *lc->mon_decimal_point;
+ else
+ __decimal_point_ = base::do_decimal_point();
+ if (*lc->mon_thousands_sep)
+ __thousands_sep_ = *lc->mon_thousands_sep;
+ else
+ __thousands_sep_ = base::do_thousands_sep();
+ __grouping_ = lc->mon_grouping;
+ __curr_symbol_ = lc->int_curr_symbol;
+ if (lc->int_frac_digits != CHAR_MAX)
+ __frac_digits_ = lc->int_frac_digits;
+ else
+ __frac_digits_ = base::do_frac_digits();
+#if _WIN32
+ if (lc->p_sign_posn == 0)
+#else // _WIN32
+ if (lc->int_p_sign_posn == 0)
+#endif //_WIN32
+ __positive_sign_ = "()";
+ else
+ __positive_sign_ = lc->positive_sign;
+#if _WIN32
+ if(lc->n_sign_posn == 0)
+#else // _WIN32
+ if (lc->int_n_sign_posn == 0)
+#endif // _WIN32
+ __negative_sign_ = "()";
+ else
+ __negative_sign_ = lc->negative_sign;
+#if _WIN32
+ __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
+ __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
+#else
+ __init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn);
+ __init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn);
+#endif // _WIN32
+}
+
+template<>
+void
+moneypunct_byname<wchar_t, false>::init(const char* nm)
+{
+ typedef moneypunct<wchar_t, false> base;
+ __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (loc == 0)
+ throw runtime_error("moneypunct_byname"
+ " failed to construct for " + string(nm));
+#endif // _LIBCPP_NO_EXCEPTIONS
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ lconv* lc = localeconv_l(loc.get());
+#else
+ lconv* lc = __localeconv_l(loc.get());
+#endif
+ if (*lc->mon_decimal_point)
+ __decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
+ else
+ __decimal_point_ = base::do_decimal_point();
+ if (*lc->mon_thousands_sep)
+ __thousands_sep_ = static_cast<wchar_t>(*lc->mon_thousands_sep);
+ else
+ __thousands_sep_ = base::do_thousands_sep();
+ __grouping_ = lc->mon_grouping;
+ wchar_t wbuf[100];
+ mbstate_t mb = {0};
+ const char* bb = lc->currency_symbol;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#else
+ size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wchar_t* wbe = wbuf + j;
+ __curr_symbol_.assign(wbuf, wbe);
+ if (lc->frac_digits != CHAR_MAX)
+ __frac_digits_ = lc->frac_digits;
+ else
+ __frac_digits_ = base::do_frac_digits();
+ if (lc->p_sign_posn == 0)
+ __positive_sign_ = L"()";
+ else
+ {
+ mb = mbstate_t();
+ bb = lc->positive_sign;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#else
+ j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __positive_sign_.assign(wbuf, wbe);
+ }
+ if (lc->n_sign_posn == 0)
+ __negative_sign_ = L"()";
+ else
+ {
+ mb = mbstate_t();
+ bb = lc->negative_sign;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#else
+ j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __negative_sign_.assign(wbuf, wbe);
+ }
+ __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
+ __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
+}
+
+template<>
+void
+moneypunct_byname<wchar_t, true>::init(const char* nm)
+{
+ typedef moneypunct<wchar_t, true> base;
+ __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (loc == 0)
+ throw runtime_error("moneypunct_byname"
+ " failed to construct for " + string(nm));
+#endif // _LIBCPP_NO_EXCEPTIONS
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ lconv* lc = localeconv_l(loc.get());
+#else
+ lconv* lc = __localeconv_l(loc.get());
+#endif
+ if (*lc->mon_decimal_point)
+ __decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
+ else
+ __decimal_point_ = base::do_decimal_point();
+ if (*lc->mon_thousands_sep)
+ __thousands_sep_ = static_cast<wchar_t>(*lc->mon_thousands_sep);
+ else
+ __thousands_sep_ = base::do_thousands_sep();
+ __grouping_ = lc->mon_grouping;
+ wchar_t wbuf[100];
+ mbstate_t mb = {0};
+ const char* bb = lc->int_curr_symbol;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#else
+ size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wchar_t* wbe = wbuf + j;
+ __curr_symbol_.assign(wbuf, wbe);
+ if (lc->int_frac_digits != CHAR_MAX)
+ __frac_digits_ = lc->int_frac_digits;
+ else
+ __frac_digits_ = base::do_frac_digits();
+#if _WIN32
+ if (lc->p_sign_posn == 0)
+#else // _WIN32
+ if (lc->int_p_sign_posn == 0)
+#endif // _WIN32
+ __positive_sign_ = L"()";
+ else
+ {
+ mb = mbstate_t();
+ bb = lc->positive_sign;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#else
+ j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __positive_sign_.assign(wbuf, wbe);
+ }
+#if _WIN32
+ if (lc->n_sign_posn == 0)
+#else // _WIN32
+ if (lc->int_n_sign_posn == 0)
+#endif // _WIN32
+ __negative_sign_ = L"()";
+ else
+ {
+ mb = mbstate_t();
+ bb = lc->negative_sign;
+#ifdef _LIBCPP_STABLE_APPLE_ABI
+ j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#else
+ j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
+#endif
+ if (j == -1)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __negative_sign_.assign(wbuf, wbe);
+ }
+#if _WIN32
+ __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
+ __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
+#else // _WIN32
+ __init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn);
+ __init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn);
+#endif // _WIN32
+}
+
+void __do_nothing(void*) {}
+
+void __throw_runtime_error(const char* msg)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw runtime_error(msg);
+#endif
+}
+
+template class collate<char>;
+template class collate<wchar_t>;
+
+template class num_get<char>;
+template class num_get<wchar_t>;
+
+template class __num_get<char>;
+template class __num_get<wchar_t>;
+
+template class num_put<char>;
+template class num_put<wchar_t>;
+
+template class __num_put<char>;
+template class __num_put<wchar_t>;
+
+template class time_get<char>;
+template class time_get<wchar_t>;
+
+template class time_get_byname<char>;
+template class time_get_byname<wchar_t>;
+
+template class time_put<char>;
+template class time_put<wchar_t>;
+
+template class time_put_byname<char>;
+template class time_put_byname<wchar_t>;
+
+template class moneypunct<char, false>;
+template class moneypunct<char, true>;
+template class moneypunct<wchar_t, false>;
+template class moneypunct<wchar_t, true>;
+
+template class moneypunct_byname<char, false>;
+template class moneypunct_byname<char, true>;
+template class moneypunct_byname<wchar_t, false>;
+template class moneypunct_byname<wchar_t, true>;
+
+template class money_get<char>;
+template class money_get<wchar_t>;
+
+template class __money_get<char>;
+template class __money_get<wchar_t>;
+
+template class money_put<char>;
+template class money_put<wchar_t>;
+
+template class __money_put<char>;
+template class __money_put<wchar_t>;
+
+template class messages<char>;
+template class messages<wchar_t>;
+
+template class messages_byname<char>;
+template class messages_byname<wchar_t>;
+
+template class codecvt_byname<char, char, mbstate_t>;
+template class codecvt_byname<wchar_t, char, mbstate_t>;
+template class codecvt_byname<char16_t, char, mbstate_t>;
+template class codecvt_byname<char32_t, char, mbstate_t>;
+
+template class __vector_base_common<true>;
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/memory.cpp b/system/lib/libcxx/memory.cpp
new file mode 100644
index 00000000..cb5e5e7b
--- /dev/null
+++ b/system/lib/libcxx/memory.cpp
@@ -0,0 +1,168 @@
+//===------------------------ memory.cpp ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "memory"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace
+{
+
+template <class T>
+inline T
+increment(T& t) _NOEXCEPT
+{
+ return __sync_add_and_fetch(&t, 1);
+}
+
+template <class T>
+inline T
+decrement(T& t) _NOEXCEPT
+{
+ return __sync_add_and_fetch(&t, -1);
+}
+
+} // namespace
+
+const allocator_arg_t allocator_arg = allocator_arg_t();
+
+bad_weak_ptr::~bad_weak_ptr() _NOEXCEPT {}
+
+const char*
+bad_weak_ptr::what() const _NOEXCEPT
+{
+ return "bad_weak_ptr";
+}
+
+__shared_count::~__shared_count()
+{
+}
+
+void
+__shared_count::__add_shared() _NOEXCEPT
+{
+ increment(__shared_owners_);
+}
+
+bool
+__shared_count::__release_shared() _NOEXCEPT
+{
+ if (decrement(__shared_owners_) == -1)
+ {
+ __on_zero_shared();
+ return true;
+ }
+ return false;
+}
+
+__shared_weak_count::~__shared_weak_count()
+{
+}
+
+void
+__shared_weak_count::__add_shared() _NOEXCEPT
+{
+ __shared_count::__add_shared();
+}
+
+void
+__shared_weak_count::__add_weak() _NOEXCEPT
+{
+ increment(__shared_weak_owners_);
+}
+
+void
+__shared_weak_count::__release_shared() _NOEXCEPT
+{
+ if (__shared_count::__release_shared())
+ __release_weak();
+}
+
+void
+__shared_weak_count::__release_weak() _NOEXCEPT
+{
+ if (decrement(__shared_weak_owners_) == -1)
+ __on_zero_shared_weak();
+}
+
+__shared_weak_count*
+__shared_weak_count::lock() _NOEXCEPT
+{
+ long object_owners = __shared_owners_;
+ while (object_owners != -1)
+ {
+ if (__sync_bool_compare_and_swap(&__shared_owners_,
+ object_owners,
+ object_owners+1))
+ {
+ __add_weak();
+ return this;
+ }
+ object_owners = __shared_owners_;
+ }
+ return 0;
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+const void*
+__shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
+{
+ return 0;
+}
+
+#endif // _LIBCPP_NO_RTTI
+
+void
+declare_reachable(void*)
+{
+}
+
+void
+declare_no_pointers(char*, size_t)
+{
+}
+
+void
+undeclare_no_pointers(char*, size_t)
+{
+}
+
+pointer_safety
+get_pointer_safety() _NOEXCEPT
+{
+ return pointer_safety::relaxed;
+}
+
+void*
+__undeclare_reachable(void* p)
+{
+ return p;
+}
+
+void*
+align(size_t alignment, size_t size, void*& ptr, size_t& space)
+{
+ void* r = nullptr;
+ if (size <= space)
+ {
+ char* p1 = static_cast<char*>(ptr);
+ char* p2 = (char*)((size_t)(p1 + (alignment - 1)) & -alignment);
+ ptrdiff_t d = p2 - p1;
+ if (d <= space - size)
+ {
+ r = p2;
+ ptr = r;
+ space -= d;
+ }
+ }
+ return r;
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/mutex.cpp b/system/lib/libcxx/mutex.cpp
new file mode 100644
index 00000000..16817198
--- /dev/null
+++ b/system/lib/libcxx/mutex.cpp
@@ -0,0 +1,250 @@
+//===------------------------- mutex.cpp ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "mutex"
+#include "limits"
+#include "system_error"
+#include "cassert"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+const defer_lock_t defer_lock = {};
+const try_to_lock_t try_to_lock = {};
+const adopt_lock_t adopt_lock = {};
+
+mutex::~mutex()
+{
+ int e = pthread_mutex_destroy(&__m_);
+// assert(e == 0);
+}
+
+void
+mutex::lock()
+{
+ int ec = pthread_mutex_lock(&__m_);
+ if (ec)
+ __throw_system_error(ec, "mutex lock failed");
+}
+
+bool
+mutex::try_lock()
+{
+ return pthread_mutex_trylock(&__m_) == 0;
+}
+
+void
+mutex::unlock()
+{
+ int ec = pthread_mutex_unlock(&__m_);
+ assert(ec == 0);
+}
+
+// recursive_mutex
+
+recursive_mutex::recursive_mutex()
+{
+ pthread_mutexattr_t attr;
+ int ec = pthread_mutexattr_init(&attr);
+ if (ec)
+ goto fail;
+ ec = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ if (ec)
+ {
+ pthread_mutexattr_destroy(&attr);
+ goto fail;
+ }
+ ec = pthread_mutex_init(&__m_, &attr);
+ if (ec)
+ {
+ pthread_mutexattr_destroy(&attr);
+ goto fail;
+ }
+ ec = pthread_mutexattr_destroy(&attr);
+ if (ec)
+ {
+ pthread_mutex_destroy(&__m_);
+ goto fail;
+ }
+ return;
+fail:
+ __throw_system_error(ec, "recursive_mutex constructor failed");
+}
+
+recursive_mutex::~recursive_mutex()
+{
+ int e = pthread_mutex_destroy(&__m_);
+ assert(e == 0);
+}
+
+void
+recursive_mutex::lock()
+{
+ int ec = pthread_mutex_lock(&__m_);
+ if (ec)
+ __throw_system_error(ec, "recursive_mutex lock failed");
+}
+
+void
+recursive_mutex::unlock()
+{
+ int e = pthread_mutex_unlock(&__m_);
+ assert(e == 0);
+}
+
+bool
+recursive_mutex::try_lock()
+{
+ return pthread_mutex_trylock(&__m_) == 0;
+}
+
+// timed_mutex
+
+timed_mutex::timed_mutex()
+ : __locked_(false)
+{
+}
+
+timed_mutex::~timed_mutex()
+{
+ lock_guard<mutex> _(__m_);
+}
+
+void
+timed_mutex::lock()
+{
+ unique_lock<mutex> lk(__m_);
+ while (__locked_)
+ __cv_.wait(lk);
+ __locked_ = true;
+}
+
+bool
+timed_mutex::try_lock()
+{
+ unique_lock<mutex> lk(__m_, try_to_lock);
+ if (lk.owns_lock() && !__locked_)
+ {
+ __locked_ = true;
+ return true;
+ }
+ return false;
+}
+
+void
+timed_mutex::unlock()
+{
+ lock_guard<mutex> _(__m_);
+ __locked_ = false;
+ __cv_.notify_one();
+}
+
+// recursive_timed_mutex
+
+recursive_timed_mutex::recursive_timed_mutex()
+ : __count_(0),
+ __id_(0)
+{
+}
+
+recursive_timed_mutex::~recursive_timed_mutex()
+{
+ lock_guard<mutex> _(__m_);
+}
+
+void
+recursive_timed_mutex::lock()
+{
+ pthread_t id = pthread_self();
+ unique_lock<mutex> lk(__m_);
+ if (pthread_equal(id, __id_))
+ {
+ if (__count_ == numeric_limits<size_t>::max())
+ __throw_system_error(EAGAIN, "recursive_timed_mutex lock limit reached");
+ ++__count_;
+ return;
+ }
+ while (__count_ != 0)
+ __cv_.wait(lk);
+ __count_ = 1;
+ __id_ = id;
+}
+
+bool
+recursive_timed_mutex::try_lock()
+{
+ pthread_t id = pthread_self();
+ unique_lock<mutex> lk(__m_, try_to_lock);
+ if (lk.owns_lock() && (__count_ == 0 || pthread_equal(id, __id_)))
+ {
+ if (__count_ == numeric_limits<size_t>::max())
+ return false;
+ ++__count_;
+ __id_ = id;
+ return true;
+ }
+ return false;
+}
+
+void
+recursive_timed_mutex::unlock()
+{
+ unique_lock<mutex> lk(__m_);
+ if (--__count_ == 0)
+ {
+ __id_ = 0;
+ lk.unlock();
+ __cv_.notify_one();
+ }
+}
+
+// If dispatch_once_f ever handles C++ exceptions, and if one can get to it
+// without illegal macros (unexpected macros not beginning with _UpperCase or
+// __lowercase), and if it stops spinning waiting threads, then call_once should
+// call into dispatch_once_f instead of here. Relevant radar this code needs to
+// keep in sync with: 7741191.
+
+static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t cv = PTHREAD_COND_INITIALIZER;
+
+void
+__call_once(volatile unsigned long& flag, void* arg, void(*func)(void*))
+{
+ pthread_mutex_lock(&mut);
+ while (flag == 1)
+ pthread_cond_wait(&cv, &mut);
+ if (flag == 0)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ flag = 1;
+ pthread_mutex_unlock(&mut);
+ func(arg);
+ pthread_mutex_lock(&mut);
+ flag = ~0ul;
+ pthread_mutex_unlock(&mut);
+ pthread_cond_broadcast(&cv);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ pthread_mutex_lock(&mut);
+ flag = 0ul;
+ pthread_mutex_unlock(&mut);
+ pthread_cond_broadcast(&cv);
+ throw;
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ else
+ pthread_mutex_unlock(&mut);
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/new.cpp b/system/lib/libcxx/new.cpp
new file mode 100644
index 00000000..1e8ed88d
--- /dev/null
+++ b/system/lib/libcxx/new.cpp
@@ -0,0 +1,185 @@
+//===--------------------------- new.cpp ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdlib.h>
+
+#include "new"
+
+#if __APPLE__
+ #include <cxxabi.h>
+ // On Darwin, there are two STL shared libraries and a lower level ABI
+ // shared libray. The global holding the current new handler is
+ // in the ABI library and named __cxa_new_handler.
+ #define __new_handler __cxxabiapple::__cxa_new_handler
+#else // __APPLE__
+ static std::new_handler __new_handler;
+#endif
+
+// Implement all new and delete operators as weak definitions
+// in this shared library, so that they can be overriden by programs
+// that define non-weak copies of the functions.
+
+__attribute__((__weak__, __visibility__("default")))
+void *
+operator new(std::size_t size)
+#if !__has_feature(cxx_noexcept)
+ throw(std::bad_alloc)
+#endif
+{
+ if (size == 0)
+ size = 1;
+ void* p;
+ while ((p = ::malloc(size)) == 0)
+ {
+ // If malloc fails and there is a new_handler,
+ // call it to try free up memory.
+ std::new_handler nh = std::get_new_handler();
+ if (nh)
+ nh();
+ else
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw std::bad_alloc();
+#else
+ break;
+#endif
+ }
+ return p;
+}
+
+__attribute__((__weak__, __visibility__("default")))
+void*
+operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
+{
+ void* p = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ p = ::operator new(size);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+ return p;
+}
+
+__attribute__((__weak__, __visibility__("default")))
+void*
+operator new[](size_t size)
+#if !__has_feature(cxx_noexcept)
+ throw(std::bad_alloc)
+#endif
+{
+ return ::operator new(size);
+}
+
+__attribute__((__weak__, __visibility__("default")))
+void*
+operator new[](size_t size, const std::nothrow_t& nothrow) _NOEXCEPT
+{
+ void* p = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ p = ::operator new[](size);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+ return p;
+}
+
+__attribute__((__weak__, __visibility__("default")))
+void
+operator delete(void* ptr) _NOEXCEPT
+{
+ if (ptr)
+ ::free(ptr);
+}
+
+__attribute__((__weak__, __visibility__("default")))
+void
+operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
+{
+ ::operator delete(ptr);
+}
+
+__attribute__((__weak__, __visibility__("default")))
+void
+operator delete[] (void* ptr) _NOEXCEPT
+{
+ ::operator delete (ptr);
+}
+
+__attribute__((__weak__, __visibility__("default")))
+void
+operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
+{
+ ::operator delete[](ptr);
+}
+
+namespace std
+{
+
+const nothrow_t nothrow = {};
+
+new_handler
+set_new_handler(new_handler handler) _NOEXCEPT
+{
+ return __sync_lock_test_and_set(&__new_handler, handler);
+}
+
+new_handler
+get_new_handler() _NOEXCEPT
+{
+ return __sync_fetch_and_add(&__new_handler, (new_handler)0);
+}
+
+bad_alloc::bad_alloc() _NOEXCEPT
+{
+}
+
+bad_alloc::~bad_alloc() _NOEXCEPT
+{
+}
+
+const char*
+bad_alloc::what() const _NOEXCEPT
+{
+ return "std::bad_alloc";
+}
+
+bad_array_new_length::bad_array_new_length() _NOEXCEPT
+{
+}
+
+bad_array_new_length::~bad_array_new_length() _NOEXCEPT
+{
+}
+
+const char*
+bad_array_new_length::what() const _NOEXCEPT
+{
+ return "bad_array_new_length";
+}
+
+void
+__throw_bad_alloc()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw bad_alloc();
+#endif
+}
+
+} // std
diff --git a/system/lib/libcxx/random.cpp b/system/lib/libcxx/random.cpp
new file mode 100644
index 00000000..eca97bc8
--- /dev/null
+++ b/system/lib/libcxx/random.cpp
@@ -0,0 +1,45 @@
+//===-------------------------- random.cpp --------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "random"
+#include "system_error"
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+random_device::random_device(const string& __token)
+ : __f_(open(__token.c_str(), O_RDONLY))
+{
+ if (__f_ <= 0)
+ __throw_system_error(errno, ("random_device failed to open " + __token).c_str());
+}
+
+random_device::~random_device()
+{
+ close(__f_);
+}
+
+unsigned
+random_device::operator()()
+{
+ unsigned r;
+ read(__f_, &r, sizeof(r));
+ return r;
+}
+
+double
+random_device::entropy() const
+{
+ return 0;
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/readme.txt b/system/lib/libcxx/readme.txt
new file mode 100644
index 00000000..c7e41df9
--- /dev/null
+++ b/system/lib/libcxx/readme.txt
@@ -0,0 +1 @@
+These files are from libc++, svn revision 140465, Sep 24 2011
diff --git a/system/lib/libcxx/regex.cpp b/system/lib/libcxx/regex.cpp
new file mode 100644
index 00000000..65e9f886
--- /dev/null
+++ b/system/lib/libcxx/regex.cpp
@@ -0,0 +1,315 @@
+//===-------------------------- regex.cpp ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "regex"
+#include "algorithm"
+#include "iterator"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+static
+const char*
+make_error_type_string(regex_constants::error_type ecode)
+{
+ switch (ecode)
+ {
+ case regex_constants::error_collate:
+ return "The expression contained an invalid collating element name.";
+ case regex_constants::error_ctype:
+ return "The expression contained an invalid character class name.";
+ case regex_constants::error_escape:
+ return "The expression contained an invalid escaped character, or a "
+ "trailing escape.";
+ case regex_constants::error_backref:
+ return "The expression contained an invalid back reference.";
+ case regex_constants::error_brack:
+ return "The expression contained mismatched [ and ].";
+ case regex_constants::error_paren:
+ return "The expression contained mismatched ( and ).";
+ case regex_constants::error_brace:
+ return "The expression contained mismatched { and }.";
+ case regex_constants::error_badbrace:
+ return "The expression contained an invalid range in a {} expression.";
+ case regex_constants::error_range:
+ return "The expression contained an invalid character range, "
+ "such as [b-a] in most encodings.";
+ case regex_constants::error_space:
+ return "There was insufficient memory to convert the expression into "
+ "a finite state machine.";
+ case regex_constants::error_badrepeat:
+ return "One of *?+{ was not preceded by a valid regular expression.";
+ case regex_constants::error_complexity:
+ return "The complexity of an attempted match against a regular "
+ "expression exceeded a pre-set level.";
+ case regex_constants::error_stack:
+ return "There was insufficient memory to determine whether the regular "
+ "expression could match the specified character sequence.";
+ case regex_constants::__re_err_grammar:
+ return "An invalid regex grammar has been requested.";
+ case regex_constants::__re_err_empty:
+ return "An empty regex is not allowed in the POSIX grammar.";
+ default:
+ break;
+ }
+ return "Unknown error type";
+}
+
+regex_error::regex_error(regex_constants::error_type ecode)
+ : runtime_error(make_error_type_string(ecode)),
+ __code_(ecode)
+{}
+
+regex_error::~regex_error() throw() {}
+
+namespace {
+
+struct collationnames
+{
+ const char* elem_;
+ char char_;
+};
+
+const collationnames collatenames[] =
+{
+ {"A", 0x41},
+ {"B", 0x42},
+ {"C", 0x43},
+ {"D", 0x44},
+ {"E", 0x45},
+ {"F", 0x46},
+ {"G", 0x47},
+ {"H", 0x48},
+ {"I", 0x49},
+ {"J", 0x4a},
+ {"K", 0x4b},
+ {"L", 0x4c},
+ {"M", 0x4d},
+ {"N", 0x4e},
+ {"NUL", 0x00},
+ {"O", 0x4f},
+ {"P", 0x50},
+ {"Q", 0x51},
+ {"R", 0x52},
+ {"S", 0x53},
+ {"T", 0x54},
+ {"U", 0x55},
+ {"V", 0x56},
+ {"W", 0x57},
+ {"X", 0x58},
+ {"Y", 0x59},
+ {"Z", 0x5a},
+ {"a", 0x61},
+ {"alert", 0x07},
+ {"ampersand", 0x26},
+ {"apostrophe", 0x27},
+ {"asterisk", 0x2a},
+ {"b", 0x62},
+ {"backslash", 0x5c},
+ {"backspace", 0x08},
+ {"c", 0x63},
+ {"carriage-return", 0x0d},
+ {"circumflex", 0x5e},
+ {"circumflex-accent", 0x5e},
+ {"colon", 0x3a},
+ {"comma", 0x2c},
+ {"commercial-at", 0x40},
+ {"d", 0x64},
+ {"dollar-sign", 0x24},
+ {"e", 0x65},
+ {"eight", 0x38},
+ {"equals-sign", 0x3d},
+ {"exclamation-mark", 0x21},
+ {"f", 0x66},
+ {"five", 0x35},
+ {"form-feed", 0x0c},
+ {"four", 0x34},
+ {"full-stop", 0x2e},
+ {"g", 0x67},
+ {"grave-accent", 0x60},
+ {"greater-than-sign", 0x3e},
+ {"h", 0x68},
+ {"hyphen", 0x2d},
+ {"hyphen-minus", 0x2d},
+ {"i", 0x69},
+ {"j", 0x6a},
+ {"k", 0x6b},
+ {"l", 0x6c},
+ {"left-brace", 0x7b},
+ {"left-curly-bracket", 0x7b},
+ {"left-parenthesis", 0x28},
+ {"left-square-bracket", 0x5b},
+ {"less-than-sign", 0x3c},
+ {"low-line", 0x5f},
+ {"m", 0x6d},
+ {"n", 0x6e},
+ {"newline", 0x0a},
+ {"nine", 0x39},
+ {"number-sign", 0x23},
+ {"o", 0x6f},
+ {"one", 0x31},
+ {"p", 0x70},
+ {"percent-sign", 0x25},
+ {"period", 0x2e},
+ {"plus-sign", 0x2b},
+ {"q", 0x71},
+ {"question-mark", 0x3f},
+ {"quotation-mark", 0x22},
+ {"r", 0x72},
+ {"reverse-solidus", 0x5c},
+ {"right-brace", 0x7d},
+ {"right-curly-bracket", 0x7d},
+ {"right-parenthesis", 0x29},
+ {"right-square-bracket", 0x5d},
+ {"s", 0x73},
+ {"semicolon", 0x3b},
+ {"seven", 0x37},
+ {"six", 0x36},
+ {"slash", 0x2f},
+ {"solidus", 0x2f},
+ {"space", 0x20},
+ {"t", 0x74},
+ {"tab", 0x09},
+ {"three", 0x33},
+ {"tilde", 0x7e},
+ {"two", 0x32},
+ {"u", 0x75},
+ {"underscore", 0x5f},
+ {"v", 0x76},
+ {"vertical-line", 0x7c},
+ {"vertical-tab", 0x0b},
+ {"w", 0x77},
+ {"x", 0x78},
+ {"y", 0x79},
+ {"z", 0x7a},
+ {"zero", 0x30}
+};
+
+struct classnames
+{
+ const char* elem_;
+ ctype_base::mask mask_;
+};
+
+const classnames ClassNames[] =
+{
+ {"alnum", ctype_base::alnum},
+ {"alpha", ctype_base::alpha},
+ {"blank", ctype_base::blank},
+ {"cntrl", ctype_base::cntrl},
+ {"d", ctype_base::digit},
+ {"digit", ctype_base::digit},
+ {"graph", ctype_base::graph},
+ {"lower", ctype_base::lower},
+ {"print", ctype_base::print},
+ {"punct", ctype_base::punct},
+ {"s", ctype_base::space},
+ {"space", ctype_base::space},
+ {"upper", ctype_base::upper},
+ {"w", regex_traits<char>::__regex_word},
+ {"xdigit", ctype_base::xdigit}
+};
+
+struct use_strcmp
+{
+ bool operator()(const collationnames& x, const char* y)
+ {return strcmp(x.elem_, y) < 0;}
+ bool operator()(const classnames& x, const char* y)
+ {return strcmp(x.elem_, y) < 0;}
+};
+
+}
+
+string
+__get_collation_name(const char* s)
+{
+ const collationnames* i =
+ _VSTD::lower_bound(begin(collatenames), end(collatenames), s, use_strcmp());
+ string r;
+ if (i != end(collatenames) && strcmp(s, i->elem_) == 0)
+ r = char(i->char_);
+ return r;
+}
+
+ctype_base::mask
+__get_classname(const char* s, bool __icase)
+{
+ const classnames* i =
+ _VSTD::lower_bound(begin(ClassNames), end(ClassNames), s, use_strcmp());
+ ctype_base::mask r = 0;
+ if (i != end(ClassNames) && strcmp(s, i->elem_) == 0)
+ {
+ r = i->mask_;
+ if (r == regex_traits<char>::__regex_word)
+ r |= ctype_base::alnum | ctype_base::upper | ctype_base::lower;
+ else if (__icase)
+ {
+ if (r & (ctype_base::lower | ctype_base::upper))
+ r |= ctype_base::alpha;
+ }
+ }
+ return r;
+}
+
+template <>
+void
+__match_any_but_newline<char>::__exec(__state& __s) const
+{
+ if (__s.__current_ != __s.__last_)
+ {
+ switch (*__s.__current_)
+ {
+ case '\r':
+ case '\n':
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ break;
+ default:
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ break;
+ }
+ }
+ else
+ {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
+}
+
+template <>
+void
+__match_any_but_newline<wchar_t>::__exec(__state& __s) const
+{
+ if (__s.__current_ != __s.__last_)
+ {
+ switch (*__s.__current_)
+ {
+ case '\r':
+ case '\n':
+ case 0x2028:
+ case 0x2029:
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ break;
+ default:
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ break;
+ }
+ }
+ else
+ {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/stdexcept.cpp b/system/lib/libcxx/stdexcept.cpp
new file mode 100644
index 00000000..28917887
--- /dev/null
+++ b/system/lib/libcxx/stdexcept.cpp
@@ -0,0 +1,178 @@
+//===------------------------ stdexcept.cpp -------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "stdexcept"
+#include "new"
+#include "string"
+#include <cstdlib>
+#include <cstring>
+#include <cstdint>
+#include <cstddef>
+#include "system_error"
+
+// Note: optimize for size
+
+#pragma GCC visibility push(hidden)
+
+namespace
+{
+
+class __libcpp_nmstr
+{
+private:
+ const char* str_;
+
+ typedef std::size_t unused_t;
+ typedef std::int32_t count_t;
+
+ static const std::ptrdiff_t offset = static_cast<std::ptrdiff_t>(2*sizeof(unused_t) +
+ sizeof(count_t));
+
+ count_t& count() const _NOEXCEPT {return (count_t&)(*(str_ - sizeof(count_t)));}
+public:
+ explicit __libcpp_nmstr(const char* msg);
+ __libcpp_nmstr(const __libcpp_nmstr& s) _LIBCPP_CANTTHROW;
+ __libcpp_nmstr& operator=(const __libcpp_nmstr& s) _LIBCPP_CANTTHROW;
+ ~__libcpp_nmstr() _LIBCPP_CANTTHROW;
+ const char* c_str() const _NOEXCEPT {return str_;}
+};
+
+__libcpp_nmstr::__libcpp_nmstr(const char* msg)
+{
+ std::size_t len = strlen(msg);
+ str_ = new char[len + 1 + offset];
+ unused_t* c = (unused_t*)str_;
+ c[0] = c[1] = len;
+ str_ += offset;
+ count() = 0;
+ std::strcpy(const_cast<char*>(c_str()), msg);
+}
+
+inline
+__libcpp_nmstr::__libcpp_nmstr(const __libcpp_nmstr& s)
+ : str_(s.str_)
+{
+ __sync_add_and_fetch(&count(), 1);
+}
+
+__libcpp_nmstr&
+__libcpp_nmstr::operator=(const __libcpp_nmstr& s)
+{
+ const char* p = str_;
+ str_ = s.str_;
+ __sync_add_and_fetch(&count(), 1);
+ if (__sync_add_and_fetch((count_t*)(p-sizeof(count_t)), -1) < 0)
+ delete [] (p-offset);
+ return *this;
+}
+
+inline
+__libcpp_nmstr::~__libcpp_nmstr()
+{
+ if (__sync_add_and_fetch(&count(), -1) < 0)
+ delete [] (str_ - offset);
+}
+
+}
+
+#pragma GCC visibility pop
+
+namespace std // purposefully not using versioning namespace
+{
+
+logic_error::logic_error(const string& msg)
+{
+ __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
+ ::new(&s) __libcpp_nmstr(msg.c_str());
+}
+
+logic_error::logic_error(const char* msg)
+{
+ __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
+ ::new(&s) __libcpp_nmstr(msg);
+}
+
+logic_error::logic_error(const logic_error& le) _NOEXCEPT
+{
+ __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
+ ::new(&s) __libcpp_nmstr((const __libcpp_nmstr&)le.__imp_);
+}
+
+logic_error&
+logic_error::operator=(const logic_error& le) _NOEXCEPT
+{
+ __libcpp_nmstr& s1 = (__libcpp_nmstr&)__imp_;
+ const __libcpp_nmstr& s2 = (const __libcpp_nmstr&)le.__imp_;
+ s1 = s2;
+ return *this;
+}
+
+logic_error::~logic_error() _NOEXCEPT
+{
+ __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
+ s.~__libcpp_nmstr();
+}
+
+const char*
+logic_error::what() const _NOEXCEPT
+{
+ __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
+ return s.c_str();
+}
+
+runtime_error::runtime_error(const string& msg)
+{
+ __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
+ ::new(&s) __libcpp_nmstr(msg.c_str());
+}
+
+runtime_error::runtime_error(const char* msg)
+{
+ __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
+ ::new(&s) __libcpp_nmstr(msg);
+}
+
+runtime_error::runtime_error(const runtime_error& le) _NOEXCEPT
+{
+ __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
+ ::new(&s) __libcpp_nmstr((const __libcpp_nmstr&)le.__imp_);
+}
+
+runtime_error&
+runtime_error::operator=(const runtime_error& le) _NOEXCEPT
+{
+ __libcpp_nmstr& s1 = (__libcpp_nmstr&)__imp_;
+ const __libcpp_nmstr& s2 = (const __libcpp_nmstr&)le.__imp_;
+ s1 = s2;
+ return *this;
+}
+
+runtime_error::~runtime_error() _NOEXCEPT
+{
+ __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
+ s.~__libcpp_nmstr();
+}
+
+const char*
+runtime_error::what() const _NOEXCEPT
+{
+ __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
+ return s.c_str();
+}
+
+domain_error::~domain_error() _NOEXCEPT {}
+invalid_argument::~invalid_argument() _NOEXCEPT {}
+length_error::~length_error() _NOEXCEPT {}
+out_of_range::~out_of_range() _NOEXCEPT {}
+
+range_error::~range_error() _NOEXCEPT {}
+overflow_error::~overflow_error() _NOEXCEPT {}
+underflow_error::~underflow_error() _NOEXCEPT {}
+
+} // std
diff --git a/system/lib/libcxx/string.cpp b/system/lib/libcxx/string.cpp
new file mode 100644
index 00000000..1f58e365
--- /dev/null
+++ b/system/lib/libcxx/string.cpp
@@ -0,0 +1,679 @@
+//===------------------------- string.cpp ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "string"
+#include "cstdlib"
+#include "cwchar"
+#include "cerrno"
+#if _WIN32
+#include "support/win32/support.h"
+#endif // _WIN32
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template class __basic_string_common<true>;
+
+template class basic_string<char>;
+template class basic_string<wchar_t>;
+
+template
+ string
+ operator+<char, char_traits<char>, allocator<char> >(char const*, string const&);
+
+int
+stoi(const string& str, size_t* idx, int base)
+{
+ char* ptr;
+ const char* const p = str.c_str();
+ long r = strtol(p, &ptr, base);
+ if (r < numeric_limits<int>::min() || numeric_limits<int>::max() < r)
+ ptr = const_cast<char*>(p);
+ if (ptr == p)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (r == 0)
+ throw invalid_argument("stoi: no conversion");
+ throw out_of_range("stoi: out of range");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return static_cast<int>(r);
+}
+
+int
+stoi(const wstring& str, size_t* idx, int base)
+{
+ wchar_t* ptr;
+ const wchar_t* const p = str.c_str();
+ long r = wcstol(p, &ptr, base);
+ if (r < numeric_limits<int>::min() || numeric_limits<int>::max() < r)
+ ptr = const_cast<wchar_t*>(p);
+ if (ptr == p)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (r == 0)
+ throw invalid_argument("stoi: no conversion");
+ throw out_of_range("stoi: out of range");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return static_cast<int>(r);
+}
+
+long
+stol(const string& str, size_t* idx, int base)
+{
+ char* ptr;
+ const char* const p = str.c_str();
+ long r = strtol(p, &ptr, base);
+ if (ptr == p)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (r == 0)
+ throw invalid_argument("stol: no conversion");
+ throw out_of_range("stol: out of range");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+long
+stol(const wstring& str, size_t* idx, int base)
+{
+ wchar_t* ptr;
+ const wchar_t* const p = str.c_str();
+ long r = wcstol(p, &ptr, base);
+ if (ptr == p)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (r == 0)
+ throw invalid_argument("stol: no conversion");
+ throw out_of_range("stol: out of range");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+unsigned long
+stoul(const string& str, size_t* idx, int base)
+{
+ char* ptr;
+ const char* const p = str.c_str();
+ unsigned long r = strtoul(p, &ptr, base);
+ if (ptr == p)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (r == 0)
+ throw invalid_argument("stoul: no conversion");
+ throw out_of_range("stoul: out of range");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+unsigned long
+stoul(const wstring& str, size_t* idx, int base)
+{
+ wchar_t* ptr;
+ const wchar_t* const p = str.c_str();
+ unsigned long r = wcstoul(p, &ptr, base);
+ if (ptr == p)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (r == 0)
+ throw invalid_argument("stoul: no conversion");
+ throw out_of_range("stoul: out of range");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+long long
+stoll(const string& str, size_t* idx, int base)
+{
+ char* ptr;
+ const char* const p = str.c_str();
+ long long r = strtoll(p, &ptr, base);
+ if (ptr == p)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (r == 0)
+ throw invalid_argument("stoll: no conversion");
+ throw out_of_range("stoll: out of range");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+long long
+stoll(const wstring& str, size_t* idx, int base)
+{
+ wchar_t* ptr;
+ const wchar_t* const p = str.c_str();
+ long long r = wcstoll(p, &ptr, base);
+ if (ptr == p)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (r == 0)
+ throw invalid_argument("stoll: no conversion");
+ throw out_of_range("stoll: out of range");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+unsigned long long
+stoull(const string& str, size_t* idx, int base)
+{
+ char* ptr;
+ const char* const p = str.c_str();
+ unsigned long long r = strtoull(p, &ptr, base);
+ if (ptr == p)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (r == 0)
+ throw invalid_argument("stoull: no conversion");
+ throw out_of_range("stoull: out of range");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+unsigned long long
+stoull(const wstring& str, size_t* idx, int base)
+{
+ wchar_t* ptr;
+ const wchar_t* const p = str.c_str();
+ unsigned long long r = wcstoull(p, &ptr, base);
+ if (ptr == p)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (r == 0)
+ throw invalid_argument("stoull: no conversion");
+ throw out_of_range("stoull: out of range");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+float
+stof(const string& str, size_t* idx)
+{
+ char* ptr;
+ const char* const p = str.c_str();
+ int errno_save = errno;
+ errno = 0;
+ double r = strtod(p, &ptr);
+ swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (errno_save == ERANGE)
+ throw out_of_range("stof: out of range");
+ if (ptr == p)
+ throw invalid_argument("stof: no conversion");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return static_cast<float>(r);
+}
+
+float
+stof(const wstring& str, size_t* idx)
+{
+ wchar_t* ptr;
+ const wchar_t* const p = str.c_str();
+ int errno_save = errno;
+ errno = 0;
+ double r = wcstod(p, &ptr);
+ swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (errno_save == ERANGE)
+ throw out_of_range("stof: out of range");
+ if (ptr == p)
+ throw invalid_argument("stof: no conversion");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return static_cast<float>(r);
+}
+
+double
+stod(const string& str, size_t* idx)
+{
+ char* ptr;
+ const char* const p = str.c_str();
+ int errno_save = errno;
+ errno = 0;
+ double r = strtod(p, &ptr);
+ swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (errno_save == ERANGE)
+ throw out_of_range("stod: out of range");
+ if (ptr == p)
+ throw invalid_argument("stod: no conversion");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+double
+stod(const wstring& str, size_t* idx)
+{
+ wchar_t* ptr;
+ const wchar_t* const p = str.c_str();
+ int errno_save = errno;
+ errno = 0;
+ double r = wcstod(p, &ptr);
+ swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (errno_save == ERANGE)
+ throw out_of_range("stod: out of range");
+ if (ptr == p)
+ throw invalid_argument("stod: no conversion");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+long double
+stold(const string& str, size_t* idx)
+{
+ char* ptr;
+ const char* const p = str.c_str();
+ int errno_save = errno;
+ errno = 0;
+ long double r = strtold(p, &ptr);
+ swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (errno_save == ERANGE)
+ throw out_of_range("stold: out of range");
+ if (ptr == p)
+ throw invalid_argument("stold: no conversion");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+long double
+stold(const wstring& str, size_t* idx)
+{
+ wchar_t* ptr;
+ const wchar_t* const p = str.c_str();
+ int errno_save = errno;
+ errno = 0;
+ long double r = wcstold(p, &ptr);
+ swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (errno_save == ERANGE)
+ throw out_of_range("stold: out of range");
+ if (ptr == p)
+ throw invalid_argument("stold: no conversion");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+string to_string(int val)
+{
+ string s;
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = snprintf(&s[0], s.size()+1, "%d", val);
+ if (n2 <= s.size())
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(n2);
+ }
+ return s;
+}
+
+string to_string(unsigned val)
+{
+ string s;
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = snprintf(&s[0], s.size()+1, "%u", val);
+ if (n2 <= s.size())
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(n2);
+ }
+ return s;
+}
+
+string to_string(long val)
+{
+ string s;
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = snprintf(&s[0], s.size()+1, "%ld", val);
+ if (n2 <= s.size())
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(n2);
+ }
+ return s;
+}
+
+string to_string(unsigned long val)
+{
+ string s;
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = snprintf(&s[0], s.size()+1, "%lu", val);
+ if (n2 <= s.size())
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(n2);
+ }
+ return s;
+}
+
+string to_string(long long val)
+{
+ string s;
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = snprintf(&s[0], s.size()+1, "%lld", val);
+ if (n2 <= s.size())
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(n2);
+ }
+ return s;
+}
+
+string to_string(unsigned long long val)
+{
+ string s;
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = snprintf(&s[0], s.size()+1, "%llu", val);
+ if (n2 <= s.size())
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(n2);
+ }
+ return s;
+}
+
+string to_string(float val)
+{
+ string s;
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = snprintf(&s[0], s.size()+1, "%f", val);
+ if (n2 <= s.size())
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(n2);
+ }
+ return s;
+}
+
+string to_string(double val)
+{
+ string s;
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = snprintf(&s[0], s.size()+1, "%f", val);
+ if (n2 <= s.size())
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(n2);
+ }
+ return s;
+}
+
+string to_string(long double val)
+{
+ string s;
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = snprintf(&s[0], s.size()+1, "%Lf", val);
+ if (n2 <= s.size())
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(n2);
+ }
+ return s;
+}
+
+wstring to_wstring(int val)
+{
+ const size_t n = (numeric_limits<int>::digits / 3)
+ + ((numeric_limits<int>::digits % 3) != 0)
+ + 1;
+ wstring s(n, wchar_t());
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = swprintf(&s[0], s.size()+1, L"%d", val);
+ if (n2 > 0)
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(2*s.size());
+ s.resize(s.capacity());
+ }
+ return s;
+}
+
+wstring to_wstring(unsigned val)
+{
+ const size_t n = (numeric_limits<unsigned>::digits / 3)
+ + ((numeric_limits<unsigned>::digits % 3) != 0)
+ + 1;
+ wstring s(n, wchar_t());
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = swprintf(&s[0], s.size()+1, L"%u", val);
+ if (n2 > 0)
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(2*s.size());
+ s.resize(s.capacity());
+ }
+ return s;
+}
+
+wstring to_wstring(long val)
+{
+ const size_t n = (numeric_limits<long>::digits / 3)
+ + ((numeric_limits<long>::digits % 3) != 0)
+ + 1;
+ wstring s(n, wchar_t());
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = swprintf(&s[0], s.size()+1, L"%ld", val);
+ if (n2 > 0)
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(2*s.size());
+ s.resize(s.capacity());
+ }
+ return s;
+}
+
+wstring to_wstring(unsigned long val)
+{
+ const size_t n = (numeric_limits<unsigned long>::digits / 3)
+ + ((numeric_limits<unsigned long>::digits % 3) != 0)
+ + 1;
+ wstring s(n, wchar_t());
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = swprintf(&s[0], s.size()+1, L"%lu", val);
+ if (n2 > 0)
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(2*s.size());
+ s.resize(s.capacity());
+ }
+ return s;
+}
+
+wstring to_wstring(long long val)
+{
+ const size_t n = (numeric_limits<long long>::digits / 3)
+ + ((numeric_limits<long long>::digits % 3) != 0)
+ + 1;
+ wstring s(n, wchar_t());
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = swprintf(&s[0], s.size()+1, L"%lld", val);
+ if (n2 > 0)
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(2*s.size());
+ s.resize(s.capacity());
+ }
+ return s;
+}
+
+wstring to_wstring(unsigned long long val)
+{
+ const size_t n = (numeric_limits<unsigned long long>::digits / 3)
+ + ((numeric_limits<unsigned long long>::digits % 3) != 0)
+ + 1;
+ wstring s(n, wchar_t());
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = swprintf(&s[0], s.size()+1, L"%llu", val);
+ if (n2 > 0)
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(2*s.size());
+ s.resize(s.capacity());
+ }
+ return s;
+}
+
+wstring to_wstring(float val)
+{
+ const size_t n = 20;
+ wstring s(n, wchar_t());
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = swprintf(&s[0], s.size()+1, L"%f", val);
+ if (n2 > 0)
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(2*s.size());
+ s.resize(s.capacity());
+ }
+ return s;
+}
+
+wstring to_wstring(double val)
+{
+ const size_t n = 20;
+ wstring s(n, wchar_t());
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = swprintf(&s[0], s.size()+1, L"%f", val);
+ if (n2 > 0)
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(2*s.size());
+ s.resize(s.capacity());
+ }
+ return s;
+}
+
+wstring to_wstring(long double val)
+{
+ const size_t n = 20;
+ wstring s(n, wchar_t());
+ s.resize(s.capacity());
+ while (true)
+ {
+ int n2 = swprintf(&s[0], s.size()+1, L"%Lf", val);
+ if (n2 > 0)
+ {
+ s.resize(n2);
+ break;
+ }
+ s.resize(2*s.size());
+ s.resize(s.capacity());
+ }
+ return s;
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/strstream.cpp b/system/lib/libcxx/strstream.cpp
new file mode 100644
index 00000000..53139509
--- /dev/null
+++ b/system/lib/libcxx/strstream.cpp
@@ -0,0 +1,327 @@
+//===------------------------ strstream.cpp -------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "strstream"
+#include "algorithm"
+#include "climits"
+#include "cstring"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+strstreambuf::strstreambuf(streamsize __alsize)
+ : __strmode_(__dynamic),
+ __alsize_(__alsize),
+ __palloc_(nullptr),
+ __pfree_(nullptr)
+{
+}
+
+strstreambuf::strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*))
+ : __strmode_(__dynamic),
+ __alsize_(__default_alsize),
+ __palloc_(__palloc),
+ __pfree_(__pfree)
+{
+}
+
+void
+strstreambuf::__init(char* __gnext, streamsize __n, char* __pbeg)
+{
+ if (__n == 0)
+ __n = strlen(__gnext);
+ else if (__n < 0)
+ __n = INT_MAX;
+ if (__pbeg == nullptr)
+ setg(__gnext, __gnext, __gnext + __n);
+ else
+ {
+ setg(__gnext, __gnext, __pbeg);
+ setp(__pbeg, __pbeg + __n);
+ }
+}
+
+strstreambuf::strstreambuf(char* __gnext, streamsize __n, char* __pbeg)
+ : __strmode_(),
+ __alsize_(__default_alsize),
+ __palloc_(nullptr),
+ __pfree_(nullptr)
+{
+ __init(__gnext, __n, __pbeg);
+}
+
+strstreambuf::strstreambuf(const char* __gnext, streamsize __n)
+ : __strmode_(__constant),
+ __alsize_(__default_alsize),
+ __palloc_(nullptr),
+ __pfree_(nullptr)
+{
+ __init((char*)__gnext, __n, nullptr);
+}
+
+strstreambuf::strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg)
+ : __strmode_(),
+ __alsize_(__default_alsize),
+ __palloc_(nullptr),
+ __pfree_(nullptr)
+{
+ __init((char*)__gnext, __n, (char*)__pbeg);
+}
+
+strstreambuf::strstreambuf(const signed char* __gnext, streamsize __n)
+ : __strmode_(__constant),
+ __alsize_(__default_alsize),
+ __palloc_(nullptr),
+ __pfree_(nullptr)
+{
+ __init((char*)__gnext, __n, nullptr);
+}
+
+strstreambuf::strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg)
+ : __strmode_(),
+ __alsize_(__default_alsize),
+ __palloc_(nullptr),
+ __pfree_(nullptr)
+{
+ __init((char*)__gnext, __n, (char*)__pbeg);
+}
+
+strstreambuf::strstreambuf(const unsigned char* __gnext, streamsize __n)
+ : __strmode_(__constant),
+ __alsize_(__default_alsize),
+ __palloc_(nullptr),
+ __pfree_(nullptr)
+{
+ __init((char*)__gnext, __n, nullptr);
+}
+
+strstreambuf::~strstreambuf()
+{
+ if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
+ {
+ if (__pfree_)
+ __pfree_(eback());
+ else
+ delete [] eback();
+ }
+}
+
+void
+strstreambuf::swap(strstreambuf& __rhs)
+{
+ streambuf::swap(__rhs);
+ _VSTD::swap(__strmode_, __rhs.__strmode_);
+ _VSTD::swap(__alsize_, __rhs.__alsize_);
+ _VSTD::swap(__palloc_, __rhs.__palloc_);
+ _VSTD::swap(__pfree_, __rhs.__pfree_);
+}
+
+void
+strstreambuf::freeze(bool __freezefl)
+{
+ if (__strmode_ & __dynamic)
+ {
+ if (__freezefl)
+ __strmode_ |= __frozen;
+ else
+ __strmode_ &= ~__frozen;
+ }
+}
+
+char*
+strstreambuf::str()
+{
+ if (__strmode_ & __dynamic)
+ __strmode_ |= __frozen;
+ return eback();
+}
+
+int
+strstreambuf::pcount() const
+{
+ return static_cast<int>(pptr() - pbase());
+}
+
+strstreambuf::int_type
+strstreambuf::overflow(int_type __c)
+{
+ if (__c == EOF)
+ return int_type(0);
+ if (pptr() == epptr())
+ {
+ if ((__strmode_ & __dynamic) == 0 || (__strmode_ & __frozen) != 0)
+ return int_type(EOF);
+ streamsize old_size = (epptr() ? epptr() : egptr()) - eback();
+ streamsize new_size = max<streamsize>(__alsize_, 2*old_size);
+ char* buf = nullptr;
+ if (__palloc_)
+ buf = static_cast<char*>(__palloc_(new_size));
+ else
+ buf = new char[new_size];
+ if (buf == nullptr)
+ return int_type(EOF);
+ memcpy(buf, eback(), old_size);
+ ptrdiff_t ninp = gptr() - eback();
+ ptrdiff_t einp = egptr() - eback();
+ ptrdiff_t nout = pptr() - pbase();
+ ptrdiff_t eout = epptr() - pbase();
+ if (__strmode_ & __allocated)
+ {
+ if (__pfree_)
+ __pfree_(eback());
+ else
+ delete [] eback();
+ }
+ setg(buf, buf + ninp, buf + einp);
+ setp(buf + einp, buf + einp + eout);
+ pbump(nout);
+ __strmode_ |= __allocated;
+ }
+ *pptr() = static_cast<char>(__c);
+ pbump(1);
+ return int_type((unsigned char)__c);
+}
+
+strstreambuf::int_type
+strstreambuf::pbackfail(int_type __c)
+{
+ if (eback() == gptr())
+ return EOF;
+ if (__c == EOF)
+ {
+ gbump(-1);
+ return int_type(0);
+ }
+ if (__strmode_ & __constant)
+ {
+ if (gptr()[-1] == static_cast<char>(__c))
+ {
+ gbump(-1);
+ return __c;
+ }
+ return EOF;
+ }
+ gbump(-1);
+ *gptr() = static_cast<char>(__c);
+ return __c;
+}
+
+strstreambuf::int_type
+strstreambuf::underflow()
+{
+ if (gptr() == egptr())
+ {
+ if (egptr() >= pptr())
+ return EOF;
+ setg(eback(), gptr(), pptr());
+ }
+ return int_type((unsigned char)*gptr());
+}
+
+strstreambuf::pos_type
+strstreambuf::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which)
+{
+ off_type __p(-1);
+ bool pos_in = __which & ios::in;
+ bool pos_out = __which & ios::out;
+ bool legal = false;
+ switch (__way)
+ {
+ case ios::beg:
+ case ios::end:
+ if (pos_in || pos_out)
+ legal = true;
+ break;
+ case ios::cur:
+ if (pos_in != pos_out)
+ legal = true;
+ break;
+ }
+ if (pos_in && gptr() == nullptr)
+ legal = false;
+ if (pos_out && pptr() == nullptr)
+ legal = false;
+ if (legal)
+ {
+ off_type newoff;
+ char* seekhigh = epptr() ? epptr() : egptr();
+ switch (__way)
+ {
+ case ios::beg:
+ newoff = 0;
+ break;
+ case ios::cur:
+ newoff = (pos_in ? gptr() : pptr()) - eback();
+ break;
+ case ios::end:
+ newoff = seekhigh - eback();
+ break;
+ }
+ newoff += __off;
+ if (0 <= newoff && newoff <= seekhigh - eback())
+ {
+ char* newpos = eback() + newoff;
+ if (pos_in)
+ setg(eback(), newpos, _VSTD::max(newpos, egptr()));
+ if (pos_out)
+ {
+ // min(pbase, newpos), newpos, epptr()
+ __off = epptr() - newpos;
+ setp(min(pbase(), newpos), epptr());
+ pbump(static_cast<int>((epptr() - pbase()) - __off));
+ }
+ __p = newoff;
+ }
+ }
+ return pos_type(__p);
+}
+
+strstreambuf::pos_type
+strstreambuf::seekpos(pos_type __sp, ios_base::openmode __which)
+{
+ off_type __p(-1);
+ bool pos_in = __which & ios::in;
+ bool pos_out = __which & ios::out;
+ if (pos_in || pos_out)
+ {
+ if (!((pos_in && gptr() == nullptr) || (pos_out && pptr() == nullptr)))
+ {
+ off_type newoff = __sp;
+ char* seekhigh = epptr() ? epptr() : egptr();
+ if (0 <= newoff && newoff <= seekhigh - eback())
+ {
+ char* newpos = eback() + newoff;
+ if (pos_in)
+ setg(eback(), newpos, _VSTD::max(newpos, egptr()));
+ if (pos_out)
+ {
+ // min(pbase, newpos), newpos, epptr()
+ off_type temp = epptr() - newpos;
+ setp(min(pbase(), newpos), epptr());
+ pbump(static_cast<int>((epptr() - pbase()) - temp));
+ }
+ __p = newoff;
+ }
+ }
+ }
+ return pos_type(__p);
+}
+
+istrstream::~istrstream()
+{
+}
+
+ostrstream::~ostrstream()
+{
+}
+
+strstream::~strstream()
+{
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/symbols b/system/lib/libcxx/symbols
new file mode 100644
index 00000000..0cea51cb
--- /dev/null
+++ b/system/lib/libcxx/symbols
@@ -0,0 +1,3098 @@
+ W _ZGVNSt3__110moneypunctIcLb0EE2idE
+ W _ZGVNSt3__110moneypunctIcLb1EE2idE
+ W _ZGVNSt3__110moneypunctIwLb0EE2idE
+ W _ZGVNSt3__110moneypunctIwLb1EE2idE
+ W _ZGVNSt3__17collateIcE2idE
+ W _ZGVNSt3__17collateIwE2idE
+ W _ZGVNSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZGVNSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ W _ZGVNSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZGVNSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ W _ZGVNSt3__18messagesIcE2idE
+ W _ZGVNSt3__18messagesIwE2idE
+ W _ZGVNSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZGVNSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ W _ZGVNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZGVNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ W _ZGVNSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZGVNSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ W _ZGVNSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZGVNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ d _ZGVZNKSt3__120__time_get_c_storageIcE3__XEvE1s
+ d _ZGVZNKSt3__120__time_get_c_storageIcE3__cEvE1s
+ d _ZGVZNKSt3__120__time_get_c_storageIcE3__rEvE1s
+ d _ZGVZNKSt3__120__time_get_c_storageIcE3__xEvE1s
+ d _ZGVZNKSt3__120__time_get_c_storageIcE7__am_pmEvE5am_pm
+ d _ZGVZNKSt3__120__time_get_c_storageIcE7__weeksEvE5weeks
+ d _ZGVZNKSt3__120__time_get_c_storageIcE8__monthsEvE6months
+ d _ZGVZNKSt3__120__time_get_c_storageIwE3__XEvE1s
+ d _ZGVZNKSt3__120__time_get_c_storageIwE3__cEvE1s
+ d _ZGVZNKSt3__120__time_get_c_storageIwE3__rEvE1s
+ d _ZGVZNKSt3__120__time_get_c_storageIwE3__xEvE1s
+ d _ZGVZNKSt3__120__time_get_c_storageIwE7__am_pmEvE5am_pm
+ d _ZGVZNKSt3__120__time_get_c_storageIwE7__weeksEvE5weeks
+ d _ZGVZNKSt3__120__time_get_c_storageIwE8__monthsEvE6months
+ d _ZGVZNSt3__112_GLOBAL__N_13mutEvE1m
+ d _ZGVZNSt3__112__rs_defaultclEvE6__rs_g
+ d _ZGVZNSt3__115future_categoryEvE3__f
+ d _ZGVZNSt3__115system_categoryEvE1s
+ d _ZGVZNSt3__116generic_categoryEvE1s
+ d _ZGVZNSt3__117iostream_categoryEvE1s
+ d _ZGVZNSt3__119__thread_local_dataEvE3__p
+ d _ZGVZNSt3__16__clocEvE6result
+ d _ZGVZNSt3__16locale7classicEvE1c
+ d _ZGVZNSt3__16locale8__globalEvE1g
+ d _ZGVZNSt3__18__get_dbEvE2db
+ d _ZGVZNSt3__1L10init_am_pmEvE5am_pm
+ d _ZGVZNSt3__1L10init_weeksEvE5weeks
+ d _ZGVZNSt3__1L11init_monthsEvE6months
+ d _ZGVZNSt3__1L11init_wam_pmEvE5am_pm
+ d _ZGVZNSt3__1L11init_wweeksEvE5weeks
+ d _ZGVZNSt3__1L12init_wmonthsEvE6months
+ d _ZL19__terminate_handler
+ d _ZL20__unexpected_handler
+ T _ZN12_GLOBAL__N_114__libcpp_nmstrC1EPKc
+ T _ZN12_GLOBAL__N_114__libcpp_nmstrC1ERKS0_
+ t _ZN12_GLOBAL__N_114__libcpp_nmstrC2EPKc
+ t _ZN12_GLOBAL__N_114__libcpp_nmstrC2ERKS0_
+ T _ZN12_GLOBAL__N_114__libcpp_nmstrD1Ev
+ t _ZN12_GLOBAL__N_114__libcpp_nmstrD2Ev
+ t _ZN12_GLOBAL__N_114__libcpp_nmstraSERKS0_
+ t _ZNK12_GLOBAL__N_114__libcpp_nmstr5c_strEv
+ t _ZNK12_GLOBAL__N_114__libcpp_nmstr5countEv
+ T _ZNKSt10bad_typeid4whatEv
+ T _ZNKSt11logic_error4whatEv
+ T _ZNKSt13bad_exception4whatEv
+ T _ZNKSt13runtime_error4whatEv
+ T _ZNKSt16nested_exception14rethrow_nestedEv
+ T _ZNKSt3__110__time_put8__do_putEPcRS1_PK2tmcc
+ T _ZNKSt3__110__time_put8__do_putEPwRS1_PK2tmcc
+ T _ZNKSt3__110error_code7messageEv
+ W _ZNKSt3__110moneypunctIcLb0EE10neg_formatEv
+ W _ZNKSt3__110moneypunctIcLb0EE10pos_formatEv
+ W _ZNKSt3__110moneypunctIcLb0EE11curr_symbolEv
+ W _ZNKSt3__110moneypunctIcLb0EE11do_groupingEv
+ W _ZNKSt3__110moneypunctIcLb0EE11frac_digitsEv
+ W _ZNKSt3__110moneypunctIcLb0EE13decimal_pointEv
+ W _ZNKSt3__110moneypunctIcLb0EE13do_neg_formatEv
+ W _ZNKSt3__110moneypunctIcLb0EE13do_pos_formatEv
+ W _ZNKSt3__110moneypunctIcLb0EE13negative_signEv
+ W _ZNKSt3__110moneypunctIcLb0EE13positive_signEv
+ W _ZNKSt3__110moneypunctIcLb0EE13thousands_sepEv
+ W _ZNKSt3__110moneypunctIcLb0EE14do_curr_symbolEv
+ W _ZNKSt3__110moneypunctIcLb0EE14do_frac_digitsEv
+ W _ZNKSt3__110moneypunctIcLb0EE16do_decimal_pointEv
+ W _ZNKSt3__110moneypunctIcLb0EE16do_negative_signEv
+ W _ZNKSt3__110moneypunctIcLb0EE16do_positive_signEv
+ W _ZNKSt3__110moneypunctIcLb0EE16do_thousands_sepEv
+ W _ZNKSt3__110moneypunctIcLb0EE8groupingEv
+ W _ZNKSt3__110moneypunctIcLb1EE10neg_formatEv
+ W _ZNKSt3__110moneypunctIcLb1EE10pos_formatEv
+ W _ZNKSt3__110moneypunctIcLb1EE11curr_symbolEv
+ W _ZNKSt3__110moneypunctIcLb1EE11do_groupingEv
+ W _ZNKSt3__110moneypunctIcLb1EE11frac_digitsEv
+ W _ZNKSt3__110moneypunctIcLb1EE13decimal_pointEv
+ W _ZNKSt3__110moneypunctIcLb1EE13do_neg_formatEv
+ W _ZNKSt3__110moneypunctIcLb1EE13do_pos_formatEv
+ W _ZNKSt3__110moneypunctIcLb1EE13negative_signEv
+ W _ZNKSt3__110moneypunctIcLb1EE13positive_signEv
+ W _ZNKSt3__110moneypunctIcLb1EE13thousands_sepEv
+ W _ZNKSt3__110moneypunctIcLb1EE14do_curr_symbolEv
+ W _ZNKSt3__110moneypunctIcLb1EE14do_frac_digitsEv
+ W _ZNKSt3__110moneypunctIcLb1EE16do_decimal_pointEv
+ W _ZNKSt3__110moneypunctIcLb1EE16do_negative_signEv
+ W _ZNKSt3__110moneypunctIcLb1EE16do_positive_signEv
+ W _ZNKSt3__110moneypunctIcLb1EE16do_thousands_sepEv
+ W _ZNKSt3__110moneypunctIcLb1EE8groupingEv
+ W _ZNKSt3__110moneypunctIwLb0EE10neg_formatEv
+ W _ZNKSt3__110moneypunctIwLb0EE10pos_formatEv
+ W _ZNKSt3__110moneypunctIwLb0EE11curr_symbolEv
+ W _ZNKSt3__110moneypunctIwLb0EE11do_groupingEv
+ W _ZNKSt3__110moneypunctIwLb0EE11frac_digitsEv
+ W _ZNKSt3__110moneypunctIwLb0EE13decimal_pointEv
+ W _ZNKSt3__110moneypunctIwLb0EE13do_neg_formatEv
+ W _ZNKSt3__110moneypunctIwLb0EE13do_pos_formatEv
+ W _ZNKSt3__110moneypunctIwLb0EE13negative_signEv
+ W _ZNKSt3__110moneypunctIwLb0EE13positive_signEv
+ W _ZNKSt3__110moneypunctIwLb0EE13thousands_sepEv
+ W _ZNKSt3__110moneypunctIwLb0EE14do_curr_symbolEv
+ W _ZNKSt3__110moneypunctIwLb0EE14do_frac_digitsEv
+ W _ZNKSt3__110moneypunctIwLb0EE16do_decimal_pointEv
+ W _ZNKSt3__110moneypunctIwLb0EE16do_negative_signEv
+ W _ZNKSt3__110moneypunctIwLb0EE16do_positive_signEv
+ W _ZNKSt3__110moneypunctIwLb0EE16do_thousands_sepEv
+ W _ZNKSt3__110moneypunctIwLb0EE8groupingEv
+ W _ZNKSt3__110moneypunctIwLb1EE10neg_formatEv
+ W _ZNKSt3__110moneypunctIwLb1EE10pos_formatEv
+ W _ZNKSt3__110moneypunctIwLb1EE11curr_symbolEv
+ W _ZNKSt3__110moneypunctIwLb1EE11do_groupingEv
+ W _ZNKSt3__110moneypunctIwLb1EE11frac_digitsEv
+ W _ZNKSt3__110moneypunctIwLb1EE13decimal_pointEv
+ W _ZNKSt3__110moneypunctIwLb1EE13do_neg_formatEv
+ W _ZNKSt3__110moneypunctIwLb1EE13do_pos_formatEv
+ W _ZNKSt3__110moneypunctIwLb1EE13negative_signEv
+ W _ZNKSt3__110moneypunctIwLb1EE13positive_signEv
+ W _ZNKSt3__110moneypunctIwLb1EE13thousands_sepEv
+ W _ZNKSt3__110moneypunctIwLb1EE14do_curr_symbolEv
+ W _ZNKSt3__110moneypunctIwLb1EE14do_frac_digitsEv
+ W _ZNKSt3__110moneypunctIwLb1EE16do_decimal_pointEv
+ W _ZNKSt3__110moneypunctIwLb1EE16do_negative_signEv
+ W _ZNKSt3__110moneypunctIwLb1EE16do_positive_signEv
+ W _ZNKSt3__110moneypunctIwLb1EE16do_thousands_sepEv
+ W _ZNKSt3__110moneypunctIwLb1EE8groupingEv
+ T _ZNKSt3__111__libcpp_db12__comparableEPKvS2_
+ T _ZNKSt3__111__libcpp_db15__decrementableEPKv
+ T _ZNKSt3__111__libcpp_db15__find_c_from_iEPv
+ T _ZNKSt3__111__libcpp_db15__find_iteratorEPKv
+ T _ZNKSt3__111__libcpp_db15__subscriptableEPKvi
+ T _ZNKSt3__111__libcpp_db17__dereferenceableEPKv
+ T _ZNKSt3__111__libcpp_db17__find_c_and_lockEPv
+ T _ZNKSt3__111__libcpp_db6unlockEv
+ T _ZNKSt3__111__libcpp_db9__addableEPKvi
+ t _ZNKSt3__112_GLOBAL__N_111__fake_bindclEv
+ T _ZNKSt3__112__do_message7messageEi
+ T _ZNKSt3__112bad_weak_ptr4whatEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE12__invariantsEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE12find_last_ofEPKcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE12find_last_ofEPKcjj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE12find_last_ofERKS5_j
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE12find_last_ofEcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13__get_pointerEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13find_first_ofEPKcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13find_first_ofEPKcjj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13find_first_ofERKS5_j
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13find_first_ofEcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13get_allocatorEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE14__get_long_capEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE15__get_long_sizeEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE16__get_short_sizeEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE16find_last_not_ofEPKcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE16find_last_not_ofEPKcjj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE16find_last_not_ofERKS5_j
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE16find_last_not_ofEcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE17find_first_not_ofEPKcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE17find_first_not_ofEPKcjj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE17find_first_not_ofERKS5_j
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE17find_first_not_ofEcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE18__get_long_pointerEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE19__get_short_pointerEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE2atEj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE3endEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4backEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4cendEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcjj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4dataEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4findEPKcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4findEPKcjj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4findERKS5_j
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4findEcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4rendEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4sizeEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5beginEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5c_strEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5crendEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5emptyEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5frontEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5rfindEPKcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5rfindEPKcjj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5rfindERKS5_j
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5rfindEcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6cbeginEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6lengthEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6rbeginEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6substrEjj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7__allocEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEPKc
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareERKS5_
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEjjPKc
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEjjPKcj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEjjRKS5_
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEjjRKS5_jj
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7crbeginEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE8capacityEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE8max_sizeEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__is_longEv
+ W _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEixEj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE12__invariantsEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE12find_last_ofEPKwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE12find_last_ofEPKwjj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE12find_last_ofERKS5_j
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE12find_last_ofEwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13__get_pointerEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13find_first_ofEPKwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13find_first_ofEPKwjj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13find_first_ofERKS5_j
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13find_first_ofEwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13get_allocatorEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE14__get_long_capEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE15__get_long_sizeEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE16__get_short_sizeEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE16find_last_not_ofEPKwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE16find_last_not_ofEPKwjj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE16find_last_not_ofERKS5_j
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE16find_last_not_ofEwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE17find_first_not_ofEPKwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE17find_first_not_ofEPKwjj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE17find_first_not_ofERKS5_j
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE17find_first_not_ofEwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE18__get_long_pointerEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE19__get_short_pointerEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE2atEj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE3endEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4backEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4cendEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4copyEPwjj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4dataEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4findEPKwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4findEPKwjj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4findERKS5_j
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4findEwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4rendEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4sizeEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5beginEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5c_strEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5crendEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5emptyEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5frontEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5rfindEPKwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5rfindEPKwjj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5rfindERKS5_j
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5rfindEwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6cbeginEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6lengthEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6rbeginEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6substrEjj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7__allocEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7compareEPKw
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7compareERKS5_
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7compareEjjPKw
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7compareEjjPKwj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7compareEjjRKS5_
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7compareEjjRKS5_jj
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7crbeginEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE8capacityEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE8max_sizeEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9__is_longEv
+ W _ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEixEj
+ T _ZNKSt3__112ctype_bynameIcE10do_tolowerEPcPKc
+ T _ZNKSt3__112ctype_bynameIcE10do_tolowerEc
+ T _ZNKSt3__112ctype_bynameIcE10do_toupperEPcPKc
+ T _ZNKSt3__112ctype_bynameIcE10do_toupperEc
+ T _ZNKSt3__112ctype_bynameIwE10do_scan_isEjPKwS3_
+ T _ZNKSt3__112ctype_bynameIwE10do_tolowerEPwPKw
+ T _ZNKSt3__112ctype_bynameIwE10do_tolowerEw
+ T _ZNKSt3__112ctype_bynameIwE10do_toupperEPwPKw
+ T _ZNKSt3__112ctype_bynameIwE10do_toupperEw
+ T _ZNKSt3__112ctype_bynameIwE11do_scan_notEjPKwS3_
+ T _ZNKSt3__112ctype_bynameIwE5do_isEPKwS3_Pj
+ T _ZNKSt3__112ctype_bynameIwE5do_isEjw
+ T _ZNKSt3__112ctype_bynameIwE8do_widenEPKcS3_Pw
+ T _ZNKSt3__112ctype_bynameIwE8do_widenEc
+ T _ZNKSt3__112ctype_bynameIwE9do_narrowEPKwS3_cPc
+ T _ZNKSt3__112ctype_bynameIwE9do_narrowEwc
+ T _ZNKSt3__112strstreambuf6pcountEv
+ W _ZNKSt3__113basic_istreamIcNS_11char_traitsIcEEE6gcountEv
+ W _ZNKSt3__113basic_istreamIcNS_11char_traitsIcEEE6sentrycvbEv
+ W _ZNKSt3__113basic_istreamIwNS_11char_traitsIwEEE6gcountEv
+ W _ZNKSt3__113basic_istreamIwNS_11char_traitsIwEEE6sentrycvbEv
+ W _ZNKSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentrycvbEv
+ W _ZNKSt3__113basic_ostreamIwNS_11char_traitsIwEEE6sentrycvbEv
+ T _ZNKSt3__113random_device7entropyEv
+ T _ZNKSt3__114__codecvt_utf8IjE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__114__codecvt_utf8IjE11do_encodingEv
+ T _ZNKSt3__114__codecvt_utf8IjE13do_max_lengthEv
+ T _ZNKSt3__114__codecvt_utf8IjE16do_always_noconvEv
+ T _ZNKSt3__114__codecvt_utf8IjE5do_inER10_mbstate_tPKcS5_RS5_PjS7_RS7_
+ T _ZNKSt3__114__codecvt_utf8IjE6do_outER10_mbstate_tPKjS5_RS5_PcS7_RS7_
+ T _ZNKSt3__114__codecvt_utf8IjE9do_lengthER10_mbstate_tPKcS5_j
+ T _ZNKSt3__114__codecvt_utf8ItE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__114__codecvt_utf8ItE11do_encodingEv
+ T _ZNKSt3__114__codecvt_utf8ItE13do_max_lengthEv
+ T _ZNKSt3__114__codecvt_utf8ItE16do_always_noconvEv
+ T _ZNKSt3__114__codecvt_utf8ItE5do_inER10_mbstate_tPKcS5_RS5_PtS7_RS7_
+ T _ZNKSt3__114__codecvt_utf8ItE6do_outER10_mbstate_tPKtS5_RS5_PcS7_RS7_
+ T _ZNKSt3__114__codecvt_utf8ItE9do_lengthER10_mbstate_tPKcS5_j
+ T _ZNKSt3__114__codecvt_utf8IwE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__114__codecvt_utf8IwE11do_encodingEv
+ T _ZNKSt3__114__codecvt_utf8IwE13do_max_lengthEv
+ T _ZNKSt3__114__codecvt_utf8IwE16do_always_noconvEv
+ T _ZNKSt3__114__codecvt_utf8IwE5do_inER10_mbstate_tPKcS5_RS5_PwS7_RS7_
+ T _ZNKSt3__114__codecvt_utf8IwE6do_outER10_mbstate_tPKwS5_RS5_PcS7_RS7_
+ T _ZNKSt3__114__codecvt_utf8IwE9do_lengthER10_mbstate_tPKcS5_j
+ T _ZNKSt3__114collate_bynameIcE10do_compareEPKcS3_S3_S3_
+ T _ZNKSt3__114collate_bynameIcE12do_transformEPKcS3_
+ T _ZNKSt3__114collate_bynameIwE10do_compareEPKwS3_S3_S3_
+ T _ZNKSt3__114collate_bynameIwE12do_transformEPKwS3_
+ T _ZNKSt3__114error_category10equivalentERKNS_10error_codeEi
+ T _ZNKSt3__114error_category10equivalentEiRKNS_15error_conditionE
+ T _ZNKSt3__114error_category23default_error_conditionEi
+ T _ZNKSt3__115__codecvt_utf16IjLb0EE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__115__codecvt_utf16IjLb0EE11do_encodingEv
+ T _ZNKSt3__115__codecvt_utf16IjLb0EE13do_max_lengthEv
+ T _ZNKSt3__115__codecvt_utf16IjLb0EE16do_always_noconvEv
+ T _ZNKSt3__115__codecvt_utf16IjLb0EE5do_inER10_mbstate_tPKcS5_RS5_PjS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16IjLb0EE6do_outER10_mbstate_tPKjS5_RS5_PcS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16IjLb0EE9do_lengthER10_mbstate_tPKcS5_j
+ T _ZNKSt3__115__codecvt_utf16IjLb1EE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__115__codecvt_utf16IjLb1EE11do_encodingEv
+ T _ZNKSt3__115__codecvt_utf16IjLb1EE13do_max_lengthEv
+ T _ZNKSt3__115__codecvt_utf16IjLb1EE16do_always_noconvEv
+ T _ZNKSt3__115__codecvt_utf16IjLb1EE5do_inER10_mbstate_tPKcS5_RS5_PjS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16IjLb1EE6do_outER10_mbstate_tPKjS5_RS5_PcS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16IjLb1EE9do_lengthER10_mbstate_tPKcS5_j
+ T _ZNKSt3__115__codecvt_utf16ItLb0EE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__115__codecvt_utf16ItLb0EE11do_encodingEv
+ T _ZNKSt3__115__codecvt_utf16ItLb0EE13do_max_lengthEv
+ T _ZNKSt3__115__codecvt_utf16ItLb0EE16do_always_noconvEv
+ T _ZNKSt3__115__codecvt_utf16ItLb0EE5do_inER10_mbstate_tPKcS5_RS5_PtS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16ItLb0EE6do_outER10_mbstate_tPKtS5_RS5_PcS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16ItLb0EE9do_lengthER10_mbstate_tPKcS5_j
+ T _ZNKSt3__115__codecvt_utf16ItLb1EE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__115__codecvt_utf16ItLb1EE11do_encodingEv
+ T _ZNKSt3__115__codecvt_utf16ItLb1EE13do_max_lengthEv
+ T _ZNKSt3__115__codecvt_utf16ItLb1EE16do_always_noconvEv
+ T _ZNKSt3__115__codecvt_utf16ItLb1EE5do_inER10_mbstate_tPKcS5_RS5_PtS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16ItLb1EE6do_outER10_mbstate_tPKtS5_RS5_PcS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16ItLb1EE9do_lengthER10_mbstate_tPKcS5_j
+ T _ZNKSt3__115__codecvt_utf16IwLb0EE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__115__codecvt_utf16IwLb0EE11do_encodingEv
+ T _ZNKSt3__115__codecvt_utf16IwLb0EE13do_max_lengthEv
+ T _ZNKSt3__115__codecvt_utf16IwLb0EE16do_always_noconvEv
+ T _ZNKSt3__115__codecvt_utf16IwLb0EE5do_inER10_mbstate_tPKcS5_RS5_PwS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16IwLb0EE6do_outER10_mbstate_tPKwS5_RS5_PcS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16IwLb0EE9do_lengthER10_mbstate_tPKcS5_j
+ T _ZNKSt3__115__codecvt_utf16IwLb1EE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__115__codecvt_utf16IwLb1EE11do_encodingEv
+ T _ZNKSt3__115__codecvt_utf16IwLb1EE13do_max_lengthEv
+ T _ZNKSt3__115__codecvt_utf16IwLb1EE16do_always_noconvEv
+ T _ZNKSt3__115__codecvt_utf16IwLb1EE5do_inER10_mbstate_tPKcS5_RS5_PwS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16IwLb1EE6do_outER10_mbstate_tPKwS5_RS5_PcS7_RS7_
+ T _ZNKSt3__115__codecvt_utf16IwLb1EE9do_lengthER10_mbstate_tPKcS5_j
+ W _ZNKSt3__115basic_streambufIcNS_11char_traitsIcEEE4gptrEv
+ W _ZNKSt3__115basic_streambufIcNS_11char_traitsIcEEE4pptrEv
+ W _ZNKSt3__115basic_streambufIcNS_11char_traitsIcEEE5ebackEv
+ W _ZNKSt3__115basic_streambufIcNS_11char_traitsIcEEE5egptrEv
+ W _ZNKSt3__115basic_streambufIcNS_11char_traitsIcEEE5epptrEv
+ W _ZNKSt3__115basic_streambufIcNS_11char_traitsIcEEE5pbaseEv
+ W _ZNKSt3__115basic_streambufIcNS_11char_traitsIcEEE6getlocEv
+ W _ZNKSt3__115basic_streambufIwNS_11char_traitsIwEEE4gptrEv
+ W _ZNKSt3__115basic_streambufIwNS_11char_traitsIwEEE4pptrEv
+ W _ZNKSt3__115basic_streambufIwNS_11char_traitsIwEEE5ebackEv
+ W _ZNKSt3__115basic_streambufIwNS_11char_traitsIwEEE5egptrEv
+ W _ZNKSt3__115basic_streambufIwNS_11char_traitsIwEEE5epptrEv
+ W _ZNKSt3__115basic_streambufIwNS_11char_traitsIwEEE5pbaseEv
+ W _ZNKSt3__115basic_streambufIwNS_11char_traitsIwEEE6getlocEv
+ T _ZNKSt3__115error_condition7messageEv
+ W _ZNKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE13do_date_orderEv
+ W _ZNKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__XEv
+ W _ZNKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__cEv
+ W _ZNKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__rEv
+ W _ZNKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__xEv
+ W _ZNKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE7__am_pmEv
+ W _ZNKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE7__weeksEv
+ W _ZNKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE8__monthsEv
+ W _ZNKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE13do_date_orderEv
+ W _ZNKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3__XEv
+ W _ZNKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3__cEv
+ W _ZNKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3__rEv
+ W _ZNKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3__xEv
+ W _ZNKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE7__am_pmEv
+ W _ZNKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE7__weeksEv
+ W _ZNKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE8__monthsEv
+ W _ZNKSt3__117moneypunct_bynameIcLb0EE11do_groupingEv
+ W _ZNKSt3__117moneypunct_bynameIcLb0EE13do_neg_formatEv
+ W _ZNKSt3__117moneypunct_bynameIcLb0EE13do_pos_formatEv
+ W _ZNKSt3__117moneypunct_bynameIcLb0EE14do_curr_symbolEv
+ W _ZNKSt3__117moneypunct_bynameIcLb0EE14do_frac_digitsEv
+ W _ZNKSt3__117moneypunct_bynameIcLb0EE16do_decimal_pointEv
+ W _ZNKSt3__117moneypunct_bynameIcLb0EE16do_negative_signEv
+ W _ZNKSt3__117moneypunct_bynameIcLb0EE16do_positive_signEv
+ W _ZNKSt3__117moneypunct_bynameIcLb0EE16do_thousands_sepEv
+ W _ZNKSt3__117moneypunct_bynameIcLb1EE11do_groupingEv
+ W _ZNKSt3__117moneypunct_bynameIcLb1EE13do_neg_formatEv
+ W _ZNKSt3__117moneypunct_bynameIcLb1EE13do_pos_formatEv
+ W _ZNKSt3__117moneypunct_bynameIcLb1EE14do_curr_symbolEv
+ W _ZNKSt3__117moneypunct_bynameIcLb1EE14do_frac_digitsEv
+ W _ZNKSt3__117moneypunct_bynameIcLb1EE16do_decimal_pointEv
+ W _ZNKSt3__117moneypunct_bynameIcLb1EE16do_negative_signEv
+ W _ZNKSt3__117moneypunct_bynameIcLb1EE16do_positive_signEv
+ W _ZNKSt3__117moneypunct_bynameIcLb1EE16do_thousands_sepEv
+ W _ZNKSt3__117moneypunct_bynameIwLb0EE11do_groupingEv
+ W _ZNKSt3__117moneypunct_bynameIwLb0EE13do_neg_formatEv
+ W _ZNKSt3__117moneypunct_bynameIwLb0EE13do_pos_formatEv
+ W _ZNKSt3__117moneypunct_bynameIwLb0EE14do_curr_symbolEv
+ W _ZNKSt3__117moneypunct_bynameIwLb0EE14do_frac_digitsEv
+ W _ZNKSt3__117moneypunct_bynameIwLb0EE16do_decimal_pointEv
+ W _ZNKSt3__117moneypunct_bynameIwLb0EE16do_negative_signEv
+ W _ZNKSt3__117moneypunct_bynameIwLb0EE16do_positive_signEv
+ W _ZNKSt3__117moneypunct_bynameIwLb0EE16do_thousands_sepEv
+ W _ZNKSt3__117moneypunct_bynameIwLb1EE11do_groupingEv
+ W _ZNKSt3__117moneypunct_bynameIwLb1EE13do_neg_formatEv
+ W _ZNKSt3__117moneypunct_bynameIwLb1EE13do_pos_formatEv
+ W _ZNKSt3__117moneypunct_bynameIwLb1EE14do_curr_symbolEv
+ W _ZNKSt3__117moneypunct_bynameIwLb1EE14do_frac_digitsEv
+ W _ZNKSt3__117moneypunct_bynameIwLb1EE16do_decimal_pointEv
+ W _ZNKSt3__117moneypunct_bynameIwLb1EE16do_negative_signEv
+ W _ZNKSt3__117moneypunct_bynameIwLb1EE16do_positive_signEv
+ W _ZNKSt3__117moneypunct_bynameIwLb1EE16do_thousands_sepEv
+ C _ZNKSt3__118__hidden_allocatorINS_4pairIPNS_18condition_variableEPNS_5mutexEEEE8max_sizeEv
+ C _ZNKSt3__118__hidden_allocatorIPNS_17__assoc_sub_stateEE8max_sizeEv
+ T _ZNKSt3__118__time_get_storageIcE15__do_date_orderEv
+ T _ZNKSt3__118__time_get_storageIwE15__do_date_orderEv
+ T _ZNKSt3__119__iostream_category4nameEv
+ T _ZNKSt3__119__iostream_category7messageEi
+ T _ZNKSt3__119__shared_weak_count13__get_deleterERKSt9type_info
+ T _ZNKSt3__120__codecvt_utf8_utf16IjE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__120__codecvt_utf8_utf16IjE11do_encodingEv
+ T _ZNKSt3__120__codecvt_utf8_utf16IjE13do_max_lengthEv
+ T _ZNKSt3__120__codecvt_utf8_utf16IjE16do_always_noconvEv
+ T _ZNKSt3__120__codecvt_utf8_utf16IjE5do_inER10_mbstate_tPKcS5_RS5_PjS7_RS7_
+ T _ZNKSt3__120__codecvt_utf8_utf16IjE6do_outER10_mbstate_tPKjS5_RS5_PcS7_RS7_
+ T _ZNKSt3__120__codecvt_utf8_utf16IjE9do_lengthER10_mbstate_tPKcS5_j
+ T _ZNKSt3__120__codecvt_utf8_utf16ItE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__120__codecvt_utf8_utf16ItE11do_encodingEv
+ T _ZNKSt3__120__codecvt_utf8_utf16ItE13do_max_lengthEv
+ T _ZNKSt3__120__codecvt_utf8_utf16ItE16do_always_noconvEv
+ T _ZNKSt3__120__codecvt_utf8_utf16ItE5do_inER10_mbstate_tPKcS5_RS5_PtS7_RS7_
+ T _ZNKSt3__120__codecvt_utf8_utf16ItE6do_outER10_mbstate_tPKtS5_RS5_PcS7_RS7_
+ T _ZNKSt3__120__codecvt_utf8_utf16ItE9do_lengthER10_mbstate_tPKcS5_j
+ T _ZNKSt3__120__codecvt_utf8_utf16IwE10do_unshiftER10_mbstate_tPcS4_RS4_
+ T _ZNKSt3__120__codecvt_utf8_utf16IwE11do_encodingEv
+ T _ZNKSt3__120__codecvt_utf8_utf16IwE13do_max_lengthEv
+ T _ZNKSt3__120__codecvt_utf8_utf16IwE16do_always_noconvEv
+ T _ZNKSt3__120__codecvt_utf8_utf16IwE5do_inER10_mbstate_tPKcS5_RS5_PwS7_RS7_
+ T _ZNKSt3__120__codecvt_utf8_utf16IwE6do_outER10_mbstate_tPKwS5_RS5_PcS7_RS7_
+ T _ZNKSt3__120__codecvt_utf8_utf16IwE9do_lengthER10_mbstate_tPKcS5_j
+ T _ZNKSt3__120__time_get_c_storageIcE3__XEv
+ T _ZNKSt3__120__time_get_c_storageIcE3__cEv
+ T _ZNKSt3__120__time_get_c_storageIcE3__rEv
+ T _ZNKSt3__120__time_get_c_storageIcE3__xEv
+ T _ZNKSt3__120__time_get_c_storageIcE7__am_pmEv
+ T _ZNKSt3__120__time_get_c_storageIcE7__weeksEv
+ T _ZNKSt3__120__time_get_c_storageIcE8__monthsEv
+ T _ZNKSt3__120__time_get_c_storageIwE3__XEv
+ T _ZNKSt3__120__time_get_c_storageIwE3__cEv
+ T _ZNKSt3__120__time_get_c_storageIwE3__rEv
+ T _ZNKSt3__120__time_get_c_storageIwE3__xEv
+ T _ZNKSt3__120__time_get_c_storageIwE7__am_pmEv
+ T _ZNKSt3__120__time_get_c_storageIwE7__weeksEv
+ T _ZNKSt3__120__time_get_c_storageIwE8__monthsEv
+ W _ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv
+ W _ZNKSt3__120__vector_base_commonILb1EE20__throw_out_of_rangeEv
+ W _ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv
+ W _ZNKSt3__121__basic_string_commonILb1EE20__throw_out_of_rangeEv
+ T _ZNKSt3__123__future_error_category4nameEv
+ T _ZNKSt3__123__future_error_category7messageEi
+ T _ZNKSt3__123__match_any_but_newlineIcE6__execERNS_7__stateIcEE
+ T _ZNKSt3__123__match_any_but_newlineIwE6__execERNS_7__stateIwEE
+ T _ZNKSt3__123__system_error_category23default_error_conditionEi
+ T _ZNKSt3__123__system_error_category4nameEv
+ T _ZNKSt3__123__system_error_category7messageEi
+ T _ZNKSt3__124__generic_error_category4nameEv
+ T _ZNKSt3__124__generic_error_category7messageEi
+ T _ZNKSt3__15ctypeIcE10do_tolowerEPcPKc
+ T _ZNKSt3__15ctypeIcE10do_tolowerEc
+ T _ZNKSt3__15ctypeIcE10do_toupperEPcPKc
+ T _ZNKSt3__15ctypeIcE10do_toupperEc
+ T _ZNKSt3__15ctypeIcE8do_widenEPKcS3_Pc
+ T _ZNKSt3__15ctypeIcE8do_widenEc
+ T _ZNKSt3__15ctypeIcE9do_narrowEPKcS3_cPc
+ T _ZNKSt3__15ctypeIcE9do_narrowEcc
+ T _ZNKSt3__15ctypeIwE10do_scan_isEjPKwS3_
+ T _ZNKSt3__15ctypeIwE10do_tolowerEPwPKw
+ T _ZNKSt3__15ctypeIwE10do_tolowerEw
+ T _ZNKSt3__15ctypeIwE10do_toupperEPwPKw
+ T _ZNKSt3__15ctypeIwE10do_toupperEw
+ T _ZNKSt3__15ctypeIwE11do_scan_notEjPKwS3_
+ T _ZNKSt3__15ctypeIwE5do_isEPKwS3_Pj
+ T _ZNKSt3__15ctypeIwE5do_isEjw
+ T _ZNKSt3__15ctypeIwE8do_widenEPKcS3_Pw
+ T _ZNKSt3__15ctypeIwE8do_widenEc
+ T _ZNKSt3__15ctypeIwE9do_narrowEPKwS3_cPc
+ T _ZNKSt3__15ctypeIwE9do_narrowEwc
+ T _ZNKSt3__16locale4nameEv
+ C _ZNKSt3__16locale5__imp4nameEv
+ C _ZNKSt3__16locale5__imp9has_facetEl
+ T _ZNKSt3__16locale5__imp9use_facetEl
+ T _ZNKSt3__16locale9has_facetERNS0_2idE
+ T _ZNKSt3__16locale9use_facetERNS0_2idE
+ T _ZNKSt3__16localeeqERKS0_
+ C _ZNKSt3__16vectorINS_4pairIPNS_18condition_variableEPNS_5mutexEEENS_18__hidden_allocatorIS6_EEE8max_sizeEv
+ C _ZNKSt3__16vectorIPNS_17__assoc_sub_stateENS_18__hidden_allocatorIS2_EEE8max_sizeEv
+ C _ZNKSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEE8max_sizeEv
+ T _ZNKSt3__17codecvtIcc10_mbstate_tE10do_unshiftERS1_PcS4_RS4_
+ T _ZNKSt3__17codecvtIcc10_mbstate_tE11do_encodingEv
+ T _ZNKSt3__17codecvtIcc10_mbstate_tE13do_max_lengthEv
+ T _ZNKSt3__17codecvtIcc10_mbstate_tE16do_always_noconvEv
+ T _ZNKSt3__17codecvtIcc10_mbstate_tE5do_inERS1_PKcS5_RS5_PcS7_RS7_
+ T _ZNKSt3__17codecvtIcc10_mbstate_tE6do_outERS1_PKcS5_RS5_PcS7_RS7_
+ T _ZNKSt3__17codecvtIcc10_mbstate_tE9do_lengthERS1_PKcS5_j
+ T _ZNKSt3__17codecvtIjc10_mbstate_tE10do_unshiftERS1_PcS4_RS4_
+ T _ZNKSt3__17codecvtIjc10_mbstate_tE11do_encodingEv
+ T _ZNKSt3__17codecvtIjc10_mbstate_tE13do_max_lengthEv
+ T _ZNKSt3__17codecvtIjc10_mbstate_tE16do_always_noconvEv
+ T _ZNKSt3__17codecvtIjc10_mbstate_tE5do_inERS1_PKcS5_RS5_PjS7_RS7_
+ T _ZNKSt3__17codecvtIjc10_mbstate_tE6do_outERS1_PKjS5_RS5_PcS7_RS7_
+ T _ZNKSt3__17codecvtIjc10_mbstate_tE9do_lengthERS1_PKcS5_j
+ T _ZNKSt3__17codecvtItc10_mbstate_tE10do_unshiftERS1_PcS4_RS4_
+ T _ZNKSt3__17codecvtItc10_mbstate_tE11do_encodingEv
+ T _ZNKSt3__17codecvtItc10_mbstate_tE13do_max_lengthEv
+ T _ZNKSt3__17codecvtItc10_mbstate_tE16do_always_noconvEv
+ T _ZNKSt3__17codecvtItc10_mbstate_tE5do_inERS1_PKcS5_RS5_PtS7_RS7_
+ T _ZNKSt3__17codecvtItc10_mbstate_tE6do_outERS1_PKtS5_RS5_PcS7_RS7_
+ T _ZNKSt3__17codecvtItc10_mbstate_tE9do_lengthERS1_PKcS5_j
+ T _ZNKSt3__17codecvtIwc10_mbstate_tE10do_unshiftERS1_PcS4_RS4_
+ T _ZNKSt3__17codecvtIwc10_mbstate_tE11do_encodingEv
+ T _ZNKSt3__17codecvtIwc10_mbstate_tE13do_max_lengthEv
+ T _ZNKSt3__17codecvtIwc10_mbstate_tE16do_always_noconvEv
+ T _ZNKSt3__17codecvtIwc10_mbstate_tE5do_inERS1_PKcS5_RS5_PwS7_RS7_
+ T _ZNKSt3__17codecvtIwc10_mbstate_tE6do_outERS1_PKwS5_RS5_PcS7_RS7_
+ T _ZNKSt3__17codecvtIwc10_mbstate_tE9do_lengthERS1_PKcS5_j
+ W _ZNKSt3__17collateIcE10do_compareEPKcS3_S3_S3_
+ W _ZNKSt3__17collateIcE12do_transformEPKcS3_
+ W _ZNKSt3__17collateIcE4hashEPKcS3_
+ W _ZNKSt3__17collateIcE7compareEPKcS3_S3_S3_
+ W _ZNKSt3__17collateIcE7do_hashEPKcS3_
+ W _ZNKSt3__17collateIcE9transformEPKcS3_
+ W _ZNKSt3__17collateIwE10do_compareEPKwS3_S3_S3_
+ W _ZNKSt3__17collateIwE12do_transformEPKwS3_
+ W _ZNKSt3__17collateIwE4hashEPKwS3_
+ W _ZNKSt3__17collateIwE7compareEPKwS3_S3_S3_
+ W _ZNKSt3__17collateIwE7do_hashEPKwS3_
+ W _ZNKSt3__17collateIwE9transformEPKwS3_
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjRPv
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjRb
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjRd
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjRe
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjRf
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjRl
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjRm
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjRt
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjRx
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjRy
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjS8_
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjRPv
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjRb
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjRd
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjRe
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjRf
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjRl
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjRm
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjRt
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjRx
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjRy
+ W _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjS8_
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjRPv
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjRb
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjRd
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjRe
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjRf
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjRl
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjRm
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjRt
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjRx
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjRy
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjS8_
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjRPv
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjRb
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjRd
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjRe
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjRf
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjRl
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjRm
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjRt
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjRx
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjRy
+ W _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjS8_
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_RNS_8ios_baseEcPKv
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_RNS_8ios_baseEcb
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_RNS_8ios_baseEcd
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_RNS_8ios_baseEce
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_RNS_8ios_baseEcl
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_RNS_8ios_baseEcm
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_RNS_8ios_baseEcx
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_RNS_8ios_baseEcy
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_RNS_8ios_baseEcPKv
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_RNS_8ios_baseEcb
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_RNS_8ios_baseEcd
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_RNS_8ios_baseEce
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_RNS_8ios_baseEcl
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_RNS_8ios_baseEcm
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_RNS_8ios_baseEcx
+ W _ZNKSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_RNS_8ios_baseEcy
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_RNS_8ios_baseEwPKv
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_RNS_8ios_baseEwb
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_RNS_8ios_baseEwd
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_RNS_8ios_baseEwe
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_RNS_8ios_baseEwl
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_RNS_8ios_baseEwm
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_RNS_8ios_baseEwx
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_RNS_8ios_baseEwy
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_RNS_8ios_baseEwPKv
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_RNS_8ios_baseEwb
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_RNS_8ios_baseEwd
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_RNS_8ios_baseEwe
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_RNS_8ios_baseEwl
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_RNS_8ios_baseEwm
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_RNS_8ios_baseEwx
+ W _ZNKSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_RNS_8ios_baseEwy
+ T _ZNKSt3__18ios_base6getlocEv
+ W _ZNKSt3__18messagesIcE3getEiiiRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ W _ZNKSt3__18messagesIcE4openERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKNS_6localeE
+ W _ZNKSt3__18messagesIcE5closeEi
+ W _ZNKSt3__18messagesIcE6do_getEiiiRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ W _ZNKSt3__18messagesIcE7do_openERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKNS_6localeE
+ W _ZNKSt3__18messagesIcE8do_closeEi
+ W _ZNKSt3__18messagesIwE3getEiiiRKNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEE
+ W _ZNKSt3__18messagesIwE4openERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKNS_6localeE
+ W _ZNKSt3__18messagesIwE5closeEi
+ W _ZNKSt3__18messagesIwE6do_getEiiiRKNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEE
+ W _ZNKSt3__18messagesIwE7do_openERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKNS_6localeE
+ W _ZNKSt3__18messagesIwE8do_closeEi
+ T _ZNKSt3__18numpunctIcE11do_groupingEv
+ T _ZNKSt3__18numpunctIcE11do_truenameEv
+ T _ZNKSt3__18numpunctIcE12do_falsenameEv
+ T _ZNKSt3__18numpunctIcE16do_decimal_pointEv
+ T _ZNKSt3__18numpunctIcE16do_thousands_sepEv
+ T _ZNKSt3__18numpunctIwE11do_groupingEv
+ T _ZNKSt3__18numpunctIwE11do_truenameEv
+ T _ZNKSt3__18numpunctIwE12do_falsenameEv
+ T _ZNKSt3__18numpunctIwE16do_decimal_pointEv
+ T _ZNKSt3__18numpunctIwE16do_thousands_sepEv
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE10__get_hourERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE10__get_yearERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE10date_orderEv
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE11__get_am_pmERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE11__get_monthERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE11__get_year4ERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE11do_get_dateES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE11do_get_timeES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE11do_get_yearES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE11get_weekdayES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE12__get_minuteERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE12__get_secondERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE13__get_12_hourERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE13__get_percentERS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE13__get_weekdayERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE13do_date_orderEv
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE13get_monthnameES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE14do_get_weekdayES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE15__get_monthnameERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE16do_get_monthnameES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE17__get_weekdaynameERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE17__get_white_spaceERS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE18__get_day_year_numERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjP2tmPKcSC_
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_RNS_8ios_baseERjP2tmcc
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmcc
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE8get_dateES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE8get_timeES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE8get_yearES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE9__get_dayERiRS4_S4_RjRKNS_5ctypeIcEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE10__get_hourERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE10__get_yearERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE10date_orderEv
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE11__get_am_pmERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE11__get_monthERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE11__get_year4ERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE11do_get_dateES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE11do_get_timeES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE11do_get_yearES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE11get_weekdayES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE12__get_minuteERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE12__get_secondERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE13__get_12_hourERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE13__get_percentERS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE13__get_weekdayERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE13do_date_orderEv
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE13get_monthnameES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE14do_get_weekdayES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE15__get_monthnameERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE16do_get_monthnameES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE17__get_weekdaynameERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE17__get_white_spaceERS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE18__get_day_year_numERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjP2tmPKwSC_
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_RNS_8ios_baseERjP2tmcc
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmcc
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE8get_dateES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE8get_timeES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE8get_yearES4_S4_RNS_8ios_baseERjP2tm
+ W _ZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE9__get_dayERiRS4_S4_RjRKNS_5ctypeIwEE
+ W _ZNKSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_RNS_8ios_baseEcPK2tmPKcSC_
+ W _ZNKSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_RNS_8ios_baseEcPK2tmcc
+ W _ZNKSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_RNS_8ios_baseEcPK2tmcc
+ W _ZNKSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_RNS_8ios_baseEwPK2tmPKwSC_
+ W _ZNKSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_RNS_8ios_baseEwPK2tmcc
+ W _ZNKSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_RNS_8ios_baseEwPK2tmcc
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE10exceptionsEv
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE3badEv
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE3eofEv
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE3tieEv
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE4failEv
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE4fillEv
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE4goodEv
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE5rdbufEv
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE5widenEc
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE6narrowEcc
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE7rdstateEv
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEEcvbEv
+ W _ZNKSt3__19basic_iosIcNS_11char_traitsIcEEEntEv
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEE10exceptionsEv
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEE3badEv
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEE3eofEv
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEE3tieEv
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEE4failEv
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEE4fillEv
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEE4goodEv
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEE5rdbufEv
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEE5widenEc
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEE6narrowEwc
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEE7rdstateEv
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEEcvbEv
+ W _ZNKSt3__19basic_iosIwNS_11char_traitsIwEEEntEv
+ W _ZNKSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_bRNS_8ios_baseERjRNS_12basic_stringIcS3_NS_9allocatorIcEEEE
+ W _ZNKSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3getES4_S4_bRNS_8ios_baseERjRe
+ W _ZNKSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_bRNS_8ios_baseERjRNS_12basic_stringIcS3_NS_9allocatorIcEEEE
+ W _ZNKSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_bRNS_8ios_baseERjRe
+ W _ZNKSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_bRNS_8ios_baseERjRNS_12basic_stringIwS3_NS_9allocatorIwEEEE
+ W _ZNKSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3getES4_S4_bRNS_8ios_baseERjRe
+ W _ZNKSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_bRNS_8ios_baseERjRNS_12basic_stringIwS3_NS_9allocatorIwEEEE
+ W _ZNKSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_bRNS_8ios_baseERjRe
+ W _ZNKSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_bRNS_8ios_baseEcRKNS_12basic_stringIcS3_NS_9allocatorIcEEEE
+ W _ZNKSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE3putES4_bRNS_8ios_baseEce
+ W _ZNKSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_bRNS_8ios_baseEcRKNS_12basic_stringIcS3_NS_9allocatorIcEEEE
+ W _ZNKSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_bRNS_8ios_baseEce
+ W _ZNKSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_bRNS_8ios_baseEwRKNS_12basic_stringIwS3_NS_9allocatorIwEEEE
+ W _ZNKSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_bRNS_8ios_baseEwe
+ W _ZNKSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_bRNS_8ios_baseEwRKNS_12basic_stringIwS3_NS_9allocatorIwEEEE
+ W _ZNKSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_bRNS_8ios_baseEwe
+ T _ZNKSt8bad_cast4whatEv
+ T _ZNKSt9exception4whatEv
+ T _ZNSt10bad_typeidC1Ev
+ T _ZNSt10bad_typeidC2Ev
+ T _ZNSt10bad_typeidD0Ev
+ T _ZNSt10bad_typeidD1Ev
+ T _ZNSt10bad_typeidD2Ev
+ T _ZNSt11logic_errorC1EPKc
+ T _ZNSt11logic_errorC1ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE
+ T _ZNSt11logic_errorC1ERKS_
+ T _ZNSt11logic_errorC2EPKc
+ T _ZNSt11logic_errorC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE
+ T _ZNSt11logic_errorC2ERKS_
+ T _ZNSt11logic_errorD0Ev
+ T _ZNSt11logic_errorD1Ev
+ T _ZNSt11logic_errorD2Ev
+ T _ZNSt11logic_erroraSERKS_
+ T _ZNSt11range_errorD0Ev
+ ? _ZNSt11range_errorD1Ev
+ T _ZNSt11range_errorD2Ev
+ T _ZNSt12domain_errorD0Ev
+ ? _ZNSt12domain_errorD1Ev
+ T _ZNSt12domain_errorD2Ev
+ T _ZNSt12length_errorD0Ev
+ ? _ZNSt12length_errorD1Ev
+ T _ZNSt12length_errorD2Ev
+ T _ZNSt12out_of_rangeD0Ev
+ ? _ZNSt12out_of_rangeD1Ev
+ T _ZNSt12out_of_rangeD2Ev
+ T _ZNSt13bad_exceptionD0Ev
+ ? _ZNSt13bad_exceptionD1Ev
+ T _ZNSt13bad_exceptionD2Ev
+ T _ZNSt13exception_ptrC1ERKS_
+ T _ZNSt13exception_ptrC2ERKS_
+ T _ZNSt13exception_ptrD1Ev
+ T _ZNSt13exception_ptrD2Ev
+ T _ZNSt13exception_ptraSERKS_
+ T _ZNSt13runtime_errorC1EPKc
+ T _ZNSt13runtime_errorC1ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE
+ T _ZNSt13runtime_errorC1ERKS_
+ T _ZNSt13runtime_errorC2EPKc
+ T _ZNSt13runtime_errorC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE
+ T _ZNSt13runtime_errorC2ERKS_
+ T _ZNSt13runtime_errorD0Ev
+ T _ZNSt13runtime_errorD1Ev
+ T _ZNSt13runtime_errorD2Ev
+ T _ZNSt13runtime_erroraSERKS_
+ T _ZNSt14overflow_errorD0Ev
+ ? _ZNSt14overflow_errorD1Ev
+ T _ZNSt14overflow_errorD2Ev
+ T _ZNSt15underflow_errorD0Ev
+ ? _ZNSt15underflow_errorD1Ev
+ T _ZNSt15underflow_errorD2Ev
+ T _ZNSt16invalid_argumentD0Ev
+ ? _ZNSt16invalid_argumentD1Ev
+ T _ZNSt16invalid_argumentD2Ev
+ T _ZNSt16nested_exceptionC1Ev
+ T _ZNSt16nested_exceptionC2Ev
+ T _ZNSt16nested_exceptionD0Ev
+ T _ZNSt16nested_exceptionD1Ev
+ T _ZNSt16nested_exceptionD2Ev
+ C _ZNSt3__110__find_endIRNS_11__traits_eqINS_11char_traitsIcEEEEPKcS7_EET0_S8_S8_T1_S9_T_NS_26random_access_iterator_tagESB_
+ C _ZNSt3__110__find_endIRNS_11__traits_eqINS_11char_traitsIwEEEEPKwS7_EET0_S8_S8_T1_S9_T_NS_26random_access_iterator_tagESB_
+ C _ZNSt3__110__sscanf_lEPKcPvS1_z
+ C _ZNSt3__110__stdinbufIcE5imbueERKNS_6localeE
+ C _ZNSt3__110__stdinbufIcE5uflowEv
+ C _ZNSt3__110__stdinbufIcE9__getcharEb
+ C _ZNSt3__110__stdinbufIcE9pbackfailEi
+ C _ZNSt3__110__stdinbufIcE9underflowEv
+ C _ZNSt3__110__stdinbufIcEC1EP7__sFILE
+ C _ZNSt3__110__stdinbufIcEC2EP7__sFILE
+ C _ZNSt3__110__stdinbufIcED0Ev
+ C _ZNSt3__110__stdinbufIcED1Ev
+ C _ZNSt3__110__stdinbufIcED2Ev
+ C _ZNSt3__110__stdinbufIwE5imbueERKNS_6localeE
+ C _ZNSt3__110__stdinbufIwE5uflowEv
+ C _ZNSt3__110__stdinbufIwE9__getcharEb
+ C _ZNSt3__110__stdinbufIwE9pbackfailEj
+ C _ZNSt3__110__stdinbufIwE9underflowEv
+ C _ZNSt3__110__stdinbufIwEC1EP7__sFILE
+ C _ZNSt3__110__stdinbufIwEC2EP7__sFILE
+ C _ZNSt3__110__stdinbufIwED0Ev
+ C _ZNSt3__110__stdinbufIwED1Ev
+ C _ZNSt3__110__stdinbufIwED2Ev
+ T _ZNSt3__110__time_getC1EPKc
+ T _ZNSt3__110__time_getC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__110__time_getC2EPKc
+ T _ZNSt3__110__time_getC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__110__time_getD1Ev
+ T _ZNSt3__110__time_getD2Ev
+ T _ZNSt3__110__time_putC1EPKc
+ T _ZNSt3__110__time_putC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__110__time_putC2EPKc
+ T _ZNSt3__110__time_putC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__110__time_putD1Ev
+ T _ZNSt3__110__time_putD2Ev
+ D _ZNSt3__110adopt_lockE
+ D _ZNSt3__110defer_lockE
+ T _ZNSt3__110istrstreamD0Ev
+ T _ZNSt3__110istrstreamD1Ev
+ T _ZNSt3__110istrstreamD2Ev
+ W _ZNSt3__110moneypunctIcLb0EE2idE
+ W _ZNSt3__110moneypunctIcLb0EEC1Ej
+ W _ZNSt3__110moneypunctIcLb0EEC2Ej
+ W _ZNSt3__110moneypunctIcLb0EED0Ev
+ W _ZNSt3__110moneypunctIcLb0EED1Ev
+ W _ZNSt3__110moneypunctIcLb0EED2Ev
+ W _ZNSt3__110moneypunctIcLb1EE2idE
+ W _ZNSt3__110moneypunctIcLb1EEC1Ej
+ W _ZNSt3__110moneypunctIcLb1EEC2Ej
+ W _ZNSt3__110moneypunctIcLb1EED0Ev
+ W _ZNSt3__110moneypunctIcLb1EED1Ev
+ W _ZNSt3__110moneypunctIcLb1EED2Ev
+ W _ZNSt3__110moneypunctIwLb0EE2idE
+ W _ZNSt3__110moneypunctIwLb0EEC1Ej
+ W _ZNSt3__110moneypunctIwLb0EEC2Ej
+ W _ZNSt3__110moneypunctIwLb0EED0Ev
+ W _ZNSt3__110moneypunctIwLb0EED1Ev
+ W _ZNSt3__110moneypunctIwLb0EED2Ev
+ W _ZNSt3__110moneypunctIwLb1EE2idE
+ W _ZNSt3__110moneypunctIwLb1EEC1Ej
+ W _ZNSt3__110moneypunctIwLb1EEC2Ej
+ W _ZNSt3__110moneypunctIwLb1EED0Ev
+ W _ZNSt3__110moneypunctIwLb1EED1Ev
+ W _ZNSt3__110moneypunctIwLb1EED2Ev
+ T _ZNSt3__110ostrstreamD0Ev
+ T _ZNSt3__110ostrstreamD1Ev
+ T _ZNSt3__110ostrstreamD2Ev
+ T _ZNSt3__110to_wstringEd
+ T _ZNSt3__110to_wstringEe
+ T _ZNSt3__110to_wstringEf
+ T _ZNSt3__110to_wstringEi
+ T _ZNSt3__110to_wstringEj
+ T _ZNSt3__110to_wstringEl
+ T _ZNSt3__110to_wstringEm
+ T _ZNSt3__110to_wstringEx
+ T _ZNSt3__110to_wstringEy
+ T _ZNSt3__110unique_ptrINS_6locale5facetENS_12_GLOBAL__N_17releaseEEC1EPS2_
+ t _ZNSt3__110unique_ptrINS_6locale5facetENS_12_GLOBAL__N_17releaseEEC2EPS2_
+ T _ZNSt3__110unique_ptrINS_6locale5facetENS_12_GLOBAL__N_17releaseEED1Ev
+ t _ZNSt3__110unique_ptrINS_6locale5facetENS_12_GLOBAL__N_17releaseEED2Ev
+ T _ZNSt3__111__call_onceERVmPvPFvS2_E
+ T _ZNSt3__111__libcpp_db10__insert_cEPv
+ T _ZNSt3__111__libcpp_db10__insert_iEPv
+ T _ZNSt3__111__libcpp_db11__insert_icEPvPKv
+ T _ZNSt3__111__libcpp_db15__iterator_copyEPvPKv
+ T _ZNSt3__111__libcpp_db16__invalidate_allEPv
+ T _ZNSt3__111__libcpp_db17__insert_iteratorEPv
+ T _ZNSt3__111__libcpp_db4swapEPvS1_
+ T _ZNSt3__111__libcpp_db9__erase_cEPv
+ T _ZNSt3__111__libcpp_db9__erase_iEPv
+ T _ZNSt3__111__libcpp_dbC1Ev
+ T _ZNSt3__111__libcpp_dbC2Ev
+ T _ZNSt3__111__libcpp_dbD1Ev
+ T _ZNSt3__111__libcpp_dbD2Ev
+ W _ZNSt3__111__money_getIcE13__gather_infoEbRKNS_6localeERNS_10money_base7patternERcS8_RNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESF_SF_SF_Ri
+ W _ZNSt3__111__money_getIcEC1Ev
+ W _ZNSt3__111__money_getIcEC2Ev
+ W _ZNSt3__111__money_getIwE13__gather_infoEbRKNS_6localeERNS_10money_base7patternERwS8_RNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERNS9_IwNSA_IwEENSC_IwEEEESJ_SJ_Ri
+ W _ZNSt3__111__money_getIwEC1Ev
+ W _ZNSt3__111__money_getIwEC2Ev
+ W _ZNSt3__111__money_putIcE13__gather_infoEbbRKNS_6localeERNS_10money_base7patternERcS8_RNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESF_SF_Ri
+ W _ZNSt3__111__money_putIcE8__formatEPcRS2_S3_jPKcS5_RKNS_5ctypeIcEEbRKNS_10money_base7patternEccRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESL_SL_i
+ W _ZNSt3__111__money_putIcEC1Ev
+ W _ZNSt3__111__money_putIcEC2Ev
+ W _ZNSt3__111__money_putIwE13__gather_infoEbbRKNS_6localeERNS_10money_base7patternERwS8_RNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERNS9_IwNSA_IwEENSC_IwEEEESJ_Ri
+ W _ZNSt3__111__money_putIwE8__formatEPwRS2_S3_jPKwS5_RKNS_5ctypeIwEEbRKNS_10money_base7patternEwwRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKNSE_IwNSF_IwEENSH_IwEEEESQ_i
+ W _ZNSt3__111__money_putIwEC1Ev
+ W _ZNSt3__111__money_putIwEC2Ev
+ C _ZNSt3__111__sprintf_lEPcPvPKcz
+ C _ZNSt3__111__stdoutbufIcE4syncEv
+ C _ZNSt3__111__stdoutbufIcE5imbueERKNS_6localeE
+ C _ZNSt3__111__stdoutbufIcE8overflowEi
+ C _ZNSt3__111__stdoutbufIcEC1EP7__sFILE
+ C _ZNSt3__111__stdoutbufIcEC2EP7__sFILE
+ C _ZNSt3__111__stdoutbufIcED0Ev
+ C _ZNSt3__111__stdoutbufIcED1Ev
+ C _ZNSt3__111__stdoutbufIcED2Ev
+ C _ZNSt3__111__stdoutbufIwE4syncEv
+ C _ZNSt3__111__stdoutbufIwE5imbueERKNS_6localeE
+ C _ZNSt3__111__stdoutbufIwE8overflowEj
+ C _ZNSt3__111__stdoutbufIwEC1EP7__sFILE
+ C _ZNSt3__111__stdoutbufIwEC2EP7__sFILE
+ C _ZNSt3__111__stdoutbufIwED0Ev
+ C _ZNSt3__111__stdoutbufIwED1Ev
+ C _ZNSt3__111__stdoutbufIwED2Ev
+ T _ZNSt3__111regex_errorC1ENS_15regex_constants10error_typeE
+ T _ZNSt3__111regex_errorC2ENS_15regex_constants10error_typeE
+ T _ZNSt3__111regex_errorD0Ev
+ T _ZNSt3__111regex_errorD1Ev
+ T _ZNSt3__111regex_errorD2Ev
+ T _ZNSt3__111this_thread9sleep_forERKNS_6chrono8durationIxNS_5ratioILx1ELx1000000000EEEEE
+ T _ZNSt3__111timed_mutex4lockEv
+ T _ZNSt3__111timed_mutex6unlockEv
+ T _ZNSt3__111timed_mutex8try_lockEv
+ T _ZNSt3__111timed_mutexC1Ev
+ T _ZNSt3__111timed_mutexC2Ev
+ T _ZNSt3__111timed_mutexD1Ev
+ T _ZNSt3__111timed_mutexD2Ev
+ D _ZNSt3__111try_to_lockE
+ C _ZNSt3__111unique_lockINS_5mutexEE6unlockEv
+ t _ZNSt3__112_GLOBAL__N_110use_strcmpclERKNS0_10classnamesEPKc
+ t _ZNSt3__112_GLOBAL__N_110use_strcmpclERKNS0_14collationnamesEPKc
+ T _ZNSt3__112_GLOBAL__N_111__fake_bindC1EMNS_6locale2idEFvvEPS3_
+ t _ZNSt3__112_GLOBAL__N_111__fake_bindC2EMNS_6locale2idEFvvEPS3_
+ t _ZNSt3__112_GLOBAL__N_13mutEv
+ t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb0EEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb1EEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb0EEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb1EEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_5ctypeIcEEPjbiEERT_T0_T1_T2_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_5ctypeIwEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_6locale5__impEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtIcc10_mbstate_tEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtIjc10_mbstate_tEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtItc10_mbstate_tEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtIwc10_mbstate_tEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_7collateIcEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_7collateIwEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_7num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_7num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_7num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_7num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_8messagesIcEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_8messagesIwEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_8numpunctIcEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_8numpunctIwEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_8time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_8time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_8time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_8time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_9money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_9money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_9money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_14makeINS_9money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_
+ t _ZNSt3__112_GLOBAL__N_17releaseclEPNS_6locale5facetE
+ t _ZNSt3__112_GLOBAL__N_19decrementIlEET_RS2_
+ t _ZNSt3__112_GLOBAL__N_19incrementIlEET_RS2_
+ d _ZNSt3__112_GLOBAL__N_1L10ClassNamesE
+ d _ZNSt3__112_GLOBAL__N_1L12collatenamesE
+ d _ZNSt3__112_GLOBAL__N_1L12small_primesE
+ d _ZNSt3__112_GLOBAL__N_1L7indicesE
+ C _ZNSt3__112__asprintf_lEPPcPvPKcz
+ C _ZNSt3__112__do_messageC2Ev
+ C _ZNSt3__112__do_messageD0Ev
+ C _ZNSt3__112__do_messageD1Ev
+ C _ZNSt3__112__do_messageD2Ev
+ T _ZNSt3__112__do_nothingEPv
+ T _ZNSt3__112__next_primeEj
+ D _ZNSt3__112__rs_default4__c_E
+ T _ZNSt3__112__rs_defaultC1ERKS0_
+ T _ZNSt3__112__rs_defaultC1Ev
+ T _ZNSt3__112__rs_defaultC2ERKS0_
+ T _ZNSt3__112__rs_defaultC2Ev
+ T _ZNSt3__112__rs_defaultD1Ev
+ T _ZNSt3__112__rs_defaultD2Ev
+ T _ZNSt3__112__rs_defaultclEv
+ C _ZNSt3__112__snprintf_lEPcjPvPKcz
+ T _ZNSt3__112bad_weak_ptrD0Ev
+ T _ZNSt3__112bad_weak_ptrD1Ev
+ T _ZNSt3__112bad_weak_ptrD2Ev
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE10__set_sizeEj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE11__recommendEj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE12__swap_allocERS4_S6_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE12__swap_allocERS4_S6_NS_17integral_constantIbLb0EEE
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE12__swap_allocERS4_S6_NS_17integral_constantIbLb1EEE
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13__get_pointerEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13shrink_to_fitEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE14__erase_to_endEj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE14__set_long_capEj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE15__set_long_sizeEj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE16__set_short_sizeEj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE18__get_long_pointerEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE18__set_long_pointerEPc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE19__copy_assign_allocERKS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE19__copy_assign_allocERKS5_NS_17integral_constantIbLb0EEE
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE19__copy_assign_allocERKS5_NS_17integral_constantIbLb1EEE
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE19__get_short_pointerEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE19__move_assign_allocERS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE19__move_assign_allocERS5_NS_17integral_constantIbLb0EEE
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE19__move_assign_allocERS5_NS_17integral_constantIbLb1EEE
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE21__grow_by_and_replaceEjjjjjjPKc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE26__invalidate_all_iteratorsEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE27__invalidate_iterators_pastEj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE2atEj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE3endEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4backEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4nposE
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4rendEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4swapERS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5beginEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5clearEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseENS_11__wrap_iterIPKcEE
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseENS_11__wrap_iterIPKcEES9_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseEjj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5frontEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcjj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEjc
+ C _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPKcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__zeroEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendERKS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendERKS5_jj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEjc
+ C _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendIPcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueERS5_E4typeES9_S9_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKcj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignERKS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignERKS5_jj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEjc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertENS_11__wrap_iterIPKcEEc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertENS_11__wrap_iterIPKcEEjc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEjPKc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEjPKcj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEjRKS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEjRKS5_jj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEjjc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6rbeginEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEjc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7__allocEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceENS_11__wrap_iterIPKcEES9_RKS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceENS_11__wrap_iterIPKcEES9_S8_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceENS_11__wrap_iterIPKcEES9_S8_j
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceENS_11__wrap_iterIPKcEES9_jc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjPKc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjPKcj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjRKS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjRKS5_jj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjjc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE8pop_backEv
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEjjjjjj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1EPKc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1EPKcRKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1EPKcj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1EPKcjRKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_RKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_jjRKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Ejc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1EjcRKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Ev
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2EPKc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2EPKcRKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2EPKcj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2EPKcjRKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2ERKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2ERKS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2ERKS5_RKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2ERKS5_jjRKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2Ejc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2EjcRKS4_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2Ev
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSEPKc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSEc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEixEj
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEpLEPKc
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEpLERKS5_
+ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEpLEc
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE10__set_sizeEj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE11__recommendEj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE12__swap_allocERS4_S6_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE12__swap_allocERS4_S6_NS_17integral_constantIbLb0EEE
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE12__swap_allocERS4_S6_NS_17integral_constantIbLb1EEE
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13__get_pointerEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13shrink_to_fitEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE14__erase_to_endEj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE14__set_long_capEj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE15__set_long_sizeEj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE16__set_short_sizeEj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE18__get_long_pointerEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE18__set_long_pointerEPw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE19__copy_assign_allocERKS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE19__copy_assign_allocERKS5_NS_17integral_constantIbLb0EEE
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE19__copy_assign_allocERKS5_NS_17integral_constantIbLb1EEE
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE19__get_short_pointerEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE19__move_assign_allocERS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE19__move_assign_allocERS5_NS_17integral_constantIbLb0EEE
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE19__move_assign_allocERS5_NS_17integral_constantIbLb1EEE
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE21__grow_by_and_replaceEjjjjjjPKw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE26__invalidate_all_iteratorsEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE27__invalidate_iterators_pastEj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE2atEj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE3endEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4backEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4nposE
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4rendEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE4swapERS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5beginEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5clearEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5eraseENS_11__wrap_iterIPKwEE
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5eraseENS_11__wrap_iterIPKwEES9_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5eraseEjj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE5frontEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initEPKwj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initEPKwjj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initEjw
+ C _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initIPKwEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__zeroEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendEPKw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendEPKwj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendERKS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendERKS5_jj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendEjw
+ C _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendIPwEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueERS5_E4typeES9_S9_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignEPKw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignEPKwj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignERKS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignERKS5_jj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignEjw
+ C _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignIPwEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueERS5_E4typeES9_S9_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertENS_11__wrap_iterIPKwEEjw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertENS_11__wrap_iterIPKwEEw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertEjPKw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertEjPKwj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertEjRKS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertEjRKS5_jj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertEjjw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6rbeginEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6resizeEj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6resizeEjw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7__allocEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceENS_11__wrap_iterIPKwEES9_RKS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceENS_11__wrap_iterIPKwEES9_S8_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceENS_11__wrap_iterIPKwEES9_S8_j
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceENS_11__wrap_iterIPKwEES9_jw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceEjjPKw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceEjjPKwj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceEjjRKS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceEjjRKS5_jj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceEjjjw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7reserveEj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE8pop_backEv
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9__grow_byEjjjjjj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1EPKw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1EPKwRKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1EPKwj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1EPKwjRKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1ERKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1ERKS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1ERKS5_RKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1ERKS5_jjRKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1Ejw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1EjwRKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1Ev
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2EPKw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2EPKwRKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2EPKwj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2EPKwjRKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2ERKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2ERKS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2ERKS5_RKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2ERKS5_jjRKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2Ejw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2EjwRKS4_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2Ev
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED1Ev
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEaSEPKw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEaSERKS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEaSEw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEixEj
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEpLEPKw
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEpLERKS5_
+ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEpLEw
+ T _ZNSt3__112ctype_bynameIcEC1EPKcj
+ T _ZNSt3__112ctype_bynameIcEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__112ctype_bynameIcEC2EPKcj
+ T _ZNSt3__112ctype_bynameIcEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__112ctype_bynameIcED0Ev
+ T _ZNSt3__112ctype_bynameIcED1Ev
+ T _ZNSt3__112ctype_bynameIcED2Ev
+ T _ZNSt3__112ctype_bynameIwEC1EPKcj
+ T _ZNSt3__112ctype_bynameIwEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__112ctype_bynameIwEC2EPKcj
+ T _ZNSt3__112ctype_bynameIwEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__112ctype_bynameIwED0Ev
+ T _ZNSt3__112ctype_bynameIwED1Ev
+ T _ZNSt3__112ctype_bynameIwED2Ev
+ T _ZNSt3__112future_errorC1ENS_10error_codeE
+ C _ZNSt3__112future_errorC1ERKS0_
+ T _ZNSt3__112future_errorC2ENS_10error_codeE
+ C _ZNSt3__112future_errorC2ERKS0_
+ T _ZNSt3__112future_errorD0Ev
+ T _ZNSt3__112future_errorD1Ev
+ T _ZNSt3__112future_errorD2Ev
+ D _ZNSt3__112placeholders2_1E
+ D _ZNSt3__112placeholders2_2E
+ D _ZNSt3__112placeholders2_3E
+ D _ZNSt3__112placeholders2_4E
+ D _ZNSt3__112placeholders2_5E
+ D _ZNSt3__112placeholders2_6E
+ D _ZNSt3__112placeholders2_7E
+ D _ZNSt3__112placeholders2_8E
+ D _ZNSt3__112placeholders2_9E
+ D _ZNSt3__112placeholders3_10E
+ T _ZNSt3__112strstreambuf3strEv
+ T _ZNSt3__112strstreambuf4swapERS0_
+ T _ZNSt3__112strstreambuf6__initEPciS1_
+ T _ZNSt3__112strstreambuf6freezeEb
+ T _ZNSt3__112strstreambuf7seekoffExNS_8ios_base7seekdirEj
+ T _ZNSt3__112strstreambuf7seekposENS_4fposI10_mbstate_tEEj
+ T _ZNSt3__112strstreambuf8overflowEi
+ T _ZNSt3__112strstreambuf9pbackfailEi
+ T _ZNSt3__112strstreambuf9underflowEv
+ T _ZNSt3__112strstreambufC1EPFPvjEPFvS1_E
+ T _ZNSt3__112strstreambufC1EPKai
+ T _ZNSt3__112strstreambufC1EPKci
+ T _ZNSt3__112strstreambufC1EPKhi
+ T _ZNSt3__112strstreambufC1EPaiS1_
+ T _ZNSt3__112strstreambufC1EPciS1_
+ T _ZNSt3__112strstreambufC1EPhiS1_
+ T _ZNSt3__112strstreambufC1Ei
+ T _ZNSt3__112strstreambufC2EPFPvjEPFvS1_E
+ T _ZNSt3__112strstreambufC2EPKai
+ T _ZNSt3__112strstreambufC2EPKci
+ T _ZNSt3__112strstreambufC2EPKhi
+ T _ZNSt3__112strstreambufC2EPaiS1_
+ T _ZNSt3__112strstreambufC2EPciS1_
+ T _ZNSt3__112strstreambufC2EPhiS1_
+ T _ZNSt3__112strstreambufC2Ei
+ T _ZNSt3__112strstreambufD0Ev
+ T _ZNSt3__112strstreambufD1Ev
+ T _ZNSt3__112strstreambufD2Ev
+ T _ZNSt3__112system_error6__initERKNS_10error_codeENS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__112system_errorC1ENS_10error_codeE
+ T _ZNSt3__112system_errorC1ENS_10error_codeEPKc
+ T _ZNSt3__112system_errorC1ENS_10error_codeERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__112system_errorC1EiRKNS_14error_categoryE
+ T _ZNSt3__112system_errorC1EiRKNS_14error_categoryEPKc
+ T _ZNSt3__112system_errorC1EiRKNS_14error_categoryERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__112system_errorC2ENS_10error_codeE
+ T _ZNSt3__112system_errorC2ENS_10error_codeEPKc
+ T _ZNSt3__112system_errorC2ENS_10error_codeERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__112system_errorC2EiRKNS_14error_categoryE
+ T _ZNSt3__112system_errorC2EiRKNS_14error_categoryEPKc
+ T _ZNSt3__112system_errorC2EiRKNS_14error_categoryERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__112system_errorD0Ev
+ T _ZNSt3__112system_errorD1Ev
+ T _ZNSt3__112system_errorD2Ev
+ t _ZNSt3__113__lower_boundIRNS_12_GLOBAL__N_110use_strcmpEPKNS1_10classnamesEPKcEET0_S9_S9_RKT1_T_
+ t _ZNSt3__113__lower_boundIRNS_12_GLOBAL__N_110use_strcmpEPKNS1_14collationnamesEPKcEET0_S9_S9_RKT1_T_
+ C _ZNSt3__113__lower_boundIRNS_6__lessIjjEEPKjjEET0_S6_S6_RKT1_T_
+ C _ZNSt3__113__vector_baseINS_4pairIPNS_18condition_variableEPNS_5mutexEEENS_18__hidden_allocatorIS6_EEED2Ev
+ C _ZNSt3__113__vector_baseIPNS_17__assoc_sub_stateENS_18__hidden_allocatorIS2_EEED2Ev
+ C _ZNSt3__113__vector_baseIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEED2Ev
+ D _ZNSt3__113allocator_argE
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getEPci
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getEPcic
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getERNS_15basic_streambufIcS2_EE
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getERNS_15basic_streambufIcS2_EEc
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getERc
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getEv
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE4peekEv
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE4readEPci
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE4swapERS3_
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE4syncEv
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE5seekgENS_4fposI10_mbstate_tEE
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE5seekgExNS_8ios_base7seekdirE
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE5tellgEv
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE5ungetEv
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE6ignoreEii
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE6sentryC1ERS3_b
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE6sentryC2ERS3_b
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE7getlineEPci
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE7getlineEPcic
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE7putbackEc
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE8readsomeEPci
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEED0Ev
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEED1Ev
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEED2Ev
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRNS_8ios_baseES5_E
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRNS_9basic_iosIcS2_EES6_E
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERPv
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERb
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERd
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERe
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERf
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERi
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERj
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERl
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERm
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERs
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERt
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERx
+ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERy
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getEPwi
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getEPwiw
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getERNS_15basic_streambufIwS2_EE
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getERNS_15basic_streambufIwS2_EEw
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getERw
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getEv
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE4peekEv
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE4readEPwi
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE4swapERS3_
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE4syncEv
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE5seekgENS_4fposI10_mbstate_tEE
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE5seekgExNS_8ios_base7seekdirE
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE5tellgEv
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE5ungetEv
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE6ignoreEij
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE6sentryC1ERS3_b
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE6sentryC2ERS3_b
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE7getlineEPwi
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE7getlineEPwiw
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE7putbackEw
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE8readsomeEPwi
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEEC1EPNS_15basic_streambufIwS2_EE
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEEC2EPNS_15basic_streambufIwS2_EE
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEED0Ev
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEED1Ev
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEED2Ev
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRNS_8ios_baseES5_E
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRNS_9basic_iosIwS2_EES6_E
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRS3_S4_E
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPNS_15basic_streambufIwS2_EE
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERPv
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERb
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERd
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERe
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERf
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERi
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERj
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERl
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERm
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERs
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERt
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERx
+ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsERy
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE3putEc
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE4swapERS3_
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5flushEv
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5seekpENS_4fposI10_mbstate_tEE
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5seekpExNS_8ios_base7seekdirE
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5tellpEv
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5writeEPKci
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryC1ERS3_
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryC2ERS3_
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryD1Ev
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryD2Ev
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC1Ev
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC2Ev
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEED0Ev
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEED1Ev
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEED2Ev
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRNS_8ios_baseES5_E
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRNS_9basic_iosIcS2_EES6_E
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRS3_S4_E
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPKv
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEb
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEd
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEe
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEf
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEi
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEj
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEl
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEm
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEs
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEt
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEx
+ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEy
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE3putEw
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE4swapERS3_
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE5flushEv
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE5seekpENS_4fposI10_mbstate_tEE
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE5seekpExNS_8ios_base7seekdirE
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE5tellpEv
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE5writeEPKwi
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE6sentryC1ERS3_
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE6sentryC2ERS3_
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE6sentryD1Ev
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE6sentryD2Ev
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC1EPNS_15basic_streambufIwS2_EE
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC1Ev
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC2EPNS_15basic_streambufIwS2_EE
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC2Ev
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEED0Ev
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEED1Ev
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEED2Ev
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRNS_8ios_baseES5_E
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRNS_9basic_iosIwS2_EES6_E
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRS3_S4_E
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPKv
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPNS_15basic_streambufIwS2_EE
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEb
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEd
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEe
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEf
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEi
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEj
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEl
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEm
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEs
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEt
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEx
+ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEy
+ C _ZNSt3__113find_first_ofIPKcS2_NS_11__traits_eqINS_11char_traitsIcEEEEEET_S7_S7_T0_S8_T1_
+ C _ZNSt3__113find_first_ofIPKwS2_NS_11__traits_eqINS_11char_traitsIwEEEEEET_S7_S7_T0_S8_T1_
+ T _ZNSt3__113random_deviceC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__113random_deviceC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__113random_deviceD1Ev
+ T _ZNSt3__113random_deviceD2Ev
+ T _ZNSt3__113random_deviceclEv
+ T _ZNSt3__113shared_futureIvED1Ev
+ T _ZNSt3__113shared_futureIvED2Ev
+ T _ZNSt3__113shared_futureIvEaSERKS1_
+ C _ZNSt3__114__codecvt_utf8IjED0Ev
+ C _ZNSt3__114__codecvt_utf8IjED1Ev
+ C _ZNSt3__114__codecvt_utf8IjED2Ev
+ C _ZNSt3__114__codecvt_utf8ItED0Ev
+ C _ZNSt3__114__codecvt_utf8ItED1Ev
+ C _ZNSt3__114__codecvt_utf8ItED2Ev
+ C _ZNSt3__114__codecvt_utf8IwED0Ev
+ C _ZNSt3__114__codecvt_utf8IwED1Ev
+ C _ZNSt3__114__codecvt_utf8IwED2Ev
+ T _ZNSt3__114__get_const_dbEv
+ T _ZNSt3__114__num_get_base10__get_baseERNS_8ios_baseE
+ D _ZNSt3__114__num_get_base5__srcE
+ T _ZNSt3__114__num_put_base12__format_intEPcPKcbj
+ T _ZNSt3__114__num_put_base14__format_floatEPcPKcj
+ T _ZNSt3__114__num_put_base18__identify_paddingEPcS1_RKNS_8ios_baseE
+ C _ZNSt3__114__scan_keywordINS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEPKNS_12basic_stringIcS3_NS_9allocatorIcEEEENS_5ctypeIcEEEET0_RT_SE_SD_SD_RKT1_Rjb
+ C _ZNSt3__114__scan_keywordINS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEPNS_12basic_stringIcS3_NS_9allocatorIcEEEENS_5ctypeIcEEEET0_RT_SD_SC_SC_RKT1_Rjb
+ C _ZNSt3__114__scan_keywordINS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEPKNS_12basic_stringIwS3_NS_9allocatorIwEEEENS_5ctypeIwEEEET0_RT_SE_SD_SD_RKT1_Rjb
+ C _ZNSt3__114__scan_keywordINS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEPNS_12basic_stringIwS3_NS_9allocatorIwEEEENS_5ctypeIwEEEET0_RT_SD_SC_SC_RKT1_Rjb
+ C _ZNSt3__114__scan_keywordIPcPNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_5ctypeIcEEEET0_RT_SC_SB_SB_RKT1_Rjb
+ C _ZNSt3__114__scan_keywordIPwPNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEENS_5ctypeIwEEEET0_RT_SC_SB_SB_RKT1_Rjb
+ T _ZNSt3__114__shared_count12__add_sharedEv
+ T _ZNSt3__114__shared_count16__release_sharedEv
+ T _ZNSt3__114__shared_countD0Ev
+ T _ZNSt3__114__shared_countD1Ev
+ T _ZNSt3__114__shared_countD2Ev
+ C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEE10push_frontERKS6_
+ C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEE18__construct_at_endINS_13move_iteratorIPS6_EEEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESG_SG_
+ C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEEC1EjjS9_
+ C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEEC2EjjS9_
+ C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEED1Ev
+ C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEED2Ev
+ C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEE10push_frontERKS2_
+ C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEE18__construct_at_endINS_13move_iteratorIPS2_EEEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESC_SC_
+ C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEEC1EjjS5_
+ C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEEC2EjjS5_
+ C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEED1Ev
+ C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEED2Ev
+ C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEE10push_frontERKS3_
+ C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEE18__construct_at_endEj
+ C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEE18__construct_at_endINS_13move_iteratorIPS3_EEEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESD_SD_
+ C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEEC1EjjS6_
+ C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEEC2EjjS6_
+ C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEED1Ev
+ C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEED2Ev
+ W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEE4swapERS3_
+ W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEED0Ev
+ W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEED1Ev
+ W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEED2Ev
+ W _ZNSt3__114codecvt_bynameIcc10_mbstate_tEC1EPKcj
+ W _ZNSt3__114codecvt_bynameIcc10_mbstate_tEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__114codecvt_bynameIcc10_mbstate_tEC2EPKcj
+ W _ZNSt3__114codecvt_bynameIcc10_mbstate_tEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__114codecvt_bynameIcc10_mbstate_tED0Ev
+ W _ZNSt3__114codecvt_bynameIcc10_mbstate_tED1Ev
+ W _ZNSt3__114codecvt_bynameIcc10_mbstate_tED2Ev
+ W _ZNSt3__114codecvt_bynameIjc10_mbstate_tEC1EPKcj
+ W _ZNSt3__114codecvt_bynameIjc10_mbstate_tEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__114codecvt_bynameIjc10_mbstate_tEC2EPKcj
+ W _ZNSt3__114codecvt_bynameIjc10_mbstate_tEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__114codecvt_bynameIjc10_mbstate_tED0Ev
+ W _ZNSt3__114codecvt_bynameIjc10_mbstate_tED1Ev
+ W _ZNSt3__114codecvt_bynameIjc10_mbstate_tED2Ev
+ W _ZNSt3__114codecvt_bynameItc10_mbstate_tEC1EPKcj
+ W _ZNSt3__114codecvt_bynameItc10_mbstate_tEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__114codecvt_bynameItc10_mbstate_tEC2EPKcj
+ W _ZNSt3__114codecvt_bynameItc10_mbstate_tEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__114codecvt_bynameItc10_mbstate_tED0Ev
+ W _ZNSt3__114codecvt_bynameItc10_mbstate_tED1Ev
+ W _ZNSt3__114codecvt_bynameItc10_mbstate_tED2Ev
+ W _ZNSt3__114codecvt_bynameIwc10_mbstate_tEC1EPKcj
+ W _ZNSt3__114codecvt_bynameIwc10_mbstate_tEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__114codecvt_bynameIwc10_mbstate_tEC2EPKcj
+ W _ZNSt3__114codecvt_bynameIwc10_mbstate_tEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__114codecvt_bynameIwc10_mbstate_tED0Ev
+ W _ZNSt3__114codecvt_bynameIwc10_mbstate_tED1Ev
+ W _ZNSt3__114codecvt_bynameIwc10_mbstate_tED2Ev
+ T _ZNSt3__114collate_bynameIcEC1EPKcj
+ T _ZNSt3__114collate_bynameIcEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__114collate_bynameIcEC2EPKcj
+ T _ZNSt3__114collate_bynameIcEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__114collate_bynameIcED0Ev
+ T _ZNSt3__114collate_bynameIcED1Ev
+ T _ZNSt3__114collate_bynameIcED2Ev
+ T _ZNSt3__114collate_bynameIwEC1EPKcj
+ T _ZNSt3__114collate_bynameIwEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__114collate_bynameIwEC2EPKcj
+ T _ZNSt3__114collate_bynameIwEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__114collate_bynameIwED0Ev
+ T _ZNSt3__114collate_bynameIwED1Ev
+ T _ZNSt3__114collate_bynameIwED2Ev
+ T _ZNSt3__114error_categoryC2Ev
+ T _ZNSt3__114error_categoryD0Ev
+ T _ZNSt3__114error_categoryD1Ev
+ T _ZNSt3__114error_categoryD2Ev
+ C _ZNSt3__115__codecvt_utf16IjLb0EED0Ev
+ C _ZNSt3__115__codecvt_utf16IjLb0EED1Ev
+ C _ZNSt3__115__codecvt_utf16IjLb0EED2Ev
+ C _ZNSt3__115__codecvt_utf16IjLb1EED0Ev
+ C _ZNSt3__115__codecvt_utf16IjLb1EED1Ev
+ C _ZNSt3__115__codecvt_utf16IjLb1EED2Ev
+ C _ZNSt3__115__codecvt_utf16ItLb0EED0Ev
+ C _ZNSt3__115__codecvt_utf16ItLb0EED1Ev
+ C _ZNSt3__115__codecvt_utf16ItLb0EED2Ev
+ C _ZNSt3__115__codecvt_utf16ItLb1EED0Ev
+ C _ZNSt3__115__codecvt_utf16ItLb1EED1Ev
+ C _ZNSt3__115__codecvt_utf16ItLb1EED2Ev
+ C _ZNSt3__115__codecvt_utf16IwLb0EED0Ev
+ C _ZNSt3__115__codecvt_utf16IwLb0EED1Ev
+ C _ZNSt3__115__codecvt_utf16IwLb0EED2Ev
+ C _ZNSt3__115__codecvt_utf16IwLb1EED0Ev
+ C _ZNSt3__115__codecvt_utf16IwLb1EED1Ev
+ C _ZNSt3__115__codecvt_utf16IwLb1EED2Ev
+ T _ZNSt3__115__get_classnameEPKcb
+ C _ZNSt3__115__num_get_floatIdEET_PKcS3_Rj
+ C _ZNSt3__115__num_get_floatIeEET_PKcS3_Rj
+ C _ZNSt3__115__num_get_floatIfEET_PKcS3_Rj
+ T _ZNSt3__115__thread_struct25notify_all_at_thread_exitEPNS_18condition_variableEPNS_5mutexE
+ T _ZNSt3__115__thread_struct27__make_ready_at_thread_exitEPNS_17__assoc_sub_stateE
+ T _ZNSt3__115__thread_structC1Ev
+ T _ZNSt3__115__thread_structC2Ev
+ T _ZNSt3__115__thread_structD1Ev
+ T _ZNSt3__115__thread_structD2Ev
+ C _ZNSt3__115__time_get_tempIcEC1EPKc
+ C _ZNSt3__115__time_get_tempIcEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ C _ZNSt3__115__time_get_tempIcEC2EPKc
+ C _ZNSt3__115__time_get_tempIcEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ C _ZNSt3__115__time_get_tempIcED0Ev
+ C _ZNSt3__115__time_get_tempIcED1Ev
+ C _ZNSt3__115__time_get_tempIcED2Ev
+ C _ZNSt3__115__time_get_tempIwEC1EPKc
+ C _ZNSt3__115__time_get_tempIwEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ C _ZNSt3__115__time_get_tempIwEC2EPKc
+ C _ZNSt3__115__time_get_tempIwEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ C _ZNSt3__115__time_get_tempIwED0Ev
+ C _ZNSt3__115__time_get_tempIwED1Ev
+ C _ZNSt3__115__time_get_tempIwED2Ev
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE10pubseekoffExNS_8ios_base7seekdirEj
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE10pubseekposENS_4fposI10_mbstate_tEEj
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE4setgEPcS4_S4_
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE4setpEPcS4_
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE4swapERS3_
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE4syncEv
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5gbumpEi
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5imbueERKNS_6localeE
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5pbumpEi
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sgetcEv
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sgetnEPci
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sputcEc
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sputnEPKci
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5uflowEv
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6sbumpcEv
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6setbufEPci
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6snextcEv
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6xsgetnEPci
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6xsputnEPKci
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE7pubsyncEv
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE7seekoffExNS_8ios_base7seekdirEj
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE7seekposENS_4fposI10_mbstate_tEEj
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE7sungetcEv
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE8in_availEv
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE8overflowEi
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE8pubimbueERKNS_6localeE
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9pbackfailEi
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9pubsetbufEPci
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9showmanycEv
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9sputbackcEc
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9underflowEv
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEEC1ERKS3_
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEEC1Ev
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEEC2ERKS3_
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEEC2Ev
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEED0Ev
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEED1Ev
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEED2Ev
+ W _ZNSt3__115basic_streambufIcNS_11char_traitsIcEEEaSERKS3_
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE10pubseekoffExNS_8ios_base7seekdirEj
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE10pubseekposENS_4fposI10_mbstate_tEEj
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE4setgEPwS4_S4_
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE4setpEPwS4_
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE4swapERS3_
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE4syncEv
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5gbumpEi
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5imbueERKNS_6localeE
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5pbumpEi
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sgetcEv
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sgetnEPwi
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sputcEw
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sputnEPKwi
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5uflowEv
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE6sbumpcEv
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE6setbufEPwi
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE6snextcEv
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE6xsgetnEPwi
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE6xsputnEPKwi
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE7pubsyncEv
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE7seekoffExNS_8ios_base7seekdirEj
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE7seekposENS_4fposI10_mbstate_tEEj
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE7sungetcEv
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE8in_availEv
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE8overflowEj
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE8pubimbueERKNS_6localeE
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE9pbackfailEj
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE9pubsetbufEPwi
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE9showmanycEv
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE9sputbackcEw
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE9underflowEv
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEEC1ERKS3_
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEEC1Ev
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEEC2ERKS3_
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEEC2Ev
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEED0Ev
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEED1Ev
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEED2Ev
+ W _ZNSt3__115basic_streambufIwNS_11char_traitsIwEEEaSERKS3_
+ T _ZNSt3__115future_categoryEv
+ W _ZNSt3__115messages_bynameIcEC1EPKcj
+ W _ZNSt3__115messages_bynameIcEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__115messages_bynameIcEC2EPKcj
+ W _ZNSt3__115messages_bynameIcEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__115messages_bynameIcED0Ev
+ W _ZNSt3__115messages_bynameIcED1Ev
+ W _ZNSt3__115messages_bynameIcED2Ev
+ W _ZNSt3__115messages_bynameIwEC1EPKcj
+ W _ZNSt3__115messages_bynameIwEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__115messages_bynameIwEC2EPKcj
+ W _ZNSt3__115messages_bynameIwEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__115messages_bynameIwED0Ev
+ W _ZNSt3__115messages_bynameIwED1Ev
+ W _ZNSt3__115messages_bynameIwED2Ev
+ T _ZNSt3__115numpunct_bynameIcE6__initEPKc
+ T _ZNSt3__115numpunct_bynameIcEC1EPKcj
+ T _ZNSt3__115numpunct_bynameIcEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__115numpunct_bynameIcEC2EPKcj
+ T _ZNSt3__115numpunct_bynameIcEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__115numpunct_bynameIcED0Ev
+ ? _ZNSt3__115numpunct_bynameIcED1Ev
+ T _ZNSt3__115numpunct_bynameIcED2Ev
+ T _ZNSt3__115numpunct_bynameIwE6__initEPKc
+ T _ZNSt3__115numpunct_bynameIwEC1EPKcj
+ T _ZNSt3__115numpunct_bynameIwEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__115numpunct_bynameIwEC2EPKcj
+ T _ZNSt3__115numpunct_bynameIwEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__115numpunct_bynameIwED0Ev
+ ? _ZNSt3__115numpunct_bynameIwED1Ev
+ T _ZNSt3__115numpunct_bynameIwED2Ev
+ T _ZNSt3__115recursive_mutex4lockEv
+ T _ZNSt3__115recursive_mutex6unlockEv
+ T _ZNSt3__115recursive_mutex8try_lockEv
+ T _ZNSt3__115recursive_mutexC1Ev
+ T _ZNSt3__115recursive_mutexC2Ev
+ T _ZNSt3__115recursive_mutexD1Ev
+ T _ZNSt3__115recursive_mutexD2Ev
+ T _ZNSt3__115system_categoryEv
+ W _ZNSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEC1EPKcj
+ W _ZNSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEC1ERKNS_12basic_stringIcS3_NS_9allocatorIcEEEEj
+ W _ZNSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEC2EPKcj
+ W _ZNSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEC2ERKNS_12basic_stringIcS3_NS_9allocatorIcEEEEj
+ W _ZNSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED0Ev
+ W _ZNSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED1Ev
+ W _ZNSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED2Ev
+ W _ZNSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEC1EPKcj
+ W _ZNSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEC1ERKNS_12basic_stringIcNS2_IcEENS_9allocatorIcEEEEj
+ W _ZNSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEC2EPKcj
+ W _ZNSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEC2ERKNS_12basic_stringIcNS2_IcEENS_9allocatorIcEEEEj
+ W _ZNSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED0Ev
+ W _ZNSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED1Ev
+ W _ZNSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED2Ev
+ W _ZNSt3__115time_put_bynameIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC1EPKcj
+ W _ZNSt3__115time_put_bynameIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC1ERKNS_12basic_stringIcS3_NS_9allocatorIcEEEEj
+ W _ZNSt3__115time_put_bynameIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC2EPKcj
+ W _ZNSt3__115time_put_bynameIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC2ERKNS_12basic_stringIcS3_NS_9allocatorIcEEEEj
+ W _ZNSt3__115time_put_bynameIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED0Ev
+ W _ZNSt3__115time_put_bynameIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED1Ev
+ W _ZNSt3__115time_put_bynameIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED2Ev
+ W _ZNSt3__115time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC1EPKcj
+ W _ZNSt3__115time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC1ERKNS_12basic_stringIcNS2_IcEENS_9allocatorIcEEEEj
+ W _ZNSt3__115time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC2EPKcj
+ W _ZNSt3__115time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC2ERKNS_12basic_stringIcNS2_IcEENS_9allocatorIcEEEEj
+ W _ZNSt3__115time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED0Ev
+ W _ZNSt3__115time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED1Ev
+ W _ZNSt3__115time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED2Ev
+ T _ZNSt3__116__check_groupingERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjS8_Rj
+ T _ZNSt3__116__narrow_to_utf8ILj16EED0Ev
+ ? _ZNSt3__116__narrow_to_utf8ILj16EED1Ev
+ ? _ZNSt3__116__narrow_to_utf8ILj16EED2Ev
+ T _ZNSt3__116__narrow_to_utf8ILj32EED0Ev
+ ? _ZNSt3__116__narrow_to_utf8ILj32EED1Ev
+ ? _ZNSt3__116__narrow_to_utf8ILj32EED2Ev
+ C _ZNSt3__116__pad_and_outputIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEET0_S5_PKT_S8_S8_RNS_8ios_baseES6_
+ C _ZNSt3__116__pad_and_outputIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEET0_S5_PKT_S8_S8_RNS_8ios_baseES6_
+ T _ZNSt3__116generic_categoryEv
+ T _ZNSt3__117__assoc_sub_state10__sub_waitERNS_11unique_lockINS_5mutexEEE
+ T _ZNSt3__117__assoc_sub_state12__make_readyEv
+ T _ZNSt3__117__assoc_sub_state13set_exceptionESt13exception_ptr
+ T _ZNSt3__117__assoc_sub_state16__on_zero_sharedEv
+ T _ZNSt3__117__assoc_sub_state24set_value_at_thread_exitEv
+ T _ZNSt3__117__assoc_sub_state28set_exception_at_thread_exitESt13exception_ptr
+ T _ZNSt3__117__assoc_sub_state4copyEv
+ T _ZNSt3__117__assoc_sub_state4waitEv
+ T _ZNSt3__117__assoc_sub_state9__executeEv
+ T _ZNSt3__117__assoc_sub_state9set_valueEv
+ C _ZNSt3__117__assoc_sub_stateD0Ev
+ C _ZNSt3__117__assoc_sub_stateD1Ev
+ C _ZNSt3__117__assoc_sub_stateD2Ev
+ T _ZNSt3__117__call_once_paramINS_12_GLOBAL__N_111__fake_bindEEC1ERKS2_
+ t _ZNSt3__117__call_once_paramINS_12_GLOBAL__N_111__fake_bindEEC2ERKS2_
+ t _ZNSt3__117__call_once_proxyINS_12_GLOBAL__N_111__fake_bindEEEvPv
+ T _ZNSt3__117__compressed_pairIPNS_6locale5facetENS_12_GLOBAL__N_17releaseEEC1ES3_i
+ t _ZNSt3__117__compressed_pairIPNS_6locale5facetENS_12_GLOBAL__N_17releaseEEC2ES3_i
+ T _ZNSt3__117__widen_from_utf8ILj16EED0Ev
+ ? _ZNSt3__117__widen_from_utf8ILj16EED1Ev
+ ? _ZNSt3__117__widen_from_utf8ILj16EED2Ev
+ T _ZNSt3__117__widen_from_utf8ILj32EED0Ev
+ ? _ZNSt3__117__widen_from_utf8ILj32EED1Ev
+ ? _ZNSt3__117__widen_from_utf8ILj32EED2Ev
+ T _ZNSt3__117declare_reachableEPv
+ T _ZNSt3__117iostream_categoryEv
+ T _ZNSt3__117moneypunct_bynameIcLb0EE4initEPKc
+ W _ZNSt3__117moneypunct_bynameIcLb0EEC1EPKcj
+ W _ZNSt3__117moneypunct_bynameIcLb0EEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__117moneypunct_bynameIcLb0EEC2EPKcj
+ W _ZNSt3__117moneypunct_bynameIcLb0EEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__117moneypunct_bynameIcLb0EED0Ev
+ W _ZNSt3__117moneypunct_bynameIcLb0EED1Ev
+ W _ZNSt3__117moneypunct_bynameIcLb0EED2Ev
+ T _ZNSt3__117moneypunct_bynameIcLb1EE4initEPKc
+ W _ZNSt3__117moneypunct_bynameIcLb1EEC1EPKcj
+ W _ZNSt3__117moneypunct_bynameIcLb1EEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__117moneypunct_bynameIcLb1EEC2EPKcj
+ W _ZNSt3__117moneypunct_bynameIcLb1EEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__117moneypunct_bynameIcLb1EED0Ev
+ W _ZNSt3__117moneypunct_bynameIcLb1EED1Ev
+ W _ZNSt3__117moneypunct_bynameIcLb1EED2Ev
+ T _ZNSt3__117moneypunct_bynameIwLb0EE4initEPKc
+ W _ZNSt3__117moneypunct_bynameIwLb0EEC1EPKcj
+ W _ZNSt3__117moneypunct_bynameIwLb0EEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__117moneypunct_bynameIwLb0EEC2EPKcj
+ W _ZNSt3__117moneypunct_bynameIwLb0EEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__117moneypunct_bynameIwLb0EED0Ev
+ W _ZNSt3__117moneypunct_bynameIwLb0EED1Ev
+ W _ZNSt3__117moneypunct_bynameIwLb0EED2Ev
+ T _ZNSt3__117moneypunct_bynameIwLb1EE4initEPKc
+ W _ZNSt3__117moneypunct_bynameIwLb1EEC1EPKcj
+ W _ZNSt3__117moneypunct_bynameIwLb1EEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__117moneypunct_bynameIwLb1EEC2EPKcj
+ W _ZNSt3__117moneypunct_bynameIwLb1EEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ W _ZNSt3__117moneypunct_bynameIwLb1EED0Ev
+ W _ZNSt3__117moneypunct_bynameIwLb1EED1Ev
+ W _ZNSt3__117moneypunct_bynameIwLb1EED2Ev
+ C _ZNSt3__118__hidden_allocatorINS_4pairIPNS_18condition_variableEPNS_5mutexEEEE10deallocateEPS6_j
+ C _ZNSt3__118__hidden_allocatorINS_4pairIPNS_18condition_variableEPNS_5mutexEEEE8allocateEj
+ C _ZNSt3__118__hidden_allocatorIPNS_17__assoc_sub_stateEE10deallocateEPS2_j
+ C _ZNSt3__118__hidden_allocatorIPNS_17__assoc_sub_stateEE8allocateEj
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIaaEEPaEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIccEEPcEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIddEEPdEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIeeEEPeEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIffEEPfEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIhhEEPhEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIiiEEPiEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIjjEEPjEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIllEEPlEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessImmEEPmEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIssEEPsEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIttEEPtEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIwwEEPwEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIxxEEPxEEvT0_S5_T_
+ C _ZNSt3__118__insertion_sort_3IRNS_6__lessIyyEEPyEEvT0_S5_T_
+ T _ZNSt3__118__time_get_storageIcE4initERKNS_5ctypeIcEE
+ T _ZNSt3__118__time_get_storageIcE9__analyzeEcRKNS_5ctypeIcEE
+ T _ZNSt3__118__time_get_storageIcEC1EPKc
+ T _ZNSt3__118__time_get_storageIcEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__118__time_get_storageIcEC2EPKc
+ T _ZNSt3__118__time_get_storageIcEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__118__time_get_storageIwE4initERKNS_5ctypeIwEE
+ T _ZNSt3__118__time_get_storageIwE9__analyzeEcRKNS_5ctypeIwEE
+ T _ZNSt3__118__time_get_storageIwEC1EPKc
+ T _ZNSt3__118__time_get_storageIwEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__118__time_get_storageIwEC2EPKc
+ T _ZNSt3__118__time_get_storageIwEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__118condition_variable10notify_allEv
+ T _ZNSt3__118condition_variable10notify_oneEv
+ T _ZNSt3__118condition_variable15__do_timed_waitERNS_11unique_lockINS_5mutexEEENS_6chrono10time_pointINS5_12system_clockENS5_8durationIxNS_5ratioILx1ELx1000000000EEEEEEE
+ T _ZNSt3__118condition_variable4waitERNS_11unique_lockINS_5mutexEEE
+ T _ZNSt3__118condition_variableD1Ev
+ T _ZNSt3__118condition_variableD2Ev
+ T _ZNSt3__118get_pointer_safetyEv
+ C _ZNSt3__119__double_or_nothingIcEEvRNS_10unique_ptrIT_PFvPvEEERPS2_S9_
+ C _ZNSt3__119__double_or_nothingIjEEvRNS_10unique_ptrIT_PFvPvEEERPS2_S9_
+ C _ZNSt3__119__double_or_nothingIwEEvRNS_10unique_ptrIT_PFvPvEEERPS2_S9_
+ C _ZNSt3__119__iostream_categoryC1Ev
+ C _ZNSt3__119__iostream_categoryC2Ev
+ C _ZNSt3__119__iostream_categoryD0Ev
+ C _ZNSt3__119__iostream_categoryD1Ev
+ C _ZNSt3__119__iostream_categoryD2Ev
+ T _ZNSt3__119__shared_weak_count10__add_weakEv
+ T _ZNSt3__119__shared_weak_count12__add_sharedEv
+ T _ZNSt3__119__shared_weak_count14__release_weakEv
+ T _ZNSt3__119__shared_weak_count16__release_sharedEv
+ T _ZNSt3__119__shared_weak_count4lockEv
+ T _ZNSt3__119__shared_weak_countD0Ev
+ ? _ZNSt3__119__shared_weak_countD1Ev
+ T _ZNSt3__119__shared_weak_countD2Ev
+ D _ZNSt3__119__start_std_streamsE
+ T _ZNSt3__119__thread_local_dataEv
+ T _ZNSt3__119__thread_struct_imp25notify_all_at_thread_exitEPNS_18condition_variableEPNS_5mutexE
+ T _ZNSt3__119__thread_struct_imp27__make_ready_at_thread_exitEPNS_17__assoc_sub_stateE
+ C _ZNSt3__119__thread_struct_impC1Ev
+ C _ZNSt3__119__thread_struct_impC2Ev
+ T _ZNSt3__119__thread_struct_impD1Ev
+ T _ZNSt3__119__thread_struct_impD2Ev
+ T _ZNSt3__119declare_no_pointersEPcj
+ D _ZNSt3__119piecewise_constructE
+ C _ZNSt3__120__codecvt_utf8_utf16IjED0Ev
+ C _ZNSt3__120__codecvt_utf8_utf16IjED1Ev
+ C _ZNSt3__120__codecvt_utf8_utf16IjED2Ev
+ C _ZNSt3__120__codecvt_utf8_utf16ItED0Ev
+ C _ZNSt3__120__codecvt_utf8_utf16ItED1Ev
+ C _ZNSt3__120__codecvt_utf8_utf16ItED2Ev
+ C _ZNSt3__120__codecvt_utf8_utf16IwED0Ev
+ C _ZNSt3__120__codecvt_utf8_utf16IwED1Ev
+ C _ZNSt3__120__codecvt_utf8_utf16IwED2Ev
+ T _ZNSt3__120__get_collation_nameEPKc
+ C _ZNSt3__120__get_up_to_n_digitsIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiRT0_S5_RjRKNS_5ctypeIT_EEi
+ C _ZNSt3__120__get_up_to_n_digitsIcPcEEiRT0_S2_RjRKNS_5ctypeIT_EEi
+ C _ZNSt3__120__get_up_to_n_digitsIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiRT0_S5_RjRKNS_5ctypeIT_EEi
+ C _ZNSt3__120__get_up_to_n_digitsIwPwEEiRT0_S2_RjRKNS_5ctypeIT_EEi
+ T _ZNSt3__120__throw_system_errorEiPKc
+ C _ZNSt3__120__time_get_c_storageIcEC2Ev
+ C _ZNSt3__120__time_get_c_storageIwEC2Ev
+ W _ZNSt3__120__vector_base_commonILb1EEC1Ev
+ W _ZNSt3__120__vector_base_commonILb1EEC2Ev
+ C _ZNSt3__121__thread_specific_ptrINS_15__thread_structEE16__at_thread_exitEPv
+ C _ZNSt3__121__thread_specific_ptrINS_15__thread_structEEC1Ev
+ C _ZNSt3__121__thread_specific_ptrINS_15__thread_structEEC2Ev
+ C _ZNSt3__121__thread_specific_ptrINS_15__thread_structEED1Ev
+ C _ZNSt3__121__thread_specific_ptrINS_15__thread_structEED2Ev
+ T _ZNSt3__121__throw_runtime_errorEPKc
+ T _ZNSt3__121__undeclare_reachableEPv
+ T _ZNSt3__121recursive_timed_mutex4lockEv
+ T _ZNSt3__121recursive_timed_mutex6unlockEv
+ T _ZNSt3__121recursive_timed_mutex8try_lockEv
+ T _ZNSt3__121recursive_timed_mutexC1Ev
+ T _ZNSt3__121recursive_timed_mutexC2Ev
+ T _ZNSt3__121recursive_timed_mutexD1Ev
+ T _ZNSt3__121recursive_timed_mutexD2Ev
+ T _ZNSt3__121undeclare_no_pointersEPcj
+ C _ZNSt3__122__release_shared_countclEPNS_14__shared_countE
+ C _ZNSt3__123__future_error_categoryC1Ev
+ C _ZNSt3__123__future_error_categoryC2Ev
+ C _ZNSt3__123__future_error_categoryD0Ev
+ C _ZNSt3__123__future_error_categoryD1Ev
+ C _ZNSt3__123__future_error_categoryD2Ev
+ C _ZNSt3__123__system_error_categoryC1Ev
+ C _ZNSt3__123__system_error_categoryC2Ev
+ C _ZNSt3__123__system_error_categoryD0Ev
+ C _ZNSt3__123__system_error_categoryD1Ev
+ C _ZNSt3__123__system_error_categoryD2Ev
+ C _ZNSt3__123mersenne_twister_engineIjLj32ELj624ELj397ELj31ELj2567483615ELj11ELj4294967295ELj7ELj2636928640ELj15ELj4022730752ELj18ELj1812433253EE4seedEj
+ C _ZNSt3__123mersenne_twister_engineIjLj32ELj624ELj397ELj31ELj2567483615ELj11ELj4294967295ELj7ELj2636928640ELj15ELj4022730752ELj18ELj1812433253EEclEv
+ C _ZNSt3__124__generic_error_categoryC1Ev
+ C _ZNSt3__124__generic_error_categoryC2Ev
+ C _ZNSt3__124__generic_error_categoryD0Ev
+ C _ZNSt3__124__generic_error_categoryD1Ev
+ C _ZNSt3__124__generic_error_categoryD2Ev
+ C _ZNSt3__125__num_get_signed_integralIlEET_PKcS3_Rji
+ C _ZNSt3__125__num_get_signed_integralIxEET_PKcS3_Rji
+ T _ZNSt3__125notify_all_at_thread_exitERNS_18condition_variableENS_11unique_lockINS_5mutexEEE
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIaaEEPaEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIccEEPcEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIddEEPdEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIeeEEPeEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIffEEPfEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIhhEEPhEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIiiEEPiEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIjjEEPjEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIllEEPlEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessImmEEPmEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIssEEPsEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIttEEPtEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIwwEEPwEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIxxEEPxEEbT0_S5_T_
+ W _ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIyyEEPyEEbT0_S5_T_
+ C _ZNSt3__127__num_get_unsigned_integralIjEET_PKcS3_Rji
+ C _ZNSt3__127__num_get_unsigned_integralImEET_PKcS3_Rji
+ C _ZNSt3__127__num_get_unsigned_integralItEET_PKcS3_Rji
+ C _ZNSt3__127__num_get_unsigned_integralIyEET_PKcS3_Rji
+ D _ZNSt3__13cinE
+ D _ZNSt3__14cerrE
+ D _ZNSt3__14clogE
+ D _ZNSt3__14coutE
+ T _ZNSt3__14stodERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPj
+ T _ZNSt3__14stodERKNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEPj
+ T _ZNSt3__14stofERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPj
+ T _ZNSt3__14stofERKNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEPj
+ T _ZNSt3__14stoiERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPji
+ T _ZNSt3__14stoiERKNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEPji
+ T _ZNSt3__14stolERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPji
+ T _ZNSt3__14stolERKNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEPji
+ D _ZNSt3__14wcinE
+ T _ZNSt3__15alignEjjRPvRj
+ T _ZNSt3__15ctypeIcE13classic_tableEv
+ T _ZNSt3__15ctypeIcE21__classic_lower_tableEv
+ T _ZNSt3__15ctypeIcE21__classic_upper_tableEv
+ D _ZNSt3__15ctypeIcE2idE
+ T _ZNSt3__15ctypeIcEC1EPKjbj
+ T _ZNSt3__15ctypeIcEC2EPKjbj
+ T _ZNSt3__15ctypeIcED0Ev
+ T _ZNSt3__15ctypeIcED1Ev
+ T _ZNSt3__15ctypeIcED2Ev
+ D _ZNSt3__15ctypeIwE2idE
+ T _ZNSt3__15ctypeIwED0Ev
+ ? _ZNSt3__15ctypeIwED1Ev
+ T _ZNSt3__15ctypeIwED2Ev
+ T _ZNSt3__15mutex4lockEv
+ T _ZNSt3__15mutex6unlockEv
+ T _ZNSt3__15mutex8try_lockEv
+ T _ZNSt3__15mutexD1Ev
+ T _ZNSt3__15mutexD2Ev
+ T _ZNSt3__15stoldERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPj
+ T _ZNSt3__15stoldERKNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEPj
+ T _ZNSt3__15stollERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPji
+ T _ZNSt3__15stollERKNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEPji
+ T _ZNSt3__15stoulERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPji
+ T _ZNSt3__15stoulERKNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEPji
+ D _ZNSt3__15wcerrE
+ D _ZNSt3__15wclogE
+ D _ZNSt3__15wcoutE
+ T _ZNSt3__16__clocEv
+ W _ZNSt3__16__sortIRNS_6__lessIaaEEPaEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIccEEPcEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIddEEPdEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIeeEEPeEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIffEEPfEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIhhEEPhEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIiiEEPiEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIjjEEPjEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIllEEPlEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessImmEEPmEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIssEEPsEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIttEEPtEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIwwEEPwEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIxxEEPxEEvT0_S5_T_
+ W _ZNSt3__16__sortIRNS_6__lessIyyEEPyEEvT0_S5_T_
+ T _ZNSt3__16chrono12steady_clock3nowEv
+ T _ZNSt3__16chrono12system_clock11from_time_tEl
+ T _ZNSt3__16chrono12system_clock3nowEv
+ T _ZNSt3__16chrono12system_clock9to_time_tERKNS0_10time_pointIS1_NS0_8durationIxNS_5ratioILx1ELx1000000EEEEEEE
+ T _ZNSt3__16futureIvE3getEv
+ T _ZNSt3__16futureIvEC1EPNS_17__assoc_sub_stateE
+ T _ZNSt3__16futureIvEC2EPNS_17__assoc_sub_stateE
+ T _ZNSt3__16futureIvED1Ev
+ T _ZNSt3__16futureIvED2Ev
+ T _ZNSt3__16gslice6__initEj
+ T _ZNSt3__16locale14__install_ctorERKS0_PNS0_5facetEl
+ T _ZNSt3__16locale2id5__getEv
+ T _ZNSt3__16locale2id6__initEv
+ D _ZNSt3__16locale2id9__next_idE
+ T _ZNSt3__16locale5__imp11make_globalEv
+ C _ZNSt3__16locale5__imp12install_fromINS_10moneypunctIcLb0EEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_10moneypunctIcLb1EEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_10moneypunctIwLb0EEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_10moneypunctIwLb1EEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_5ctypeIcEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_5ctypeIwEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_7codecvtIcc10_mbstate_tEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_7codecvtIjc10_mbstate_tEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_7codecvtItc10_mbstate_tEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_7codecvtIwc10_mbstate_tEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_7collateIcEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_7collateIwEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_7num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_7num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_7num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_7num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_8messagesIcEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_8messagesIwEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_8numpunctIcEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_8numpunctIwEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_8time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_8time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_8time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_8time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_9money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_9money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_9money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvRKS1_
+ C _ZNSt3__16locale5__imp12install_fromINS_9money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvRKS1_
+ T _ZNSt3__16locale5__imp12make_classicEv
+ T _ZNSt3__16locale5__imp7installEPNS0_5facetEl
+ C _ZNSt3__16locale5__imp7installINS_10moneypunctIcLb0EEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_10moneypunctIcLb1EEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_10moneypunctIwLb0EEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_10moneypunctIwLb1EEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_12ctype_bynameIcEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_12ctype_bynameIwEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_14codecvt_bynameIcc10_mbstate_tEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_14codecvt_bynameIjc10_mbstate_tEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_14codecvt_bynameItc10_mbstate_tEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_14codecvt_bynameIwc10_mbstate_tEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_14collate_bynameIcEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_14collate_bynameIwEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_15messages_bynameIcEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_15messages_bynameIwEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_15numpunct_bynameIcEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_15numpunct_bynameIwEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_15time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_15time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_15time_put_bynameIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_15time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_17moneypunct_bynameIcLb0EEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_17moneypunct_bynameIcLb1EEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_17moneypunct_bynameIwLb0EEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_17moneypunct_bynameIwLb1EEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_5ctypeIcEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_5ctypeIwEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_7codecvtIcc10_mbstate_tEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_7codecvtIjc10_mbstate_tEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_7codecvtItc10_mbstate_tEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_7codecvtIwc10_mbstate_tEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_7collateIcEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_7collateIwEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_7num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_7num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_7num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_7num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_8messagesIcEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_8messagesIwEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_8numpunctIcEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_8numpunctIwEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_8time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_8time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_8time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_8time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_9money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_9money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_9money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEEEvPT_
+ C _ZNSt3__16locale5__imp7installINS_9money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEEEvPT_
+ T _ZNSt3__16locale5__impC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__16locale5__impC1ERKS1_
+ T _ZNSt3__16locale5__impC1ERKS1_PNS0_5facetEl
+ T _ZNSt3__16locale5__impC1ERKS1_RKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEi
+ T _ZNSt3__16locale5__impC1ERKS1_S3_i
+ T _ZNSt3__16locale5__impC1Ej
+ T _ZNSt3__16locale5__impC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj
+ T _ZNSt3__16locale5__impC2ERKS1_
+ T _ZNSt3__16locale5__impC2ERKS1_PNS0_5facetEl
+ T _ZNSt3__16locale5__impC2ERKS1_RKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEi
+ T _ZNSt3__16locale5__impC2ERKS1_S3_i
+ T _ZNSt3__16locale5__impC2Ej
+ T _ZNSt3__16locale5__impD0Ev
+ T _ZNSt3__16locale5__impD1Ev
+ T _ZNSt3__16locale5__impD2Ev
+ T _ZNSt3__16locale5facet16__on_zero_sharedEv
+ T _ZNSt3__16locale5facetD0Ev
+ T _ZNSt3__16locale5facetD1Ev
+ T _ZNSt3__16locale5facetD2Ev
+ T _ZNSt3__16locale6globalERKS0_
+ T _ZNSt3__16locale7classicEv
+ T _ZNSt3__16locale8__globalEv
+ T _ZNSt3__16localeC1EPKc
+ T _ZNSt3__16localeC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__16localeC1ERKS0_
+ T _ZNSt3__16localeC1ERKS0_PKci
+ T _ZNSt3__16localeC1ERKS0_RKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEi
+ T _ZNSt3__16localeC1ERKS0_S2_i
+ T _ZNSt3__16localeC1Ev
+ T _ZNSt3__16localeC2EPKc
+ T _ZNSt3__16localeC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
+ T _ZNSt3__16localeC2ERKS0_
+ T _ZNSt3__16localeC2ERKS0_PKci
+ T _ZNSt3__16localeC2ERKS0_RKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEi
+ T _ZNSt3__16localeC2ERKS0_S2_i
+ T _ZNSt3__16localeC2Ev
+ T _ZNSt3__16localeD1Ev
+ T _ZNSt3__16localeD2Ev
+ T _ZNSt3__16localeaSERKS0_
+ T _ZNSt3__16stoullERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPji
+ T _ZNSt3__16stoullERKNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEPji
+ T _ZNSt3__16thread20hardware_concurrencyEv
+ T _ZNSt3__16thread4joinEv
+ T _ZNSt3__16thread6detachEv
+ T _ZNSt3__16threadD1Ev
+ T _ZNSt3__16threadD2Ev
+ C _ZNSt3__16vectorINS_4pairIPNS_18condition_variableEPNS_5mutexEEENS_18__hidden_allocatorIS6_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS6_RS8_EE
+ C _ZNSt3__16vectorINS_4pairIPNS_18condition_variableEPNS_5mutexEEENS_18__hidden_allocatorIS6_EEED1Ev
+ C _ZNSt3__16vectorINS_4pairIPNS_18condition_variableEPNS_5mutexEEENS_18__hidden_allocatorIS6_EEED2Ev
+ C _ZNSt3__16vectorIPNS_17__assoc_sub_stateENS_18__hidden_allocatorIS2_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS2_RS4_EE
+ C _ZNSt3__16vectorIPNS_17__assoc_sub_stateENS_18__hidden_allocatorIS2_EEED1Ev
+ C _ZNSt3__16vectorIPNS_17__assoc_sub_stateENS_18__hidden_allocatorIS2_EEED2Ev
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEE10deallocateEv
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEE18__construct_at_endEj
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEE18__construct_at_endIPS3_EENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEE26__swap_out_circular_bufferERNS_14__split_bufferIS3_RS5_EE
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEE6assignIPS3_EENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEE6resizeEj
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEE8__appendEj
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEE8allocateEj
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEEC1Ej
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEEC2Ej
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEED1Ev
+ C _ZNSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEED2Ev
+ C _ZNSt3__17__sort3IRNS_6__lessIaaEEPaEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIccEEPcEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIddEEPdEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIeeEEPeEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIffEEPfEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIhhEEPhEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIiiEEPiEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIjjEEPjEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIllEEPlEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessImmEEPmEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIssEEPsEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIttEEPtEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIwwEEPwEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIxxEEPxEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort3IRNS_6__lessIyyEEPyEEjT0_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIaaEEPaEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIccEEPcEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIddEEPdEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIeeEEPeEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIffEEPfEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIhhEEPhEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIiiEEPiEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIjjEEPjEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIllEEPlEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessImmEEPmEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIssEEPsEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIttEEPtEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIwwEEPwEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIxxEEPxEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort4IRNS_6__lessIyyEEPyEEjT0_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIaaEEPaEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIccEEPcEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIddEEPdEEjT0_S5_S5_S5_S5_T_
+ W _ZNSt3__17__sort5IRNS_6__lessIeeEEPeEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIffEEPfEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIhhEEPhEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIiiEEPiEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIjjEEPjEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIllEEPlEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessImmEEPmEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIssEEPsEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIttEEPtEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIwwEEPwEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIxxEEPxEEjT0_S5_S5_S5_S5_T_
+ C _ZNSt3__17__sort5IRNS_6__lessIyyEEPyEEjT0_S5_S5_S5_S5_T_
+ D _ZNSt3__17codecvtIcc10_mbstate_tE2idE
+ T _ZNSt3__17codecvtIcc10_mbstate_tED0Ev
+ ? _ZNSt3__17codecvtIcc10_mbstate_tED1Ev
+ T _ZNSt3__17codecvtIcc10_mbstate_tED2Ev
+ D _ZNSt3__17codecvtIjc10_mbstate_tE2idE
+ T _ZNSt3__17codecvtIjc10_mbstate_tED0Ev
+ ? _ZNSt3__17codecvtIjc10_mbstate_tED1Ev
+ T _ZNSt3__17codecvtIjc10_mbstate_tED2Ev
+ D _ZNSt3__17codecvtItc10_mbstate_tE2idE
+ T _ZNSt3__17codecvtItc10_mbstate_tED0Ev
+ ? _ZNSt3__17codecvtItc10_mbstate_tED1Ev
+ T _ZNSt3__17codecvtItc10_mbstate_tED2Ev
+ D _ZNSt3__17codecvtIwc10_mbstate_tE2idE
+ T _ZNSt3__17codecvtIwc10_mbstate_tEC1EPKcj
+ T _ZNSt3__17codecvtIwc10_mbstate_tEC1Ej
+ T _ZNSt3__17codecvtIwc10_mbstate_tEC2EPKcj
+ T _ZNSt3__17codecvtIwc10_mbstate_tEC2Ej
+ T _ZNSt3__17codecvtIwc10_mbstate_tED0Ev
+ T _ZNSt3__17codecvtIwc10_mbstate_tED1Ev
+ T _ZNSt3__17codecvtIwc10_mbstate_tED2Ev
+ W _ZNSt3__17collateIcE2idE
+ W _ZNSt3__17collateIcEC1Ej
+ W _ZNSt3__17collateIcEC2Ej
+ W _ZNSt3__17collateIcED0Ev
+ W _ZNSt3__17collateIcED1Ev
+ W _ZNSt3__17collateIcED2Ev
+ W _ZNSt3__17collateIwE2idE
+ W _ZNSt3__17collateIwEC1Ej
+ W _ZNSt3__17collateIwEC2Ej
+ W _ZNSt3__17collateIwED0Ev
+ W _ZNSt3__17collateIwED1Ev
+ W _ZNSt3__17collateIwED2Ev
+ W _ZNSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZNSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEC1Ej
+ W _ZNSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEC2Ej
+ W _ZNSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED0Ev
+ W _ZNSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED1Ev
+ W _ZNSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED2Ev
+ W _ZNSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ W _ZNSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEC1Ej
+ W _ZNSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEC2Ej
+ W _ZNSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED0Ev
+ W _ZNSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED1Ev
+ W _ZNSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED2Ev
+ W _ZNSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZNSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC1Ej
+ W _ZNSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC2Ej
+ W _ZNSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED0Ev
+ W _ZNSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED1Ev
+ W _ZNSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED2Ev
+ W _ZNSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ W _ZNSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC1Ej
+ W _ZNSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC2Ej
+ W _ZNSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED0Ev
+ W _ZNSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED1Ev
+ W _ZNSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED2Ev
+ T _ZNSt3__17promiseIvE10get_futureEv
+ T _ZNSt3__17promiseIvE13set_exceptionESt13exception_ptr
+ T _ZNSt3__17promiseIvE24set_value_at_thread_exitEv
+ T _ZNSt3__17promiseIvE28set_exception_at_thread_exitESt13exception_ptr
+ T _ZNSt3__17promiseIvE9set_valueEv
+ T _ZNSt3__17promiseIvEC1Ev
+ T _ZNSt3__17promiseIvEC2Ev
+ T _ZNSt3__17promiseIvED1Ev
+ T _ZNSt3__17promiseIvED2Ev
+ T _ZNSt3__18__c_node5__addEPNS_8__i_nodeE
+ T _ZNSt3__18__c_node8__removeEPNS_8__i_nodeE
+ T _ZNSt3__18__c_nodeD0Ev
+ T _ZNSt3__18__c_nodeD1Ev
+ T _ZNSt3__18__c_nodeD2Ev
+ T _ZNSt3__18__get_dbEv
+ T _ZNSt3__18__i_nodeD1Ev
+ T _ZNSt3__18__i_nodeD2Ev
+ T _ZNSt3__18__rs_getEv
+ C _ZNSt3__18__searchIRNS_11__traits_eqINS_11char_traitsIcEEEEPKcS7_EET0_S8_S8_T1_S9_T_NS_26random_access_iterator_tagESB_
+ C _ZNSt3__18__searchIRNS_11__traits_eqINS_11char_traitsIwEEEEPKwS7_EET0_S8_S8_T1_S9_T_NS_26random_access_iterator_tagESB_
+ D _ZNSt3__18ios_base10floatfieldE
+ D _ZNSt3__18ios_base10scientificE
+ D _ZNSt3__18ios_base11adjustfieldE
+ T _ZNSt3__18ios_base15sync_with_stdioEb
+ T _ZNSt3__18ios_base16__call_callbacksENS0_5eventE
+ T _ZNSt3__18ios_base17register_callbackEPFvNS0_5eventERS0_iEi
+ D _ZNSt3__18ios_base2inE
+ T _ZNSt3__18ios_base33__set_badbit_and_consider_rethrowEv
+ T _ZNSt3__18ios_base34__set_failbit_and_consider_rethrowEv
+ D _ZNSt3__18ios_base3appE
+ D _ZNSt3__18ios_base3ateE
+ D _ZNSt3__18ios_base3decE
+ D _ZNSt3__18ios_base3hexE
+ D _ZNSt3__18ios_base3octE
+ D _ZNSt3__18ios_base3outE
+ T _ZNSt3__18ios_base4InitC1Ev
+ T _ZNSt3__18ios_base4InitC2Ev
+ T _ZNSt3__18ios_base4InitD1Ev
+ T _ZNSt3__18ios_base4InitD2Ev
+ T _ZNSt3__18ios_base4initEPv
+ D _ZNSt3__18ios_base4leftE
+ T _ZNSt3__18ios_base4moveERS0_
+ T _ZNSt3__18ios_base4swapERS0_
+ T _ZNSt3__18ios_base5clearEj
+ D _ZNSt3__18ios_base5fixedE
+ T _ZNSt3__18ios_base5imbueERKNS_6localeE
+ T _ZNSt3__18ios_base5iwordEi
+ T _ZNSt3__18ios_base5pwordEi
+ D _ZNSt3__18ios_base5rightE
+ D _ZNSt3__18ios_base5truncE
+ D _ZNSt3__18ios_base6badbitE
+ D _ZNSt3__18ios_base6binaryE
+ D _ZNSt3__18ios_base6eofbitE
+ D _ZNSt3__18ios_base6skipwsE
+ T _ZNSt3__18ios_base6xallocEv
+ T _ZNSt3__18ios_base7copyfmtERKS0_
+ D _ZNSt3__18ios_base7failbitE
+ T _ZNSt3__18ios_base7failureC1EPKcRKNS_10error_codeE
+ T _ZNSt3__18ios_base7failureC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKNS_10error_codeE
+ T _ZNSt3__18ios_base7failureC2EPKcRKNS_10error_codeE
+ T _ZNSt3__18ios_base7failureC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKNS_10error_codeE
+ T _ZNSt3__18ios_base7failureD0Ev
+ T _ZNSt3__18ios_base7failureD1Ev
+ T _ZNSt3__18ios_base7failureD2Ev
+ D _ZNSt3__18ios_base7goodbitE
+ D _ZNSt3__18ios_base7showposE
+ D _ZNSt3__18ios_base7unitbufE
+ D _ZNSt3__18ios_base8internalE
+ D _ZNSt3__18ios_base8showbaseE
+ D _ZNSt3__18ios_base9__xindex_E
+ D _ZNSt3__18ios_base9basefieldE
+ D _ZNSt3__18ios_base9boolalphaE
+ D _ZNSt3__18ios_base9showpointE
+ D _ZNSt3__18ios_base9uppercaseE
+ T _ZNSt3__18ios_baseD0Ev
+ T _ZNSt3__18ios_baseD1Ev
+ T _ZNSt3__18ios_baseD2Ev
+ W _ZNSt3__18messagesIcE2idE
+ W _ZNSt3__18messagesIcEC1Ej
+ W _ZNSt3__18messagesIcEC2Ej
+ W _ZNSt3__18messagesIcED0Ev
+ W _ZNSt3__18messagesIcED1Ev
+ W _ZNSt3__18messagesIcED2Ev
+ W _ZNSt3__18messagesIwE2idE
+ W _ZNSt3__18messagesIwEC1Ej
+ W _ZNSt3__18messagesIwEC2Ej
+ W _ZNSt3__18messagesIwED0Ev
+ W _ZNSt3__18messagesIwED1Ev
+ W _ZNSt3__18messagesIwED2Ev
+ D _ZNSt3__18numpunctIcE2idE
+ T _ZNSt3__18numpunctIcEC1Ej
+ T _ZNSt3__18numpunctIcEC2Ej
+ T _ZNSt3__18numpunctIcED0Ev
+ T _ZNSt3__18numpunctIcED1Ev
+ T _ZNSt3__18numpunctIcED2Ev
+ D _ZNSt3__18numpunctIwE2idE
+ T _ZNSt3__18numpunctIwEC1Ej
+ T _ZNSt3__18numpunctIwEC2Ej
+ T _ZNSt3__18numpunctIwED0Ev
+ T _ZNSt3__18numpunctIwED1Ev
+ T _ZNSt3__18numpunctIwED2Ev
+ W _ZNSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZNSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEC1Ej
+ W _ZNSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEC2Ej
+ W _ZNSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED0Ev
+ W _ZNSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED1Ev
+ W _ZNSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED2Ev
+ W _ZNSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ W _ZNSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEC1Ej
+ W _ZNSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEC2Ej
+ W _ZNSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED0Ev
+ W _ZNSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED1Ev
+ W _ZNSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED2Ev
+ W _ZNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC1EPKcj
+ W _ZNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC1ERKNS_12basic_stringIcS3_NS_9allocatorIcEEEEj
+ W _ZNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC1Ej
+ W _ZNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC2EPKcj
+ W _ZNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC2ERKNS_12basic_stringIcS3_NS_9allocatorIcEEEEj
+ W _ZNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC2Ej
+ W _ZNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED0Ev
+ W _ZNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED1Ev
+ W _ZNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED2Ev
+ W _ZNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ W _ZNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC1EPKcj
+ W _ZNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC1ERKNS_12basic_stringIcNS2_IcEENS_9allocatorIcEEEEj
+ W _ZNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC1Ej
+ W _ZNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC2EPKcj
+ W _ZNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC2ERKNS_12basic_stringIcNS2_IcEENS_9allocatorIcEEEEj
+ W _ZNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC2Ej
+ W _ZNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED0Ev
+ W _ZNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED1Ev
+ W _ZNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED2Ev
+ W _ZNSt3__18valarrayIjE6resizeEjj
+ W _ZNSt3__18valarrayIjEC1Ej
+ W _ZNSt3__18valarrayIjEC2Ej
+ W _ZNSt3__18valarrayIjED1Ev
+ W _ZNSt3__18valarrayIjED2Ev
+ W _ZNSt3__19__num_getIcE17__stage2_int_loopEciPcRS2_RjcRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjRSD_S2_
+ W _ZNSt3__19__num_getIcE17__stage2_int_prepERNS_8ios_baseEPcRc
+ W _ZNSt3__19__num_getIcE19__stage2_float_loopEcRbRcPcRS4_ccRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjRSE_RjS4_
+ W _ZNSt3__19__num_getIcE19__stage2_float_prepERNS_8ios_baseEPcRcS5_
+ W _ZNSt3__19__num_getIwE17__stage2_int_loopEwiPcRS2_RjwRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjRSD_Pw
+ W _ZNSt3__19__num_getIwE17__stage2_int_prepERNS_8ios_baseEPwRw
+ W _ZNSt3__19__num_getIwE19__stage2_float_loopEwRbRcPcRS4_wwRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjRSE_RjPw
+ W _ZNSt3__19__num_getIwE19__stage2_float_prepERNS_8ios_baseEPwRwS5_
+ W _ZNSt3__19__num_putIcE21__widen_and_group_intEPcS2_S2_S2_RS2_S3_RKNS_6localeE
+ W _ZNSt3__19__num_putIcE23__widen_and_group_floatEPcS2_S2_S2_RS2_S3_RKNS_6localeE
+ W _ZNSt3__19__num_putIwE21__widen_and_group_intEPcS2_S2_PwRS3_S4_RKNS_6localeE
+ W _ZNSt3__19__num_putIwE23__widen_and_group_floatEPcS2_S2_PwRS3_S4_RKNS_6localeE
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE10exceptionsEj
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE3tieEPNS_13basic_ostreamIcS2_EE
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE4fillEc
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE4initEPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE4moveERS3_
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE4swapERS3_
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE5clearEj
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE5imbueERKNS_6localeE
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE5rdbufEPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE7copyfmtERKS3_
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE8setstateEj
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE9set_rdbufEPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEEC1Ev
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEEC2Ev
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEED0Ev
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEED1Ev
+ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEED2Ev
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE10exceptionsEj
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE3tieEPNS_13basic_ostreamIwS2_EE
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE4fillEw
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE4initEPNS_15basic_streambufIwS2_EE
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE4moveERS3_
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE4swapERS3_
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE5clearEj
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE5imbueERKNS_6localeE
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE5rdbufEPNS_15basic_streambufIwS2_EE
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE7copyfmtERKS3_
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE8setstateEj
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE9set_rdbufEPNS_15basic_streambufIwS2_EE
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEEC1EPNS_15basic_streambufIwS2_EE
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEEC1Ev
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEEC2EPNS_15basic_streambufIwS2_EE
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEEC2Ev
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEED0Ev
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEED1Ev
+ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEED2Ev
+ W _ZNSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZNSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE8__do_getERS4_S4_bRKNS_6localeEjRjRbRKNS_5ctypeIcEERNS_10unique_ptrIcPFvPvEEERPcSM_
+ W _ZNSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEC1Ej
+ W _ZNSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEC2Ej
+ W _ZNSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED0Ev
+ W _ZNSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED1Ev
+ W _ZNSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEED2Ev
+ W _ZNSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ W _ZNSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE8__do_getERS4_S4_bRKNS_6localeEjRjRbRKNS_5ctypeIwEERNS_10unique_ptrIwPFvPvEEERPwSM_
+ W _ZNSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEC1Ej
+ W _ZNSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEC2Ej
+ W _ZNSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED0Ev
+ W _ZNSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED1Ev
+ W _ZNSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEED2Ev
+ W _ZNSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE
+ W _ZNSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC1Ej
+ W _ZNSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEC2Ej
+ W _ZNSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED0Ev
+ W _ZNSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED1Ev
+ W _ZNSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEED2Ev
+ W _ZNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE
+ W _ZNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC1Ej
+ W _ZNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEC2Ej
+ W _ZNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED0Ev
+ W _ZNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED1Ev
+ W _ZNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED2Ev
+ T _ZNSt3__19strstreamD0Ev
+ T _ZNSt3__19strstreamD1Ev
+ T _ZNSt3__19strstreamD2Ev
+ T _ZNSt3__19to_stringEd
+ T _ZNSt3__19to_stringEe
+ T _ZNSt3__19to_stringEf
+ T _ZNSt3__19to_stringEi
+ T _ZNSt3__19to_stringEj
+ T _ZNSt3__19to_stringEl
+ T _ZNSt3__19to_stringEm
+ T _ZNSt3__19to_stringEx
+ T _ZNSt3__19to_stringEy
+ t _ZNSt3__1L10__init_patERNS_10money_base7patternEccc
+ t _ZNSt3__1L10init_am_pmEv
+ t _ZNSt3__1L10init_weeksEv
+ t _ZNSt3__1L11init_monthsEv
+ t _ZNSt3__1L11init_wam_pmEv
+ t _ZNSt3__1L11init_wweeksEv
+ t _ZNSt3__1L12init_wmonthsEv
+ t _ZNSt3__1L12ucs2_to_utf8EPKtS1_RS1_PhS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L12ucs4_to_utf8EPKjS1_RS1_PhS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L12utf8_to_ucs2EPKhS1_RS1_PtS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L12utf8_to_ucs4EPKhS1_RS1_PjS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L13utf16_to_utf8EPKjS1_RS1_PhS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L13utf16_to_utf8EPKtS1_RS1_PhS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L13utf8_to_utf16EPKhS1_RS1_PjS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L13utf8_to_utf16EPKhS1_RS1_PtS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L15ucs2_to_utf16beEPKtS1_RS1_PhS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L15ucs2_to_utf16leEPKtS1_RS1_PhS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L15ucs4_to_utf16beEPKjS1_RS1_PhS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L15ucs4_to_utf16leEPKjS1_RS1_PhS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L15utf16be_to_ucs2EPKhS1_RS1_PtS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L15utf16be_to_ucs4EPKhS1_RS1_PjS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L15utf16le_to_ucs2EPKhS1_RS1_PtS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L15utf16le_to_ucs4EPKhS1_RS1_PjS3_RS3_mNS_12codecvt_modeE
+ t _ZNSt3__1L19utf8_to_ucs2_lengthEPKhS1_jmNS_12codecvt_modeE
+ t _ZNSt3__1L19utf8_to_ucs4_lengthEPKhS1_jmNS_12codecvt_modeE
+ t _ZNSt3__1L20utf8_to_utf16_lengthEPKhS1_jmNS_12codecvt_modeE
+ t _ZNSt3__1L22make_error_type_stringENS_15regex_constants10error_typeE
+ t _ZNSt3__1L22utf16be_to_ucs2_lengthEPKhS1_jmNS_12codecvt_modeE
+ t _ZNSt3__1L22utf16be_to_ucs4_lengthEPKhS1_jmNS_12codecvt_modeE
+ t _ZNSt3__1L22utf16le_to_ucs2_lengthEPKhS1_jmNS_12codecvt_modeE
+ t _ZNSt3__1L22utf16le_to_ucs4_lengthEPKhS1_jmNS_12codecvt_modeE
+ d _ZNSt3__1L2cvE
+ d _ZNSt3__1L3mutE
+ d _ZNSt3__1L5__cinE
+ d _ZNSt3__1L6__cerrE
+ d _ZNSt3__1L6__coutE
+ d _ZNSt3__1L6__wcinE
+ d _ZNSt3__1L7__wcerrE
+ d _ZNSt3__1L7__wcoutE
+ d _ZNSt3__1L8__rs_mutE
+ W _ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_
+ T _ZNSt8bad_castC1Ev
+ T _ZNSt8bad_castC2Ev
+ T _ZNSt8bad_castD0Ev
+ T _ZNSt8bad_castD1Ev
+ T _ZNSt8bad_castD2Ev
+ T _ZNSt9exceptionD0Ev
+ T _ZNSt9exceptionD1Ev
+ T _ZNSt9exceptionD2Ev
+ T _ZSt10unexpectedv
+ T _ZSt13get_terminatev
+ T _ZSt13set_terminatePFvvE
+ T _ZSt14get_unexpectedv
+ T _ZSt14set_unexpectedPFvvE
+ T _ZSt17current_exceptionv
+ T _ZSt17rethrow_exceptionSt13exception_ptr
+ C _ZSt18make_exception_ptrINSt3__112future_errorEESt13exception_ptrT_
+ T _ZSt18uncaught_exceptionv
+ D _ZSt7nothrow
+ D _ZTCNSt3__110istrstreamE0_NS_13basic_istreamIcNS_11char_traitsIcEEEE
+ D _ZTCNSt3__110ostrstreamE0_NS_13basic_ostreamIcNS_11char_traitsIcEEEE
+ W _ZTCNSt3__114basic_iostreamIcNS_11char_traitsIcEEEE0_NS_13basic_istreamIcS2_EE
+ W _ZTCNSt3__114basic_iostreamIcNS_11char_traitsIcEEEE8_NS_13basic_ostreamIcS2_EE
+ D _ZTCNSt3__19strstreamE0_NS_13basic_istreamIcNS_11char_traitsIcEEEE
+ D _ZTCNSt3__19strstreamE0_NS_14basic_iostreamIcNS_11char_traitsIcEEEE
+ D _ZTCNSt3__19strstreamE8_NS_13basic_ostreamIcNS_11char_traitsIcEEEE
+ C _ZTINSt3__110__stdinbufIcEE
+ C _ZTINSt3__110__stdinbufIwEE
+ C _ZTINSt3__110__time_getE
+ C _ZTINSt3__110__time_putE
+ C _ZTINSt3__110ctype_baseE
+ D _ZTINSt3__110istrstreamE
+ C _ZTINSt3__110money_baseE
+ W _ZTINSt3__110moneypunctIcLb0EEE
+ W _ZTINSt3__110moneypunctIcLb1EEE
+ W _ZTINSt3__110moneypunctIwLb0EEE
+ W _ZTINSt3__110moneypunctIwLb1EEE
+ D _ZTINSt3__110ostrstreamE
+ C _ZTINSt3__111__money_getIcEE
+ C _ZTINSt3__111__money_getIwEE
+ C _ZTINSt3__111__money_putIcEE
+ C _ZTINSt3__111__money_putIwEE
+ C _ZTINSt3__111__stdoutbufIcEE
+ C _ZTINSt3__111__stdoutbufIwEE
+ D _ZTINSt3__111regex_errorE
+ D _ZTINSt3__112__do_messageE
+ D _ZTINSt3__112bad_weak_ptrE
+ C _ZTINSt3__112codecvt_baseE
+ D _ZTINSt3__112ctype_bynameIcEE
+ D _ZTINSt3__112ctype_bynameIwEE
+ D _ZTINSt3__112future_errorE
+ D _ZTINSt3__112strstreambufE
+ D _ZTINSt3__112system_errorE
+ W _ZTINSt3__113basic_istreamIcNS_11char_traitsIcEEEE
+ W _ZTINSt3__113basic_istreamIwNS_11char_traitsIwEEEE
+ W _ZTINSt3__113basic_ostreamIcNS_11char_traitsIcEEEE
+ W _ZTINSt3__113basic_ostreamIwNS_11char_traitsIwEEEE
+ C _ZTINSt3__113messages_baseE
+ D _ZTINSt3__114__codecvt_utf8IjEE
+ D _ZTINSt3__114__codecvt_utf8ItEE
+ D _ZTINSt3__114__codecvt_utf8IwEE
+ C _ZTINSt3__114__num_get_baseE
+ C _ZTINSt3__114__num_put_baseE
+ D _ZTINSt3__114__shared_countE
+ W _ZTINSt3__114basic_iostreamIcNS_11char_traitsIcEEEE
+ W _ZTINSt3__114codecvt_bynameIcc10_mbstate_tEE
+ W _ZTINSt3__114codecvt_bynameIjc10_mbstate_tEE
+ W _ZTINSt3__114codecvt_bynameItc10_mbstate_tEE
+ W _ZTINSt3__114codecvt_bynameIwc10_mbstate_tEE
+ D _ZTINSt3__114collate_bynameIcEE
+ D _ZTINSt3__114collate_bynameIwEE
+ D _ZTINSt3__114error_categoryE
+ D _ZTINSt3__115__codecvt_utf16IjLb0EEE
+ D _ZTINSt3__115__codecvt_utf16IjLb1EEE
+ D _ZTINSt3__115__codecvt_utf16ItLb0EEE
+ D _ZTINSt3__115__codecvt_utf16ItLb1EEE
+ D _ZTINSt3__115__codecvt_utf16IwLb0EEE
+ D _ZTINSt3__115__codecvt_utf16IwLb1EEE
+ C _ZTINSt3__115__time_get_tempIcEE
+ C _ZTINSt3__115__time_get_tempIwEE
+ W _ZTINSt3__115basic_streambufIcNS_11char_traitsIcEEEE
+ W _ZTINSt3__115basic_streambufIwNS_11char_traitsIwEEEE
+ W _ZTINSt3__115messages_bynameIcEE
+ W _ZTINSt3__115messages_bynameIwEE
+ D _ZTINSt3__115numpunct_bynameIcEE
+ D _ZTINSt3__115numpunct_bynameIwEE
+ W _ZTINSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTINSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTINSt3__115time_put_bynameIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTINSt3__115time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ D _ZTINSt3__116__narrow_to_utf8ILj16EEE
+ D _ZTINSt3__116__narrow_to_utf8ILj32EEE
+ D _ZTINSt3__117__assoc_sub_stateE
+ D _ZTINSt3__117__widen_from_utf8ILj16EEE
+ D _ZTINSt3__117__widen_from_utf8ILj32EEE
+ W _ZTINSt3__117moneypunct_bynameIcLb0EEE
+ W _ZTINSt3__117moneypunct_bynameIcLb1EEE
+ W _ZTINSt3__117moneypunct_bynameIwLb0EEE
+ W _ZTINSt3__117moneypunct_bynameIwLb1EEE
+ C _ZTINSt3__118__time_get_storageIcEE
+ C _ZTINSt3__118__time_get_storageIwEE
+ D _ZTINSt3__119__iostream_categoryE
+ D _ZTINSt3__119__shared_weak_countE
+ D _ZTINSt3__120__codecvt_utf8_utf16IjEE
+ D _ZTINSt3__120__codecvt_utf8_utf16ItEE
+ D _ZTINSt3__120__codecvt_utf8_utf16IwEE
+ C _ZTINSt3__120__time_get_c_storageIcEE
+ C _ZTINSt3__120__time_get_c_storageIwEE
+ D _ZTINSt3__123__future_error_categoryE
+ D _ZTINSt3__123__system_error_categoryE
+ D _ZTINSt3__124__generic_error_categoryE
+ D _ZTINSt3__15ctypeIcEE
+ D _ZTINSt3__15ctypeIwEE
+ D _ZTINSt3__16locale5__impE
+ D _ZTINSt3__16locale5facetE
+ D _ZTINSt3__17codecvtIcc10_mbstate_tEE
+ D _ZTINSt3__17codecvtIjc10_mbstate_tEE
+ D _ZTINSt3__17codecvtItc10_mbstate_tEE
+ D _ZTINSt3__17codecvtIwc10_mbstate_tEE
+ W _ZTINSt3__17collateIcEE
+ W _ZTINSt3__17collateIwEE
+ W _ZTINSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTINSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTINSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTINSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ D _ZTINSt3__18__c_nodeE
+ D _ZTINSt3__18ios_base7failureE
+ D _ZTINSt3__18ios_baseE
+ W _ZTINSt3__18messagesIcEE
+ W _ZTINSt3__18messagesIwEE
+ D _ZTINSt3__18numpunctIcEE
+ D _ZTINSt3__18numpunctIwEE
+ W _ZTINSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTINSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTINSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTINSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ C _ZTINSt3__19__num_getIcEE
+ C _ZTINSt3__19__num_getIwEE
+ C _ZTINSt3__19__num_putIcEE
+ C _ZTINSt3__19__num_putIwEE
+ W _ZTINSt3__19basic_iosIcNS_11char_traitsIcEEEE
+ W _ZTINSt3__19basic_iosIwNS_11char_traitsIwEEEE
+ W _ZTINSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTINSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTINSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTINSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ D _ZTINSt3__19strstreamE
+ C _ZTINSt3__19time_baseE
+ D _ZTISt10bad_typeid
+ D _ZTISt11logic_error
+ D _ZTISt11range_error
+ D _ZTISt12domain_error
+ D _ZTISt12length_error
+ D _ZTISt12out_of_range
+ D _ZTISt13bad_exception
+ D _ZTISt13runtime_error
+ D _ZTISt14overflow_error
+ D _ZTISt15underflow_error
+ D _ZTISt16invalid_argument
+ D _ZTISt16nested_exception
+ D _ZTISt8bad_cast
+ D _ZTISt9exception
+ C _ZTSNSt3__110__stdinbufIcEE
+ C _ZTSNSt3__110__stdinbufIwEE
+ C _ZTSNSt3__110__time_getE
+ C _ZTSNSt3__110__time_putE
+ C _ZTSNSt3__110ctype_baseE
+ D _ZTSNSt3__110istrstreamE
+ C _ZTSNSt3__110money_baseE
+ W _ZTSNSt3__110moneypunctIcLb0EEE
+ W _ZTSNSt3__110moneypunctIcLb1EEE
+ W _ZTSNSt3__110moneypunctIwLb0EEE
+ W _ZTSNSt3__110moneypunctIwLb1EEE
+ D _ZTSNSt3__110ostrstreamE
+ C _ZTSNSt3__111__money_getIcEE
+ C _ZTSNSt3__111__money_getIwEE
+ C _ZTSNSt3__111__money_putIcEE
+ C _ZTSNSt3__111__money_putIwEE
+ C _ZTSNSt3__111__stdoutbufIcEE
+ C _ZTSNSt3__111__stdoutbufIwEE
+ D _ZTSNSt3__111regex_errorE
+ D _ZTSNSt3__112__do_messageE
+ D _ZTSNSt3__112bad_weak_ptrE
+ C _ZTSNSt3__112codecvt_baseE
+ D _ZTSNSt3__112ctype_bynameIcEE
+ D _ZTSNSt3__112ctype_bynameIwEE
+ D _ZTSNSt3__112future_errorE
+ D _ZTSNSt3__112strstreambufE
+ D _ZTSNSt3__112system_errorE
+ W _ZTSNSt3__113basic_istreamIcNS_11char_traitsIcEEEE
+ W _ZTSNSt3__113basic_istreamIwNS_11char_traitsIwEEEE
+ W _ZTSNSt3__113basic_ostreamIcNS_11char_traitsIcEEEE
+ W _ZTSNSt3__113basic_ostreamIwNS_11char_traitsIwEEEE
+ C _ZTSNSt3__113messages_baseE
+ D _ZTSNSt3__114__codecvt_utf8IjEE
+ D _ZTSNSt3__114__codecvt_utf8ItEE
+ D _ZTSNSt3__114__codecvt_utf8IwEE
+ C _ZTSNSt3__114__num_get_baseE
+ C _ZTSNSt3__114__num_put_baseE
+ D _ZTSNSt3__114__shared_countE
+ W _ZTSNSt3__114basic_iostreamIcNS_11char_traitsIcEEEE
+ W _ZTSNSt3__114codecvt_bynameIcc10_mbstate_tEE
+ W _ZTSNSt3__114codecvt_bynameIjc10_mbstate_tEE
+ W _ZTSNSt3__114codecvt_bynameItc10_mbstate_tEE
+ W _ZTSNSt3__114codecvt_bynameIwc10_mbstate_tEE
+ D _ZTSNSt3__114collate_bynameIcEE
+ D _ZTSNSt3__114collate_bynameIwEE
+ D _ZTSNSt3__114error_categoryE
+ D _ZTSNSt3__115__codecvt_utf16IjLb0EEE
+ D _ZTSNSt3__115__codecvt_utf16IjLb1EEE
+ D _ZTSNSt3__115__codecvt_utf16ItLb0EEE
+ D _ZTSNSt3__115__codecvt_utf16ItLb1EEE
+ D _ZTSNSt3__115__codecvt_utf16IwLb0EEE
+ D _ZTSNSt3__115__codecvt_utf16IwLb1EEE
+ C _ZTSNSt3__115__time_get_tempIcEE
+ C _ZTSNSt3__115__time_get_tempIwEE
+ W _ZTSNSt3__115basic_streambufIcNS_11char_traitsIcEEEE
+ W _ZTSNSt3__115basic_streambufIwNS_11char_traitsIwEEEE
+ W _ZTSNSt3__115messages_bynameIcEE
+ W _ZTSNSt3__115messages_bynameIwEE
+ D _ZTSNSt3__115numpunct_bynameIcEE
+ D _ZTSNSt3__115numpunct_bynameIwEE
+ W _ZTSNSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTSNSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTSNSt3__115time_put_bynameIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTSNSt3__115time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ D _ZTSNSt3__116__narrow_to_utf8ILj16EEE
+ D _ZTSNSt3__116__narrow_to_utf8ILj32EEE
+ D _ZTSNSt3__117__assoc_sub_stateE
+ D _ZTSNSt3__117__widen_from_utf8ILj16EEE
+ D _ZTSNSt3__117__widen_from_utf8ILj32EEE
+ W _ZTSNSt3__117moneypunct_bynameIcLb0EEE
+ W _ZTSNSt3__117moneypunct_bynameIcLb1EEE
+ W _ZTSNSt3__117moneypunct_bynameIwLb0EEE
+ W _ZTSNSt3__117moneypunct_bynameIwLb1EEE
+ C _ZTSNSt3__118__time_get_storageIcEE
+ C _ZTSNSt3__118__time_get_storageIwEE
+ D _ZTSNSt3__119__iostream_categoryE
+ D _ZTSNSt3__119__shared_weak_countE
+ D _ZTSNSt3__120__codecvt_utf8_utf16IjEE
+ D _ZTSNSt3__120__codecvt_utf8_utf16ItEE
+ D _ZTSNSt3__120__codecvt_utf8_utf16IwEE
+ C _ZTSNSt3__120__time_get_c_storageIcEE
+ C _ZTSNSt3__120__time_get_c_storageIwEE
+ D _ZTSNSt3__123__future_error_categoryE
+ D _ZTSNSt3__123__system_error_categoryE
+ D _ZTSNSt3__124__generic_error_categoryE
+ D _ZTSNSt3__15ctypeIcEE
+ D _ZTSNSt3__15ctypeIwEE
+ D _ZTSNSt3__16locale5__impE
+ D _ZTSNSt3__16locale5facetE
+ D _ZTSNSt3__17codecvtIcc10_mbstate_tEE
+ D _ZTSNSt3__17codecvtIjc10_mbstate_tEE
+ D _ZTSNSt3__17codecvtItc10_mbstate_tEE
+ D _ZTSNSt3__17codecvtIwc10_mbstate_tEE
+ W _ZTSNSt3__17collateIcEE
+ W _ZTSNSt3__17collateIwEE
+ W _ZTSNSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTSNSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTSNSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTSNSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ D _ZTSNSt3__18__c_nodeE
+ D _ZTSNSt3__18ios_base7failureE
+ D _ZTSNSt3__18ios_baseE
+ W _ZTSNSt3__18messagesIcEE
+ W _ZTSNSt3__18messagesIwEE
+ D _ZTSNSt3__18numpunctIcEE
+ D _ZTSNSt3__18numpunctIwEE
+ W _ZTSNSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTSNSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTSNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTSNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ C _ZTSNSt3__19__num_getIcEE
+ C _ZTSNSt3__19__num_getIwEE
+ C _ZTSNSt3__19__num_putIcEE
+ C _ZTSNSt3__19__num_putIwEE
+ W _ZTSNSt3__19basic_iosIcNS_11char_traitsIcEEEE
+ W _ZTSNSt3__19basic_iosIwNS_11char_traitsIwEEEE
+ W _ZTSNSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTSNSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTSNSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTSNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ D _ZTSNSt3__19strstreamE
+ C _ZTSNSt3__19time_baseE
+ D _ZTSSt10bad_typeid
+ D _ZTSSt11logic_error
+ D _ZTSSt11range_error
+ D _ZTSSt12domain_error
+ D _ZTSSt12length_error
+ D _ZTSSt12out_of_range
+ D _ZTSSt13bad_exception
+ D _ZTSSt13runtime_error
+ D _ZTSSt14overflow_error
+ D _ZTSSt15underflow_error
+ D _ZTSSt16invalid_argument
+ D _ZTSSt16nested_exception
+ D _ZTSSt8bad_cast
+ D _ZTSSt9exception
+ D _ZTTNSt3__110istrstreamE
+ D _ZTTNSt3__110ostrstreamE
+ W _ZTTNSt3__113basic_istreamIcNS_11char_traitsIcEEEE
+ W _ZTTNSt3__113basic_istreamIwNS_11char_traitsIwEEEE
+ W _ZTTNSt3__113basic_ostreamIcNS_11char_traitsIcEEEE
+ W _ZTTNSt3__113basic_ostreamIwNS_11char_traitsIwEEEE
+ W _ZTTNSt3__114basic_iostreamIcNS_11char_traitsIcEEEE
+ D _ZTTNSt3__19strstreamE
+ C _ZTVNSt3__110__stdinbufIcEE
+ C _ZTVNSt3__110__stdinbufIwEE
+ D _ZTVNSt3__110istrstreamE
+ W _ZTVNSt3__110moneypunctIcLb0EEE
+ W _ZTVNSt3__110moneypunctIcLb1EEE
+ W _ZTVNSt3__110moneypunctIwLb0EEE
+ W _ZTVNSt3__110moneypunctIwLb1EEE
+ D _ZTVNSt3__110ostrstreamE
+ C _ZTVNSt3__111__stdoutbufIcEE
+ C _ZTVNSt3__111__stdoutbufIwEE
+ D _ZTVNSt3__111regex_errorE
+ D _ZTVNSt3__112__do_messageE
+ D _ZTVNSt3__112bad_weak_ptrE
+ D _ZTVNSt3__112ctype_bynameIcEE
+ D _ZTVNSt3__112ctype_bynameIwEE
+ D _ZTVNSt3__112future_errorE
+ D _ZTVNSt3__112strstreambufE
+ D _ZTVNSt3__112system_errorE
+ W _ZTVNSt3__113basic_istreamIcNS_11char_traitsIcEEEE
+ W _ZTVNSt3__113basic_istreamIwNS_11char_traitsIwEEEE
+ W _ZTVNSt3__113basic_ostreamIcNS_11char_traitsIcEEEE
+ W _ZTVNSt3__113basic_ostreamIwNS_11char_traitsIwEEEE
+ D _ZTVNSt3__114__codecvt_utf8IjEE
+ D _ZTVNSt3__114__codecvt_utf8ItEE
+ D _ZTVNSt3__114__codecvt_utf8IwEE
+ D _ZTVNSt3__114__shared_countE
+ W _ZTVNSt3__114basic_iostreamIcNS_11char_traitsIcEEEE
+ W _ZTVNSt3__114codecvt_bynameIcc10_mbstate_tEE
+ W _ZTVNSt3__114codecvt_bynameIjc10_mbstate_tEE
+ W _ZTVNSt3__114codecvt_bynameItc10_mbstate_tEE
+ W _ZTVNSt3__114codecvt_bynameIwc10_mbstate_tEE
+ D _ZTVNSt3__114collate_bynameIcEE
+ D _ZTVNSt3__114collate_bynameIwEE
+ D _ZTVNSt3__114error_categoryE
+ D _ZTVNSt3__115__codecvt_utf16IjLb0EEE
+ D _ZTVNSt3__115__codecvt_utf16IjLb1EEE
+ D _ZTVNSt3__115__codecvt_utf16ItLb0EEE
+ D _ZTVNSt3__115__codecvt_utf16ItLb1EEE
+ D _ZTVNSt3__115__codecvt_utf16IwLb0EEE
+ D _ZTVNSt3__115__codecvt_utf16IwLb1EEE
+ C _ZTVNSt3__115__time_get_tempIcEE
+ C _ZTVNSt3__115__time_get_tempIwEE
+ W _ZTVNSt3__115basic_streambufIcNS_11char_traitsIcEEEE
+ W _ZTVNSt3__115basic_streambufIwNS_11char_traitsIwEEEE
+ W _ZTVNSt3__115messages_bynameIcEE
+ W _ZTVNSt3__115messages_bynameIwEE
+ D _ZTVNSt3__115numpunct_bynameIcEE
+ D _ZTVNSt3__115numpunct_bynameIwEE
+ W _ZTVNSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTVNSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTVNSt3__115time_put_bynameIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTVNSt3__115time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ D _ZTVNSt3__116__narrow_to_utf8ILj16EEE
+ D _ZTVNSt3__116__narrow_to_utf8ILj32EEE
+ D _ZTVNSt3__117__assoc_sub_stateE
+ D _ZTVNSt3__117__widen_from_utf8ILj16EEE
+ D _ZTVNSt3__117__widen_from_utf8ILj32EEE
+ W _ZTVNSt3__117moneypunct_bynameIcLb0EEE
+ W _ZTVNSt3__117moneypunct_bynameIcLb1EEE
+ W _ZTVNSt3__117moneypunct_bynameIwLb0EEE
+ W _ZTVNSt3__117moneypunct_bynameIwLb1EEE
+ D _ZTVNSt3__119__iostream_categoryE
+ D _ZTVNSt3__119__shared_weak_countE
+ D _ZTVNSt3__120__codecvt_utf8_utf16IjEE
+ D _ZTVNSt3__120__codecvt_utf8_utf16ItEE
+ D _ZTVNSt3__120__codecvt_utf8_utf16IwEE
+ C _ZTVNSt3__120__time_get_c_storageIcEE
+ C _ZTVNSt3__120__time_get_c_storageIwEE
+ D _ZTVNSt3__123__future_error_categoryE
+ D _ZTVNSt3__123__system_error_categoryE
+ D _ZTVNSt3__124__generic_error_categoryE
+ D _ZTVNSt3__15ctypeIcEE
+ D _ZTVNSt3__15ctypeIwEE
+ D _ZTVNSt3__16locale5__impE
+ D _ZTVNSt3__16locale5facetE
+ D _ZTVNSt3__17codecvtIcc10_mbstate_tEE
+ D _ZTVNSt3__17codecvtIjc10_mbstate_tEE
+ D _ZTVNSt3__17codecvtItc10_mbstate_tEE
+ D _ZTVNSt3__17codecvtIwc10_mbstate_tEE
+ W _ZTVNSt3__17collateIcEE
+ W _ZTVNSt3__17collateIwEE
+ W _ZTVNSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTVNSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTVNSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTVNSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ D _ZTVNSt3__18__c_nodeE
+ D _ZTVNSt3__18ios_base7failureE
+ D _ZTVNSt3__18ios_baseE
+ W _ZTVNSt3__18messagesIcEE
+ W _ZTVNSt3__18messagesIwEE
+ D _ZTVNSt3__18numpunctIcEE
+ D _ZTVNSt3__18numpunctIwEE
+ W _ZTVNSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTVNSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTVNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTVNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTVNSt3__19basic_iosIcNS_11char_traitsIcEEEE
+ W _ZTVNSt3__19basic_iosIwNS_11char_traitsIwEEEE
+ W _ZTVNSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTVNSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ W _ZTVNSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE
+ W _ZTVNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE
+ D _ZTVNSt3__19strstreamE
+ D _ZTVSt10bad_typeid
+ D _ZTVSt11logic_error
+ D _ZTVSt11range_error
+ D _ZTVSt12domain_error
+ D _ZTVSt12length_error
+ D _ZTVSt12out_of_range
+ D _ZTVSt13bad_exception
+ D _ZTVSt13runtime_error
+ D _ZTVSt14overflow_error
+ D _ZTVSt15underflow_error
+ D _ZTVSt16invalid_argument
+ D _ZTVSt16nested_exception
+ D _ZTVSt8bad_cast
+ D _ZTVSt9exception
+ W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__XEv
+ W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__cEv
+ W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__rEv
+ W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__xEv
+ W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE7__am_pmEv
+ W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE7__weeksEv
+ W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE8__monthsEv
+ W _ZThn8_NKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3__XEv
+ W _ZThn8_NKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3__cEv
+ W _ZThn8_NKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3__rEv
+ W _ZThn8_NKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE3__xEv
+ W _ZThn8_NKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE7__am_pmEv
+ W _ZThn8_NKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE7__weeksEv
+ W _ZThn8_NKSt3__115time_get_bynameIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE8__monthsEv
+ W _ZThn8_NSt3__114basic_iostreamIcNS_11char_traitsIcEEED0Ev
+ W _ZThn8_NSt3__114basic_iostreamIcNS_11char_traitsIcEEED1Ev
+ T _ZThn8_NSt3__19strstreamD0Ev
+ T _ZThn8_NSt3__19strstreamD1Ev
+ T _ZTv0_n12_NSt3__110istrstreamD0Ev
+ T _ZTv0_n12_NSt3__110istrstreamD1Ev
+ T _ZTv0_n12_NSt3__110ostrstreamD0Ev
+ T _ZTv0_n12_NSt3__110ostrstreamD1Ev
+ W _ZTv0_n12_NSt3__113basic_istreamIcNS_11char_traitsIcEEED0Ev
+ W _ZTv0_n12_NSt3__113basic_istreamIcNS_11char_traitsIcEEED1Ev
+ W _ZTv0_n12_NSt3__113basic_istreamIwNS_11char_traitsIwEEED0Ev
+ W _ZTv0_n12_NSt3__113basic_istreamIwNS_11char_traitsIwEEED1Ev
+ W _ZTv0_n12_NSt3__113basic_ostreamIcNS_11char_traitsIcEEED0Ev
+ W _ZTv0_n12_NSt3__113basic_ostreamIcNS_11char_traitsIcEEED1Ev
+ W _ZTv0_n12_NSt3__113basic_ostreamIwNS_11char_traitsIwEEED0Ev
+ W _ZTv0_n12_NSt3__113basic_ostreamIwNS_11char_traitsIwEEED1Ev
+ W _ZTv0_n12_NSt3__114basic_iostreamIcNS_11char_traitsIcEEED0Ev
+ W _ZTv0_n12_NSt3__114basic_iostreamIcNS_11char_traitsIcEEED1Ev
+ T _ZTv0_n12_NSt3__19strstreamD0Ev
+ T _ZTv0_n12_NSt3__19strstreamD1Ev
+ d _ZZNKSt3__120__time_get_c_storageIcE3__XEvE1s
+ d _ZZNKSt3__120__time_get_c_storageIcE3__cEvE1s
+ d _ZZNKSt3__120__time_get_c_storageIcE3__rEvE1s
+ d _ZZNKSt3__120__time_get_c_storageIcE3__xEvE1s
+ d _ZZNKSt3__120__time_get_c_storageIcE7__am_pmEvE5am_pm
+ d _ZZNKSt3__120__time_get_c_storageIcE7__weeksEvE5weeks
+ d _ZZNKSt3__120__time_get_c_storageIcE8__monthsEvE6months
+ d _ZZNKSt3__120__time_get_c_storageIwE3__XEvE1s
+ d _ZZNKSt3__120__time_get_c_storageIwE3__cEvE1s
+ d _ZZNKSt3__120__time_get_c_storageIwE3__rEvE1s
+ d _ZZNKSt3__120__time_get_c_storageIwE3__xEvE1s
+ d _ZZNKSt3__120__time_get_c_storageIwE7__am_pmEvE5am_pm
+ d _ZZNKSt3__120__time_get_c_storageIwE7__weeksEvE5weeks
+ d _ZZNKSt3__120__time_get_c_storageIwE8__monthsEvE6months
+ d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE11do_get_timeES4_S4_RNS_8ios_baseERjP2tmE5__fmt
+ d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt
+ d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt11
+ d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt12
+ d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt13
+ d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt14
+ d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE11do_get_timeES4_S4_RNS_8ios_baseERjP2tmE5__fmt
+ d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt
+ d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt16
+ d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt17
+ d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt18
+ d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt19
+ d _ZZNKSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_bRNS_8ios_baseERjReE5__src
+ d _ZZNKSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_bRNS_8ios_baseERjReE5__src
+ d _ZZNSt3__112_GLOBAL__N_13mutEvE1m
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb0EEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb1EEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb0EEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb1EEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_5ctypeIcEEPjbiEERT_T0_T1_T2_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_5ctypeIwEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_6locale5__impEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtIcc10_mbstate_tEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtIjc10_mbstate_tEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtItc10_mbstate_tEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtIwc10_mbstate_tEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_7collateIcEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_7collateIwEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_8messagesIcEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_8messagesIwEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_8numpunctIcEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_8numpunctIwEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf
+ d _ZZNSt3__112__rs_defaultclEvE6__rs_g
+ d _ZZNSt3__115future_categoryEvE3__f
+ d _ZZNSt3__115system_categoryEvE1s
+ d _ZZNSt3__116generic_categoryEvE1s
+ d _ZZNSt3__117iostream_categoryEvE1s
+ d _ZZNSt3__119__thread_local_dataEvE3__p
+ d _ZZNSt3__16__clocEvE6result
+ d _ZZNSt3__16locale5__imp11make_globalEvE3buf
+ d _ZZNSt3__16locale5__imp12make_classicEvE3buf
+ d _ZZNSt3__16locale7classicEvE1c
+ d _ZZNSt3__16locale8__globalEvE1g
+ d _ZZNSt3__18__get_dbEvE2db
+ d _ZZNSt3__18ios_base15sync_with_stdioEbE14previous_state
+ d _ZZNSt3__18ios_base5iwordEiE5error
+ d _ZZNSt3__18ios_base5pwordEiE5error
+ d _ZZNSt3__1L10init_am_pmEvE5am_pm
+ d _ZZNSt3__1L10init_weeksEvE5weeks
+ d _ZZNSt3__1L11init_monthsEvE6months
+ d _ZZNSt3__1L11init_wam_pmEvE5am_pm
+ d _ZZNSt3__1L11init_wweeksEvE5weeks
+ d _ZZNSt3__1L12init_wmonthsEvE6months
diff --git a/system/lib/libcxx/system_error.cpp b/system/lib/libcxx/system_error.cpp
new file mode 100644
index 00000000..763d62c2
--- /dev/null
+++ b/system/lib/libcxx/system_error.cpp
@@ -0,0 +1,201 @@
+//===---------------------- system_error.cpp ------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "system_error"
+#include "string"
+#include "cstring"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// class error_category
+
+error_category::error_category() _NOEXCEPT
+{
+}
+
+error_category::~error_category() _NOEXCEPT
+{
+}
+
+error_condition
+error_category::default_error_condition(int ev) const _NOEXCEPT
+{
+ return error_condition(ev, *this);
+}
+
+bool
+error_category::equivalent(int code, const error_condition& condition) const _NOEXCEPT
+{
+ return default_error_condition(code) == condition;
+}
+
+bool
+error_category::equivalent(const error_code& code, int condition) const _NOEXCEPT
+{
+ return *this == code.category() && code.value() == condition;
+}
+
+string
+__do_message::message(int ev) const
+{
+ return string(strerror(ev));
+}
+
+class _LIBCPP_HIDDEN __generic_error_category
+ : public __do_message
+{
+public:
+ virtual const char* name() const _NOEXCEPT;
+ virtual string message(int ev) const;
+};
+
+const char*
+__generic_error_category::name() const _NOEXCEPT
+{
+ return "generic";
+}
+
+string
+__generic_error_category::message(int ev) const
+{
+#ifdef ELAST
+ if (ev > ELAST)
+ return string("unspecified generic_category error");
+#endif // ELAST
+ return __do_message::message(ev);
+}
+
+const error_category&
+generic_category() _NOEXCEPT
+{
+ static __generic_error_category s;
+ return s;
+}
+
+class _LIBCPP_HIDDEN __system_error_category
+ : public __do_message
+{
+public:
+ virtual const char* name() const _NOEXCEPT;
+ virtual string message(int ev) const;
+ virtual error_condition default_error_condition(int ev) const _NOEXCEPT;
+};
+
+const char*
+__system_error_category::name() const _NOEXCEPT
+{
+ return "system";
+}
+
+string
+__system_error_category::message(int ev) const
+{
+#ifdef ELAST
+ if (ev > ELAST)
+ return string("unspecified system_category error");
+#endif // ELAST
+ return __do_message::message(ev);
+}
+
+error_condition
+__system_error_category::default_error_condition(int ev) const _NOEXCEPT
+{
+#ifdef ELAST
+ if (ev > ELAST)
+ return error_condition(ev, system_category());
+#endif // ELAST
+ return error_condition(ev, generic_category());
+}
+
+const error_category&
+system_category() _NOEXCEPT
+{
+ static __system_error_category s;
+ return s;
+}
+
+// error_condition
+
+string
+error_condition::message() const
+{
+ return __cat_->message(__val_);
+}
+
+// error_code
+
+string
+error_code::message() const
+{
+ return __cat_->message(__val_);
+}
+
+// system_error
+
+string
+system_error::__init(const error_code& ec, string what_arg)
+{
+ if (ec)
+ {
+ if (!what_arg.empty())
+ what_arg += ": ";
+ what_arg += ec.message();
+ }
+ return _VSTD::move(what_arg);
+}
+
+system_error::system_error(error_code ec, const string& what_arg)
+ : runtime_error(__init(ec, what_arg)),
+ __ec_(ec)
+{
+}
+
+system_error::system_error(error_code ec, const char* what_arg)
+ : runtime_error(__init(ec, what_arg)),
+ __ec_(ec)
+{
+}
+
+system_error::system_error(error_code ec)
+ : runtime_error(__init(ec, "")),
+ __ec_(ec)
+{
+}
+
+system_error::system_error(int ev, const error_category& ecat, const string& what_arg)
+ : runtime_error(__init(error_code(ev, ecat), what_arg)),
+ __ec_(error_code(ev, ecat))
+{
+}
+
+system_error::system_error(int ev, const error_category& ecat, const char* what_arg)
+ : runtime_error(__init(error_code(ev, ecat), what_arg)),
+ __ec_(error_code(ev, ecat))
+{
+}
+
+system_error::system_error(int ev, const error_category& ecat)
+ : runtime_error(__init(error_code(ev, ecat), "")),
+ __ec_(error_code(ev, ecat))
+{
+}
+
+system_error::~system_error() _NOEXCEPT
+{
+}
+
+void
+__throw_system_error(int ev, const char* what_arg)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw system_error(error_code(ev, system_category()), what_arg);
+#endif
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/thread.cpp b/system/lib/libcxx/thread.cpp
new file mode 100644
index 00000000..b07f8f85
--- /dev/null
+++ b/system/lib/libcxx/thread.cpp
@@ -0,0 +1,183 @@
+//===------------------------- thread.cpp----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "thread"
+#include "exception"
+#include "vector"
+#include "future"
+#include <sys/types.h>
+#if !_WIN32
+#include <sys/sysctl.h>
+#endif // _WIN32
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+thread::~thread()
+{
+ if (__t_ != 0)
+ terminate();
+}
+
+void
+thread::join()
+{
+ int ec = pthread_join(__t_, 0);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (ec)
+ throw system_error(error_code(ec, system_category()), "thread::join failed");
+#endif // _LIBCPP_NO_EXCEPTIONS
+ __t_ = 0;
+}
+
+void
+thread::detach()
+{
+ int ec = EINVAL;
+ if (__t_ != 0)
+ {
+ ec = pthread_detach(__t_);
+ if (ec == 0)
+ __t_ = 0;
+ }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (ec)
+ throw system_error(error_code(ec, system_category()), "thread::detach failed");
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+unsigned
+thread::hardware_concurrency()
+{
+#if defined(CTL_HW) && defined(HW_NCPU)
+ int n;
+ int mib[2] = {CTL_HW, HW_NCPU};
+ std::size_t s = sizeof(n);
+ sysctl(mib, 2, &n, &s, 0, 0);
+ return n;
+#else // defined(CTL_HW) && defined(HW_NCPU)
+ // TODO: grovel through /proc or check cpuid on x86 and similar
+ // instructions on other architectures.
+ return 0; // Means not computable [thread.thread.static]
+#endif // defined(CTL_HW) && defined(HW_NCPU)
+}
+
+namespace this_thread
+{
+
+void
+sleep_for(const chrono::nanoseconds& ns)
+{
+ using namespace chrono;
+ if (ns >= nanoseconds::zero())
+ {
+ timespec ts;
+ ts.tv_sec = static_cast<decltype(ts.tv_sec)>(duration_cast<seconds>(ns).count());
+ ts.tv_nsec = static_cast<decltype(ts.tv_nsec)>((ns - seconds(ts.tv_sec)).count());
+ nanosleep(&ts, 0);
+ }
+}
+
+} // this_thread
+
+__thread_specific_ptr<__thread_struct>&
+__thread_local_data()
+{
+ static __thread_specific_ptr<__thread_struct> __p;
+ return __p;
+}
+
+// __thread_struct_imp
+
+template <class T>
+class _LIBCPP_HIDDEN __hidden_allocator
+{
+public:
+ typedef T value_type;
+
+ T* allocate(size_t __n)
+ {return static_cast<T*>(::operator new(__n * sizeof(T)));}
+ void deallocate(T* __p, size_t) {::operator delete((void*)__p);}
+
+ size_t max_size() const {return size_t(~0) / sizeof(T);}
+};
+
+class _LIBCPP_HIDDEN __thread_struct_imp
+{
+ typedef vector<__assoc_sub_state*,
+ __hidden_allocator<__assoc_sub_state*> > _AsyncStates;
+ typedef vector<pair<condition_variable*, mutex*>,
+ __hidden_allocator<pair<condition_variable*, mutex*> > > _Notify;
+
+ _AsyncStates async_states_;
+ _Notify notify_;
+
+ __thread_struct_imp(const __thread_struct_imp&);
+ __thread_struct_imp& operator=(const __thread_struct_imp&);
+public:
+ __thread_struct_imp() {}
+ ~__thread_struct_imp();
+
+ void notify_all_at_thread_exit(condition_variable* cv, mutex* m);
+ void __make_ready_at_thread_exit(__assoc_sub_state* __s);
+};
+
+__thread_struct_imp::~__thread_struct_imp()
+{
+ for (_Notify::iterator i = notify_.begin(), e = notify_.end();
+ i != e; ++i)
+ {
+ i->second->unlock();
+ i->first->notify_all();
+ }
+ for (_AsyncStates::iterator i = async_states_.begin(), e = async_states_.end();
+ i != e; ++i)
+ {
+ (*i)->__make_ready();
+ (*i)->__release_shared();
+ }
+}
+
+void
+__thread_struct_imp::notify_all_at_thread_exit(condition_variable* cv, mutex* m)
+{
+ notify_.push_back(pair<condition_variable*, mutex*>(cv, m));
+}
+
+void
+__thread_struct_imp::__make_ready_at_thread_exit(__assoc_sub_state* __s)
+{
+ async_states_.push_back(__s);
+ __s->__add_shared();
+}
+
+// __thread_struct
+
+__thread_struct::__thread_struct()
+ : __p_(new __thread_struct_imp)
+{
+}
+
+__thread_struct::~__thread_struct()
+{
+ delete __p_;
+}
+
+void
+__thread_struct::notify_all_at_thread_exit(condition_variable* cv, mutex* m)
+{
+ __p_->notify_all_at_thread_exit(cv, m);
+}
+
+void
+__thread_struct::__make_ready_at_thread_exit(__assoc_sub_state* __s)
+{
+ __p_->__make_ready_at_thread_exit(__s);
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/typeinfo.cpp b/system/lib/libcxx/typeinfo.cpp
new file mode 100644
index 00000000..9ca03a18
--- /dev/null
+++ b/system/lib/libcxx/typeinfo.cpp
@@ -0,0 +1,50 @@
+//===------------------------- typeinfo.cpp -------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdlib.h>
+#if __APPLE__
+#include <cxxabi.h>
+#endif
+
+#include "typeinfo"
+
+std::bad_cast::bad_cast() _NOEXCEPT
+{
+}
+
+std::bad_cast::~bad_cast() _NOEXCEPT
+{
+}
+
+const char*
+std::bad_cast::what() const _NOEXCEPT
+{
+ return "std::bad_cast";
+}
+
+std::bad_typeid::bad_typeid() _NOEXCEPT
+{
+}
+
+std::bad_typeid::~bad_typeid() _NOEXCEPT
+{
+}
+
+const char*
+std::bad_typeid::what() const _NOEXCEPT
+{
+ return "std::bad_typeid";
+}
+
+#if __APPLE__
+ // On Darwin, the cxa_bad_* functions cannot be in the lower level library
+ // because bad_cast and bad_typeid are defined in his higher level library
+ void __cxxabiv1::__cxa_bad_typeid() { throw std::bad_typeid(); }
+ void __cxxabiv1::__cxa_bad_cast() { throw std::bad_cast(); }
+#endif
+
diff --git a/system/lib/libcxx/utility.cpp b/system/lib/libcxx/utility.cpp
new file mode 100644
index 00000000..7dccffb7
--- /dev/null
+++ b/system/lib/libcxx/utility.cpp
@@ -0,0 +1,16 @@
+//===------------------------ utility.cpp ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "utility"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+const piecewise_construct_t piecewise_construct = {};
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/system/lib/libcxx/valarray.cpp b/system/lib/libcxx/valarray.cpp
new file mode 100644
index 00000000..2d8db52a
--- /dev/null
+++ b/system/lib/libcxx/valarray.cpp
@@ -0,0 +1,54 @@
+//===------------------------ valarray.cpp --------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "valarray"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template valarray<size_t>::valarray(size_t);
+template valarray<size_t>::~valarray();
+template void valarray<size_t>::resize(size_t, size_t);
+
+void
+gslice::__init(size_t __start)
+{
+ valarray<size_t> __indices(__size_.size());
+ size_t __k = __size_.size() != 0;
+ for (size_t __i = 0; __i < __size_.size(); ++__i)
+ __k *= __size_[__i];
+ __1d_.resize(__k);
+ if (__1d_.size())
+ {
+ __k = 0;
+ __1d_[__k] = __start;
+ while (true)
+ {
+ size_t __i = __indices.size() - 1;
+ while (true)
+ {
+ if (++__indices[__i] < __size_[__i])
+ {
+ ++__k;
+ __1d_[__k] = __1d_[__k-1] + __stride_[__i];
+ for (size_t __j = __i + 1; __j != __indices.size(); ++__j)
+ __1d_[__k] -= __stride_[__j] * (__size_[__j] - 1);
+ break;
+ }
+ else
+ {
+ if (__i == 0)
+ return;
+ __indices[__i--] = 0;
+ }
+ }
+ }
+ }
+}
+
+_LIBCPP_END_NAMESPACE_STD